List of usage examples for org.apache.commons.collections.buffer TypedBuffer decorate
public static Buffer decorate(Buffer buffer, Class type)
From source file:org.opencms.publish.CmsPublishHistory.java
/** * Returns (and initializes) the queue.<p> * /* w w w. j a va2 s .c o m*/ * @param size the history size * * @return the queue buffer */ public static Buffer getQueue(int size) { if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_PUBLISH_HISTORY_SIZE_SET_1, new Integer(size))); } return BufferUtils.synchronizedBuffer(TypedBuffer.decorate(new CircularFifoBuffer(size) { /** The serialization version id constant. */ private static final long serialVersionUID = -6257542123241183114L; /** * Called when the queue is full to remove the oldest element.<p> * * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove() */ @Override public Object remove() { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean) super.remove(); try { OpenCms.getPublishManager().getEngine().getPublishHistory().remove(publishJob); } catch (CmsException exc) { if (LOG.isErrorEnabled()) { LOG.error(exc.getLocalizedMessage(), exc); } } return publishJob; } }, CmsPublishJobInfoBean.class)); }
From source file:org.opencms.publish.CmsPublishQueue.java
/** * Creates the buffer used as publish queue.<p> * /*www . ja v a 2s . co m*/ * @return the queue buffer */ public static Buffer getQueue() { return BufferUtils.synchronizedBuffer(TypedBuffer.decorate(new UnboundedFifoBuffer() { /** The serialization version id constant. */ private static final long serialVersionUID = 606444342980861724L; /** * Called when the queue is full to remove the oldest element.<p> * * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove() */ @Override public Object remove() { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean) super.remove(); return publishJob; } }, CmsPublishJobInfoBean.class)); }