/** * Returns a synchronized buffer backed by the given buffer. * Much like the synchronized collections returned by * {@link java.util.Collections}, you must manually synchronize on * the returned buffer's iterator to avoid non-deterministic behavior: * * <pre> * Buffer b = BufferUtils.synchronizedBuffer(myBuffer); * synchronized (b) { * Iterator i = b.iterator(); * while (i.hasNext()) { * process (i.next()); * } * } * </pre> * * @param buffer the buffer to synchronize, must not be null * @return a synchronized buffer backed by that buffer * @throws IllegalArgumentException if the Buffer is null */ public static Buffer synchronizedBuffer(Buffer buffer) { return SynchronizedBuffer.decorate(buffer); }
/** * Factory method to create a synchronized buffer. * * @param buffer the buffer to decorate, must not be null * @return a new synchronized Buffer * @throws IllegalArgumentException if buffer is null */ public static Buffer decorate(Buffer buffer) { return new SynchronizedBuffer(buffer); }
public Object remove() { synchronized (lock) { return getBuffer().remove(); } }
/** * Returns a synchronized buffer backed by the given buffer. * Much like the synchronized collections returned by * {@link java.util.Collections}, you must manually synchronize on * the returned buffer's iterator to avoid non-deterministic behavior: * * <pre> * Buffer b = BufferUtils.synchronizedBuffer(myBuffer); * synchronized (b) { * Iterator i = b.iterator(); * while (i.hasNext()) { * process (i.next()); * } * } * </pre> * * @param buffer the buffer to synchronize, must not be null * @return a synchronized buffer backed by that buffer * @throws IllegalArgumentException if the Buffer is null */ public static Buffer synchronizedBuffer(Buffer buffer) { return SynchronizedBuffer.decorate(buffer); }
public Object get() { synchronized (lock) { return getBuffer().get(); } }
/** * Factory method to create a synchronized buffer. * * @param buffer the buffer to decorate, must not be null * @return a new synchronized Buffer * @throws IllegalArgumentException if buffer is null */ public static Buffer decorate(Buffer buffer) { return new SynchronizedBuffer(buffer); }
public Collection makeCollection() { return SynchronizedBuffer.decorate(new UnboundedFifoBuffer()); }
public Object get() { synchronized (lock) { return getBuffer().get(); } }
/** * Factory method to create a synchronized buffer. * * @param buffer the buffer to decorate, must not be null * @return a new synchronized Buffer * @throws IllegalArgumentException if buffer is null */ public static Buffer decorate(Buffer buffer) { return new SynchronizedBuffer(buffer); }
public Collection makeFullCollection() { Buffer buffer = new UnboundedFifoBuffer(); buffer.addAll(Arrays.asList(getFullElements())); return SynchronizedBuffer.decorate(buffer); }
public Object remove() { synchronized (lock) { return getBuffer().remove(); } }
/** * Factory method to create a synchronized buffer. * * @param buffer the buffer to decorate, must not be null * @return a new synchronized Buffer * @throws IllegalArgumentException if buffer is null */ public static Buffer decorate(Buffer buffer) { return new SynchronizedBuffer(buffer); }
/** * Returns a synchronized buffer backed by the given buffer. * Much like the synchronized collections returned by * {@link java.util.Collections}, you must manually synchronize on * the returned buffer's iterator to avoid non-deterministic behavior: * * <pre> * Buffer b = BufferUtils.synchronizedBuffer(myBuffer); * synchronized (b) { * Iterator i = b.iterator(); * while (i.hasNext()) { * process (i.next()); * } * } * </pre> * * @param buffer the buffer to synchronize, must not be null * @return a synchronized buffer backed by that buffer * @throws IllegalArgumentException if the Buffer is null */ public static Buffer synchronizedBuffer(Buffer buffer) { return SynchronizedBuffer.decorate(buffer); }
public Object remove() { synchronized (lock) { return getBuffer().remove(); } }
/** * Factory method to create a synchronized buffer. * * @param buffer the buffer to decorate, must not be null * @return a new synchronized Buffer * @throws IllegalArgumentException if buffer is null */ public static Buffer decorate(Buffer buffer) { return new SynchronizedBuffer(buffer); }
/** * Returns a synchronized buffer backed by the given buffer. * Much like the synchronized collections returned by * {@link java.util.Collections}, you must manually synchronize on * the returned buffer's iterator to avoid non-deterministic behavior: * * <pre> * Buffer b = BufferUtils.synchronizedBuffer(myBuffer); * synchronized (b) { * Iterator i = b.iterator(); * while (i.hasNext()) { * process (i.next()); * } * } * </pre> * * @param buffer the buffer to synchronize, must not be null * @return a synchronized buffer backed by that buffer * @throws IllegalArgumentException if the Buffer is null */ public static Buffer synchronizedBuffer(Buffer buffer) { return SynchronizedBuffer.decorate(buffer); }
public Object get() { synchronized (lock) { return getBuffer().get(); } }
/** * Factory method to create a synchronized buffer. * * @param buffer the buffer to decorate, must not be null * @return a new synchronized Buffer * @throws IllegalArgumentException if buffer is null */ public static Buffer decorate(Buffer buffer) { return new SynchronizedBuffer(buffer); }
/** * Returns a synchronized buffer backed by the given buffer. * Much like the synchronized collections returned by * {@link java.util.Collections}, you must manually synchronize on * the returned buffer's iterator to avoid non-deterministic behavior: * * <pre> * Buffer b = BufferUtils.synchronizedBuffer(myBuffer); * synchronized (b) { * Iterator i = b.iterator(); * while (i.hasNext()) { * process (i.next()); * } * } * </pre> * * @param buffer the buffer to synchronize, must not be null * @return a synchronized buffer backed by that buffer * @throws IllegalArgumentException if the Buffer is null */ public static Buffer synchronizedBuffer(Buffer buffer) { return SynchronizedBuffer.decorate(buffer); }
public Object remove() { synchronized (lock) { return getBuffer().remove(); } }