/** * Adds a group of objects to the central queue ready for consumption by the * receiver. * * @param o * The objects to be added. */ private void populateCentralQueue() { lock.lock(); try { checkForOutputErrors(); // Wait until the currently posted data is cleared. while (centralQueue.size() >= bufferCapacity) { waitForUpdate(); checkForOutputErrors(); } // Post the new data. centralQueue.addAll(inboundQueue); inboundQueue.clear(); signalUpdate(); } finally { lock.unlock(); } }
/** * Adds a group of objects to the central queue ready for consumption by the * receiver. * * @param o * The objects to be added. */ private void populateCentralQueue() { lock.lock(); try { checkForOutputErrors(); // Wait until the currently posted data is cleared. while (centralQueue.size() >= bufferCapacity) { waitForUpdate(); checkForOutputErrors(); } // Post the new data. centralQueue.addAll(inboundQueue); inboundQueue.clear(); signalUpdate(); } finally { lock.unlock(); } }
/** * {@inheritDoc} */ @Override public void initialize(Map<String, Object> metaData) { if (inputInitialized) { throw new OsmosisRuntimeException("initialize has already been called"); } lock.lock(); try { checkForOutputErrors(); // Set the processing metadata, and flag that we have initialized. processingMetaData = metaData; inputInitialized = true; signalUpdate(); // Now we must wait until the output thread initializes or // encounters an error. while (!outputInitialized) { waitForUpdate(); checkForOutputErrors(); } } finally { lock.unlock(); } }
/** * {@inheritDoc} */ @Override public void initialize(Map<String, Object> metaData) { if (inputInitialized) { throw new OsmosisRuntimeException("initialize has already been called"); } lock.lock(); try { checkForOutputErrors(); // Set the processing metadata, and flag that we have initialized. processingMetaData = metaData; inputInitialized = true; signalUpdate(); // Now we must wait until the output thread initializes or // encounters an error. while (!outputInitialized) { waitForUpdate(); checkForOutputErrors(); } } finally { lock.unlock(); } }
/** * {@inheritDoc} */ @Override public void complete() { if (!inputInitialized) { throw new OsmosisRuntimeException("initialize has not been called"); } lock.lock(); try { populateCentralQueue(); inputComplete = true; signalUpdate(); // Now we must wait until the output thread completes or // encounters an error. while (!outputComplete) { waitForUpdate(); checkForOutputErrors(); } } finally { lock.unlock(); } }
/** * {@inheritDoc} */ @Override public void complete() { if (!inputInitialized) { throw new OsmosisRuntimeException("initialize has not been called"); } lock.lock(); try { populateCentralQueue(); inputComplete = true; signalUpdate(); // Now we must wait until the output thread completes or // encounters an error. while (!outputComplete) { waitForUpdate(); checkForOutputErrors(); } } finally { lock.unlock(); } }