public void abort() throws UnknownTransactionException, CannotAbortException, RemoteException { mgr.abort(id); }
public void commit() throws UnknownTransactionException, CannotCommitException, RemoteException { mgr.commit(id); }
/** * Returns the current state of the transaction. The returned * state can be any of the <code>TransactionConstants</code> values. * * @return an <code>int</code> representing the state of the transaction * * @throws UnknownTransactionException if the transaction * is unknown to the transaction manager, either * because the transaction ID is incorrect or because the * transaction is complete and its state has been * discarded by the manager. * @throws RemoteException if there is a communication error * * @see TransactionConstants */ public int getState() throws UnknownTransactionException, RemoteException { return mgr.getState(id); }
/** * Create a new top-level transaction. If the specified transaction manager supports nested * transactions, then the returned transaction can be cast to a <code>NestableTransaction</code>. * * @param mgr the transaction manager to use for this transaction * @param leaseTime the requested lease time for the transaction * @return the created transaction and the lease granted * @throws LeaseDeniedException if this manager is unwilling to grant the requested lease time * @throws RemoteException if a communication error occurs. */ public static Transaction.Created create(TransactionManager mgr, long leaseTime) throws LeaseDeniedException, RemoteException { TransactionManager.Created rawTxn = mgr.create(leaseTime); Transaction transaction; if (mgr instanceof NestableTransactionManager) transaction = new NestableServerTransaction((NestableTransactionManager) mgr, rawTxn.id, null, leaseTime); else transaction = ServerTransaction.create(mgr, rawTxn.id, leaseTime); return new Transaction.Created(transaction, rawTxn.lease); }
/** * Join the transaction. The <code>crashCount</code> marks the state of * the storage used by the participant for transactions. If the * participant attempts to join a transaction more than once, the crash * counts must be the same. Each system crash or other event that * destroys the state of the participant's unprepared transaction storage * must cause the crash count to increase by at least one. * * @param part the participant joining the transaction * @param crashCount the participant's current crash count * * @throws UnknownTransactionException if the transaction * is unknown to the transaction manager, either * because the transaction ID is incorrect or because the * transaction is complete and its state has been * discarded by the manager. * @throws CannotJoinException if the transaction is known * to the manager but is no longer active. * @throws CrashCountException if the crash count provided * for the participant differs from the crash count * in a previous invocation of the same pairing of * participant and transaction * @throws RemoteException if there is a communication error */ public void join(TransactionParticipant part, long crashCount) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException { mgr.join(id, part, crashCount); }
public ServerTransaction createServerTransaction(TransactionManager mgr, Object id, int numOfParticipants) { try { if (id instanceof Long) { long txId = ((Long) id).longValue(); TransactionParticipantDataImpl serverTransactionMetaData = new TransactionParticipantDataImpl(new DefaultTransactionUniqueId(mgr.getTransactionManagerId(), txId), _engine.getPartitionIdOneBased(), numOfParticipants); return new ServerTransaction(mgr, txId, serverTransactionMetaData); } else { TransactionParticipantDataImpl serverTransactionMetaData = new TransactionParticipantDataImpl(new XATransactionUniqueId(mgr.getTransactionManagerId(), id), _engine.getPartitionIdOneBased(), numOfParticipants); return new GSServerTransaction(mgr, id, serverTransactionMetaData); } } catch (RemoteException e) { // mgr.getTransactionManagerId should never throw this exception since // there isn't a remote call involved. } return null; }
/** * Create a new top-level transaction. If the specified transaction * manager supports nested transactions, then the returned transaction * can be cast to a <code>NestableTransaction</code>. * * @param mgr the transaction manager to use for this transaction * @param leaseTime the requested lease time for the transaction * @return the created transaction and the lease granted * * @throws LeaseDeniedException if this manager is unwilling to * grant the requested lease time * @throws RemoteException if a communication error occurs. */ public static Transaction.Created create(TransactionManager mgr, long leaseTime) throws LeaseDeniedException, RemoteException { TransactionManager.Created rawTxn = mgr.create(leaseTime); Transaction transaction; if (mgr instanceof NestableTransactionManager) transaction = new NestableServerTransaction( (NestableTransactionManager)mgr, rawTxn.id, null); else transaction = new ServerTransaction(mgr, rawTxn.id); return new Transaction.Created(transaction, rawTxn.lease); }
public void abort(long waitFor) throws UnknownTransactionException, CannotAbortException, TimeoutExpiredException, RemoteException { mgr.abort(id, waitFor); }
public void commit(long waitFor) throws UnknownTransactionException, CannotCommitException, TimeoutExpiredException, RemoteException { mgr.commit(id, waitFor); }