/** * 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); }
/** * 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 Collection makeCollection() { return SynchronizedBuffer.decorate(new UnboundedFifoBuffer()); }
public Collection makeFullCollection() { Buffer buffer = new UnboundedFifoBuffer(); buffer.addAll(Arrays.asList(getFullElements())); return SynchronizedBuffer.decorate(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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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 boolean initialize ( ) { AddressBean addressBean =getActiveAddressBean ( ); // TODO: negative values? timer = new Timer( addressBean.getPredicateValueAsInt( CLOCK_PERIOD_KEY ,DEFAULT_CLOCK_PERIODS) , this ); maximumDelay = addressBean.getPredicateValueAsInt(MAX_DELAY_KEY, DEFAULT_MAX_DELAY); if(maximumDelay > 0){ streamElementBuffer = SynchronizedBuffer.decorate(new UnboundedFifoBuffer()); delayPostingElements = true; if(timer.getDelay() < maximumDelay) logger.warn("Maximum delay is greater than element production interval. Running for a long time may lead to an OutOfMemoryException" ); } return true; }