if (localValve.open()) { try { log.info("Processing valve on exception failure"); super.handleConnectionFailure(failedConnDelegate); } finally { localValve.close(); synchronized (this) {  valve = new Valve(); } } } else { log.info("The valve was closed, so this invocation waited another invocation to finish on handleFailure"); }
   protected void handleConnectionFailure(ClientConnectionDelegate failedConnDelegate) throws Exception   {      Valve localValve = null;      // The idea is to reset the Valve synchronized with a reset valve      synchronized (this) // I'm not sure if this synchronized is necessary. I will keep it here just to be safe      {         localValve = valve;      }      // only one execution should be performed if multiple exceptions happened at the same time      if (localValve.open())      {         try         {            log.info("Processing valve on exception failure");            super.handleConnectionFailure(failedConnDelegate);         }         finally         {            localValve.close();            synchronized (this)            {               // reset the valve, so future exceptions will also get processed               valve = new Valve();            }         }      } else      {         log.info("The valve was closed, so this invocation waited another invocation to finish on handleFailure");      }   }