code: public void close() {
  
          // Infinite loop is still active
          if (this.infiniteLoop.get()) {
              // First attempt to close the application
              this.infiniteLoop.set(false);
          } else {
              // N-th attempt to close the application
              this.forceClose.set(true);
  
              // All Task Queues are cleared
              // this.queuedTasks.clear();
              this.processingTasks.clear();
          }
  
      }
docs: This method can be called a lot of time while application is running.
  
  The first time to stop the infinite loop, then to purge all queues and let the thread terminate itself.