use of com.hazelcast.ringbuffer.impl.RingbufferContainer in project hazelcast by hazelcast.
the class AddOperation method run.
@Override
public void run() throws Exception {
RingbufferContainer ringbuffer = getRingBufferContainer();
//todo: move into ringbuffer.
if (overflowPolicy == FAIL) {
if (ringbuffer.remainingCapacity() < 1) {
resultSequence = -1;
return;
}
}
resultSequence = ringbuffer.add(item);
}
use of com.hazelcast.ringbuffer.impl.RingbufferContainer in project hazelcast by hazelcast.
the class ReadManyOperation method beforeRun.
@Override
public void beforeRun() {
RingbufferContainer ringbuffer = getRingBufferContainer();
ringbuffer.checkBlockableReadSequence(startSequence);
}
use of com.hazelcast.ringbuffer.impl.RingbufferContainer in project hazelcast by hazelcast.
the class ReadManyOperation method shouldWait.
@Override
public boolean shouldWait() {
if (resultSet == null) {
resultSet = new ReadResultSetImpl(minSize, maxSize, getNodeEngine().getHazelcastInstance(), filter);
sequence = startSequence;
}
RingbufferContainer ringbuffer = getRingBufferContainer();
if (minSize == 0) {
if (!ringbuffer.shouldWait(sequence)) {
sequence = ringbuffer.readMany(sequence, resultSet);
}
return false;
}
if (resultSet.isMinSizeReached()) {
// enough items have been read, we are done.
return false;
}
if (ringbuffer.shouldWait(sequence)) {
// the sequence is not readable
return true;
}
sequence = ringbuffer.readMany(sequence, resultSet);
return !resultSet.isMinSizeReached();
}
use of com.hazelcast.ringbuffer.impl.RingbufferContainer in project hazelcast by hazelcast.
the class ReadOneOperation method beforeRun.
@Override
public void beforeRun() throws Exception {
RingbufferContainer ringbuffer = getRingBufferContainer();
ringbuffer.checkBlockableReadSequence(sequence);
}
use of com.hazelcast.ringbuffer.impl.RingbufferContainer in project hazelcast by hazelcast.
the class ReadOneOperation method run.
@Override
public void run() throws Exception {
RingbufferContainer ringbuffer = getRingBufferContainer();
result = ringbuffer.read(sequence);
}
Aggregations