code: private static void updateCloseable(boolean register,Closeable closeable)
      {
          boolean updated=false;
          synchronized(CloseableResourceManager.class)
          {
              if(register)
              {
                  if(CloseableResourceManager.active)
                  {
                      //update resources data structure
                      CloseableResourceManager.RESOURCES.add(closeable);
      
                      //set flag
                      updated=true;
                  }
              }
              else
              {
                  //update resources data structure
                  CloseableResourceManager.RESOURCES.remove(closeable);
  
                  //set flag
                  updated=true;
              }
          }
          
          if(!updated)
          {
              throw new FaxException("Can not perform action, manager is being released.");
          }
      }
docs: Registers/Unregisters the provided closeable.<br>
  Will throw an error in case the manager is no longer active (due
  to JVM shutdown).
  
  @param   register
  True to register, false to unregister
  @param   closeable
  The closeable to register/unregister