本文整理汇总了Java中org.apache.commons.collections.buffer.CircularFifoBuffer类的典型用法代码示例。如果您正苦于以下问题:Java CircularFifoBuffer类的具体用法?Java CircularFifoBuffer怎么用?Java CircularFifoBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CircularFifoBuffer类属于org.apache.commons.collections.buffer包,在下文中一共展示了CircularFifoBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldBombWithErrorWhenStatusCodeReturnedIsRequestEntityTooLarge
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Test
public void shouldBombWithErrorWhenStatusCodeReturnedIsRequestEntityTooLarge() throws IOException, InterruptedException {
long size = anyLong();
when(httpService.upload(any(String.class), size, any(File.class), any(Properties.class))).thenReturn(HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE);
CircularFifoBuffer buffer = (CircularFifoBuffer) ReflectionUtil.getField(ReflectionUtil.getField(goPublisher, "consoleOutputTransmitter"), "buffer");
synchronized (buffer) {
try {
goArtifactsManipulatorStub.publish(goPublisher, "some_dest", tempFile, jobIdentifier);
fail("should have thrown request entity too large error");
} catch (RuntimeException e) {
String expectedMessage = "Artifact upload for file " + tempFile.getAbsolutePath() + " (Size: "+size+") was denied by the server. This usually happens when server runs out of disk space.";
assertThat(e.getMessage(), is("java.lang.RuntimeException: " + expectedMessage + ". HTTP return code is 413"));
assertThat(buffer.toString().contains(expectedMessage), is(true));
}
}
}
示例2: Statistics
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public Statistics ( final DataItemFactory itemFactory, final int size )
{
this.stateItem = itemFactory.createInput ( "state", null );
this.timeoutStateItem = itemFactory.createInput ( "timeout", null );
this.lastUpdateItem = itemFactory.createInput ( "lastUpdate", null );
this.lastTimeDiffItem = itemFactory.createInput ( "lastDiff", null );
this.avgDiffItem = itemFactory.createInput ( "avgDiff", null );
this.checksumErrorsItem = itemFactory.createInput ( "checksumErrors", null );
this.sizeItem = itemFactory.createInput ( "size", null );
this.sizeItem.updateData ( Variant.valueOf ( size ), null, null );
this.lastUpdate = System.currentTimeMillis ();
this.diffBuffer = new CircularFifoBuffer ( 20 );
}
示例3: AsyncPollingHelper
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/***********************************************************************************************
* @param driver Handle to the driver class that will do the polling
***********************************************************************************************/
public AsyncPollingHelper(Driver driver) {
this.driver = driver;
//Default the max buffer size to 10 seconds worth of imu data
int maxSize = Math.round(driver.getDatarate().getHz() * 10);
fifo = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(maxSize));
}
示例4: NthLastModifiedTimeTracker
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
if (numTimesToTrack < 1) {
throw new IllegalArgumentException(
"numTimesToTrack must be greater than zero (you requested " + numTimesToTrack + ")");
}
lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
initLastModifiedTimesMillis();
}
示例5: getInstance
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public static PlotSource getInstance()
{
if(instance == null)
{
instance = new PlotSource();
buffer = new CircularFifoBuffer(BUFFER_SIZE);
}
return instance;
}
示例6: convert2String
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/**
* TODO: Javadoc missing
*
* @param bBuf
* @return
*/
private String convert2String(CircularFifoBuffer bBuf) {
byte[] tmp = new byte[bBuf.size()];
int tmpCnt = 0;
for (Object aBBuf : bBuf) {
tmp[tmpCnt++] = (Byte) aBBuf;
}
return new String(tmp);
}
示例7: eval
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Override
public void eval(FunctionContext ctx, Tuple params) {
LagContext lagCtx = (LagContext)ctx;
if(lagCtx.lagBuffer == null) {
int lagNum = 0;
if (params.size() == 1) {
lagNum = 1;
} else {
lagNum = params.getInt4(1);
}
lagCtx.lagBuffer = new CircularFifoBuffer(lagNum+1);
}
if (!params.isBlankOrNull(0)) {
lagCtx.lagBuffer.add(params.asDatum(0));
} else {
lagCtx.lagBuffer.add(NullDatum.get());
}
if (lagCtx.defaultDatum == null) {
if (params.size() == 3) {
lagCtx.defaultDatum = params.asDatum(2);
} else {
lagCtx.defaultDatum = NullDatum.get();
}
}
}
示例8: eegPort
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public eegPort(PApplet applet, Serial serial) {
app = applet;
serialPort = serial;
rawDataBuffer = new CircularFifoBuffer(4096);
vectorBuffer = new CircularFifoBuffer(4096);
attentionBuffer = new CircularFifoBuffer(3600);
meditationBuffer = new CircularFifoBuffer(3600);
}
示例9: VQVADTrainer
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/**
* See the class documentation for a full explanation of the parameters.
*
* @param trainingBufferSize
* @param energyMinLevel
* @param energyFraction
* @param vqSize
* @param maxKMeansIter
*/
public VQVADTrainer(int trainingBufferSize, int minFrameCount, double energyMinLevel, double energyFraction, int vqSize, int maxKMeansIter) {
this.minFrameCount = minFrameCount;
this.energyMinLevel = energyMinLevel;
this.energyFraction = energyFraction;
this.vqSize = vqSize;
trainingFrameBuffer = new CircularFifoBuffer(trainingBufferSize);
clusterer = new KMeansPlusPlusClusterer<DoublePoint>(vqSize, maxKMeansIter);
}
示例10: SlidingWindowState
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public SlidingWindowState(long windowSize, long slideInterval, long timeUnitInMillis) {
this.currentRecordCount = 0;
// here we assume that windowSize and slidingStep is divisible by
// computationGranularity.
this.fullRecordCount = (int) (windowSize / timeUnitInMillis);
this.slideRecordCount = (int) (slideInterval / timeUnitInMillis);
this.buffer = new CircularFifoBuffer(fullRecordCount);
this.iterator = new SlidingWindowStateIterator<T>(buffer);
}
示例11: NthLastModifiedTimeTracker
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
if (numTimesToTrack < 1) {
throw new IllegalArgumentException("numTimesToTrack must be greater than zero (you requested "
+ numTimesToTrack + ")");
}
lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
initLastModifiedTimesMillis();
}
示例12: NthLastModifiedTimeTracker
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
if (numTimesToTrack < 1) {
throw new IllegalArgumentException(
"numTimesToTrack must be greater than zero (you requested "
+ numTimesToTrack + ")");
}
lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
initLastModifiedTimesMillis();
}
示例13: NthLastModifiedTimeTracker
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
if (numTimesToTrack < 1) {
throw new IllegalArgumentException(
"numTimesToTrack must be greater than zero (you requested " + numTimesToTrack + ")");
}
lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
initLastModifiedTimesMillis();
}
示例14: setBufferSize
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/************************************************************************************************
* @param size sets the maximum size of the circular fifo buffer
************************************************************************************************/
public void setBufferSize(int size){
fifo = (CircularFifoBuffer) BufferUtils.synchronizedBuffer(new CircularFifoBuffer(size));
}
示例15: RollingLogOutputStream
import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
RollingLogOutputStream(int maxLines) {
ringBuffer = new CircularFifoBuffer(maxLines);
}