Search in sources :

Example 1 with SizeOperation

use of com.hazelcast.collection.impl.queue.operations.SizeOperation in project hazelcast by hazelcast.

the class QueueDataSerializerHook method createFactory.

public DataSerializableFactory createFactory() {
    // noinspection unchecked
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[MERGE_BACKUP + 1];
    constructors[OFFER] = arg -> new OfferOperation();
    constructors[OFFER_BACKUP] = arg -> new OfferBackupOperation();
    constructors[POLL] = arg -> new PollOperation();
    constructors[POLL_BACKUP] = arg -> new PollBackupOperation();
    constructors[PEEK] = arg -> new PeekOperation();
    constructors[ADD_ALL_BACKUP] = arg -> new AddAllBackupOperation();
    constructors[ADD_ALL] = arg -> new AddAllOperation();
    constructors[CLEAR_BACKUP] = arg -> new ClearBackupOperation();
    constructors[CLEAR] = arg -> new ClearOperation();
    constructors[COMPARE_AND_REMOVE_BACKUP] = arg -> new CompareAndRemoveBackupOperation();
    constructors[COMPARE_AND_REMOVE] = arg -> new CompareAndRemoveOperation();
    constructors[CONTAINS] = arg -> new ContainsOperation();
    constructors[DRAIN_BACKUP] = arg -> new DrainBackupOperation();
    constructors[DRAIN] = arg -> new DrainOperation();
    constructors[ITERATOR] = arg -> new IteratorOperation();
    constructors[QUEUE_EVENT] = arg -> new QueueEvent();
    constructors[QUEUE_EVENT_FILTER] = arg -> new QueueEventFilter();
    constructors[QUEUE_ITEM] = arg -> new QueueItem();
    constructors[QUEUE_REPLICATION] = arg -> new QueueReplicationOperation();
    constructors[REMOVE_BACKUP] = arg -> new RemoveBackupOperation();
    constructors[REMOVE] = arg -> new RemoveOperation();
    constructors[SIZE] = arg -> new SizeOperation();
    constructors[TXN_OFFER_BACKUP] = arg -> new TxnOfferBackupOperation();
    constructors[TXN_OFFER] = arg -> new TxnOfferOperation();
    constructors[TXN_POLL_BACKUP] = arg -> new TxnPollBackupOperation();
    constructors[TXN_POLL] = arg -> new TxnPollOperation();
    constructors[TXN_PREPARE_BACKUP] = arg -> new TxnPrepareBackupOperation();
    constructors[TXN_PREPARE] = arg -> new TxnPrepareOperation();
    constructors[TXN_RESERVE_OFFER] = arg -> new TxnReserveOfferOperation();
    constructors[TXN_RESERVE_OFFER_BACKUP] = arg -> new TxnReserveOfferBackupOperation();
    constructors[TXN_RESERVE_POLL] = arg -> new TxnReservePollOperation();
    constructors[TXN_RESERVE_POLL_BACKUP] = arg -> new TxnReservePollBackupOperation();
    constructors[TXN_ROLLBACK_BACKUP] = arg -> new TxnRollbackBackupOperation();
    constructors[TXN_ROLLBACK] = arg -> new TxnRollbackOperation();
    constructors[CHECK_EVICT] = arg -> new CheckAndEvictOperation();
    constructors[QUEUE_CONTAINER] = arg -> new QueueContainer();
    constructors[TRANSACTION_ROLLBACK] = arg -> new QueueTransactionRollbackOperation();
    constructors[TX_QUEUE_ITEM] = arg -> new TxQueueItem();
    constructors[TXN_PEEK] = arg -> new TxnPeekOperation();
    constructors[IS_EMPTY] = arg -> new IsEmptyOperation();
    constructors[REMAINING_CAPACITY] = arg -> new RemainingCapacityOperation();
    constructors[TXN_COMMIT] = arg -> new TxnCommitOperation();
    constructors[TXN_COMMIT_BACKUP] = arg -> new TxnCommitBackupOperation();
    constructors[MERGE] = arg -> new QueueMergeOperation();
    constructors[MERGE_BACKUP] = arg -> new QueueMergeBackupOperation();
    return new ArrayDataSerializableFactory(constructors);
}
Also used : TxnReserveOfferBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReserveOfferBackupOperation) TxnOfferBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnOfferBackupOperation) OfferBackupOperation(com.hazelcast.collection.impl.queue.operations.OfferBackupOperation) AddAllOperation(com.hazelcast.collection.impl.queue.operations.AddAllOperation) QueueMergeOperation(com.hazelcast.collection.impl.queue.operations.QueueMergeOperation) QueueReplicationOperation(com.hazelcast.collection.impl.queue.operations.QueueReplicationOperation) TxnPrepareBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPrepareBackupOperation) TxnReservePollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReservePollBackupOperation) PollBackupOperation(com.hazelcast.collection.impl.queue.operations.PollBackupOperation) TxnPollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPollBackupOperation) ClearBackupOperation(com.hazelcast.collection.impl.queue.operations.ClearBackupOperation) AddAllBackupOperation(com.hazelcast.collection.impl.queue.operations.AddAllBackupOperation) IsEmptyOperation(com.hazelcast.collection.impl.queue.operations.IsEmptyOperation) DrainOperation(com.hazelcast.collection.impl.queue.operations.DrainOperation) IteratorOperation(com.hazelcast.collection.impl.queue.operations.IteratorOperation) CompareAndRemoveBackupOperation(com.hazelcast.collection.impl.queue.operations.CompareAndRemoveBackupOperation) TxnReservePollOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReservePollOperation) TxnPollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPollBackupOperation) TxnReserveOfferBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReserveOfferBackupOperation) TxnCommitOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnCommitOperation) TxnReservePollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReservePollBackupOperation) TxnPrepareOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPrepareOperation) TxnReserveOfferOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReserveOfferOperation) TxQueueItem(com.hazelcast.collection.impl.txnqueue.TxQueueItem) TxnOfferOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnOfferOperation) SizeOperation(com.hazelcast.collection.impl.queue.operations.SizeOperation) CheckAndEvictOperation(com.hazelcast.collection.impl.queue.operations.CheckAndEvictOperation) TxnReserveOfferOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReserveOfferOperation) TxnOfferOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnOfferOperation) OfferOperation(com.hazelcast.collection.impl.queue.operations.OfferOperation) TxnRollbackOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnRollbackOperation) TxnOfferBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnOfferBackupOperation) ContainsOperation(com.hazelcast.collection.impl.queue.operations.ContainsOperation) TxnPeekOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPeekOperation) RemoveOperation(com.hazelcast.collection.impl.queue.operations.RemoveOperation) CompareAndRemoveOperation(com.hazelcast.collection.impl.queue.operations.CompareAndRemoveOperation) ClearOperation(com.hazelcast.collection.impl.queue.operations.ClearOperation) CompareAndRemoveOperation(com.hazelcast.collection.impl.queue.operations.CompareAndRemoveOperation) TxnPeekOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPeekOperation) PeekOperation(com.hazelcast.collection.impl.queue.operations.PeekOperation) ConstructorFunction(com.hazelcast.internal.util.ConstructorFunction) QueueTransactionRollbackOperation(com.hazelcast.collection.impl.txnqueue.operations.QueueTransactionRollbackOperation) TxnCommitBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnCommitBackupOperation) PollOperation(com.hazelcast.collection.impl.queue.operations.PollOperation) TxnReservePollOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReservePollOperation) TxnPollOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPollOperation) TxQueueItem(com.hazelcast.collection.impl.txnqueue.TxQueueItem) TxnRollbackBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnRollbackBackupOperation) RemoveBackupOperation(com.hazelcast.collection.impl.queue.operations.RemoveBackupOperation) CompareAndRemoveBackupOperation(com.hazelcast.collection.impl.queue.operations.CompareAndRemoveBackupOperation) DrainBackupOperation(com.hazelcast.collection.impl.queue.operations.DrainBackupOperation) ArrayDataSerializableFactory(com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory) RemainingCapacityOperation(com.hazelcast.collection.impl.queue.operations.RemainingCapacityOperation) QueueMergeBackupOperation(com.hazelcast.collection.impl.queue.operations.QueueMergeBackupOperation) TxnPollOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPollOperation)

