/** * Offer a single datapoint to this Queue * * If the queue is a bounded queue and is full it will block until space comes available or until * offer time out is reached (default is Integer.MAX_VALUE DAYS). * * @param data * data to add * @return self */ @Override public boolean offer(final T data) { if (!open) { throw new ClosedQueueException(); } try { final boolean result = producerWait.offer(() -> this.queue.offer((T) nullSafe(data), this.offerTimeout, this.offerTimeUnit)); if (sizeSignal != null) this.sizeSignal.set(queue.size()); return result; } catch (final InterruptedException e) { Thread.currentThread() .interrupt(); throw ExceptionSoftener.throwSoftenedException(e); } }
/** * Offer a single datapoint to this Queue * * If the queue is a bounded queue and is full it will block until space comes available or until * offer time out is reached (default is Integer.MAX_VALUE DAYS). * * @param data * data to add * @return self */ @Override public boolean offer(final T data) { if (!open) { throw new ClosedQueueException(); } try { final boolean result = producerWait.offer(() -> this.queue.offer((T) nullSafe(data), this.offerTimeout, this.offerTimeUnit)); if (sizeSignal != null) this.sizeSignal.set(queue.size()); return result; } catch (final InterruptedException e) { Thread.currentThread() .interrupt(); throw ExceptionSoftener.throwSoftenedException(e); } }