Пример #1
0
  /**
   * Immediately closes the input gate and all its input channels. The corresponding output channels
   * are notified. Any remaining records in any buffers or queue is considered irrelevant and is
   * discarded.
   *
   * @throws IOException thrown if an I/O error occurs while closing the gate
   * @throws InterruptedException thrown if the thread is interrupted while waiting for the gate to
   *     be closed
   */
  public void close() throws IOException, InterruptedException {

    for (int i = 0; i < this.getNumberOfInputChannels(); i++) {
      final InputChannel<T> inputChannel = this.channels[i];
      inputChannel.close();
    }
  }
Пример #2
0
  @Override
  public boolean isClosed() throws IOException, InterruptedException {

    if (this.isClosed) {
      return true;
    }

    for (int i = 0; i < this.getNumberOfInputChannels(); i++) {
      final InputChannel<T> inputChannel = this.channels[i];
      if (!inputChannel.isClosed()) {
        return false;
      }
    }

    this.isClosed = true;

    return true;
  }