Search in sources :

Example 11 with ReadablePosition

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

the class DriverConductor method positionArray.

private static ReadablePosition[] positionArray(final List<SubscriberPosition> subscriberPositions) {
    final int size = subscriberPositions.size();
    final ReadablePosition[] positions = new ReadablePosition[subscriberPositions.size()];
    for (int i = 0; i < size; i++) {
        positions[i] = subscriberPositions.get(i).position();
    }
    return positions;
}
Also used : ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint) SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint) ReadablePosition(org.agrona.concurrent.status.ReadablePosition)

Example 12 with ReadablePosition

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

the class NetworkPublication method updatePublishersLimit.

/**
     * Update the publishers limit for flow control as part of the conductor duty cycle.
     *
     * @return 1 if the limit has been updated otherwise 0.
     */
int updatePublishersLimit() {
    int workCount = 0;
    if (isConnected) {
        long minConsumerPosition = senderPosition.getVolatile();
        if (spyPositions.length > 0) {
            for (final ReadablePosition spyPosition : spyPositions) {
                minConsumerPosition = Math.min(minConsumerPosition, spyPosition.getVolatile());
            }
        }
        final long proposedPublisherLimit = minConsumerPosition + termWindowLength;
        if (publisherLimit.proposeMaxOrdered(proposedPublisherLimit)) {
            cleanBuffer(proposedPublisherLimit);
            workCount = 1;
        }
    } else {
        publisherLimit.setOrdered(senderPosition.getVolatile());
    }
    return workCount;
}
Also used : SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint) ReadablePosition(org.agrona.concurrent.status.ReadablePosition)

Example 13 with ReadablePosition

use of org.agrona.concurrent.status.ReadablePosition in project aeron by real-logic.

the class IpcPublication method close.

public void close() {
    publisherLimit.close();
    for (final ReadablePosition position : subscriberPositions) {
        position.close();
    }
    rawLog.close();
}
Also used : ReadablePosition(org.agrona.concurrent.status.ReadablePosition)

Example 14 with ReadablePosition

use of org.agrona.concurrent.status.ReadablePosition in project aeron by real-logic.

the class NetworkPublication method close.

public void close() {
    publisherLimit.close();
    senderPosition.close();
    senderLimit.close();
    for (final ReadablePosition position : spyPositions) {
        position.close();
    }
    rawLog.close();
}
Also used : ReadablePosition(org.agrona.concurrent.status.ReadablePosition)

Example 15 with ReadablePosition

use of org.agrona.concurrent.status.ReadablePosition in project aeron by real-logic.

the class PublicationImage method close.

/**
 * {@inheritDoc}
 */
public void close() {
    hwmPosition.close();
    rebuildPosition.close();
    for (final ReadablePosition position : subscriberPositions) {
        position.close();
    }
    congestionControl.close();
    rawLog.close();
}
Also used : ReadablePosition(org.agrona.concurrent.status.ReadablePosition)

Aggregations

ReadablePosition (org.agrona.concurrent.status.ReadablePosition)18 ReceiveChannelEndpoint (io.aeron.driver.media.ReceiveChannelEndpoint)5 SendChannelEndpoint (io.aeron.driver.media.SendChannelEndpoint)4 IdentityHashMap (java.util.IdentityHashMap)1 Map (java.util.Map)1