Example 2 with SizeOperation

use of com.hazelcast.collection.impl.queue.operations.SizeOperation in project hazelcast by hazelcast.

the class TransactionalQueueProxySupport method size.

@Override
public int size() {
    checkTransactionState();
    SizeOperation operation = new SizeOperation(name);
    try {
        Future<Integer> future = invoke(operation);
        Integer size = future.get();
        return size + offeredQueue.size();
    } catch (Throwable t) {
        throw ExceptionUtil.rethrow(t);
    }
}
Also used : SizeOperation(com.hazelcast.collection.impl.queue.operations.SizeOperation)

Aggregations

SizeOperation (com.hazelcast.collection.impl.queue.operations.SizeOperation)2 AddAllBackupOperation (com.hazelcast.collection.impl.queue.operations.AddAllBackupOperation)1 AddAllOperation (com.hazelcast.collection.impl.queue.operations.AddAllOperation)1 CheckAndEvictOperation (com.hazelcast.collection.impl.queue.operations.CheckAndEvictOperation)1 ClearBackupOperation (com.hazelcast.collection.impl.queue.operations.ClearBackupOperation)1 ClearOperation (com.hazelcast.collection.impl.queue.operations.ClearOperation)1 CompareAndRemoveBackupOperation (com.hazelcast.collection.impl.queue.operations.CompareAndRemoveBackupOperation)1 CompareAndRemoveOperation (com.hazelcast.collection.impl.queue.operations.CompareAndRemoveOperation)1 ContainsOperation (com.hazelcast.collection.impl.queue.operations.ContainsOperation)1 DrainBackupOperation (com.hazelcast.collection.impl.queue.operations.DrainBackupOperation)1 DrainOperation (com.hazelcast.collection.impl.queue.operations.DrainOperation)1 IsEmptyOperation (com.hazelcast.collection.impl.queue.operations.IsEmptyOperation)1 IteratorOperation (com.hazelcast.collection.impl.queue.operations.IteratorOperation)1 OfferBackupOperation (com.hazelcast.collection.impl.queue.operations.OfferBackupOperation)1 OfferOperation (com.hazelcast.collection.impl.queue.operations.OfferOperation)1 PeekOperation (com.hazelcast.collection.impl.queue.operations.PeekOperation)1 PollBackupOperation (com.hazelcast.collection.impl.queue.operations.PollBackupOperation)1 PollOperation (com.hazelcast.collection.impl.queue.operations.PollOperation)1 QueueMergeBackupOperation (com.hazelcast.collection.impl.queue.operations.QueueMergeBackupOperation)1 QueueMergeOperation (com.hazelcast.collection.impl.queue.operations.QueueMergeOperation)1