public long getPublisherLimit() { if (isClosed) { return -1L; } else { return publisherLimit.get(); } }
public long getPublisherPosition() { if (isClosed) { return -1L; } else { return publisherPosition.get(); } }
public long getPublisherLimit() { if (isClosed) { return -1L; } else { return publisherLimit.get(); } }
public long getPublisherPosition() { if (isClosed) { return -1L; } else { return publisherPosition.get(); } }
public long getPosition() { return position.get(); }
protected long getLimit() { return limit.get(); }
protected long getLimit() { return limit.get(); }
public long getPosition() { return position.get(); }
public int updatePublisherLimit() { int isUpdated = 0; if (!isClosed) { long lastSubscriberPosition = -1; if (subscriptions.length > 0) { lastSubscriberPosition = subscriptions[subscriptions.length - 1].getPosition(); if (MODE_PUB_SUB == mode && subscriptions.length > 1) { for (int i = 0; i < subscriptions.length - 1; i++) { lastSubscriberPosition = Math.min(lastSubscriberPosition, subscriptions[i].getPosition()); } } } else { lastSubscriberPosition = Math.max(0, publisherLimit.get() - logWindowLength); } int partitionId = partitionId(lastSubscriberPosition); int partitionOffset = partitionOffset(lastSubscriberPosition) + logWindowLength; if (partitionOffset >= logBuffer.getPartitionSize()) { ++partitionId; partitionOffset = logWindowLength; } final long proposedPublisherLimit = position(partitionId, partitionOffset); if (publisherLimit.proposeMaxOrdered(proposedPublisherLimit)) { isUpdated = 1; } } return isUpdated; }
public int updatePublisherLimit() { int isUpdated = 0; if (!isClosed) { long lastSubscriberPosition = -1; if (subscriptions.length > 0) { lastSubscriberPosition = subscriptions[subscriptions.length - 1].getPosition(); if (MODE_PUB_SUB == mode && subscriptions.length > 1) { for (int i = 0; i < subscriptions.length - 1; i++) { lastSubscriberPosition = Math.min(lastSubscriberPosition, subscriptions[i].getPosition()); } } } else { lastSubscriberPosition = Math.max(0, publisherLimit.get() - logWindowLength); } int partitionId = partitionId(lastSubscriberPosition); int partitionOffset = partitionOffset(lastSubscriberPosition) + logWindowLength; if (partitionOffset >= logBuffer.getPartitionSize()) { ++partitionId; partitionOffset = logWindowLength; } final long proposedPublisherLimit = position(partitionId, partitionOffset); if (publisherLimit.proposeMaxOrdered(proposedPublisherLimit)) { isUpdated = 1; } } return isUpdated; }
final long limit = publisherLimit.get();
/** * Read fragments from the buffer and invoke the given handler for each fragment. Consume the * fragments (i.e. update the subscription position) after all fragments are handled. * * <p>Note that the handler is not aware of fragment batches. * * @return the amount of read fragments */ public int poll(FragmentHandler frgHandler, int maxNumOfFragments) { int fragmentsRead = 0; if (!isClosed) { final long currentPosition = position.get(); final long limit = getLimit(); if (limit > currentPosition) { final int partitionId = partitionId(currentPosition); final int partitionOffset = partitionOffset(currentPosition); final LogBufferPartition partition = logBuffer.getPartition(partitionId); fragmentsRead = pollFragments( partition, frgHandler, partitionId, partitionOffset, maxNumOfFragments, limit, false); } } return fragmentsRead; }
final long currentPosition = position.get(); final long limit = getLimit();
/** * Read fragments from the buffer and invoke the given handler for each fragment. Consume the * fragments (i.e. update the subscription position) after all fragments are handled. * * <p>Note that the handler is not aware of fragment batches. * * @return the amount of read fragments */ public int poll(FragmentHandler frgHandler, int maxNumOfFragments) { int fragmentsRead = 0; if (!isClosed) { final long currentPosition = position.get(); final long limit = getLimit(); if (limit > currentPosition) { final int partitionId = partitionId(currentPosition); final int partitionOffset = partitionOffset(currentPosition); final LogBufferPartition partition = logBuffer.getPartition(partitionId); fragmentsRead = pollFragments( partition, frgHandler, partitionId, partitionOffset, maxNumOfFragments, limit, false); } } return fragmentsRead; }
final long currentPosition = position.get();
final long currentPosition = position.get(); final long limit = getLimit();
final long currentPosition = position.get();
final long limit = publisherLimit.get();
final long limit = publisherLimit.get();
final long limit = publisherLimit.get();