本文整理汇总了Java中org.agrona.concurrent.status.CountersManager类的典型用法代码示例。如果您正苦于以下问题:Java CountersManager类的具体用法?Java CountersManager怎么用?Java CountersManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CountersManager类属于org.agrona.concurrent.status包,在下文中一共展示了CountersManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
/**
* Allocate an indicator for tracking the status of a channel endpoint.
*
* @param tempBuffer to be used for labels and metadata.
* @param name of the counter for the label.
* @param typeId of the counter for classification.
* @param countersManager from which to allocated the underlying storage.
* @param channel for the stream of messages.
* @return a new {@link AtomicCounter} for tracking the status.
*/
public static AtomicCounter allocate(
final MutableDirectBuffer tempBuffer,
final String name,
final int typeId,
final CountersManager countersManager,
final String channel)
{
final int keyLength = tempBuffer.putStringWithoutLengthAscii(
CHANNEL_OFFSET + SIZE_OF_INT, channel, 0, MAX_CHANNEL_LENGTH);
tempBuffer.putInt(CHANNEL_OFFSET, keyLength);
int labelLength = 0;
labelLength += tempBuffer.putStringWithoutLengthAscii(keyLength + labelLength, name);
labelLength += tempBuffer.putStringWithoutLengthAscii(keyLength + labelLength, ": ");
labelLength += tempBuffer.putStringWithoutLengthAscii(
keyLength + labelLength, channel, 0, MAX_LABEL_LENGTH - labelLength);
return countersManager.newCounter(typeId, tempBuffer, 0, keyLength, tempBuffer, keyLength, labelLength);
}
示例2: addCounter
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
Counter addCounter(final int typeId, final String label)
{
clientLock.lock();
try
{
ensureOpen();
if (label.length() > CountersManager.MAX_LABEL_LENGTH)
{
throw new IllegalArgumentException("label length exceeds MAX_LABEL_LENGTH: " + label.length());
}
final long registrationId = driverProxy.addCounter(typeId, label);
awaitResponse(registrationId);
return (Counter)resourceByRegIdMap.get(registrationId);
}
finally
{
clientLock.unlock();
}
}
示例3: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public static UnsafeBufferPosition allocate(
final MutableDirectBuffer tempBuffer,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel,
final long joinPosition)
{
return StreamPositionCounter.allocate(
tempBuffer,
NAME,
SUBSCRIBER_POSITION_TYPE_ID,
countersManager,
registrationId,
sessionId,
streamId,
channel,
joinPosition);
}
示例4: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
/**
* Allocate a counter for tracking a position on a stream of messages.
*
* @param tempBuffer to be used for labels and key.
* @param name of the counter for the label.
* @param typeId of the counter for classification.
* @param countersManager from which to allocated the underlying storage.
* @param registrationId to be associated with the counter.
* @param sessionId for the stream of messages.
* @param streamId for the stream of messages.
* @param channel for the stream of messages.
* @return a new {@link UnsafeBufferPosition} for tracking the stream.
*/
public static UnsafeBufferPosition allocate(
final MutableDirectBuffer tempBuffer,
final String name,
final int typeId,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel)
{
return new UnsafeBufferPosition(
(UnsafeBuffer)countersManager.valuesBuffer(),
allocateCounterId(tempBuffer, name, typeId, countersManager, registrationId, sessionId, streamId, channel),
countersManager);
}
示例5: newInstance
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public CongestionControl newInstance(
final long registrationId,
final UdpChannel udpChannel,
final int streamId,
final int sessionId,
final int termLength,
final int senderMtuLength,
final NanoClock clock,
final MediaDriver.Context context,
final CountersManager countersManager)
{
return new StaticWindowCongestionControl(
registrationId,
udpChannel,
streamId,
sessionId,
termLength,
senderMtuLength,
clock,
context,
countersManager);
}
示例6: newInstance
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public CongestionControl newInstance(
final long registrationId,
final UdpChannel udpChannel,
final int streamId,
final int sessionId,
final int termLength,
final int senderMtuLength,
final NanoClock clock,
final MediaDriver.Context context,
final CountersManager countersManager)
{
return new CubicCongestionControl(
registrationId,
udpChannel,
streamId,
sessionId,
termLength,
senderMtuLength,
clock,
context,
countersManager);
}
示例7: StatusCounters
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public StatusCounters(final CountersManager countersManager)
{
for (final StatusCounterDescriptor descriptor : StatusCounterDescriptor.values())
{
counterByDescriptorMap.put(descriptor, descriptor.newCounter(countersManager));
}
}
示例8: FixCounters
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
FixCounters(final CountersManager countersManager)
{
this.countersManager = countersManager;
failedInboundPublications = countersManager.newCounter("Failed offer to inbound publication");
failedOutboundPublications = countersManager.newCounter("Failed offer to outbound publication");
failedReplayPublications = countersManager.newCounter("Failed offer to replay publication");
}
示例9: main
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public static void main(final String[] args) throws InterruptedException
{
final EngineConfiguration configuration = new EngineConfiguration();
configuration.libraryAeronChannel("").conclude();
try (MonitoringFile monitoringFile = new MonitoringFile(false, configuration))
{
final CountersManager countersManager = monitoringFile.createCountersManager();
final AtomicBuffer countersBuffer = monitoringFile.countersBuffer();
final AtomicBoolean running = new AtomicBoolean(true);
SigInt.register(() -> running.set(false));
while (running.get())
{
System.out.print("\033[H\033[2J");
System.out.format("%1$tH:%1$tM:%1$tS - Fix Stat%n", LocalTime.now());
System.out.println("=========================");
countersManager.forEach(
(id, label) ->
{
final int offset = CountersManager.counterOffset(id);
final long value = countersBuffer.getLongVolatile(offset);
System.out.format("%3d: %,20d - %s%n", id, value, label);
});
Thread.sleep(1000);
}
}
}
示例10: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public static UnsafeBufferPosition allocate(
final MutableDirectBuffer tempBuffer,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel)
{
return StreamPositionCounter.allocate(
tempBuffer, NAME, RECEIVER_HWM_TYPE_ID, countersManager, registrationId, sessionId, streamId, channel);
}
示例11: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
/**
* Allocate a per {@link io.aeron.driver.PublicationImage} indicator.
*
* @param tempBuffer to be used for labels and key.
* @param name of the counter for the label.
* @param countersManager from which to allocated the underlying storage.
* @param registrationId to be associated with the counter.
* @param sessionId for the stream of messages.
* @param streamId for the stream of messages.
* @param channel for the stream of messages.
* @return a new {@link AtomicCounter} for tracking the indicator.
*/
public static AtomicCounter allocate(
final MutableDirectBuffer tempBuffer,
final String name,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel)
{
final int counterId = StreamPositionCounter.allocateCounterId(
tempBuffer, name, PER_IMAGE_TYPE_ID, countersManager, registrationId, sessionId, streamId, channel);
return new AtomicCounter(countersManager.valuesBuffer(), counterId, countersManager);
}
示例12: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public static UnsafeBufferPosition allocate(
final MutableDirectBuffer tempBuffer,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel)
{
return StreamPositionCounter.allocate(
tempBuffer, NAME, PUBLISHER_LIMIT_TYPE_ID, countersManager, registrationId, sessionId, streamId, channel);
}
示例13: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public static UnsafeBufferPosition allocate(
final MutableDirectBuffer tempBuffer,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel)
{
return StreamPositionCounter.allocate(
tempBuffer, NAME, SENDER_POSITION_TYPE_ID, countersManager, registrationId, sessionId, streamId, channel);
}
示例14: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public static UnsafeBufferPosition allocate(
final MutableDirectBuffer tempBuffer,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel)
{
return StreamPositionCounter.allocate(
tempBuffer, NAME, RECEIVER_POS_TYPE_ID, countersManager, registrationId, sessionId, streamId, channel);
}
示例15: allocate
import org.agrona.concurrent.status.CountersManager; //导入依赖的package包/类
public static UnsafeBufferPosition allocate(
final MutableDirectBuffer tempBuffer,
final CountersManager countersManager,
final long registrationId,
final int sessionId,
final int streamId,
final String channel)
{
return StreamPositionCounter.allocate(
tempBuffer, NAME, SENDER_LIMIT_TYPE_ID, countersManager, registrationId, sessionId, streamId, channel);
}