public int secondsSinceOldestModification() { long modifiedTimeMillis = ((Long) lastModifiedTimesMillis.get()).longValue(); return (int) ((now() - modifiedTimeMillis) / MILLIS_IN_SEC); }
public int secondsSinceOldestModification() { long modifiedTimeMillis = ((Long) lastModifiedTimesMillis.get()).longValue(); return (int) ((now() - modifiedTimeMillis) / MILLIS_IN_SEC); }
public LogEvent get() { return (LogEvent) buffer.get(); }
@Override public Datum terminate(FunctionContext ctx) { LagContext lagCtx = (LagContext)ctx; if(lagCtx.lagBuffer.isFull()) { return (Datum)(lagCtx.lagBuffer.get()); } else { return lagCtx.defaultDatum; } }
@Override public Datum terminate(FunctionContext ctx) { LagContext lagCtx = (LagContext)ctx; if(lagCtx.lagBuffer.isFull()) { return (Datum)(lagCtx.lagBuffer.get()); } else { return lagCtx.defaultDatum; } }
public int secondsSinceOldestModification() { long modifiedTimeMillis = ((Long) lastModifiedTimesMillis.get()).longValue(); return (int) ((now() - modifiedTimeMillis) / MILLIS_IN_SEC); }
public int secondsSinceOldestModification() { long modifiedTimeMillis = ((Long) lastModifiedTimesMillis.get()).longValue(); return (int) ((now() - modifiedTimeMillis) / MILLIS_IN_SEC); }
public int secondsSinceOldestModification() { long modifiedTimeMillis = ((Long) lastModifiedTimesMillis.get()).longValue(); return (int) ((now() - modifiedTimeMillis) / MILLIS_IN_SEC); }
public int secondsSinceOldestModification() { long modifiedTimeMillis = ((Long) lastModifiedTimesMillis.get()).longValue(); return (int) ((now() - modifiedTimeMillis) / MILLIS_IN_SEC); }
public int secondsSinceOldestModification() { long modifiedTimeMillis = ((Long) lastModifiedTimesMillis.get()).longValue(); return (int) ((now() - modifiedTimeMillis) / MILLIS_IN_SEC); }
private void addToTimerDataList(MonitorData mdata) { // We should remove the oldest entry if (lastTimerDataList.isFull()) lastTimerDataList.remove(lastTimerDataList.get()); lastTimerDataList.add(mdata); }
private void addToLastUnfinishedTimerDataList(MonitorData mdata) { // We should remove the oldest entry if (lastUnfinishedTimerDataList.isFull()) lastUnfinishedTimerDataList.remove(lastUnfinishedTimerDataList.get()); lastUnfinishedTimerDataList.add(mdata); }
/** * Collects values from supplier in specified periods of time, and compares last n samples every * iteration. If all n samples are equal(), returns the value. If last n samples don't match * before max iterations threshold is reached, returns last collected sample. * * @param samplesSupplier supplier of value to wait for, * @param samplingPeriod milliseconds period between taking each sample, * @param sampleQueueSize defines the last n elements that are to be compared, * @param maxSamplesThreshold max number of samples before return * @return last collected sample */ public static <T> T waitForValue(Supplier<T> samplesSupplier, int samplingPeriod, int sampleQueueSize, int maxSamplesThreshold) { CircularFifoBuffer samplesQueue = new CircularFifoBuffer(sampleQueueSize); int samplesTaken = 0; while (!isThresholdReached(samplesTaken, maxSamplesThreshold) && !areAllSamplesEqual(samplesQueue)) { CurrentThread.sleep(samplingPeriod); T nextSample = samplesSupplier.get(); samplesQueue.add(nextSample); ++samplesTaken; } return (T) samplesQueue.get(); }
/** * Collects values from supplier in specified periods of time, and compares last n samples every * iteration. If all n samples are equal(), returns the value. If last n samples don't match * before max iterations threshold is reached, returns last collected sample. * * @param samplesSupplier supplier of value to wait for, * @param samplingPeriod milliseconds period between taking each sample, * @param sampleQueueSize defines the last n elements that are to be compared, * @param maxSamplesThreshold max number of samples before return * @return last collected sample */ public static <T> T waitForValue(Supplier<T> samplesSupplier, int samplingPeriod, int sampleQueueSize, int maxSamplesThreshold) { CircularFifoBuffer samplesQueue = new CircularFifoBuffer(sampleQueueSize); int samplesTaken = 0; while (!isThresholdReached(samplesTaken, maxSamplesThreshold) && !areAllSamplesEqual(samplesQueue)) { CurrentThread.sleep(samplingPeriod); T nextSample = samplesSupplier.get(); samplesQueue.add(nextSample); ++samplesTaken; } return (T) samplesQueue.get(); }