
com.alachisoft.ncache.client.internal.communication.RequestInformation Maven / Gradle / Ivy
package com.alachisoft.ncache.client.internal.communication;
class RequestInformation {
private final Object _mutex = new Object();
private java.util.HashSet _threadIds;
private int _requestsPerSecond;
private int _bulkThreshold;
private boolean _bulkingEnabled = false;
public RequestInformation() {
_threadIds = new java.util.HashSet();
_requestsPerSecond = 0;
}
public final void AddRequest() {
synchronized (_mutex) {
_threadIds.add(Thread.currentThread().getId());
_requestsPerSecond++;
}
}
public final boolean getBulkingEnabled() {
synchronized (_mutex) {
return _bulkingEnabled;
}
}
public final int getBulkThreshold() {
synchronized (_mutex) {
return _bulkThreshold;
}
}
public final void UpdateBulkThreshold() {
synchronized (_mutex) {
_bulkThreshold = _threadIds.size();
_bulkingEnabled = _threadIds.size() >= Runtime.getRuntime().availableProcessors();
_threadIds.clear();
_requestsPerSecond = 0;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy