@Override public void abort(long waitFor) throws UnknownTransactionException, CannotAbortException, TimeoutExpiredException, RemoteException { mgr.abort(id, waitFor); }
@Override public void commit() throws UnknownTransactionException, CannotCommitException, RemoteException { try { mgr.commit(id, DEFAULT_COMMIT_ABORT_TIMEOUT); } catch (TimeoutExpiredException e) { // TOLOG LB: } }
/** * 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); }
public void join(TransactionParticipant part, long crashCount, int partitionId, String clusterName) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException { if (crashCount == EMBEDDED_CRASH_COUNT) throw new UnsupportedOperationException(" not supported for embedded join"); mgr.join(id, part, crashCount, partitionId, clusterName); }
/** * returns true if this the txn participants need to join it in contrary to a xtn which the * participants are known prior to txn propagation * * @return true if its a the xtn mgr requires the txn participants to join */ @Override public boolean needParticipantsJoin() throws RemoteException { return mgr.needParticipantsJoin(); }
public int prepare(Xid xid) throws XAException { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "XAResourceImpl:prepare(), the Xid is: " + xid + " rmid=" + _rmid + " thread=" + Thread.currentThread().getId()); } xid = createGSXid(xid); if (_activeEmptyTransactions.remove(xid) != null) { // if empty than read_only return XA_RDONLY; } try { int result = m_txnManger.prepare(xid); switch (result) { // Try to prepare case TransactionParticipant.PREPARED: return XA_OK; case TransactionParticipant.NOTCHANGED: return XA_RDONLY; default: // Abort throw new XAException(XAException.XA_RBROLLBACK); } } catch (UnknownTransactionException e) { _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , UnknownTransactionException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBROLLBACK, e); } catch (CannotCommitException e) { _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , CannotCommitException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBROLLBACK, e); } catch (RemoteException e) { _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , remoteException rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace()); throw createsXAException(XAException.XA_RBCOMMFAIL, e); } }
/** * Creates new transaction for XA transactions. * * @param xid XA TX id * @param setAsDefault set as default TX for the space */ public static Transaction.Created create(ExtendedTransactionManager mgr, Xid xid, long leaseTime, boolean setAsDefault, ISpaceProxy proxy, XAResourceImpl resource, boolean delegatedXa) throws LeaseDeniedException, RemoteException { TransactionManager.Created rawTxn = mgr.create(xid, leaseTime); GSServerTransaction transaction = GSServerTransaction.create(mgr, xid, leaseTime); Transaction.Created txCreated = new Transaction.Created(transaction, rawTxn.lease); if (setAsDefault) { proxy.replaceContextTransaction(txCreated, resource, delegatedXa); } return txCreated; } }
public static void afterExecute(SpaceOperationRequest<?> spaceRequest, IRemoteSpace targetSpace, int partitionId, boolean isRejected) { // afterOperationExecution is called first on the request for keeping the execution order // (beforeOperationExecution is called last on the request) spaceRequest.afterOperationExecution(partitionId); // disjoin transaction on failure or operation didn't lock any entries in space (transaction) if (spaceRequest.getTransaction() != null && (isRejected || !spaceRequest.hasLockedResources())) { final ServerTransaction transaction = (ServerTransaction) spaceRequest.getTransaction(); if (transaction.isEmbeddedMgrInProxy()) { try { // TODO: Log joined transaction. //if (_logger.isLoggable(Level.FINEST)) // _logger.log(Level.FINEST, "Detaching transaction [" + proxy.toLogMessage(request) + "]"); transaction.mgr.disJoin(transaction.id, targetSpace); } catch (Exception e) { // Ignore.. } } } }
public void join(TransactionParticipant part, long crashCount, int partitionId, String clusterName) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException { if (crashCount == EMBEDDED_CRASH_COUNT) throw new UnsupportedOperationException(" not supported for embedded join"); mgr.join(_id, part, crashCount, partitionId, clusterName); }
protected void initEmbedded() throws RemoteException { if (mgr.needParticipantsJoin()) { //check for embedded manager if (((TxnMgrProxy) mgr).isEmbeddedMgr()) { setEmbeddedMgrInProxy(true); setEmbeddedMgrProxySideInstance(true); } } else//local mng { setEmbeddedMgrInProxy(true); setEmbeddedMgrProxySideInstance(true); } }
/** * 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 { if (crashCount == EMBEDDED_CRASH_COUNT) // used only in embedded mahalo- pass the user ServerTrasaction- allows // * updaing the lease interval in it mgr.join(id, part, crashCount, this); else mgr.join(id, part, crashCount); }
@Override public void abort() throws UnknownTransactionException, CannotAbortException, RemoteException { try { mgr.abort(id, DEFAULT_COMMIT_ABORT_TIMEOUT); } catch (TimeoutExpiredException e) { // TOLOG LB: } }
@Override public void commit(long waitFor) throws UnknownTransactionException, CannotCommitException, TimeoutExpiredException, RemoteException { mgr.commit(id, waitFor); }
@Override public int getState() throws UnknownTransactionException, RemoteException { if (isXid()) return mgr.getState(_id); return super.getState(); }
protected void join(TransactionParticipant part, long crashCount, int partitionId, String clusterName, Object proxy) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException { if (crashCount == EMBEDDED_CRASH_COUNT) // used only in embedded mahalo- pass the user ServerTrasaction- allows // * updaing the lease interval in it mgr.join(id, part, crashCount, this, partitionId, clusterName, proxy); else throw new UnsupportedOperationException(" supported only for embedded join"); }
@Override public void abort(long l) throws UnknownTransactionException, CannotAbortException, TimeoutExpiredException, RemoteException { if (isXid()) mgr.abort(_id, l); else super.abort(l); }
@Override public void commit() throws UnknownTransactionException, CannotCommitException, RemoteException { if (isXid()) mgr.commit(_id); else super.commit(); }
@Override protected void join(TransactionParticipant part, long crashCount, int partitionId, String clusterName, Object proxy) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException { if (crashCount == EMBEDDED_CRASH_COUNT) // used only in embedded mahalo- pass the user ServerTrasaction- allows // * updaing the lease interval in it mgr.join(_id, part, crashCount, this, partitionId, clusterName, proxy); else throw new UnsupportedOperationException(" supported only for embedded join"); }
@Override public void abort() throws UnknownTransactionException, CannotAbortException, RemoteException { if (isXid()) mgr.abort(_id); else super.abort(); }