當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。