);
if (getConfiguration().isSuspendOnStart()) {
// verify the debugger socket has been opened and is waiting for a debugger to connect
// command monitor thread is not started while suspended so this is the best we can do
final boolean jvmSuspended = new TimedCondition()
{
@Override
protected boolean isSatisfied()
throws Exception
{
Socket socket = new Socket();
socket.setSoTimeout(5000);
socket.connect(
new InetSocketAddress(getConfiguration().getHostName(), getConfiguration().getDebugPort()));
return true;
}
}.await(Time.seconds(10), Time.seconds(DEFAULT_START_TIMEOUT), Time.seconds(1));
if (jvmSuspended) {
log.info("{} ({}) suspended for debugging at {}:{}", getName(), getConfiguration().getId(),
getConfiguration().getHostName(), getConfiguration().getDebugPort());
}
else {
throw new RuntimeException(
format(
"%s (%s) no open socket for debugging at %s:%s within 10 seconds", getName(),
getConfiguration().getId(), getConfiguration().getHostName(),
getConfiguration().getDebugPort()
)
);
}
}
else {
// when not suspending, we expect the internal command monitor thread to start well before bundle is ready
// so we only give it 10 seconds to be available
log.info("{} ({}) pinging command monitor at {}:{}", getName(), getConfiguration().getId(),
getConfiguration().getHostName(), commandMonitorPort);
final boolean monitorInstalled = new TimedCondition()
{
@Override
protected boolean isSatisfied()
throws Exception
{