/** * Tries to close the component's connection(s). Ignores any problems which * normally would be reported by the {@link #close()} method with an * according exception. * * The default implementation tries to invoke a "flush()" in case the * implementing instance implements the {@link java.io.Flushable} interface * before invoking {@link #close()}. Additionally the default implementation * tries {@link IoRetryCount#NORM} number of times to invoke * {@link #close()} till a timeout of {@link IoTimeout#NORM} is reached. In * any case this method will return quietly without throwing any exception. */ default void closeQuietly() { if ( this instanceof java.io.Flushable ) { try { ((java.io.Flushable) this).flush(); } catch ( Exception ignore ) {} } RetryTimeout theRetryTimeout = new RetryTimeoutImpl( IoTimeout.NORM.getMilliseconds(), IoRetryCount.NORM.getNumber() ); while ( theRetryTimeout.hasNextRetry() ) { try { close(); return; } catch ( CloseException ignore ) {} } }
RetryTimeout theRetryTimeout = new RetryTimeoutImpl( IoTimeout.NORM.getMilliseconds(), RetryLoopCount.NORM_NUM_RETRY_LOOPS.getNumber() ); while ( (isBusy()) && theRetryTimeout.hasNextRetry() && isOpened() ) { if ( ENABLE_EXTENDED_DEBUG_LOGGING ) { LOGGER.warn( "Still being BUSY even after reaching the timeout of <" + IoTimeout.NORM.getMilliseconds() + "> ms, closing connection nonetheless." );
/** * {@inheritDoc} */ @Override protected synchronized void close( CloseConnectionMessage aJob ) { ControlFlowUtility.throwIllegalStateException( isDestroyed() ); if ( ENABLE_EXTENDED_DEBUG_LOGGING ) { LOGGER.info( "CLOSE called on <" + getClass().getName() + "> with job <" + aJob + ">; connection status is " + getConnectionStatus() + "." ); } if ( !isClosed() ) { signOffAllProxies(); _instanceHandler.lock(); RetryTimeout theRetryTimeout = new RetryTimeoutImpl( IoTimeout.NORM.getMilliseconds(), RetryLoopCount.NORM_NUM_RETRY_LOOPS.getNumber() ); while ( (isBusy()) && theRetryTimeout.hasNextRetry() ) { if ( ENABLE_EXTENDED_DEBUG_LOGGING ) LOGGER.info( "Wait loop <" + theRetryTimeout.getRetryCount() + "> while being BUSY for <" + LoopSleepTime.NORM.getMilliseconds() + "> ms." ); theRetryTimeout.nextRetry(); } super.close( aJob ); if ( isBusy() ) { LOGGER.warn( "Still being BUSY even after reaching the timeout of <" + IoTimeout.NORM.getMilliseconds() + "> ms, closing connection nonetheless." ); } try { super.close(); } catch ( CloseException e ) { LOGGER.warn( "Unable to close malfunctioning connection.", e ); } onClosed(); } }
RetryTimeout theRetryTimeout = new RetryTimeoutImpl( IoTimeout.MIN.getMilliseconds(), RetryLoopCount.NORM_NUM_RETRY_LOOPS.getNumber() ); while ( !isClosed() && theRetryTimeout.hasNextRetry() && theSubjectDescriptor == null ) { theRetryTimeout.nextRetry();