private void serialize(ObjectOutput out) throws IOException { boolean lightMgr = _embeddedMgrProxySideInstance && needParticipantsJoin() && mgr instanceof TxnMgrProxy; if (lightMgr) { TxnMgrProxy cur = (TxnMgrProxy) mgr; out.writeObject(cur.createLightProxy()); } else out.writeObject(mgr); out.writeLong(id); out.writeLong(lease); //note: written _embeddedMgrProxySideInstance will be read into _embeddedMgr out.writeBoolean(_embeddedMgrProxySideInstance); }
@Deprecated public void joinIfNeededAndEmbedded(TransactionParticipant participant) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException { if (isEmbeddedMgrProxySideInstance() && needParticipantsJoin()) join(participant, ServerTransaction.EMBEDDED_CRASH_COUNT /* crashcount */); }
public boolean joinIfNeededAndEmbedded(TransactionParticipant participant, int partitionId, String clusterName, Object proxy) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException { if (isEmbeddedMgrProxySideInstance() && needParticipantsJoin()) { if (partitionId < 0) join(participant, ServerTransaction.EMBEDDED_CRASH_COUNT /* crashcount */); else join(participant, ServerTransaction.EMBEDDED_CRASH_COUNT /* crashcount */, partitionId, clusterName, proxy); return true; } return false; }
@Override public boolean beforeOperationExecution(boolean isEmbedded) { if (!super.beforeOperationExecution(isEmbedded)) return false; // Optimization: the following code is intended for remote execution only. if (isEmbedded) return true; if (_txn != null) { final ServerTransaction transaction = (ServerTransaction) _txn; try { // Required on embedded transaction manager so the transaction won't be joined in the server if (transaction.isEmbeddedMgrProxySideInstance() && transaction.needParticipantsJoin()) { _txn = transaction.createCopy(); ((ServerTransaction) _txn).setEmbeddedMgrProxySideInstance(false); } } catch (RemoteException e) { setRemoteOperationExecutionError(new IllegalStateException("Caught remote exception on embedded transaction manager", e)); return false; } } return true; }