void close(long timeout,TimeUnit timeUnit){
  disable();
  try {
    if (!reentrantLock.tryLock(timeout,timeUnit)) {
      log.warn("Could not gracefully close the subscription connection " + subscriptionId + " within "+ timeout+ " "+ timeUnit+ ", forcing close of connection");
    }
  }
 catch (  InterruptedException e) {
    throw new IllegalStateException(e);
  }
 finally {
    if (reentrantLock.isLocked() && reentrantLock.isHeldByCurrentThread()) {
      reentrantLock.unlock();
    }
  }
  closeConnection();
  unsubscribe();
}

void close ( long timeout , TimeUnit timeUnit ) { disable ( ) ; try { if ( ! reentrantLock . tryLock ( timeout , timeUnit ) ) { log . warn ( "Could not gracefully close the subscription connection " + subscriptionId + " within " + timeout + " " + timeUnit + ", forcing close of connection" ) ; } } catch ( InterruptedException e ) { throw new IllegalStateException ( e ) ; } finally { if ( reentrantLock . isLocked ( ) && reentrantLock . isHeldByCurrentThread ( ) ) { reentrantLock . unlock ( ) ; } } closeConnection ( ) ; unsubscribe ( ) ; }
unsubscribe and try to close the resources gracefully . if the grace period times out ( minimum of 100 ms , max timeout plus 100ms ) , the connection is closed forcibly .
