Search in sources :

Example 1 with RemoteCommitResponse

use of org.apache.geode.internal.cache.TXRemoteCommitMessage.RemoteCommitResponse in project geode by apache.

the class PeerTXStateStub method afterCompletion.

@Override
public void afterCompletion(int status) {
    RemoteCommitResponse response = JtaAfterCompletionMessage.send(this.proxy.getCache(), this.proxy.getTxId().getUniqId(), getOriginatingMember(), status, this.target);
    try {
        this.proxy.getTxMgr().setTXState(null);
        this.commitMessage = response.waitForResponse();
        if (logger.isDebugEnabled()) {
            logger.debug("afterCompletion received commit response of {}", this.commitMessage);
        }
    } catch (Exception e) {
        throw new TransactionException(e);
    // TODO throw a better exception
    } finally {
        cleanup();
    }
}
Also used : RemoteCommitResponse(org.apache.geode.internal.cache.TXRemoteCommitMessage.RemoteCommitResponse) TransactionException(org.apache.geode.cache.TransactionException) ReliableReplyException(org.apache.geode.distributed.internal.ReliableReplyException) TransactionDataRebalancedException(org.apache.geode.cache.TransactionDataRebalancedException) TransactionException(org.apache.geode.cache.TransactionException) CommitConflictException(org.apache.geode.cache.CommitConflictException) ReplyException(org.apache.geode.distributed.internal.ReplyException) TransactionInDoubtException(org.apache.geode.cache.TransactionInDoubtException) CancelException(org.apache.geode.CancelException)

Example 2 with RemoteCommitResponse

use of org.apache.geode.internal.cache.TXRemoteCommitMessage.RemoteCommitResponse in project geode by apache.

the class JtaAfterCompletionMessage method send.

public static RemoteCommitResponse send(Cache cache, int txId, InternalDistributedMember onBehalfOfClientMember, int status, DistributedMember recipient) {
    final InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
    final Set recipients = Collections.singleton(recipient);
    RemoteCommitResponse response = new RemoteCommitResponse(system, recipients);
    JtaAfterCompletionMessage msg = new JtaAfterCompletionMessage(status, txId, onBehalfOfClientMember, response);
    msg.setRecipients(recipients);
    // bug #43087 - hang sending JTA synchronizations from delegate server
    if (system.threadOwnsResources()) {
        msg.processorType = DistributionManager.SERIAL_EXECUTOR;
    } else {
        msg.processorType = DistributionManager.HIGH_PRIORITY_EXECUTOR;
    }
    system.getDistributionManager().putOutgoing(msg);
    return response;
}
Also used : RemoteCommitResponse(org.apache.geode.internal.cache.TXRemoteCommitMessage.RemoteCommitResponse) Set(java.util.Set) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem)

Aggregations

RemoteCommitResponse (org.apache.geode.internal.cache.TXRemoteCommitMessage.RemoteCommitResponse)2 Set (java.util.Set)1 CancelException (org.apache.geode.CancelException)1 CommitConflictException (org.apache.geode.cache.CommitConflictException)1 TransactionDataRebalancedException (org.apache.geode.cache.TransactionDataRebalancedException)1 TransactionException (org.apache.geode.cache.TransactionException)1 TransactionInDoubtException (org.apache.geode.cache.TransactionInDoubtException)1 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 ReliableReplyException (org.apache.geode.distributed.internal.ReliableReplyException)1 ReplyException (org.apache.geode.distributed.internal.ReplyException)1