Package com.hazelcast.transaction

Examples of com.hazelcast.transaction.TransactionException


    void prepareTxBackupLog(List<TransactionLog> txLogs, String callerUuid, String txnId,
                            long timeoutMillis, long startTime) {
        TxBackupLog beginLog = txBackupLogs.get(txnId);
        if (beginLog == null) {
            throw new TransactionException("Could not find begin tx log!");
        }
        if (beginLog.state != State.ACTIVE) {
            throw new TransactionException("TxLog already exists!");
        }
        TxBackupLog newTxBackupLog
                = new TxBackupLog(txLogs, callerUuid, State.COMMITTING, timeoutMillis, startTime, beginLog.xid);
        if (!txBackupLogs.replace(txnId, beginLog, newTxBackupLog)) {
            throw new TransactionException("TxLog already exists!");
        }
    }
View Full Code Here


    //TX Methods

    public boolean txnEnsureReserve(long itemId) {
        if (txMap.get(itemId) == null) {
            throw new TransactionException("No reserve for itemId: " + itemId);
        }
        return true;
    }
View Full Code Here

    }

    public boolean txnCommitOffer(long itemId, Data data, boolean backup) {
        QueueItem item = txMap.remove(itemId);
        if (item == null && !backup) {
            throw new TransactionException("No reserve :" + itemId);
        } else if (item == null) {
            item = new QueueItem(this, itemId, data);
        }
        item.setData(data);
        if (!backup) {
View Full Code Here

    }

    @Override
    public void run() throws Exception {
        if (!recordStore.txnLock(getKey(), lockOwner, lockThreadId, LOCK_TTL_MILLIS)) {
            throw new TransactionException("Lock is not owned by the transaction! Caller: " + lockOwner
                    + ", Owner: " + recordStore.getLockOwnerInfo(getKey()));
        }
    }
View Full Code Here

        try {
            Future<Long> f = invoke(operation);
            Long itemId = f.get();
            if (itemId != null) {
                if (!itemIdSet.add(itemId)) {
                    throw new TransactionException("Duplicate itemId: " + itemId);
                }
                offeredQueue.offer(new QueueItem(null, itemId, data));
                TxnOfferOperation txnOfferOperation = new TxnOfferOperation(name, itemId, data);
                QueueTransactionLog transactionLog = new QueueTransactionLog(
                        tx.getTxnId(), itemId, name, partitionId, txnOfferOperation);
View Full Code Here

                    itemIdSet.remove(reservedOffer.getItemId());
                    return reservedOffer.getData();
                }
                //
                if (!itemIdSet.add(item.getItemId())) {
                    throw new TransactionException("Duplicate itemId: " + item.getItemId());
                }
                TxnPollOperation op = new TxnPollOperation(name, item.getItemId());
                QueueTransactionLog transactionLog
                        = new QueueTransactionLog(tx.getTxnId(), item.getItemId(), name, partitionId, op);
                tx.addTransactionLog(transactionLog);
View Full Code Here

    }

    @Override
    public void run() throws Exception {
        if (!recordStore.txnLock(getKey(), ownerUuid, getThreadId(), ttl)) {
            throw new TransactionException("Transaction couldn't obtain lock.");
        }
        Record record = recordStore.getRecord(dataKey);
        Data value = record == null ? null : mapService.getMapServiceContext().toData(record.getValue());
        response = new VersionedValue(value, record == null ? 0 : record.getVersion());
    }
View Full Code Here

    }

    @Override
    public void run() throws Exception {
        if (recordStore.isLocked(getKey()) && !recordStore.unlock(getKey(), ownerUuid, getThreadId())) {
            throw new TransactionException("Lock is not owned by the transaction! Owner: "
                    + recordStore.getLockOwnerInfo(getKey()));
        }
    }
View Full Code Here

    }

    @Override
    public void run() throws Exception {
        if (recordStore.isLocked(getKey()) && !recordStore.unlock(getKey(), lockOwner, lockThreadId)) {
            throw new TransactionException("Lock is not owned by the transaction! Owner: "
                    + recordStore.getLockOwnerInfo(getKey()));
        }
    }
View Full Code Here

            int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
            Future<VersionedValue> f = nodeEngine.getOperationService()
                    .invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
            versionedValue = f.get();
            if (versionedValue == null) {
                throw new TransactionException("Transaction couldn't obtain lock for the key:"
                        + getService().getMapServiceContext().toObject(key));
            }
            valueMap.put(key, versionedValue);
            return versionedValue;
        } catch (Throwable t) {
View Full Code Here

TOP

Related Classes of com.hazelcast.transaction.TransactionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.