当前位置: 首页>>代码示例>>Java>>正文


Java CountersManager类代码示例

本文整理汇总了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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:30,代码来源:ChannelEndpointStatus.java

示例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();
    }
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:24,代码来源:ClientConductor.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:21,代码来源:SubscriberPos.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:29,代码来源:StreamPositionCounter.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:23,代码来源:DefaultCongestionControlSupplier.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:23,代码来源:CubicCongestionControlSupplier.java

示例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));
    }
}
 
开发者ID:canepat,项目名称:Helios,代码行数:8,代码来源:StatusCounters.java

示例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");
}
 
开发者ID:real-logic,项目名称:artio,代码行数:8,代码来源:FixCounters.java

示例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);
        }
    }
}
 
开发者ID:real-logic,项目名称:artio,代码行数:32,代码来源:FixStat.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:12,代码来源:ReceiverHwm.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:27,代码来源:PerImageIndicator.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:12,代码来源:PublisherLimit.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:12,代码来源:SenderPos.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:12,代码来源:ReceiverPos.java

示例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);
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:12,代码来源:SenderLimit.java


注:本文中的org.agrona.concurrent.status.CountersManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。