示例#1
0
  public RestoreWork poll(CachedByteBufferAllocator resultBufferAllocator) {
    if (m_in == null || m_ack == null) {
      // not initialized yet or terminated already
      return null;
    }

    Pair<Long, Pair<Long, BBContainer>> msg = m_in.poll();
    return processMessage(msg, resultBufferAllocator);
  }
示例#2
0
  public RestoreWork take(CachedByteBufferAllocator resultBufferAllocator)
      throws InterruptedException {
    if (m_in == null || m_ack == null) {
      // terminated already
      return null;
    }

    RestoreWork result = null;
    while (!m_EOF) {
      Pair<Long, Pair<Long, BBContainer>> msg = m_in.take();
      result = processMessage(msg, resultBufferAllocator);
      if (result != null) {
        break;
      }
    }

    return result;
  }
示例#3
0
  public void close() {
    if (m_in != null) {
      m_in.close();
      // Interrupt the thread in case it's blocked on mailbox recv.
      m_inThread.interrupt();
      try {
        m_inThread.join();
      } catch (InterruptedException e) {
      }
    }

    if (m_ack != null) {
      m_ack.close();
      try {
        m_ackThread.join();
      } catch (InterruptedException e) {
      }
    }

    m_in = null;
    m_ack = null;
  }