/** * Creates an instance of this class for cloning using the {@link ServerTransaction#createCopy()} * method. */ protected ServerTransaction createInstance() { return new ServerTransaction(); }
public static ServerTransaction create(TransactionManager mgr, long id, long lease) throws RemoteException { ServerTransaction txn = new ServerTransaction(mgr, id, lease); txn.initEmbedded(); return txn; }
str = new ServerTransaction(mgr, id, lease);
/** * 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 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; }