Code example for ArrayBlockingQueue

Methods: offer

0
        log.error("Cannot stop runaway thread " + getName(), error);
      } 
    } 
 
    private void shutdownGracefully() { 
      if (!input.offer(Input.END_THREAD)) {
        log.error("Cannot gracefully stop thread " + getName());
      } 
    } 
 
    @Override 
    public void run() { 
      try { 
        for (;;) { 
          Input in;
          try { 
            in = input.take();
          } catch (InterruptedException e) {
            log.error("Unexpected interrupt on " + getName());
            continue; 
          }