List of usage examples for org.apache.commons.collections.buffer CircularFifoBuffer CircularFifoBuffer
public CircularFifoBuffer(Collection coll)
From source file:org.kei.android.phone.cellhistory.CellHistoryApp.java
public Buffer getLogBuffer() { if (logs == null) logs = new CircularFifoBuffer(CIRCULAR_BUFFER_DEPTH); return logs; }
From source file:org.kei.android.phone.netcap.OutputFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Context context = owner.getApplicationContext(); refreshBT = (Button) getView().findViewById(R.id.refreshBT); promiscuousCB = (CheckBox) getView().findViewById(R.id.promiscuousCB); devicesSp = (Spinner) getView().findViewById(R.id.devicesSp); showResult = (TextView) getView().findViewById(R.id.showResult); browseOutputCaptureTV = (TextView) getView().findViewById(R.id.browseOutputCaptureTV); browseOutputCaptureTV.setText(Tools.DEFAULT_DOWNLOAD.getAbsolutePath()); browseOutputCaptureTV.setOnClickListener(this); captureBT = (ToggleButton) getView().findViewById(R.id.captureBT); captureBT.setOnClickListener(this); refreshBT.setOnClickListener(this); showResult.setMovementMethod(new ScrollingMovementMethod()); buffer = new CircularFifoBuffer(20); // Create an ArrayAdapter using the string array and a default spinner // layout/*from w ww .j a v a 2s . co m*/ adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner devicesSp.setAdapter(adapter); onClick(refreshBT); }
From source file:org.opencms.main.CmsSessionManager.java
/** * Returns the broadcast queue for the given OpenCms session id.<p> * /* w ww . jav a 2 s . c om*/ * @param sessionId the OpenCms session id to get the broadcast queue for * * @return the broadcast queue for the given OpenCms session id */ public Buffer getBroadcastQueue(String sessionId) { CmsSessionInfo sessionInfo = getSessionInfo(getSessionUUID(sessionId)); if (sessionInfo == null) { // return empty message buffer if the session is gone or not available return BufferUtils.synchronizedBuffer(new CircularFifoBuffer(CmsSessionInfo.QUEUE_SIZE)); } return sessionInfo.getBroadcastQueue(); }
From source file:org.opencms.publish.CmsPublishHistory.java
/** * Returns (and initializes) the queue.<p> * // w w w . j a v a2s . 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.openempi.webapp.server.EventNotificationServiceImpl.java
public void init(ServletConfig config) throws ServletException { super.init(config); eventBuffer = new CircularFifoBuffer(BUFFER_SIZE); handler = new EventNotificationMessageHandler(OPENEMPI_ADMIN_WEB); }
From source file:org.openmrs.util.MemoryAppender.java
public void activateOptions() { this.buffer = new CircularFifoBuffer(bufferSize); }
From source file:org.outerrim.snippad.service.config.Configuration.java
private void init() { store.setDefault(CSS_LOCATION, "http://snippad.berlios.de/snippad.css"); store.setDefault(SHOW_EDITOR, true); store.setDefault(INITIAL_SIZE_X, 1024); store.setDefault(INITIAL_SIZE_Y, 600); store.setDefault(SAVE_AS_LOCATION, System.getProperty("user.home")); store.setDefault(NUMBER_RECENT, 4);/*from w w w .jav a 2 s .com*/ recentDocuments = new CircularFifoBuffer(store.getInt(NUMBER_RECENT)); }
From source file:org.outerrim.snippad.service.config.Configuration.java
/** * Resizes the Recent Documents list.//from w w w .j a v a2s .c om * * @param newSize * the new size of the list */ private void resizeRecentDocuments(final int newSize) { CircularFifoBuffer newBuffer = new CircularFifoBuffer(newSize); for (Iterator it = recentDocuments.iterator(); it.hasNext();) { newBuffer.add(it.next()); } recentDocuments = newBuffer; }
From source file:org.paxle.tools.logging.impl.ALogReader.java
@OverrideMustInvoke @Activate/* ww w . java 2 s .c o m*/ protected void activate(Map<String, Object> props) { // configuring the buffer Integer bufferSize = Integer.valueOf(200); if (props.containsKey(BUFFER_SIZE)) { bufferSize = (Integer) props.get(BUFFER_SIZE); } this.fifo = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(bufferSize)); }
From source file:org.perfcake.reporting.reporters.accumulators.AbstractSlidingWindowAccumulator.java
/** * Creates a new accumulator with the sliding window of a given size. * * @param windowSize//from w w w .ja v a 2 s .c o m * Size of the sliding window. */ public AbstractSlidingWindowAccumulator(final int windowSize) { fifo = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(windowSize)); }