I want to have something like this:
long timeout = isDebugModeActive() ? Long.MAX_VALUE : 10000;
So that when the debugger stops on a breakpoint the timeouts do not take place.
Is there any API or System/Environment property to find it out?
I want to have something like this:
long timeout = isDebugModeActive() ? Long.MAX_VALUE : 10000;
So that when the debugger stops on a breakpoint the timeouts do not take place.
Is there any API or System/Environment property to find it out?
The author of this thread found this solution:
java.lang.management.ManagementFactory.getRuntimeMXBean().
getInputArguments().toString().indexOf("-agentlib:jdwp") > 0;
A standard disclaimer seem appropriate, though - this is pretty brittle (in that it is very specific in when it is triggered) and can lead to Heisenbugs (bugs which don't appear when you're trying to debug). For many scenarios, a system property or environment variable is probably better.
You can make a new run configuration (Run -> Run Configurations) and add an environment variable or system property there.
if you develop RCP application you may use:
if(Platform.inDevelopmentMode()) {
// ....
}
It is possible by inspecting the JVM
arguments that started the program.
There you will see:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=[port]
Then you check is the port is listening or there are connections .