Esempio n. 1
0
 public void tryCompleteClose() {
   synchronized (lock) {
     if (null != closeFuture) {
       closeFuture.trySetResult(null);
     }
   }
 }
Esempio n. 2
0
 @Override
 public DbFuture<Void> close(CloseMode closeMode) throws DbException {
   synchronized (lock) {
     if (this.closeFuture != null) {
       return closeFuture;
     }
     if (closeMode == CloseMode.CANCEL_PENDING_OPERATIONS) {
       forceCloseOnPendingRequests();
     }
     Request request = requestCreator.createCloseRequest();
     forceQueRequest(request);
     closeFuture = (DefaultDbFuture<Void>) request.getToComplete();
     closeFuture.addListener(
         new DbListener<Void>() {
           @Override
           public void onCompletion(DbFuture<Void> future) {
             H2Connection.this.manager.removeConnection(H2Connection.this);
           }
         });
     return closeFuture;
   }
 }