Search in sources :

Example 1 with StatusIndicator

use of org.agrona.concurrent.status.StatusIndicator in project Aeron by real-logic.

the class SetControllableIdleStrategy method main.

public static void main(final String[] args) throws Exception {
    try (Aeron aeron = Aeron.connect()) {
        final CountersReader countersReader = aeron.countersReader();
        final MutableInteger id = new MutableInteger();
        id.value = -1;
        countersReader.forEach((counterId, typeId, keyBuffer, label) -> {
            if (counterId == SystemCounterDescriptor.CONTROLLABLE_IDLE_STRATEGY.id() && label.equals(SystemCounterDescriptor.CONTROLLABLE_IDLE_STRATEGY.label())) {
                id.value = counterId;
            }
        });
        if (-1 != id.value) {
            final StatusIndicator statusIndicator = new UnsafeBufferStatusIndicator(countersReader.valuesBuffer(), id.value);
            final int status = Integer.parseInt(args[0]);
            statusIndicator.setOrdered(status);
            System.out.println("Set ControllableIdleStrategy status to " + status);
        } else {
            System.out.println("Could not find ControllableIdleStrategy status.");
        }
    }
}
Also used : StatusIndicator(org.agrona.concurrent.status.StatusIndicator) UnsafeBufferStatusIndicator(org.agrona.concurrent.status.UnsafeBufferStatusIndicator) MutableInteger(org.agrona.collections.MutableInteger) UnsafeBufferStatusIndicator(org.agrona.concurrent.status.UnsafeBufferStatusIndicator) Aeron(io.aeron.Aeron) CountersReader(org.agrona.concurrent.status.CountersReader)

Aggregations

Aeron (io.aeron.Aeron)1 MutableInteger (org.agrona.collections.MutableInteger)1 CountersReader (org.agrona.concurrent.status.CountersReader)1 StatusIndicator (org.agrona.concurrent.status.StatusIndicator)1 UnsafeBufferStatusIndicator (org.agrona.concurrent.status.UnsafeBufferStatusIndicator)1