/** * {@inheritDoc} */ @Override public synchronized void close() throws CloseException { if ( _connectionStatus != ConnectionStatus.OPENED ) { throw new CloseException( "Connection is in status <" + _connectionStatus + ">. Open the connection before closing!" ); } try { if ( _httpServer != null ) { _httpServer.stop( LatencySleepTime.MIN.getMilliseconds() / 1000 ); _httpServer.removeContext( CONTEXT_PATH ); _httpServer = null; } } finally { _connectionStatus = ConnectionStatus.CLOSED; } }
RetryCounter theRetryCounter = new RetryCounterImpl( IoRetryCount.NORM.getNumber(), LatencySleepTime.MIN.getMilliseconds(), LoopExtensionTime.NORM.getMilliseconds() ); while ( theRetryCounter.nextRetry() ) { List<CipherVersion> theCipherVersions = _decryptionService.getCipherVersions();
/** * Waits for the {@link DatagramTransceiver} to open up; in case it is * open, then true is returned; in case it does not open within a given * period of time then false is returned. * * @return True in case the {@link DatagramTransceiver} is (finally) * open. */ private boolean isOpened() { if ( !AbstractRemote.this.isOpened() ) { return false; } else if ( _transceiver.isOpened() && AbstractRemote.this.isOpened() ) { return true; } else if ( AbstractRemote.this.isOpened() && !_transceiver.isOpened() ) { RetryCounter theRetryCounter = new RetryCounterImpl( IoRetryCount.NORM.getNumber(), LatencySleepTime.NORM.getMilliseconds(), LoopExtensionTime.NORM.getMilliseconds() ); while ( AbstractRemote.this.isOpened() && theRetryCounter.hasNextRetry() && !_transceiver.isOpened() ) { // @formatter:off if ( ENABLE_EXTENDED_DEBUG_LOGGING ) LOGGER.debug( "Wait loop <" + theRetryCounter.getRetryCount() + "> while waiting for OPEN for <" + WAIT_FOR_REPLY_LOOPS + "> ms; connection status is " + getConnectionStatus() + " (transceiver connection status is " + _transceiver.getConnectionStatus() + ")."); // @formatter:on theRetryCounter.nextRetry(); } } if ( _transceiver.isOpened() && AbstractRemote.this.isOpened() ) { return true; } return false; }