Search in sources :

Example 1 with CheckAndEvictOperation

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

the class QueueDataSerializerHook method createFactory.

public DataSerializableFactory createFactory() {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[TXN_COMMIT_BACKUP + 1];
    constructors[OFFER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new OfferOperation();
        }
    };
    constructors[OFFER_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new OfferBackupOperation();
        }
    };
    constructors[POLL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new PollOperation();
        }
    };
    constructors[POLL_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new PollBackupOperation();
        }
    };
    constructors[PEEK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new PeekOperation();
        }
    };
    constructors[ADD_ALL_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new AddAllBackupOperation();
        }
    };
    constructors[ADD_ALL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new AddAllOperation();
        }
    };
    constructors[CLEAR_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ClearBackupOperation();
        }
    };
    constructors[CLEAR] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ClearOperation();
        }
    };
    constructors[COMPARE_AND_REMOVE_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CompareAndRemoveBackupOperation();
        }
    };
    constructors[COMPARE_AND_REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CompareAndRemoveOperation();
        }
    };
    constructors[CONTAINS] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ContainsOperation();
        }
    };
    constructors[DRAIN_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new DrainBackupOperation();
        }
    };
    constructors[DRAIN] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new DrainOperation();
        }
    };
    constructors[ITERATOR] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new IteratorOperation();
        }
    };
    constructors[QUEUE_EVENT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new QueueEvent();
        }
    };
    constructors[QUEUE_EVENT_FILTER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new QueueEventFilter();
        }
    };
    constructors[QUEUE_ITEM] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new QueueItem();
        }
    };
    constructors[QUEUE_REPLICATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new QueueReplicationOperation();
        }
    };
    constructors[REMOVE_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RemoveBackupOperation();
        }
    };
    constructors[REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RemoveOperation();
        }
    };
    constructors[SIZE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SizeOperation();
        }
    };
    constructors[TXN_OFFER_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnOfferBackupOperation();
        }
    };
    constructors[TXN_OFFER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnOfferOperation();
        }
    };
    constructors[TXN_POLL_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnPollBackupOperation();
        }
    };
    constructors[TXN_POLL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnPollOperation();
        }
    };
    constructors[TXN_PREPARE_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnPrepareBackupOperation();
        }
    };
    constructors[TXN_PREPARE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnPrepareOperation();
        }
    };
    constructors[TXN_RESERVE_OFFER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnReserveOfferOperation();
        }
    };
    constructors[TXN_RESERVE_OFFER_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnReserveOfferBackupOperation();
        }
    };
    constructors[TXN_RESERVE_POLL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnReservePollOperation();
        }
    };
    constructors[TXN_RESERVE_POLL_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnReservePollBackupOperation();
        }
    };
    constructors[TXN_ROLLBACK_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnRollbackBackupOperation();
        }
    };
    constructors[TXN_ROLLBACK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnRollbackOperation();
        }
    };
    constructors[CHECK_EVICT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CheckAndEvictOperation();
        }
    };
    constructors[QUEUE_CONTAINER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new QueueContainer(null);
        }
    };
    constructors[TRANSACTION_ROLLBACK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new QueueTransactionRollbackOperation();
        }
    };
    constructors[TX_QUEUE_ITEM] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxQueueItem();
        }
    };
    constructors[TXN_PEEK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnPeekOperation();
        }
    };
    constructors[IS_EMPTY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new IsEmptyOperation();
        }
    };
    constructors[REMAINING_CAPACITY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new RemainingCapacityOperation();
        }
    };
    constructors[TXN_COMMIT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnCommitOperation();
        }
    };
    constructors[TXN_COMMIT_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxnCommitBackupOperation();
        }
    };
    return new ArrayDataSerializableFactory(constructors);
}
Also used : TxnPollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPollBackupOperation) TxnReservePollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReservePollBackupOperation) PollBackupOperation(com.hazelcast.collection.impl.queue.operations.PollBackupOperation) ClearBackupOperation(com.hazelcast.collection.impl.queue.operations.ClearBackupOperation) 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) TxnCommitOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnCommitOperation) 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) IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) TxnRollbackOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnRollbackOperation) ContainsOperation(com.hazelcast.collection.impl.queue.operations.ContainsOperation) TxnPeekOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPeekOperation) CompareAndRemoveOperation(com.hazelcast.collection.impl.queue.operations.CompareAndRemoveOperation) RemoveOperation(com.hazelcast.collection.impl.queue.operations.RemoveOperation) CompareAndRemoveOperation(com.hazelcast.collection.impl.queue.operations.CompareAndRemoveOperation) TxnPeekOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPeekOperation) PeekOperation(com.hazelcast.collection.impl.queue.operations.PeekOperation) 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) RemainingCapacityOperation(com.hazelcast.collection.impl.queue.operations.RemainingCapacityOperation) TxnPollOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPollOperation) 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) QueueReplicationOperation(com.hazelcast.collection.impl.queue.operations.QueueReplicationOperation) TxnPrepareBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPrepareBackupOperation) AddAllBackupOperation(com.hazelcast.collection.impl.queue.operations.AddAllBackupOperation) IsEmptyOperation(com.hazelcast.collection.impl.queue.operations.IsEmptyOperation) TxnPollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnPollBackupOperation) TxnReserveOfferBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReserveOfferBackupOperation) TxnReservePollBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnReservePollBackupOperation) 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) TxnOfferBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnOfferBackupOperation) ClearOperation(com.hazelcast.collection.impl.queue.operations.ClearOperation) ConstructorFunction(com.hazelcast.util.ConstructorFunction) QueueTransactionRollbackOperation(com.hazelcast.collection.impl.txnqueue.operations.QueueTransactionRollbackOperation) TxnCommitBackupOperation(com.hazelcast.collection.impl.txnqueue.operations.TxnCommitBackupOperation) DrainBackupOperation(com.hazelcast.collection.impl.queue.operations.DrainBackupOperation) ArrayDataSerializableFactory(com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory)

