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); }
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; }
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; }