/** * Gets the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object get(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().get(); } }
/** * Removes the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object remove(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().remove(); } }
/** * Gets the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object get() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return get(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().get(); } }
/** * Removes the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object remove() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return remove(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().remove(); } }
/** * Removes the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object remove(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().remove(); } }
/** * Gets the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object get(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().get(); } }
/** * Gets the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object get() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return get(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().get(); } }
/** * Removes the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object remove() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return remove(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().remove(); } }
/** * Removes the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object remove(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().remove(); } }
/** * Gets the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object get(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().get(); } }
/** * Gets the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object get(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().get(); } }
/** * Removes the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object remove(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().remove(); } }
/** * Gets the next value from the buffer, waiting until an object is * added for up to the specified timeout value if the buffer is empty. * * @param timeout the timeout value in milliseconds * @throws BufferUnderflowException if an interrupt is received * @throws BufferUnderflowException if the timeout expires * @since Commons Collections 3.2 */ public Object get(final long timeout) { synchronized (lock) { final long expiration = System.currentTimeMillis() + timeout; long timeLeft = expiration - System.currentTimeMillis(); while (timeLeft > 0 && collection.isEmpty()) { try { lock.wait(timeLeft); timeLeft = expiration - System.currentTimeMillis(); } catch(InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } if (collection.isEmpty()) { throw new BufferUnderflowException("Timeout expired"); } return getBuffer().get(); } }
/** * Removes the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object remove() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return remove(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().remove(); } }
/** * Gets the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object get() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return get(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().get(); } }
/** * Gets the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object get() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return get(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().get(); } }
/** * Gets the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object get() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return get(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().get(); } }
/** * Gets the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object get() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return get(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().get(); } }
/** * Gets the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object get() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return get(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().get(); } }
/** * Removes the next value from the buffer, waiting until an object is * added if the buffer is empty. This method uses the default timeout * set in the constructor. * * @throws BufferUnderflowException if an interrupt is received */ public Object remove() { synchronized (lock) { while (collection.isEmpty()) { try { if (timeout <= 0) { lock.wait(); } else { return remove(timeout); } } catch (InterruptedException e) { PrintWriter out = new PrintWriter(new StringWriter()); e.printStackTrace(out); throw new BufferUnderflowException("Caused by InterruptedException: " + out.toString()); } } return getBuffer().remove(); } }