/** * Empties the contents of the central queue into the outbound queue. */ private void consumeCentralQueue() { lock.lock(); try { checkForInputErrors(); // Wait until data is available. while (!((centralQueue.size() > 0) || inputComplete)) { waitForUpdate(); checkForInputErrors(); } outboundQueue.addAll(centralQueue); centralQueue.clear(); signalUpdate(); } finally { lock.unlock(); } }
/** * Empties the contents of the central queue into the outbound queue. */ private void consumeCentralQueue() { lock.lock(); try { checkForInputErrors(); // Wait until data is available. while (!((centralQueue.size() > 0) || inputComplete)) { waitForUpdate(); checkForInputErrors(); } outboundQueue.addAll(centralQueue); centralQueue.clear(); signalUpdate(); } finally { lock.unlock(); } }
/** * Notifies that the output thread has completed processing. This will block * until either the input thread has called complete, or an input error * occurs. */ public void outputComplete() { if (!outputInitialized) { throw new OsmosisRuntimeException("outputInitialize has not been called"); } lock.lock(); try { checkForInputErrors(); // We must wait until the input thread completes or encounters an // error. while (!inputComplete) { waitForUpdate(); checkForInputErrors(); } outputComplete = true; signalUpdate(); } finally { lock.unlock(); } }
/** * Notifies that the output thread has completed processing. This will block * until either the input thread has called complete, or an input error * occurs. */ public void outputComplete() { if (!outputInitialized) { throw new OsmosisRuntimeException("outputInitialize has not been called"); } lock.lock(); try { checkForInputErrors(); // We must wait until the input thread completes or encounters an // error. while (!inputComplete) { waitForUpdate(); checkForInputErrors(); } outputComplete = true; signalUpdate(); } finally { lock.unlock(); } }
/** * Notifies that the output thread has begun processing, and gets the * initialization data set by the input thread. This will block until either * the input thread has called initialize, or an input error occurs. * * @return The initialization data. */ public Map<String, Object> outputInitialize() { if (outputInitialized) { throw new OsmosisRuntimeException("outputInitialize has already been called"); } lock.lock(); try { checkForInputErrors(); // We must wait until the input thread initializes or // encounters an error. while (!inputInitialized) { waitForUpdate(); checkForInputErrors(); } outputInitialized = true; signalUpdate(); return processingMetaData; } finally { lock.unlock(); } }
/** * Notifies that the output thread has begun processing, and gets the * initialization data set by the input thread. This will block until either * the input thread has called initialize, or an input error occurs. * * @return The initialization data. */ public Map<String, Object> outputInitialize() { if (outputInitialized) { throw new OsmosisRuntimeException("outputInitialize has already been called"); } lock.lock(); try { checkForInputErrors(); // We must wait until the input thread initializes or // encounters an error. while (!inputInitialized) { waitForUpdate(); checkForInputErrors(); } outputInitialized = true; signalUpdate(); return processingMetaData; } finally { lock.unlock(); } }