Example 2 with CheckAndEvictOperation

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

the class QueueEvictionProcessor method process.

@Override
public void process(EntryTaskScheduler<String, Void> scheduler, Collection<ScheduledEntry<String, Void>> entries) {
    if (entries.isEmpty()) {
        return;
    }
    IPartitionService partitionService = nodeEngine.getPartitionService();
    OperationService operationService = nodeEngine.getOperationService();
    for (ScheduledEntry<String, Void> entry : entries) {
        String name = entry.getKey();
        int partitionId = partitionService.getPartitionId(nodeEngine.toData(name));
        Operation op = new CheckAndEvictOperation(entry.getKey()).setPartitionId(partitionId);
        operationService.invokeOnPartition(op).join();
    }
}
Also used : CheckAndEvictOperation(com.hazelcast.collection.impl.queue.operations.CheckAndEvictOperation) IPartitionService(com.hazelcast.spi.partition.IPartitionService) OperationService(com.hazelcast.spi.OperationService) Operation(com.hazelcast.spi.Operation) CheckAndEvictOperation(com.hazelcast.collection.impl.queue.operations.CheckAndEvictOperation)

Aggregations

CheckAndEvictOperation (com.hazelcast.collection.impl.queue.operations.CheckAndEvictOperation)2 AddAllBackupOperation (com.hazelcast.collection.impl.queue.operations.AddAllBackupOperation)1 AddAllOperation (com.hazelcast.collection.impl.queue.operations.AddAllOperation)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 QueueReplicationOperation (com.hazelcast.collection.impl.queue.operations.QueueReplicationOperation)1 RemainingCapacityOperation (com.hazelcast.collection.impl.queue.operations.RemainingCapacityOperation)1 RemoveBackupOperation (com.hazelcast.collection.impl.queue.operations.RemoveBackupOperation)1