code: protected static void blockAndReleaseAllCloseableResources()
      {
          synchronized(CloseableResourceManager.class)
          {
              //set flag
              CloseableResourceManager.active=false;
          }
          
          Closeable[] closeables=null;
          synchronized(CloseableResourceManager.RESOURCES)
          {
              //get resources
              closeables=CloseableResourceManager.RESOURCES.toArray(new Closeable[CloseableResourceManager.RESOURCES.size()]);
          }
          
          //get amount
          int amount=closeables.length;
          
          Closeable closeable=null;
          for(int index=0;index<amount;index++)
          {
              //get next element
              closeable=closeables[index];
              
              //close resource
              IOHelper.closeResource(closeable);
          }
      }
docs: Blocks any call to register/unregister new resources and releases all resources
  currently registered.