本文整理汇总了Java中org.apache.commons.lang.mutable.MutableLong类的典型用法代码示例。如果您正苦于以下问题:Java MutableLong类的具体用法?Java MutableLong怎么用?Java MutableLong使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MutableLong类属于org.apache.commons.lang.mutable包,在下文中一共展示了MutableLong类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JobRequestStats
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
public JobRequestStats(
JobRequest jobRequest,
final int latencyNumBuckets,
final int latencyGranularityFactor,
final double latencyWarmUpSecs) {
this.jobRequest = jobRequest;
for (PerfStatType s : PerfStatType.values()) {
_stats.put(s, new MutableLong(0));
}
_latencyBuckets = new ArrayList<MutableLong>(latencyNumBuckets);
for (int i = 0; i < latencyNumBuckets; i++) {
_latencyBuckets.add(new MutableLong(0));
}
_latencyGranularity = latencyGranularityFactor;
_latencyWarmupInSecs = latencyWarmUpSecs;
_toUs = 1000; // nano to micro.
_totalLatency = 0;
this.resetStats();
}
示例2: resetStats
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
public synchronized void resetStats() {
for (MutableLong ml : _stats.values()) {
ml.setValue(0);
}
_receiveEndTimeInNanos = 0;
_receiveStartTimeInNanos = 0;
_totalLatency = 0;
for (MutableLong bucket : _latencyBuckets) {
bucket.setValue(0);
}
_stats.get(PerfStatType.LATENCY_USEC_MIN).setValue(Long.MAX_VALUE);
_stats.get(PerfStatType.LATENCY_USEC_MAX).setValue(0);
expectedAcksSet = new HashSet<>();
expectedResponseSet = new HashSet<>();
}
示例3: setup
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
public void setup(OperatorContext context)
{
try {
fs = getHDFSInstance();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
this.context = context;
lastTimeStamp = System.currentTimeMillis();
fileCounters.setCounter(Counters.TOTAL_BYTES_WRITTEN, new MutableLong());
fileCounters.setCounter(Counters.TOTAL_TIME_ELAPSED, new MutableLong());
super.setup(context);
}
示例4: populateDAG
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
public void populateDAG(DAG dag, Configuration conf)
{
String filePath = "HDFSOutputOperatorBenchmarkingApp/"
+ System.currentTimeMillis();
dag.setAttribute(DAG.STREAMING_WINDOW_SIZE_MILLIS, 1000);
RandomWordGenerator wordGenerator = dag.addOperator("wordGenerator", RandomWordGenerator.class);
dag.getOperatorMeta("wordGenerator").getMeta(wordGenerator.output)
.getAttributes().put(PortContext.QUEUE_CAPACITY, 10000);
dag.getOperatorMeta("wordGenerator").getAttributes()
.put(OperatorContext.APPLICATION_WINDOW_COUNT, 1);
FSByteOutputOperator hdfsOutputOperator = dag.addOperator("hdfsOutputOperator", new FSByteOutputOperator());
hdfsOutputOperator.setFilePath(filePath);
dag.getOperatorMeta("hdfsOutputOperator").getAttributes()
.put(OperatorContext.COUNTERS_AGGREGATOR, new BasicCounters.LongAggregator<MutableLong>());
dag.addStream("Generator2HDFSOutput", wordGenerator.output, hdfsOutputOperator.input);
}
示例5: processStats
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Response processStats(BatchedOperatorStats batchedOperatorStats)
{
BasicCounters<MutableLong> fileCounters = null;
for (OperatorStats operatorStats : batchedOperatorStats.getLastWindowedStats()) {
if (operatorStats.counters != null) {
fileCounters = (BasicCounters<MutableLong>)operatorStats.counters;
}
}
Response response = new Response();
if (fileCounters != null &&
fileCounters.getCounter(FileCounters.PENDING_FILES).longValue() > 0L ||
System.currentTimeMillis() - repartitionInterval <= lastRepartition) {
response.repartitionRequired = false;
return response;
}
response.repartitionRequired = true;
return response;
}
示例6: setup
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
public void setup(OperatorContext context)
{
this.context = context;
this.currentWindow = context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID);
sleepTimeMillis = context.getValue(OperatorContext.SPIN_MILLIS);
bucketManager.setBucketCounters(counters);
counters.setCounter(CounterKeys.DUPLICATE_EVENTS, new MutableLong());
bucketManager.startService(this);
logger.debug("bucket keys at startup {}", waitingEvents.keySet());
for (long bucketKey : waitingEvents.keySet()) {
bucketManager.loadBucketData(bucketKey);
}
if (orderedOutput) {
decisions = Maps.newLinkedHashMap();
}
}
示例7: processStats
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
public Response processStats(BatchedOperatorStats batchedOperatorStats)
{
List<Stats.OperatorStats> lastWindowedStats = batchedOperatorStats.getLastWindowedStats();
if (lastWindowedStats != null) {
for (Stats.OperatorStats os : lastWindowedStats) {
if (os.counters != null) {
if (os.counters instanceof BasicCounters) {
@SuppressWarnings("unchecked")
BasicCounters<MutableLong> cs = (BasicCounters<MutableLong>)os.counters;
logger.debug("operatorId:{} buckets:[in-memory:{} deleted:{} evicted:{}] events:[in-memory:{} "
+ "committed-last-window:{} duplicates:{}] low:{} high:{}",
batchedOperatorStats.getOperatorId(),
cs.getCounter(BucketManager.CounterKeys.BUCKETS_IN_MEMORY),
cs.getCounter(BucketManager.CounterKeys.DELETED_BUCKETS),
cs.getCounter(BucketManager.CounterKeys.EVICTED_BUCKETS),
cs.getCounter(BucketManager.CounterKeys.EVENTS_IN_MEMORY),
cs.getCounter(BucketManager.CounterKeys.EVENTS_COMMITTED_LAST_WINDOW),
cs.getCounter(CounterKeys.DUPLICATE_EVENTS));
}
}
}
}
return null;
}
示例8: createStore
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
protected AppDataSingleSchemaDimensionStoreHDHT createStore(DAG dag, Configuration conf, String eventSchema)
{
AppDataSingleSchemaDimensionStoreHDHT store = dag.addOperator("Store", ProcessTimeAwareStore.class);
store.setUpdateEnumValues(true);
String basePath = Preconditions.checkNotNull(conf.get(PROP_STORE_PATH),
"base path should be specified in the properties.xml");
TFileImpl hdsFile = new TFileImpl.DTFileImpl();
basePath += System.currentTimeMillis();
hdsFile.setBasePath(basePath);
store.setFileStore(hdsFile);
dag.setAttribute(store, Context.OperatorContext.COUNTERS_AGGREGATOR,
new BasicCounters.LongAggregator<MutableLong>());
store.setConfigurationSchemaJSON(eventSchema);
store.setPartitionCount(storePartitionCount);
if(storePartitionCount > 1)
{
store.setPartitionCount(storePartitionCount);
store.setQueryResultUnifier(new DimensionStoreHDHTNonEmptyQueryResultUnifier());
}
return store;
}
示例9: MySession
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
public MySession(SessionManager sessionManager, String id, ThreadLocalManager threadLocalManager,
IdManager idManager, SessionStore sessionStore, SessionAttributeListener sessionListener,
int inactiveInterval, NonPortableSession nonPortableSession, MutableLong expirationTimeSuggestion,
RebuildBreakdownService rebuildBreakdownService)
{
this.sessionManager = sessionManager;
m_id = id;
this.threadLocalManager = threadLocalManager;
this.idManager = idManager;
this.sessionStore = sessionStore;
this.sessionListener = sessionListener;
m_inactiveInterval = inactiveInterval;
m_nonPortalSession = nonPortableSession;
m_created = System.currentTimeMillis();
m_accessed = m_created;
this.expirationTimeSuggestion = expirationTimeSuggestion;
resetExpirationTimeSuggestion();
// set the TERRACOTTA_CLUSTER flag
resolveTerracottaClusterProperty();
this.rebuildBreakdownService = rebuildBreakdownService;
}
示例10: newSessionWithBlockableMutableLong
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
protected Session newSessionWithBlockableMutableLong(final CountDownLatch opStarted,
final CountDownLatch opBlocker, final CountDownLatch opCompleted) {
// unfortunately, the Maintenance implementation compels us to
// use MySession rather than an interface.
String uuid = nextUuid();
final MutableLong expirationTimeSuggestion = new MutableLong(System.currentTimeMillis()) {
@Override
public long longValue() {
Callable<Long> callback = new Callable<Long>() {
public Long call() throws Exception {
return superLongValue();
}
};
Long result =
execBlockableSessionOp(opStarted, opBlocker, opCompleted, callback);
return result;
}
private long superLongValue() {
return super.longValue();
}
};
final MySession session = new MySession(sessionComponent,uuid,threadLocalManager,idManager,
sessionComponent,sessionListener,sessionComponent.getInactiveInterval(),new MyNonPortableSession(),
expirationTimeSuggestion, null);
return session;
}
示例11: newSessionWithBlockableGetLastAccessedTimeImpl
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
protected Session newSessionWithBlockableGetLastAccessedTimeImpl(final CountDownLatch opStarted,
final CountDownLatch opBlocker, final CountDownLatch opCompleted) {
// unfortunately, the getActiveUserCount() implementation compels us to
// use MySession rather than an interface.
String uuid = nextUuid();
final MySession session = new MySession(sessionComponent,uuid,threadLocalManager,idManager,
sessionComponent,sessionListener,sessionComponent.getInactiveInterval(),new MyNonPortableSession(),
new MutableLong(System.currentTimeMillis()), null) {
private long superGetLastAccessedTime() {
return super.getLastAccessedTime();
}
@Override
public long getLastAccessedTime()
{
Callable<Long> callback = new Callable<Long>() {
public Long call() throws Exception {
return superGetLastAccessedTime();
}
};
Long result =
execBlockableSessionOp(opStarted, opBlocker, opCompleted, callback);
return result;
}
};
return session;
}
示例12: streamTermIdsForField
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
public void streamTermIdsForField(String name,
int fieldId,
List<KeyRange> ranges,
final TermIdStream termIdStream,
StackBuffer stackBuffer) throws Exception {
MutableLong bytes = new MutableLong();
indexes[fieldId].streamKeys(ranges, rawKey -> {
try {
bytes.add(rawKey.length);
return termIdStream.stream(termInterner.intern(rawKey));
} catch (Exception e) {
throw new RuntimeException(e);
}
}, stackBuffer);
LOG.inc("count>streamTermIdsForField>total");
LOG.inc("count>streamTermIdsForField>" + name + ">total");
LOG.inc("count>streamTermIdsForField>" + name + ">" + fieldId);
LOG.inc("bytes>streamTermIdsForField>total", bytes.longValue());
LOG.inc("bytes>streamTermIdsForField>" + name + ">total", bytes.longValue());
LOG.inc("bytes>streamTermIdsForField>" + name + ">" + fieldId, bytes.longValue());
}
示例13: multiGetLastIds
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
public void multiGetLastIds(String name, int fieldId, MiruTermId[] termIds, int[] results, StackBuffer stackBuffer) throws Exception {
byte[][] termIdBytes = new byte[termIds.length][];
for (int i = 0; i < termIds.length; i++) {
if (termIds[i] != null) {
termIdBytes[i] = termIds[i].getBytes();
}
}
MutableLong bytes = new MutableLong();
indexes[fieldId].readEach(termIdBytes, null, (monkey, filer, _stackBuffer, lock, index) -> {
if (filer != null) {
bytes.add(4);
results[index] = MiruFilerInvertedIndex.deserLastId(filer);
}
return null;
}, new Void[results.length], stackBuffer);
LOG.inc("count>multiGetLastIds>total");
LOG.inc("count>multiGetLastIds>" + name + ">total");
LOG.inc("count>multiGetLastIds>" + name + ">" + fieldId);
LOG.inc("bytes>multiGetLastIds>total", bytes.longValue());
LOG.inc("bytes>multiGetLastIds>" + name + ">total", bytes.longValue());
LOG.inc("bytes>multiGetLastIds>" + name + ">" + fieldId, bytes.longValue());
}
示例14: lastId
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
@Override
public int lastId(StackBuffer stackBuffer) throws Exception {
if (lastId == Integer.MIN_VALUE) {
MutableLong bytes = new MutableLong();
synchronized (mutationLock) {
lastId = keyedFilerStore.read(indexKeyBytes, null, (monkey, filer, stackBuffer1, lock) -> {
if (filer != null) {
bytes.add(filer.length());
return getLastId(lock, filer, stackBuffer1);
} else {
return -1;
}
}, stackBuffer);
}
LOG.inc("count>lastId>total");
LOG.inc("count>lastId>" + name + ">total");
LOG.inc("count>lastId>" + name + ">" + fieldId);
LOG.inc("bytes>lastId>total", bytes.longValue());
LOG.inc("bytes>lastId>" + name + ">total", bytes.longValue());
LOG.inc("bytes>lastId>" + name + ">" + fieldId, bytes.longValue());
}
return lastId;
}
示例15: getActivity
import org.apache.commons.lang.mutable.MutableLong; //导入依赖的package包/类
public StreamBatch<MiruWALEntry, AmzaCursor> getActivity(MiruTenantId tenantId,
MiruPartitionId partitionId,
AmzaCursor cursor,
int batchSize,
long stopAtTimestamp,
MutableLong bytesCount)
throws Exception {
getActivityLatency.startTimer();
try {
List<MiruWALEntry> activities = new ArrayList<>();
AmzaCursor nextCursor = activityWALReader.stream(tenantId, partitionId, cursor, batchSize, stopAtTimestamp,
(collisionId, partitionedActivity, timestamp) -> {
activities.add(new MiruWALEntry(collisionId, timestamp, partitionedActivity));
return activities.size() < batchSize;
});
return new StreamBatch<>(activities, nextCursor, false, null);
} finally {
getActivityLatency.stopTimer("Get activity latency", "Check partition health");
}
}