Search in sources :

Example 1 with RingbufferWaitNotifyKey

use of com.hazelcast.ringbuffer.impl.RingbufferWaitNotifyKey in project hazelcast by hazelcast.

the class AbstractRingBufferOperation method getRingbufferWaitNotifyKey.

/**
 * Returns {@link WaitNotifyKey} of the ringbuffer.
 *
 * If the RingbufferContainer exists it reuses it's {@link RingbufferContainer#getRingEmptyWaitNotifyKey()}.
 * If the RingbufferContainer doesn't exist it creates new RingbufferWaitNotifyKey and doesn't recreate
 * the ringbuffer container.
 *
 * @return WaitNotifyKey of the ringbuffer
 */
WaitNotifyKey getRingbufferWaitNotifyKey() {
    final RingbufferService service = getService();
    final ObjectNamespace ns = RingbufferService.getRingbufferNamespace(name);
    RingbufferContainer ringbuffer = service.getContainerOrNull(getPartitionId(), ns);
    if (ringbuffer != null) {
        return ringbuffer.getRingEmptyWaitNotifyKey();
    } else {
        return new RingbufferWaitNotifyKey(ns, getPartitionId());
    }
}
Also used : RingbufferContainer(com.hazelcast.ringbuffer.impl.RingbufferContainer) RingbufferWaitNotifyKey(com.hazelcast.ringbuffer.impl.RingbufferWaitNotifyKey) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) ObjectNamespace(com.hazelcast.internal.services.ObjectNamespace)

Aggregations

ObjectNamespace (com.hazelcast.internal.services.ObjectNamespace)1 RingbufferContainer (com.hazelcast.ringbuffer.impl.RingbufferContainer)1 RingbufferService (com.hazelcast.ringbuffer.impl.RingbufferService)1 RingbufferWaitNotifyKey (com.hazelcast.ringbuffer.impl.RingbufferWaitNotifyKey)1