JBoss Remoting SVN: r4818 - remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-15 13:15:27 -0500 (Thu, 15 Jan 2009)
New Revision: 4818
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java
Log:
imports
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java 2009-01-15 18:15:04 UTC (rev 4817)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java 2009-01-15 18:15:27 UTC (rev 4818)
@@ -26,12 +26,9 @@
import org.jboss.remoting.spi.AbstractAutoCloseable;
import org.jboss.remoting.spi.RemoteRequestContext;
import org.jboss.remoting.spi.ReplyHandler;
-import org.jboss.remoting.spi.SpiUtils;
import org.jboss.remoting.txn.spi.TxnRequest;
-import org.jboss.remoting.RemoteRequestException;
import org.jboss.xnio.log.Logger;
import java.util.concurrent.Executor;
-import java.io.IOException;
/**
* A request handler which invokes a {@code TxnRequest} visitor to demultiplex a transaction control message.
15 years, 10 months
JBoss Remoting SVN: r4817 - remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-15 13:15:04 -0500 (Thu, 15 Jan 2009)
New Revision: 4817
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java
Log:
Treat unwrapped requests properly
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java 2009-01-15 18:07:06 UTC (rev 4816)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java 2009-01-15 18:15:04 UTC (rev 4817)
@@ -61,12 +61,7 @@
final TxnRequest txnRequest = (TxnRequest) request;
return txnRequest.accept(visitor, replyHandler);
} else {
- try {
- replyHandler.handleException(new RemoteRequestException("Incorrect request type"));
- } catch (IOException e) {
- log.warn(e, "Failed to send RemoteRequestException");
- }
- return SpiUtils.getBlankRemoteRequestContext();
+ return visitor.visit(new TxnRequest.Wrapped(request), replyHandler);
}
}
}
15 years, 10 months
JBoss Remoting SVN: r4816 - in remoting-txn/trunk/src/main/java/org/jboss/remoting/txn: impl and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-15 13:07:06 -0500 (Thu, 15 Jan 2009)
New Revision: 4816
Added:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/ForwardingTxnRequestVisitor.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnRequest.java
Removed:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java
Log:
The receiving end of transactional requests
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java 2009-01-15 03:50:40 UTC (rev 4815)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -1,290 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- * A reply to a request for a transaction operation on a transactional client.
- */
-public interface TxnReply {
-
- /**
- * Accept a visitor.
- *
- * @param visitor the visitor
- * @param param a parameter to pass to the visitor method
- * @param <I> the type of the visitor parameter
- * @param <O> the return type of the visitor
- * @return the value returned by the visitor
- */
- <I, O> O accept(Visitor<I, O> visitor, I param);
-
- /**
- * A visitor for {@code TxnReply} types.
- *
- * @param <I> the type of the visitor parameter
- * @param <O> the return type of the visitor
- */
- interface Visitor<I, O> {
-
- /**
- * Handle a {@code ResourceManagerId} instance.
- *
- * @param reply the reply
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(ResourceManagerId reply, I param);
-
- /**
- * Handle a {@code Timeout} instance.
- *
- * @param reply the reply
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(Timeout reply, I param);
-
- /**
- * Handle a {@code Prepared} instance.
- *
- * @param reply the reply
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(Prepared reply, I param);
-
- /**
- * Handle a {@code Recover} instance.
- *
- * @param reply the reply
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(Recover reply, I param);
-
- /**
- * Handle a {@code TimeoutSet} instance.
- *
- * @param reply the reply
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(TimeoutSet reply, I param);
-
- /**
- * Handle a {@code Success} instance.
- *
- * @param reply the reply
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(Success reply, I param);
- }
-
- /**
- * A reply to a request to get the resource manager ID.
- *
- * @see javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
- */
- final class ResourceManagerId implements TxnReply {
- private final Object id;
-
- /**
- * Construct a new instance.
- *
- * @param id the resource manager ID
- */
- public ResourceManagerId(final Object id) {
- this.id = id;
- }
-
- /**
- * Get the resource manager ID.
- *
- * @return the resource manager ID
- */
- public Object getId() {
- return id;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A reply to a request to get the currently configured transaction timeout.
- *
- * @see javax.transaction.xa.XAResource#getTransactionTimeout()
- */
- final class Timeout implements TxnReply {
-
- private final int timeout;
-
- /**
- * Construct a new instance.
- *
- * @param timeout the timeout
- */
- public Timeout(final int timeout) {
- this.timeout = timeout;
- }
-
- /**
- * Get the timeout.
- *
- * @return the timeout
- */
- public int getTimeout() {
- return timeout;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A reply to a request to prepare a distributed transaction.
- *
- * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
- */
- final class Prepared implements TxnReply {
- private final int vote;
-
- /**
- * Construct a new instance.
- *
- * @param vote the vote
- */
- public Prepared(final int vote) {
- this.vote = vote;
- }
-
- /**
- * Get the vote.
- *
- * @return the vote
- */
- public int getVote() {
- return vote;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A reply to a request to get transaction IDs to recover.
- *
- * @see javax.transaction.xa.XAResource#recover(int)
- */
- final class Recover implements TxnReply {
-
- private final Xid[] resources;
-
- /**
- * Construct a new instance.
- *
- * @param resources the resources to recover
- */
- public Recover(final Xid[] resources) {
- this.resources = resources;
- }
-
- /**
- * Get the resources to recover.
- *
- * @return the resources to recover
- */
- public Xid[] getResources() {
- return resources;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A reply to a request to set the transaction timeout.
- *
- * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
- */
- final class TimeoutSet implements TxnReply {
-
- private final boolean success;
- /**
- * The timeout was set successfully.
- */
- public static final TimeoutSet SUCCESS = new TimeoutSet(true);
- /**
- * The timeout could not be set.
- */
- public static final TimeoutSet FAILED = new TimeoutSet(false);
-
- private TimeoutSet(final boolean success) {
- this.success = success;
- }
-
- /**
- * Get whether the timeout was set successfully.
- *
- * @return {@code true} if the timeout was set successfully.
- */
- public boolean getSuccess() {
- return success;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A general successful reply.
- */
- final class Success implements TxnReply {
-
- /**
- * Get the single instance.
- */
- public static final Success INSTANCE = new Success();
-
- private Success() {
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java 2009-01-15 03:50:40 UTC (rev 4815)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -1,611 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- * A request for a transaction operation on a transactional client.
- */
-public interface TxnRequest {
-
- /**
- * Accept a visitor.
- *
- * @param visitor the visitor
- * @param param a parameter to pass to the visitor method
- * @param <I> the type of the visitor parameter
- * @param <O> the return type of the visitor
- * @return the value returned by the visitor
- */
- <I, O> O accept(Visitor<I, O> visitor, I param);
-
- /**
- * A visitor for {@code TxnRequest} types.
- *
- * @param <I> the type of the visitor parameter
- * @param <O> the return type of the visitor
- */
- interface Visitor<I, O> {
-
- /**
- * Handle a {@code CommitXA} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(CommitXA request, I param);
-
- /**
- * Handle a {@code EndXA} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(EndXA request, I param);
-
- /**
- * Handle a {@code ForgetXA} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(ForgetXA request, I param);
-
- /**
- * Handle a {@code GetTimeout} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(GetTimeout request, I param);
-
- /**
- * Handle a {@code PrepareXA} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(PrepareXA request, I param);
-
- /**
- * Handle a {@code Recover} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(Recover request, I param);
-
- /**
- * Handle a {@code RollbackXA} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(RollbackXA request, I param);
-
- /**
- * Handle a {@code SetTimeout} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(SetTimeout request, I param);
-
- /**
- * Handle a {@code StartXA} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(StartXA request, I param);
-
- /**
- * Handle a {@code Wrapped} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(Wrapped request, I param);
-
- /**
- * Handle a {@code GetResourceManagerId} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(GetResourceManagerId request, I param);
-
- /**
- * Handle a {@code StartLocal} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(StartLocal request, I param);
-
- /**
- * Handle a {@code CommitLocal} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(CommitLocal request, I param);
-
- /**
- * Handle a {@code RollbackLocal} instance.
- *
- * @param request the request
- * @param param the visitor parameter
- * @return the visitor return value
- */
- O visit(RollbackLocal request, I param);
- }
-
- /**
- * A request to commit a local transaction.
- *
- * @see TransactionalClient#commit()
- */
- final class CommitLocal implements TxnRequest {
-
- /**
- * The single instance.
- */
- public static final CommitLocal INSTANCE = new CommitLocal();
-
- private CommitLocal() {
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to end the work performed on behalf of a distributed transaction.
- *
- * @see javax.transaction.xa.XAResource#end(javax.transaction.xa.Xid, int)
- */
- final class EndXA implements TxnRequest {
-
- private final Xid xid;
- private final int flags;
-
- /**
- * Construct a new instance.
- *
- * @param xid the transaction ID
- * @param flags the transaction flags
- */
- public EndXA(final Xid xid, final int flags) {
- this.xid = xid;
- this.flags = flags;
- }
-
- /**
- * Get the XID.
- *
- * @return the XID
- */
- public Xid getXid() {
- return xid;
- }
-
- /**
- * Get the flags.
- *
- * @return the flags
- */
- public int getFlags() {
- return flags;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to forget about a heurstically completed transaction branch.
- *
- * @see javax.transaction.xa.XAResource#forget(javax.transaction.xa.Xid)
- */
- final class ForgetXA implements TxnRequest {
-
- private final Xid xid;
-
- /**
- * Construct a new instance.
- *
- * @param xid the transaction ID
- */
- public ForgetXA(final Xid xid) {
- this.xid = xid;
- }
-
- /**
- * Get the XID.
- *
- * @return the XID
- */
- public Xid getXid() {
- return xid;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to get the resource manager ID for this resource.
- *
- * @see javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
- */
- final class GetResourceManagerId implements TxnRequest {
-
- /**
- * The single instance.
- */
- public static final GetResourceManagerId INSTANCE = new GetResourceManagerId();
-
- private GetResourceManagerId() {
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to get the transaction timeout value.
- *
- * @see javax.transaction.xa.XAResource#getTransactionTimeout()
- */
- final class GetTimeout implements TxnRequest {
-
- /**
- * The single instance.
- */
- public static final GetTimeout INSTANCE = new GetTimeout();
-
- private GetTimeout() {
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to set the transaction timeout value.
- *
- * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
- */
- final class SetTimeout implements TxnRequest {
-
- private final int timeout;
-
- /**
- * Construct a new instance.
- *
- * @param timeout the requested timeout value
- */
- public SetTimeout(final int timeout) {
- this.timeout = timeout;
- }
-
- /**
- * Get the requested timeout value.
- *
- * @return the requested timeout value
- */
- public int getTimeout() {
- return timeout;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to prepare a for distributed transaction commit of the given transaction.
- *
- * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
- */
- final class PrepareXA implements TxnRequest {
-
- private final Xid xid;
-
- /**
- * Construct a new instance.
- *
- * @param xid the transaction ID
- */
- public PrepareXA(final Xid xid) {
- this.xid = xid;
- }
-
- /**
- * Get the transaction ID.
- *
- * @return the transaction ID
- */
- public Xid getXid() {
- return xid;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to obtain a list of prepared transaction branches from the underlying resource manager.
- *
- * @see javax.transaction.xa.XAResource#recover(int)
- */
- final class Recover implements TxnRequest {
-
- private final int flag;
-
- /**
- * Construct a new instance.
- *
- * @param flag the flag(s)
- */
- public Recover(final int flag) {
- this.flag = flag;
- }
-
- /**
- * Get the flag value.
- *
- * @return the flag value
- */
- public int getFlag() {
- return flag;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to roll back a local transaction.
- *
- * @see TransactionalClient#rollback()
- */
- final class RollbackLocal implements TxnRequest {
-
- /**
- * The single instance.
- */
- public static RollbackLocal INSTANCE = new RollbackLocal();
-
- private RollbackLocal() {
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to start a local transaction.
- *
- * @see TransactionalClient#start()
- */
- final class StartLocal implements TxnRequest {
-
- /**
- * The single instance.
- */
- public static StartLocal INSTANCE = new StartLocal();
-
- private StartLocal() {
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A wrapped application request.
- */
- final class Wrapped implements TxnRequest {
-
- private final Object wrappedRequest;
-
- /**
- * Construct a new instance.
- *
- * @param request the application request
- */
- public Wrapped(final Object request) {
- wrappedRequest = request;
- }
-
- /**
- * Get the wrapped request.
- *
- * @return the wrapped request
- */
- public Object getWrappedRequest() {
- return wrappedRequest;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to commit a distributed transaction.
- *
- * @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid, boolean)
- */
- final class CommitXA implements TxnRequest {
- private final Xid xid;
- private final boolean onePhase;
-
- /**
- * Construct a new instance.
- *
- * @param xid the transaction ID
- * @param onePhase {@code true} if the commit should be done in a single phase
- */
- public CommitXA(final Xid xid, final boolean onePhase) {
- this.xid = xid;
- this.onePhase = onePhase;
- }
-
- /**
- * Get the transaction ID.
- *
- * @return the transaction ID
- */
- public Xid getXid() {
- return xid;
- }
-
- /**
- * Determine whether a one-phase commit was requested.
- *
- * @return {@code true} if a one-phase commit was requested
- */
- public boolean isOnePhase() {
- return onePhase;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to roll back a distributed transaction.
- *
- * @see javax.transaction.xa.XAResource#rollback(javax.transaction.xa.Xid)
- */
- final class RollbackXA implements TxnRequest {
-
- private final Xid xid;
-
- /**
- * Construct a new instance.
- *
- * @param xid the transaction ID
- */
- public RollbackXA(final Xid xid) {
- this.xid = xid;
- }
-
- /**
- * Get the transaction ID.
- *
- * @return the transaction ID
- */
- public Xid getXid() {
- return xid;
- }
-
- /** {@inheritDoc} */
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-
- /**
- * A request to start a distributed transaction.
- *
- * @see javax.transaction.xa.XAResource#start(javax.transaction.xa.Xid, int)
- */
- final class StartXA implements TxnRequest {
-
- private final Xid xid;
- private final int flags;
-
- /**
- * Construct a new instance.
- *
- * @param xid the transaction ID
- * @param flags the flags
- */
- public StartXA(final Xid xid, final int flags) {
- this.xid = xid;
- this.flags = flags;
- }
-
- /**
- * Get the transaction ID.
- *
- * @return the transaction ID
- */
- public Xid getXid() {
- return xid;
- }
-
- /**
- * Get the flags.
- *
- * @return the flags
- */
- public int getFlags() {
- return flags;
- }
-
- public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
- }
-}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/ForwardingTxnRequestVisitor.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/ForwardingTxnRequestVisitor.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/ForwardingTxnRequestVisitor.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.impl;
+
+import org.jboss.remoting.txn.spi.TxnRequest;
+import org.jboss.remoting.spi.ReplyHandler;
+import org.jboss.remoting.spi.RemoteRequestContext;
+import org.jboss.remoting.spi.RequestHandler;
+
+/**
+ * An abstract base class which forwards wrapped requests on to another request handler, but handles transaction
+ * control messages locally.
+ */
+public abstract class ForwardingTxnRequestVisitor implements TxnRequest.Visitor<ReplyHandler, RemoteRequestContext> {
+ private final RequestHandler requestHandler;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param handler the handler which handles wrapped requests
+ */
+ protected ForwardingTxnRequestVisitor(final RequestHandler handler) {
+ requestHandler = handler;
+ }
+
+ /** {@inheritDoc} */
+ public RemoteRequestContext visit(final TxnRequest.Wrapped request, final ReplyHandler replyHandler) {
+ return requestHandler.receiveRequest(request.getWrappedRequest(), replyHandler);
+ }
+}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 03:50:40 UTC (rev 4815)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -35,12 +35,12 @@
import org.jboss.remoting.Client;
import org.jboss.remoting.CloseHandler;
import org.jboss.remoting.RemoteExecutionException;
-import org.jboss.remoting.txn.TxnRequest;
-import org.jboss.remoting.txn.TxnReply;
+import org.jboss.remoting.txn.spi.TxnRequest;
+import org.jboss.remoting.txn.spi.TxnReply;
import org.jboss.remoting.txn.TransactionalClient;
/**
- *
+ * A transactional client implementation.
*/
public final class TransactionalClientImpl<I, O> implements TransactionalClient<I, O> {
@@ -75,34 +75,42 @@
}
}
+ /** {@inheritDoc} */
public void start() throws IOException {
txnClient.invoke(TxnRequest.StartLocal.INSTANCE);
}
+ /** {@inheritDoc} */
public void commit() throws IOException {
txnClient.invoke(TxnRequest.CommitLocal.INSTANCE);
}
+ /** {@inheritDoc} */
public void rollback() throws IOException {
txnClient.invoke(TxnRequest.RollbackLocal.INSTANCE);
}
+ /** {@inheritDoc} */
public XAResource getXAResource() {
return remotingXAResource;
}
+ /** {@inheritDoc} */
public O invoke(final I request) throws IOException, CancellationException {
return realClient.invoke(request);
}
+ /** {@inheritDoc} */
public IoFuture<? extends O> send(final I request) throws IOException {
return realClient.send(request);
}
+ /** {@inheritDoc} */
public ConcurrentMap<Object, Object> getAttributes() {
return realClient.getAttributes();
}
+ /** {@inheritDoc} */
public void close() throws IOException {
try {
realClient.close();
@@ -112,6 +120,7 @@
}
}
+ /** {@inheritDoc} */
public Key addCloseHandler(final CloseHandler<? super Client<I, O>> handler) {
return realClient.addCloseHandler(new CloseHandler<Client<I, O>>() {
public void handleClose(final Client<I, O> closed) {
@@ -120,10 +129,7 @@
});
}
- /**
- *
- */
- public static final class RemotingXAResource implements XAResource {
+ private static final class RemotingXAResource implements XAResource {
private final Client<TxnRequest, TxnReply> txnClient;
private final IoFuture<? extends TxnReply.ResourceManagerId> futureIdReply;
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java 2009-01-15 03:50:40 UTC (rev 4815)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -28,8 +28,8 @@
import org.jboss.remoting.Endpoint;
import org.jboss.remoting.Client;
import org.jboss.remoting.CloseHandler;
-import org.jboss.remoting.txn.TxnRequest;
-import org.jboss.remoting.txn.TxnReply;
+import org.jboss.remoting.txn.spi.TxnRequest;
+import org.jboss.remoting.txn.spi.TxnReply;
import org.jboss.remoting.txn.TransactionalClientSource;
import org.jboss.remoting.txn.TransactionalClient;
import org.jboss.remoting.spi.RequestHandlerSource;
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/UnwrappingRequestHandler.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.impl;
+
+import org.jboss.remoting.spi.RequestHandler;
+import org.jboss.remoting.spi.AbstractAutoCloseable;
+import org.jboss.remoting.spi.RemoteRequestContext;
+import org.jboss.remoting.spi.ReplyHandler;
+import org.jboss.remoting.spi.SpiUtils;
+import org.jboss.remoting.txn.spi.TxnRequest;
+import org.jboss.remoting.RemoteRequestException;
+import org.jboss.xnio.log.Logger;
+import java.util.concurrent.Executor;
+import java.io.IOException;
+
+/**
+ * A request handler which invokes a {@code TxnRequest} visitor to demultiplex a transaction control message.
+ *
+ * @see org.jboss.remoting.txn.impl.ForwardingTxnRequestVisitor
+ */
+public final class UnwrappingRequestHandler extends AbstractAutoCloseable<RequestHandler> implements RequestHandler{
+
+ private static final Logger log = Logger.getLogger("org.jboss.remoting.txn");
+
+ private final TxnRequest.Visitor<ReplyHandler, RemoteRequestContext> visitor;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param executor the executor used to execute the close notification handlers
+ * @param visitor the visitor which will handle the decoded transaction control message
+ */
+ protected UnwrappingRequestHandler(final Executor executor, final TxnRequest.Visitor<ReplyHandler, RemoteRequestContext> visitor) {
+ super(executor);
+ this.visitor = visitor;
+ }
+
+ /** {@inheritDoc} */
+ public RemoteRequestContext receiveRequest(final Object request, final ReplyHandler replyHandler) {
+ if (request instanceof TxnRequest) {
+ final TxnRequest txnRequest = (TxnRequest) request;
+ return txnRequest.accept(visitor, replyHandler);
+ } else {
+ try {
+ replyHandler.handleException(new RemoteRequestException("Incorrect request type"));
+ } catch (IOException e) {
+ log.warn(e, "Failed to send RemoteRequestException");
+ }
+ return SpiUtils.getBlankRemoteRequestContext();
+ }
+ }
+}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java 2009-01-15 03:50:40 UTC (rev 4815)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -28,7 +28,7 @@
import org.jboss.remoting.spi.AbstractAutoCloseable;
import org.jboss.remoting.spi.Handle;
import org.jboss.remoting.CloseHandler;
-import org.jboss.remoting.txn.TxnRequest;
+import org.jboss.remoting.txn.spi.TxnRequest;
import org.jboss.xnio.IoUtils;
import java.util.concurrent.Executor;
import java.io.IOException;
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnReply.java (from rev 4813, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnReply.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -0,0 +1,290 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.spi;
+
+import javax.transaction.xa.Xid;
+
+/**
+ * A reply to a request for a transaction operation on a transactional client.
+ */
+public interface TxnReply {
+
+ /**
+ * Accept a visitor.
+ *
+ * @param visitor the visitor
+ * @param param a parameter to pass to the visitor method
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ * @return the value returned by the visitor
+ */
+ <I, O> O accept(Visitor<I, O> visitor, I param);
+
+ /**
+ * A visitor for {@code TxnReply} types.
+ *
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ */
+ interface Visitor<I, O> {
+
+ /**
+ * Handle a {@code ResourceManagerId} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(ResourceManagerId reply, I param);
+
+ /**
+ * Handle a {@code Timeout} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Timeout reply, I param);
+
+ /**
+ * Handle a {@code Prepared} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Prepared reply, I param);
+
+ /**
+ * Handle a {@code Recover} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Recover reply, I param);
+
+ /**
+ * Handle a {@code TimeoutSet} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(TimeoutSet reply, I param);
+
+ /**
+ * Handle a {@code Success} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Success reply, I param);
+ }
+
+ /**
+ * A reply to a request to get the resource manager ID.
+ *
+ * @see javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
+ */
+ final class ResourceManagerId implements TxnReply {
+ private final Object id;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param id the resource manager ID
+ */
+ public ResourceManagerId(final Object id) {
+ this.id = id;
+ }
+
+ /**
+ * Get the resource manager ID.
+ *
+ * @return the resource manager ID
+ */
+ public Object getId() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A reply to a request to get the currently configured transaction timeout.
+ *
+ * @see javax.transaction.xa.XAResource#getTransactionTimeout()
+ */
+ final class Timeout implements TxnReply {
+
+ private final int timeout;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param timeout the timeout
+ */
+ public Timeout(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ /**
+ * Get the timeout.
+ *
+ * @return the timeout
+ */
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A reply to a request to prepare a distributed transaction.
+ *
+ * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
+ */
+ final class Prepared implements TxnReply {
+ private final int vote;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param vote the vote
+ */
+ public Prepared(final int vote) {
+ this.vote = vote;
+ }
+
+ /**
+ * Get the vote.
+ *
+ * @return the vote
+ */
+ public int getVote() {
+ return vote;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A reply to a request to get transaction IDs to recover.
+ *
+ * @see javax.transaction.xa.XAResource#recover(int)
+ */
+ final class Recover implements TxnReply {
+
+ private final Xid[] resources;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param resources the resources to recover
+ */
+ public Recover(final Xid[] resources) {
+ this.resources = resources;
+ }
+
+ /**
+ * Get the resources to recover.
+ *
+ * @return the resources to recover
+ */
+ public Xid[] getResources() {
+ return resources;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A reply to a request to set the transaction timeout.
+ *
+ * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
+ */
+ final class TimeoutSet implements TxnReply {
+
+ private final boolean success;
+ /**
+ * The timeout was set successfully.
+ */
+ public static final TimeoutSet SUCCESS = new TimeoutSet(true);
+ /**
+ * The timeout could not be set.
+ */
+ public static final TimeoutSet FAILED = new TimeoutSet(false);
+
+ private TimeoutSet(final boolean success) {
+ this.success = success;
+ }
+
+ /**
+ * Get whether the timeout was set successfully.
+ *
+ * @return {@code true} if the timeout was set successfully.
+ */
+ public boolean getSuccess() {
+ return success;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A general successful reply.
+ */
+ final class Success implements TxnReply {
+
+ /**
+ * Get the single instance.
+ */
+ public static final Success INSTANCE = new Success();
+
+ private Success() {
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnRequest.java (from rev 4813, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/spi/TxnRequest.java 2009-01-15 18:07:06 UTC (rev 4816)
@@ -0,0 +1,611 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.spi;
+
+import javax.transaction.xa.Xid;
+
+/**
+ * A request for a transaction operation on a transactional client.
+ */
+public interface TxnRequest {
+
+ /**
+ * Accept a visitor.
+ *
+ * @param visitor the visitor
+ * @param param a parameter to pass to the visitor method
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ * @return the value returned by the visitor
+ */
+ <I, O> O accept(Visitor<I, O> visitor, I param);
+
+ /**
+ * A visitor for {@code TxnRequest} types.
+ *
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ */
+ interface Visitor<I, O> {
+
+ /**
+ * Handle a {@code CommitXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(CommitXA request, I param);
+
+ /**
+ * Handle a {@code EndXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(EndXA request, I param);
+
+ /**
+ * Handle a {@code ForgetXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(ForgetXA request, I param);
+
+ /**
+ * Handle a {@code GetTimeout} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(GetTimeout request, I param);
+
+ /**
+ * Handle a {@code PrepareXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(PrepareXA request, I param);
+
+ /**
+ * Handle a {@code Recover} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Recover request, I param);
+
+ /**
+ * Handle a {@code RollbackXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(RollbackXA request, I param);
+
+ /**
+ * Handle a {@code SetTimeout} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(SetTimeout request, I param);
+
+ /**
+ * Handle a {@code StartXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(StartXA request, I param);
+
+ /**
+ * Handle a {@code Wrapped} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Wrapped request, I param);
+
+ /**
+ * Handle a {@code GetResourceManagerId} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(GetResourceManagerId request, I param);
+
+ /**
+ * Handle a {@code StartLocal} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(StartLocal request, I param);
+
+ /**
+ * Handle a {@code CommitLocal} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(CommitLocal request, I param);
+
+ /**
+ * Handle a {@code RollbackLocal} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(RollbackLocal request, I param);
+ }
+
+ /**
+ * A request to commit a local transaction.
+ *
+ * @see org.jboss.remoting.txn.TransactionalClient#commit()
+ */
+ final class CommitLocal implements TxnRequest {
+
+ /**
+ * The single instance.
+ */
+ public static final CommitLocal INSTANCE = new CommitLocal();
+
+ private CommitLocal() {
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to end the work performed on behalf of a distributed transaction.
+ *
+ * @see javax.transaction.xa.XAResource#end(javax.transaction.xa.Xid, int)
+ */
+ final class EndXA implements TxnRequest {
+
+ private final Xid xid;
+ private final int flags;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ * @param flags the transaction flags
+ */
+ public EndXA(final Xid xid, final int flags) {
+ this.xid = xid;
+ this.flags = flags;
+ }
+
+ /**
+ * Get the XID.
+ *
+ * @return the XID
+ */
+ public Xid getXid() {
+ return xid;
+ }
+
+ /**
+ * Get the flags.
+ *
+ * @return the flags
+ */
+ public int getFlags() {
+ return flags;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to forget about a heurstically completed transaction branch.
+ *
+ * @see javax.transaction.xa.XAResource#forget(javax.transaction.xa.Xid)
+ */
+ final class ForgetXA implements TxnRequest {
+
+ private final Xid xid;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ */
+ public ForgetXA(final Xid xid) {
+ this.xid = xid;
+ }
+
+ /**
+ * Get the XID.
+ *
+ * @return the XID
+ */
+ public Xid getXid() {
+ return xid;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to get the resource manager ID for this resource.
+ *
+ * @see javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
+ */
+ final class GetResourceManagerId implements TxnRequest {
+
+ /**
+ * The single instance.
+ */
+ public static final GetResourceManagerId INSTANCE = new GetResourceManagerId();
+
+ private GetResourceManagerId() {
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to get the transaction timeout value.
+ *
+ * @see javax.transaction.xa.XAResource#getTransactionTimeout()
+ */
+ final class GetTimeout implements TxnRequest {
+
+ /**
+ * The single instance.
+ */
+ public static final GetTimeout INSTANCE = new GetTimeout();
+
+ private GetTimeout() {
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to set the transaction timeout value.
+ *
+ * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
+ */
+ final class SetTimeout implements TxnRequest {
+
+ private final int timeout;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param timeout the requested timeout value
+ */
+ public SetTimeout(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ /**
+ * Get the requested timeout value.
+ *
+ * @return the requested timeout value
+ */
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to prepare a for distributed transaction commit of the given transaction.
+ *
+ * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
+ */
+ final class PrepareXA implements TxnRequest {
+
+ private final Xid xid;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ */
+ public PrepareXA(final Xid xid) {
+ this.xid = xid;
+ }
+
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
+ public Xid getXid() {
+ return xid;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to obtain a list of prepared transaction branches from the underlying resource manager.
+ *
+ * @see javax.transaction.xa.XAResource#recover(int)
+ */
+ final class Recover implements TxnRequest {
+
+ private final int flag;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param flag the flag(s)
+ */
+ public Recover(final int flag) {
+ this.flag = flag;
+ }
+
+ /**
+ * Get the flag value.
+ *
+ * @return the flag value
+ */
+ public int getFlag() {
+ return flag;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to roll back a local transaction.
+ *
+ * @see org.jboss.remoting.txn.TransactionalClient#rollback()
+ */
+ final class RollbackLocal implements TxnRequest {
+
+ /**
+ * The single instance.
+ */
+ public static RollbackLocal INSTANCE = new RollbackLocal();
+
+ private RollbackLocal() {
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to start a local transaction.
+ *
+ * @see org.jboss.remoting.txn.TransactionalClient#start()
+ */
+ final class StartLocal implements TxnRequest {
+
+ /**
+ * The single instance.
+ */
+ public static StartLocal INSTANCE = new StartLocal();
+
+ private StartLocal() {
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A wrapped application request.
+ */
+ final class Wrapped implements TxnRequest {
+
+ private final Object wrappedRequest;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param request the application request
+ */
+ public Wrapped(final Object request) {
+ wrappedRequest = request;
+ }
+
+ /**
+ * Get the wrapped request.
+ *
+ * @return the wrapped request
+ */
+ public Object getWrappedRequest() {
+ return wrappedRequest;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to commit a distributed transaction.
+ *
+ * @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid, boolean)
+ */
+ final class CommitXA implements TxnRequest {
+ private final Xid xid;
+ private final boolean onePhase;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ * @param onePhase {@code true} if the commit should be done in a single phase
+ */
+ public CommitXA(final Xid xid, final boolean onePhase) {
+ this.xid = xid;
+ this.onePhase = onePhase;
+ }
+
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
+ public Xid getXid() {
+ return xid;
+ }
+
+ /**
+ * Determine whether a one-phase commit was requested.
+ *
+ * @return {@code true} if a one-phase commit was requested
+ */
+ public boolean isOnePhase() {
+ return onePhase;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to roll back a distributed transaction.
+ *
+ * @see javax.transaction.xa.XAResource#rollback(javax.transaction.xa.Xid)
+ */
+ final class RollbackXA implements TxnRequest {
+
+ private final Xid xid;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ */
+ public RollbackXA(final Xid xid) {
+ this.xid = xid;
+ }
+
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
+ public Xid getXid() {
+ return xid;
+ }
+
+ /** {@inheritDoc} */
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ * A request to start a distributed transaction.
+ *
+ * @see javax.transaction.xa.XAResource#start(javax.transaction.xa.Xid, int)
+ */
+ final class StartXA implements TxnRequest {
+
+ private final Xid xid;
+ private final int flags;
+
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ * @param flags the flags
+ */
+ public StartXA(final Xid xid, final int flags) {
+ this.xid = xid;
+ this.flags = flags;
+ }
+
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
+ public Xid getXid() {
+ return xid;
+ }
+
+ /**
+ * Get the flags.
+ *
+ * @return the flags
+ */
+ public int getFlags() {
+ return flags;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+}
15 years, 10 months
JBoss Remoting SVN: r4815 - remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-14 22:50:40 -0500 (Wed, 14 Jan 2009)
New Revision: 4815
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
Log:
More reasonable exception
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 03:48:15 UTC (rev 4814)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 03:50:40 UTC (rev 4815)
@@ -64,12 +64,12 @@
} catch (XAException xae) {
return xae;
} catch (Throwable throwable) {
- final XAException xae = new XAException(XAException.XA_RBPROTO);
+ final XAException xae = new XAException(XAException.XAER_RMFAIL);
xae.initCause(e);
return xae;
}
} catch (IOException e) {
- final XAException xae = new XAException(XAException.XA_RBPROTO);
+ final XAException xae = new XAException(XAException.XAER_RMFAIL);
xae.initCause(e);
return xae;
}
15 years, 10 months
JBoss Remoting SVN: r4814 - remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-14 22:48:15 -0500 (Wed, 14 Jan 2009)
New Revision: 4814
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
Log:
clarify some code
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 03:43:01 UTC (rev 4813)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 03:48:15 UTC (rev 4814)
@@ -75,14 +75,6 @@
}
}
- private static TxnReply doInvoke(Client<TxnRequest, TxnReply> txnClient, TxnRequest request) throws XAException {
- try {
- return txnClient.invoke(request);
- } catch (IOException e) {
- throw xaException(e);
- }
- }
-
public void start() throws IOException {
txnClient.invoke(TxnRequest.StartLocal.INSTANCE);
}
@@ -141,19 +133,37 @@
}
public void commit(final Xid xid, final boolean onePhase) throws XAException {
- doInvoke(txnClient, new TxnRequest.CommitXA(xid, onePhase));
+ try {
+ txnClient.invoke(new TxnRequest.CommitXA(xid, onePhase));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
}
public void end(final Xid xid, final int flags) throws XAException {
- doInvoke(txnClient, new TxnRequest.EndXA(xid, flags));
+ try {
+ txnClient.invoke(new TxnRequest.EndXA(xid, flags));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
}
public void forget(final Xid xid) throws XAException {
- doInvoke(txnClient, new TxnRequest.ForgetXA(xid));
+ try {
+ txnClient.invoke(new TxnRequest.ForgetXA(xid));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
}
public int getTransactionTimeout() throws XAException {
- return ((TxnReply.Timeout) doInvoke(txnClient, TxnRequest.GetTimeout.INSTANCE)).getTimeout();
+ final TxnReply result;
+ try {
+ result = txnClient.invoke(TxnRequest.GetTimeout.INSTANCE);
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ return ((TxnReply.Timeout) result).getTimeout();
}
public boolean isSameRM(final XAResource resource) throws XAException {
@@ -170,23 +180,49 @@
}
public int prepare(final Xid xid) throws XAException {
- return ((TxnReply.Prepared) doInvoke(txnClient, new TxnRequest.PrepareXA(xid))).getVote();
+ final TxnReply result;
+ try {
+ result = txnClient.invoke(new TxnRequest.PrepareXA(xid));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ return ((TxnReply.Prepared) result).getVote();
}
public Xid[] recover(final int flag) throws XAException {
- return ((TxnReply.Recover) doInvoke(txnClient, new TxnRequest.Recover(flag))).getResources();
+ final TxnReply result;
+ try {
+ result = txnClient.invoke(new TxnRequest.Recover(flag));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ return ((TxnReply.Recover) result).getResources();
}
public void rollback(final Xid xid) throws XAException {
- doInvoke(txnClient, new TxnRequest.RollbackXA(xid));
+ try {
+ txnClient.invoke(new TxnRequest.RollbackXA(xid));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
}
public boolean setTransactionTimeout(final int timeout) throws XAException {
- return ((TxnReply.TimeoutSet) doInvoke(txnClient, new TxnRequest.SetTimeout(timeout))).getSuccess();
+ final TxnReply result;
+ try {
+ result = txnClient.invoke(new TxnRequest.SetTimeout(timeout));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ return ((TxnReply.TimeoutSet) result).getSuccess();
}
public void start(final Xid xid, final int flags) throws XAException {
- doInvoke(txnClient, new TxnRequest.StartXA(xid, flags));
+ try {
+ txnClient.invoke(new TxnRequest.StartXA(xid, flags));
+ } catch (IOException e) {
+ throw xaException(e);
+ }
}
}
}
15 years, 10 months
JBoss Remoting SVN: r4813 - in remoting-txn/trunk/src/main/java/org/jboss/remoting/txn: impl and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-14 22:43:01 -0500 (Wed, 14 Jan 2009)
New Revision: 4813
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
Log:
Lots o javadoc
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java 2009-01-15 01:32:33 UTC (rev 4812)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java 2009-01-15 03:43:01 UTC (rev 4813)
@@ -29,14 +29,40 @@
import java.io.IOException;
/**
+ * A transactional communications client. The client may be associated with state maintained by the local and/or remote side.
+ * The client is additionally associated with a transactional resource.
*
+ * @param <I> the request type
+ * @param <O> the reply type
*/
public interface TransactionalClient<I, O> extends Client<I, O> {
+
+ /**
+ * Start a local transaction.
+ *
+ * @throws IOException if an error occurs
+ */
void start() throws IOException;
+ /**
+ * Commit a local transaction.
+ *
+ * @throws IOException if an error occurs
+ */
void commit() throws IOException;
+ /**
+ * Roll back a local transaction.
+ *
+ * @throws IOException if an error occurs
+ */
void rollback() throws IOException;
- XAResource getXaResource();
+ /**
+ * Get an {@code XAResource} which can be used to enlist this client's resource in a
+ * distributed transaction.
+ *
+ * @return the {@code XAResource}
+ */
+ XAResource getXAResource();
}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java 2009-01-15 01:32:33 UTC (rev 4812)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java 2009-01-15 03:43:01 UTC (rev 4813)
@@ -26,9 +26,18 @@
import java.io.IOException;
/**
+ * A source for new transactional Remoting clients.
*
+ * @param <I> the request type
+ * @param <O> the reply type
*/
public interface TransactionalClientSource<I, O> extends ClientSource<I, O> {
+ /**
+ * Create a new transactional communications context.
+ *
+ * @return a new transactional client
+ * @throws IOException if an error occurs
+ */
TransactionalClient<I, O> createClient() throws IOException;
}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java 2009-01-15 01:32:33 UTC (rev 4812)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java 2009-01-15 03:43:01 UTC (rev 4813)
@@ -25,134 +25,264 @@
import javax.transaction.xa.Xid;
/**
- *
+ * A reply to a request for a transaction operation on a transactional client.
*/
public interface TxnReply {
+ /**
+ * Accept a visitor.
+ *
+ * @param visitor the visitor
+ * @param param a parameter to pass to the visitor method
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ * @return the value returned by the visitor
+ */
<I, O> O accept(Visitor<I, O> visitor, I param);
+ /**
+ * A visitor for {@code TxnReply} types.
+ *
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ */
interface Visitor<I, O> {
- O visit(ResourceManagerId id, I param);
+ /**
+ * Handle a {@code ResourceManagerId} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(ResourceManagerId reply, I param);
- O visit(Timeout id, I param);
+ /**
+ * Handle a {@code Timeout} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Timeout reply, I param);
- O visit(Prepared prepared, I param);
+ /**
+ * Handle a {@code Prepared} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
+ O visit(Prepared reply, I param);
+ /**
+ * Handle a {@code Recover} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(Recover reply, I param);
+ /**
+ * Handle a {@code TimeoutSet} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(TimeoutSet reply, I param);
+ /**
+ * Handle a {@code Success} instance.
+ *
+ * @param reply the reply
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(Success reply, I param);
}
/**
+ * A reply to a request to get the resource manager ID.
*
+ * @see javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
*/
final class ResourceManagerId implements TxnReply {
private final Object id;
+ /**
+ * Construct a new instance.
+ *
+ * @param id the resource manager ID
+ */
public ResourceManagerId(final Object id) {
this.id = id;
}
+ /**
+ * Get the resource manager ID.
+ *
+ * @return the resource manager ID
+ */
public Object getId() {
return id;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A reply to a request to get the currently configured transaction timeout.
*
+ * @see javax.transaction.xa.XAResource#getTransactionTimeout()
*/
final class Timeout implements TxnReply {
private final int timeout;
+ /**
+ * Construct a new instance.
+ *
+ * @param timeout the timeout
+ */
public Timeout(final int timeout) {
this.timeout = timeout;
}
+ /**
+ * Get the timeout.
+ *
+ * @return the timeout
+ */
public int getTimeout() {
return timeout;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A reply to a request to prepare a distributed transaction.
*
+ * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
*/
final class Prepared implements TxnReply {
private final int vote;
+ /**
+ * Construct a new instance.
+ *
+ * @param vote the vote
+ */
public Prepared(final int vote) {
this.vote = vote;
}
+ /**
+ * Get the vote.
+ *
+ * @return the vote
+ */
public int getVote() {
return vote;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A reply to a request to get transaction IDs to recover.
*
+ * @see javax.transaction.xa.XAResource#recover(int)
*/
final class Recover implements TxnReply {
private final Xid[] resources;
+ /**
+ * Construct a new instance.
+ *
+ * @param resources the resources to recover
+ */
public Recover(final Xid[] resources) {
this.resources = resources;
}
+ /**
+ * Get the resources to recover.
+ *
+ * @return the resources to recover
+ */
public Xid[] getResources() {
return resources;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A reply to a request to set the transaction timeout.
*
+ * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
*/
final class TimeoutSet implements TxnReply {
private final boolean success;
+ /**
+ * The timeout was set successfully.
+ */
+ public static final TimeoutSet SUCCESS = new TimeoutSet(true);
+ /**
+ * The timeout could not be set.
+ */
+ public static final TimeoutSet FAILED = new TimeoutSet(false);
- public TimeoutSet(final boolean success) {
+ private TimeoutSet(final boolean success) {
this.success = success;
}
+ /**
+ * Get whether the timeout was set successfully.
+ *
+ * @return {@code true} if the timeout was set successfully.
+ */
public boolean getSuccess() {
return success;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
- *
+ * A general successful reply.
*/
final class Success implements TxnReply {
+
+ /**
+ * Get the single instance.
+ */
public static final Success INSTANCE = new Success();
private Success() {
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java 2009-01-15 01:32:33 UTC (rev 4812)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java 2009-01-15 03:43:01 UTC (rev 4813)
@@ -28,301 +28,578 @@
* A request for a transaction operation on a transactional client.
*/
public interface TxnRequest {
+
+ /**
+ * Accept a visitor.
+ *
+ * @param visitor the visitor
+ * @param param a parameter to pass to the visitor method
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ * @return the value returned by the visitor
+ */
<I, O> O accept(Visitor<I, O> visitor, I param);
+ /**
+ * A visitor for {@code TxnRequest} types.
+ *
+ * @param <I> the type of the visitor parameter
+ * @param <O> the return type of the visitor
+ */
interface Visitor<I, O> {
+ /**
+ * Handle a {@code CommitXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(CommitXA request, I param);
+ /**
+ * Handle a {@code EndXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(EndXA request, I param);
+ /**
+ * Handle a {@code ForgetXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(ForgetXA request, I param);
+ /**
+ * Handle a {@code GetTimeout} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(GetTimeout request, I param);
+ /**
+ * Handle a {@code PrepareXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(PrepareXA request, I param);
+ /**
+ * Handle a {@code Recover} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(Recover request, I param);
+ /**
+ * Handle a {@code RollbackXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(RollbackXA request, I param);
+ /**
+ * Handle a {@code SetTimeout} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(SetTimeout request, I param);
+ /**
+ * Handle a {@code StartXA} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(StartXA request, I param);
+ /**
+ * Handle a {@code Wrapped} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(Wrapped request, I param);
+ /**
+ * Handle a {@code GetResourceManagerId} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(GetResourceManagerId request, I param);
+ /**
+ * Handle a {@code StartLocal} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(StartLocal request, I param);
+ /**
+ * Handle a {@code CommitLocal} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(CommitLocal request, I param);
+ /**
+ * Handle a {@code RollbackLocal} instance.
+ *
+ * @param request the request
+ * @param param the visitor parameter
+ * @return the visitor return value
+ */
O visit(RollbackLocal request, I param);
}
/**
+ * A request to commit a local transaction.
*
+ * @see TransactionalClient#commit()
*/
final class CommitLocal implements TxnRequest {
+
+ /**
+ * The single instance.
+ */
public static final CommitLocal INSTANCE = new CommitLocal();
private CommitLocal() {
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to end the work performed on behalf of a distributed transaction.
*
+ * @see javax.transaction.xa.XAResource#end(javax.transaction.xa.Xid, int)
*/
final class EndXA implements TxnRequest {
private final Xid xid;
private final int flags;
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ * @param flags the transaction flags
+ */
public EndXA(final Xid xid, final int flags) {
this.xid = xid;
this.flags = flags;
}
+ /**
+ * Get the XID.
+ *
+ * @return the XID
+ */
public Xid getXid() {
return xid;
}
+ /**
+ * Get the flags.
+ *
+ * @return the flags
+ */
public int getFlags() {
return flags;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to forget about a heurstically completed transaction branch.
*
+ * @see javax.transaction.xa.XAResource#forget(javax.transaction.xa.Xid)
*/
final class ForgetXA implements TxnRequest {
private final Xid xid;
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ */
public ForgetXA(final Xid xid) {
this.xid = xid;
}
+ /**
+ * Get the XID.
+ *
+ * @return the XID
+ */
public Xid getXid() {
return xid;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to get the resource manager ID for this resource.
*
+ * @see javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
*/
final class GetResourceManagerId implements TxnRequest {
+ /**
+ * The single instance.
+ */
public static final GetResourceManagerId INSTANCE = new GetResourceManagerId();
private GetResourceManagerId() {
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to get the transaction timeout value.
*
+ * @see javax.transaction.xa.XAResource#getTransactionTimeout()
*/
final class GetTimeout implements TxnRequest {
+ /**
+ * The single instance.
+ */
public static final GetTimeout INSTANCE = new GetTimeout();
private GetTimeout() {
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to set the transaction timeout value.
*
+ * @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
*/
final class SetTimeout implements TxnRequest {
private final int timeout;
+ /**
+ * Construct a new instance.
+ *
+ * @param timeout the requested timeout value
+ */
public SetTimeout(final int timeout) {
this.timeout = timeout;
}
+ /**
+ * Get the requested timeout value.
+ *
+ * @return the requested timeout value
+ */
public int getTimeout() {
return timeout;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to prepare a for distributed transaction commit of the given transaction.
*
+ * @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
*/
final class PrepareXA implements TxnRequest {
private final Xid xid;
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ */
public PrepareXA(final Xid xid) {
this.xid = xid;
}
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
public Xid getXid() {
return xid;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to obtain a list of prepared transaction branches from the underlying resource manager.
*
+ * @see javax.transaction.xa.XAResource#recover(int)
*/
final class Recover implements TxnRequest {
private final int flag;
+ /**
+ * Construct a new instance.
+ *
+ * @param flag the flag(s)
+ */
public Recover(final int flag) {
this.flag = flag;
}
+ /**
+ * Get the flag value.
+ *
+ * @return the flag value
+ */
public int getFlag() {
return flag;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to roll back a local transaction.
*
+ * @see TransactionalClient#rollback()
*/
final class RollbackLocal implements TxnRequest {
+ /**
+ * The single instance.
+ */
public static RollbackLocal INSTANCE = new RollbackLocal();
private RollbackLocal() {
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to start a local transaction.
*
+ * @see TransactionalClient#start()
*/
final class StartLocal implements TxnRequest {
+ /**
+ * The single instance.
+ */
public static StartLocal INSTANCE = new StartLocal();
private StartLocal() {
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
- *
+ * A wrapped application request.
*/
final class Wrapped implements TxnRequest {
private final Object wrappedRequest;
+ /**
+ * Construct a new instance.
+ *
+ * @param request the application request
+ */
public Wrapped(final Object request) {
wrappedRequest = request;
}
+ /**
+ * Get the wrapped request.
+ *
+ * @return the wrapped request
+ */
public Object getWrappedRequest() {
return wrappedRequest;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to commit a distributed transaction.
*
+ * @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid, boolean)
*/
final class CommitXA implements TxnRequest {
private final Xid xid;
private final boolean onePhase;
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ * @param onePhase {@code true} if the commit should be done in a single phase
+ */
public CommitXA(final Xid xid, final boolean onePhase) {
this.xid = xid;
this.onePhase = onePhase;
}
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
public Xid getXid() {
return xid;
}
+ /**
+ * Determine whether a one-phase commit was requested.
+ *
+ * @return {@code true} if a one-phase commit was requested
+ */
public boolean isOnePhase() {
return onePhase;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to roll back a distributed transaction.
*
+ * @see javax.transaction.xa.XAResource#rollback(javax.transaction.xa.Xid)
*/
final class RollbackXA implements TxnRequest {
private final Xid xid;
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ */
public RollbackXA(final Xid xid) {
this.xid = xid;
}
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
public Xid getXid() {
return xid;
}
+ /** {@inheritDoc} */
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
return visitor.visit(this, param);
}
}
/**
+ * A request to start a distributed transaction.
*
+ * @see javax.transaction.xa.XAResource#start(javax.transaction.xa.Xid, int)
*/
final class StartXA implements TxnRequest {
private final Xid xid;
private final int flags;
+ /**
+ * Construct a new instance.
+ *
+ * @param xid the transaction ID
+ * @param flags the flags
+ */
public StartXA(final Xid xid, final int flags) {
this.xid = xid;
this.flags = flags;
}
+ /**
+ * Get the transaction ID.
+ *
+ * @return the transaction ID
+ */
public Xid getXid() {
return xid;
}
+ /**
+ * Get the flags.
+ *
+ * @return the flags
+ */
public int getFlags() {
return flags;
}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 01:32:33 UTC (rev 4812)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 03:43:01 UTC (rev 4813)
@@ -95,7 +95,7 @@
txnClient.invoke(TxnRequest.RollbackLocal.INSTANCE);
}
- public XAResource getXaResource() {
+ public XAResource getXAResource() {
return remotingXAResource;
}
15 years, 10 months
JBoss Remoting SVN: r4812 - remoting-txn/trunk/src/main/java/org/jboss/remoting/txn.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-14 20:32:33 -0500 (Wed, 14 Jan 2009)
New Revision: 4812
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java
Log:
Minor rename
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java 2009-01-15 01:31:58 UTC (rev 4811)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java 2009-01-15 01:32:33 UTC (rev 4812)
@@ -43,7 +43,7 @@
O visit(TimeoutSet reply, I param);
- O visit(TxnSuccessfulReply reply, I param);
+ O visit(Success reply, I param);
}
/**
@@ -147,10 +147,10 @@
/**
*
*/
- final class TxnSuccessfulReply implements TxnReply {
- public static final TxnSuccessfulReply INSTANCE = new TxnSuccessfulReply();
+ final class Success implements TxnReply {
+ public static final Success INSTANCE = new Success();
- private TxnSuccessfulReply() {
+ private Success() {
}
public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
15 years, 10 months
JBoss Remoting SVN: r4811 - in remoting-txn/trunk/src/main/java/org/jboss/remoting/txn: impl and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-14 20:31:58 -0500 (Wed, 14 Jan 2009)
New Revision: 4811
Added:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java
Removed:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/
Modified:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java
Log:
Make the API somewhat less intimidating
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java (from rev 4810, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/AbstractTxnReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnReply.java 2009-01-15 01:31:58 UTC (rev 4811)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public interface TxnReply {
+
+ <I, O> O accept(Visitor<I, O> visitor, I param);
+
+ interface Visitor<I, O> {
+
+ O visit(ResourceManagerId id, I param);
+
+ O visit(Timeout id, I param);
+
+ O visit(Prepared prepared, I param);
+
+ O visit(Recover reply, I param);
+
+ O visit(TimeoutSet reply, I param);
+
+ O visit(TxnSuccessfulReply reply, I param);
+ }
+
+ /**
+ *
+ */
+ final class ResourceManagerId implements TxnReply {
+ private final Object id;
+
+ public ResourceManagerId(final Object id) {
+ this.id = id;
+ }
+
+ public Object getId() {
+ return id;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class Timeout implements TxnReply {
+
+ private final int timeout;
+
+ public Timeout(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class Prepared implements TxnReply {
+ private final int vote;
+
+ public Prepared(final int vote) {
+ this.vote = vote;
+ }
+
+ public int getVote() {
+ return vote;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class Recover implements TxnReply {
+
+ private final Xid[] resources;
+
+ public Recover(final Xid[] resources) {
+ this.resources = resources;
+ }
+
+ public Xid[] getResources() {
+ return resources;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class TimeoutSet implements TxnReply {
+
+ private final boolean success;
+
+ public TimeoutSet(final boolean success) {
+ this.success = success;
+ }
+
+ public boolean getSuccess() {
+ return success;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class TxnSuccessfulReply implements TxnReply {
+ public static final TxnSuccessfulReply INSTANCE = new TxnSuccessfulReply();
+
+ private TxnSuccessfulReply() {
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java (from rev 4810, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/AbstractTxnRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequest.java 2009-01-15 01:31:58 UTC (rev 4811)
@@ -0,0 +1,334 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ * A request for a transaction operation on a transactional client.
+ */
+public interface TxnRequest {
+ <I, O> O accept(Visitor<I, O> visitor, I param);
+
+ interface Visitor<I, O> {
+
+ O visit(CommitXA request, I param);
+
+ O visit(EndXA request, I param);
+
+ O visit(ForgetXA request, I param);
+
+ O visit(GetTimeout request, I param);
+
+ O visit(PrepareXA request, I param);
+
+ O visit(Recover request, I param);
+
+ O visit(RollbackXA request, I param);
+
+ O visit(SetTimeout request, I param);
+
+ O visit(StartXA request, I param);
+
+ O visit(Wrapped request, I param);
+
+ O visit(GetResourceManagerId request, I param);
+
+ O visit(StartLocal request, I param);
+
+ O visit(CommitLocal request, I param);
+
+ O visit(RollbackLocal request, I param);
+ }
+
+ /**
+ *
+ */
+ final class CommitLocal implements TxnRequest {
+ public static final CommitLocal INSTANCE = new CommitLocal();
+
+ private CommitLocal() {
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class EndXA implements TxnRequest {
+
+ private final Xid xid;
+ private final int flags;
+
+ public EndXA(final Xid xid, final int flags) {
+ this.xid = xid;
+ this.flags = flags;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class ForgetXA implements TxnRequest {
+
+ private final Xid xid;
+
+ public ForgetXA(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class GetResourceManagerId implements TxnRequest {
+
+ public static final GetResourceManagerId INSTANCE = new GetResourceManagerId();
+
+ private GetResourceManagerId() {
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class GetTimeout implements TxnRequest {
+
+ public static final GetTimeout INSTANCE = new GetTimeout();
+
+ private GetTimeout() {
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class SetTimeout implements TxnRequest {
+
+ private final int timeout;
+
+ public SetTimeout(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class PrepareXA implements TxnRequest {
+
+ private final Xid xid;
+
+ public PrepareXA(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class Recover implements TxnRequest {
+
+ private final int flag;
+
+ public Recover(final int flag) {
+ this.flag = flag;
+ }
+
+ public int getFlag() {
+ return flag;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class RollbackLocal implements TxnRequest {
+
+ public static RollbackLocal INSTANCE = new RollbackLocal();
+
+ private RollbackLocal() {
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class StartLocal implements TxnRequest {
+
+ public static StartLocal INSTANCE = new StartLocal();
+
+ private StartLocal() {
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class Wrapped implements TxnRequest {
+
+ private final Object wrappedRequest;
+
+ public Wrapped(final Object request) {
+ wrappedRequest = request;
+ }
+
+ public Object getWrappedRequest() {
+ return wrappedRequest;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class CommitXA implements TxnRequest {
+ private final Xid xid;
+ private final boolean onePhase;
+
+ public CommitXA(final Xid xid, final boolean onePhase) {
+ this.xid = xid;
+ this.onePhase = onePhase;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public boolean isOnePhase() {
+ return onePhase;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class RollbackXA implements TxnRequest {
+
+ private final Xid xid;
+
+ public RollbackXA(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+
+ /**
+ *
+ */
+ final class StartXA implements TxnRequest {
+
+ private final Xid xid;
+ private final int flags;
+
+ public StartXA(final Xid xid, final int flags) {
+ this.xid = xid;
+ this.flags = flags;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public <I, O> O accept(final Visitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+ }
+}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 00:08:49 UTC (rev 4810)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 01:31:58 UTC (rev 4811)
@@ -35,26 +35,8 @@
import org.jboss.remoting.Client;
import org.jboss.remoting.CloseHandler;
import org.jboss.remoting.RemoteExecutionException;
-import org.jboss.remoting.txn.request.TxnEndRequest;
-import org.jboss.remoting.txn.request.TxnRollbackRequest;
-import org.jboss.remoting.txn.request.TxnPrepareRequest;
-import org.jboss.remoting.txn.request.TxnGetResourceManagerIdRequest;
-import org.jboss.remoting.txn.request.TxnGetTimeoutRequest;
-import org.jboss.remoting.txn.request.TxnRecoverRequest;
-import org.jboss.remoting.txn.request.TxnForgetRequest;
-import org.jboss.remoting.txn.request.TxnCommitRequest;
-import org.jboss.remoting.txn.request.AbstractTxnRequest;
-import org.jboss.remoting.txn.request.TxnSetTimeoutRequest;
-import org.jboss.remoting.txn.request.TxnXACommitRequest;
-import org.jboss.remoting.txn.request.TxnXARollbackRequest;
-import org.jboss.remoting.txn.request.TxnXAStartRequest;
-import org.jboss.remoting.txn.request.TxnStartRequest;
-import org.jboss.remoting.txn.reply.AbstractTxnReply;
-import org.jboss.remoting.txn.reply.TxnGetResourceManagerIdReply;
-import org.jboss.remoting.txn.reply.TxnGetTimeoutReply;
-import org.jboss.remoting.txn.reply.TxnPrepareReply;
-import org.jboss.remoting.txn.reply.TxnRecoverReply;
-import org.jboss.remoting.txn.reply.TxnSetTimeoutReply;
+import org.jboss.remoting.txn.TxnRequest;
+import org.jboss.remoting.txn.TxnReply;
import org.jboss.remoting.txn.TransactionalClient;
/**
@@ -63,11 +45,11 @@
public final class TransactionalClientImpl<I, O> implements TransactionalClient<I, O> {
private final Client<I, O> realClient;
- private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
+ private final Client<TxnRequest, TxnReply> txnClient;
private RemotingXAResource remotingXAResource;
- TransactionalClientImpl(final Client<I, O> realClient, final Client<AbstractTxnRequest, AbstractTxnReply> txnClient) throws IOException {
+ TransactionalClientImpl(final Client<I, O> realClient, final Client<TxnRequest, TxnReply> txnClient) throws IOException {
this.realClient = realClient;
this.txnClient = txnClient;
remotingXAResource = new RemotingXAResource(txnClient);
@@ -93,7 +75,7 @@
}
}
- private static AbstractTxnReply doInvoke(Client<AbstractTxnRequest, AbstractTxnReply> txnClient, AbstractTxnRequest request) throws XAException {
+ private static TxnReply doInvoke(Client<TxnRequest, TxnReply> txnClient, TxnRequest request) throws XAException {
try {
return txnClient.invoke(request);
} catch (IOException e) {
@@ -102,15 +84,15 @@
}
public void start() throws IOException {
- txnClient.invoke(TxnStartRequest.INSTANCE);
+ txnClient.invoke(TxnRequest.StartLocal.INSTANCE);
}
public void commit() throws IOException {
- txnClient.invoke(TxnCommitRequest.INSTANCE);
+ txnClient.invoke(TxnRequest.CommitLocal.INSTANCE);
}
public void rollback() throws IOException {
- txnClient.invoke(TxnRollbackRequest.INSTANCE);
+ txnClient.invoke(TxnRequest.RollbackLocal.INSTANCE);
}
public XAResource getXaResource() {
@@ -150,28 +132,28 @@
*
*/
public static final class RemotingXAResource implements XAResource {
- private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
- private final IoFuture<? extends TxnGetResourceManagerIdReply> futureIdReply;
+ private final Client<TxnRequest, TxnReply> txnClient;
+ private final IoFuture<? extends TxnReply.ResourceManagerId> futureIdReply;
- public RemotingXAResource(final Client<AbstractTxnRequest, AbstractTxnReply> client) throws IOException {
+ public RemotingXAResource(final Client<TxnRequest, TxnReply> client) throws IOException {
txnClient = client;
- futureIdReply = IoUtils.cast(txnClient.send(TxnGetResourceManagerIdRequest.INSTANCE), TxnGetResourceManagerIdReply.class);
+ futureIdReply = IoUtils.cast(txnClient.send(TxnRequest.GetResourceManagerId.INSTANCE), TxnReply.ResourceManagerId.class);
}
public void commit(final Xid xid, final boolean onePhase) throws XAException {
- doInvoke(txnClient, new TxnXACommitRequest(xid, onePhase));
+ doInvoke(txnClient, new TxnRequest.CommitXA(xid, onePhase));
}
public void end(final Xid xid, final int flags) throws XAException {
- doInvoke(txnClient, new TxnEndRequest(xid, flags));
+ doInvoke(txnClient, new TxnRequest.EndXA(xid, flags));
}
public void forget(final Xid xid) throws XAException {
- doInvoke(txnClient, new TxnForgetRequest(xid));
+ doInvoke(txnClient, new TxnRequest.ForgetXA(xid));
}
public int getTransactionTimeout() throws XAException {
- return ((TxnGetTimeoutReply) doInvoke(txnClient, TxnGetTimeoutRequest.INSTANCE)).getTimeout();
+ return ((TxnReply.Timeout) doInvoke(txnClient, TxnRequest.GetTimeout.INSTANCE)).getTimeout();
}
public boolean isSameRM(final XAResource resource) throws XAException {
@@ -188,23 +170,23 @@
}
public int prepare(final Xid xid) throws XAException {
- return ((TxnPrepareReply) doInvoke(txnClient, new TxnPrepareRequest(xid))).getVote();
+ return ((TxnReply.Prepared) doInvoke(txnClient, new TxnRequest.PrepareXA(xid))).getVote();
}
public Xid[] recover(final int flag) throws XAException {
- return ((TxnRecoverReply) doInvoke(txnClient, new TxnRecoverRequest(flag))).getResources();
+ return ((TxnReply.Recover) doInvoke(txnClient, new TxnRequest.Recover(flag))).getResources();
}
public void rollback(final Xid xid) throws XAException {
- doInvoke(txnClient, new TxnXARollbackRequest(xid));
+ doInvoke(txnClient, new TxnRequest.RollbackXA(xid));
}
public boolean setTransactionTimeout(final int timeout) throws XAException {
- return ((TxnSetTimeoutReply) doInvoke(txnClient, new TxnSetTimeoutRequest(timeout))).getSuccess();
+ return ((TxnReply.TimeoutSet) doInvoke(txnClient, new TxnRequest.SetTimeout(timeout))).getSuccess();
}
public void start(final Xid xid, final int flags) throws XAException {
- doInvoke(txnClient, new TxnXAStartRequest(xid, flags));
+ doInvoke(txnClient, new TxnRequest.StartXA(xid, flags));
}
}
}
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java 2009-01-15 00:08:49 UTC (rev 4810)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java 2009-01-15 01:31:58 UTC (rev 4811)
@@ -28,8 +28,8 @@
import org.jboss.remoting.Endpoint;
import org.jboss.remoting.Client;
import org.jboss.remoting.CloseHandler;
-import org.jboss.remoting.txn.request.AbstractTxnRequest;
-import org.jboss.remoting.txn.reply.AbstractTxnReply;
+import org.jboss.remoting.txn.TxnRequest;
+import org.jboss.remoting.txn.TxnReply;
import org.jboss.remoting.txn.TransactionalClientSource;
import org.jboss.remoting.txn.TransactionalClient;
import org.jboss.remoting.spi.RequestHandlerSource;
@@ -83,7 +83,7 @@
final RequestHandler requestHandler = handle.getResource();
final Client<I, O> realClient = endpoint.createClient(WrappingRequestHandler.create(executor, requestHandler), requestClass, replyClass);
try {
- final Client<AbstractTxnRequest, AbstractTxnReply> txnClient = endpoint.createClient(requestHandler, AbstractTxnRequest.class, AbstractTxnReply.class);
+ final Client<TxnRequest, TxnReply> txnClient = endpoint.createClient(requestHandler, TxnRequest.class, TxnReply.class);
try {
handle.close();
final TransactionalClientImpl<I, O> transactionalClient = new TransactionalClientImpl<I, O>(realClient, txnClient);
Modified: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java 2009-01-15 00:08:49 UTC (rev 4810)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java 2009-01-15 01:31:58 UTC (rev 4811)
@@ -28,7 +28,7 @@
import org.jboss.remoting.spi.AbstractAutoCloseable;
import org.jboss.remoting.spi.Handle;
import org.jboss.remoting.CloseHandler;
-import org.jboss.remoting.txn.request.TxnWrappedRequest;
+import org.jboss.remoting.txn.TxnRequest;
import org.jboss.xnio.IoUtils;
import java.util.concurrent.Executor;
import java.io.IOException;
@@ -66,6 +66,6 @@
}
public RemoteRequestContext receiveRequest(final Object request, final ReplyHandler replyHandler) {
- return handle.getResource().receiveRequest(new TxnWrappedRequest(request), replyHandler);
+ return handle.getResource().receiveRequest(new TxnRequest.Wrapped(request), replyHandler);
}
}
15 years, 10 months
JBoss Remoting SVN: r4810 - in remoting-txn/trunk/src/main/java/org/jboss/remoting/txn: impl and 2 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-14 19:08:49 -0500 (Wed, 14 Jan 2009)
New Revision: 4810
Added:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/AbstractTxnReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetResourceManagerIdReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetTimeoutReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnPrepareReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnRecoverReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSetTimeoutReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSuccessfulReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/AbstractTxnRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnCommitRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnEndRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnForgetRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetResourceManagerIdRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetTimeoutRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnPrepareRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRecoverRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRequestVisitor.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRollbackRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnSetTimeoutRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnStartRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnWrappedRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXACommitRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXARollbackRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXAStartRequest.java
Removed:
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java
Log:
Organize into packages
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public abstract class AbstractTxnReply {
-
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public abstract class AbstractTxnRequest {
- public abstract <I, O> O accept(TxnRequestVisitor<I, O> visitor, I param);
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,189 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import java.io.IOException;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.Xid;
-
-import org.jboss.xnio.IoFuture;
-import org.jboss.xnio.IoUtils;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.CloseHandler;
-import org.jboss.remoting.RemoteExecutionException;
-
-/**
- *
- */
-public final class TransactionalClientImpl<I, O> implements TransactionalClient<I, O> {
-
- private final Client<I, O> realClient;
- private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
-
- private RemotingXAResource remotingXAResource;
-
- TransactionalClientImpl(final Client<I, O> realClient, final Client<AbstractTxnRequest, AbstractTxnReply> txnClient) throws IOException {
- this.realClient = realClient;
- this.txnClient = txnClient;
- remotingXAResource = new RemotingXAResource(txnClient);
- }
-
- private static XAException xaException(IOException ex) {
- try {
- throw ex;
- } catch (RemoteExecutionException e) {
- try {
- throw e.getCause();
- } catch (XAException xae) {
- return xae;
- } catch (Throwable throwable) {
- final XAException xae = new XAException(XAException.XA_RBPROTO);
- xae.initCause(e);
- return xae;
- }
- } catch (IOException e) {
- final XAException xae = new XAException(XAException.XA_RBPROTO);
- xae.initCause(e);
- return xae;
- }
- }
-
- private static AbstractTxnReply doInvoke(Client<AbstractTxnRequest, AbstractTxnReply> txnClient, AbstractTxnRequest request) throws XAException {
- try {
- return txnClient.invoke(request);
- } catch (IOException e) {
- throw xaException(e);
- }
- }
-
- public void start() throws IOException {
- txnClient.invoke(TxnStartRequest.INSTANCE);
- }
-
- public void commit() throws IOException {
- txnClient.invoke(TxnCommitRequest.INSTANCE);
- }
-
- public void rollback() throws IOException {
- txnClient.invoke(TxnRollbackRequest.INSTANCE);
- }
-
- public XAResource getXaResource() {
- return remotingXAResource;
- }
-
- public O invoke(final I request) throws IOException, CancellationException {
- return realClient.invoke(request);
- }
-
- public IoFuture<? extends O> send(final I request) throws IOException {
- return realClient.send(request);
- }
-
- public ConcurrentMap<Object, Object> getAttributes() {
- return realClient.getAttributes();
- }
-
- public void close() throws IOException {
- try {
- realClient.close();
- txnClient.close();
- } finally {
- IoUtils.safeClose(txnClient);
- }
- }
-
- public Key addCloseHandler(final CloseHandler<? super Client<I, O>> handler) {
- return realClient.addCloseHandler(new CloseHandler<Client<I, O>>() {
- public void handleClose(final Client<I, O> closed) {
- handler.handleClose(TransactionalClientImpl.this);
- }
- });
- }
-
- /**
- *
- */
- public static final class RemotingXAResource implements XAResource {
- private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
- private final IoFuture<? extends TxnGetResourceManagerIdReply> futureIdReply;
-
- public RemotingXAResource(final Client<AbstractTxnRequest, AbstractTxnReply> client) throws IOException {
- txnClient = client;
- futureIdReply = IoUtils.cast(txnClient.send(TxnGetResourceManagerIdRequest.INSTANCE), TxnGetResourceManagerIdReply.class);
- }
-
- public void commit(final Xid xid, final boolean onePhase) throws XAException {
- doInvoke(txnClient, new TxnXACommitRequest(xid, onePhase));
- }
-
- public void end(final Xid xid, final int flags) throws XAException {
- doInvoke(txnClient, new TxnEndRequest(xid, flags));
- }
-
- public void forget(final Xid xid) throws XAException {
- doInvoke(txnClient, new TxnForgetRequest(xid));
- }
-
- public int getTransactionTimeout() throws XAException {
- return ((TxnGetTimeoutReply) doInvoke(txnClient, TxnGetTimeoutRequest.INSTANCE)).getTimeout();
- }
-
- public boolean isSameRM(final XAResource resource) throws XAException {
- if (resource instanceof RemotingXAResource) {
- final RemotingXAResource xaResource = (RemotingXAResource) resource;
- try {
- return futureIdReply.get().getId().equals(xaResource.futureIdReply.get().getId());
- } catch (IOException e) {
- throw xaException(e);
- }
- } else {
- return false;
- }
- }
-
- public int prepare(final Xid xid) throws XAException {
- return ((TxnPrepareReply) doInvoke(txnClient, new TxnPrepareRequest(xid))).getVote();
- }
-
- public Xid[] recover(final int flag) throws XAException {
- return ((TxnRecoverReply) doInvoke(txnClient, new TxnRecoverRequest(flag))).getResources();
- }
-
- public void rollback(final Xid xid) throws XAException {
- doInvoke(txnClient, new TxnXARollbackRequest(xid));
- }
-
- public boolean setTransactionTimeout(final int timeout) throws XAException {
- return ((TxnSetTimeoutReply) doInvoke(txnClient, new TxnSetTimeoutRequest(timeout))).getSuccess();
- }
-
- public void start(final Xid xid, final int flags) throws XAException {
- doInvoke(txnClient, new TxnXAStartRequest(xid, flags));
- }
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import java.io.IOException;
-import java.util.concurrent.Executor;
-import org.jboss.remoting.ClientSource;
-import org.jboss.remoting.Endpoint;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.CloseHandler;
-import org.jboss.remoting.spi.RequestHandlerSource;
-import org.jboss.remoting.spi.Handle;
-import org.jboss.remoting.spi.RequestHandler;
-import org.jboss.remoting.spi.AbstractHandleableCloseable;
-import org.jboss.xnio.IoUtils;
-
-/**
- *
- */
-public final class TransactionalClientSourceImpl<I, O> extends AbstractHandleableCloseable<ClientSource<I, O>> implements TransactionalClientSource<I, O> {
-
- private final Endpoint endpoint;
- private final RequestHandlerSource requestHandlerSource;
- private final Class<I> requestClass;
- private final Class<O> replyClass;
- private volatile Key key;
-
- private TransactionalClientSourceImpl(final Executor executor, final Endpoint endpoint, final RequestHandlerSource requestHandlerSource, final Class<I> requestClass, final Class<O> replyClass) {
- super(executor);
- this.endpoint = endpoint;
- this.requestHandlerSource = requestHandlerSource;
- this.requestClass = requestClass;
- this.replyClass = replyClass;
- }
-
- static <I, O> TransactionalClientSourceImpl<I, O> create(final Executor executor, final Endpoint endpoint, final RequestHandlerSource requestHandlerSource, final Class<I> requestClass, final Class<O> replyClass) {
- final TransactionalClientSourceImpl<I, O> clientSource = new TransactionalClientSourceImpl<I, O>(executor, endpoint, requestHandlerSource, requestClass, replyClass);
- final Key key = requestHandlerSource.addCloseHandler(new CloseHandler<RequestHandlerSource>() {
- public void handleClose(final RequestHandlerSource closed) {
- IoUtils.safeClose(clientSource);
- }
- });
- clientSource.key = key;
- return clientSource;
- }
-
- protected void closeAction() throws IOException {
- final Key key = this.key;
- if (key != null) {
- key.remove();
- this.key = null;
- }
- }
-
- public TransactionalClient<I, O> createClient() throws IOException {
- boolean ok = false;
- final Handle<RequestHandler> handle = requestHandlerSource.createRequestHandler();
- try {
- final RequestHandler requestHandler = handle.getResource();
- final Client<I, O> realClient = endpoint.createClient(WrappingRequestHandler.create(executor, requestHandler), requestClass, replyClass);
- try {
- final Client<AbstractTxnRequest, AbstractTxnReply> txnClient = endpoint.createClient(requestHandler, AbstractTxnRequest.class, AbstractTxnReply.class);
- try {
- handle.close();
- final TransactionalClientImpl<I, O> transactionalClient = new TransactionalClientImpl<I, O>(realClient, txnClient);
- ok = true;
- return transactionalClient;
- } finally {
- if (! ok) IoUtils.safeClose(txnClient);
- }
- } finally {
- if (! ok) IoUtils.safeClose(realClient);
- }
- } finally {
- IoUtils.safeClose(handle);
- }
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnCommitRequest extends AbstractTxnRequest {
- public static final TxnCommitRequest INSTANCE = new TxnCommitRequest();
-
- private TxnCommitRequest() {
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- *
- */
-public final class TxnEndRequest extends AbstractTxnRequest {
-
- public TxnEndRequest(final Xid xid, final int flags) {
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- *
- */
-public final class TxnForgetRequest extends AbstractTxnRequest {
-
- private final Xid xid;
-
- public TxnForgetRequest(final Xid xid) {
- this.xid = xid;
- }
-
- public Xid getXid() {
- return xid;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnGetResourceManagerIdReply extends AbstractTxnReply {
- private final Object id;
-
- public TxnGetResourceManagerIdReply(final Object id) {
- this.id = id;
- }
-
- public Object getId() {
- return id;
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnGetResourceManagerIdRequest extends AbstractTxnRequest {
-
- public static final TxnGetResourceManagerIdRequest INSTANCE = new TxnGetResourceManagerIdRequest();
-
- private TxnGetResourceManagerIdRequest() {
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnGetTimeoutReply extends AbstractTxnReply {
-
- private final int timeout;
-
- public TxnGetTimeoutReply(final int timeout) {
- this.timeout = timeout;
- }
-
- public int getTimeout() {
- return timeout;
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnGetTimeoutRequest extends AbstractTxnRequest {
-
- public static final TxnGetTimeoutRequest INSTANCE = new TxnGetTimeoutRequest();
-
- private TxnGetTimeoutRequest() {
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnPrepareReply extends AbstractTxnReply {
- private final int vote;
-
- public TxnPrepareReply(final int vote) {
- this.vote = vote;
- }
-
- public int getVote() {
- return vote;
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- *
- */
-public final class TxnPrepareRequest extends AbstractTxnRequest {
-
- private final Xid xid;
-
- public TxnPrepareRequest(final Xid xid) {
- this.xid = xid;
- }
-
- public Xid getXid() {
- return xid;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- *
- */
-public final class TxnRecoverReply extends AbstractTxnReply {
-
- private final Xid[] resources;
-
- public TxnRecoverReply(final Xid[] resources) {
- this.resources = resources;
- }
-
- public Xid[] getResources() {
- return resources;
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnRecoverRequest extends AbstractTxnRequest {
-
- private final int flag;
-
- public TxnRecoverRequest(final int flag) {
- this.flag = flag;
- }
-
- public int getFlag() {
- return flag;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public interface TxnRequestVisitor<I, O> {
-
- O visit(TxnXACommitRequest request, I param);
-
- O visit(TxnEndRequest request, I param);
-
- O visit(TxnForgetRequest request, I param);
-
- O visit(TxnGetTimeoutRequest request, I param);
-
- O visit(TxnPrepareRequest request, I param);
-
- O visit(TxnRecoverRequest request, I param);
-
- O visit(TxnXARollbackRequest request, I param);
-
- O visit(TxnSetTimeoutRequest request, I param);
-
- O visit(TxnXAStartRequest request, I param);
-
- O visit(TxnWrappedRequest request, I param);
-
- O visit(TxnGetResourceManagerIdRequest request, I param);
-
- O visit(TxnStartRequest request, I param);
-
- O visit(TxnCommitRequest request, I param);
-
- O visit(TxnRollbackRequest request, I param);
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnRollbackRequest extends AbstractTxnRequest {
-
- public static TxnRollbackRequest INSTANCE = new TxnRollbackRequest();
-
- private TxnRollbackRequest() {
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnSetTimeoutReply extends AbstractTxnReply {
-
- private final boolean success;
-
- public TxnSetTimeoutReply(final boolean success) {
- this.success = success;
- }
-
- public boolean getSuccess() {
- return success;
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnSetTimeoutRequest extends AbstractTxnRequest {
-
- private final int timeout;
-
- public TxnSetTimeoutRequest(final int timeout) {
- this.timeout = timeout;
- }
-
- public int getTimeout() {
- return timeout;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnStartRequest extends AbstractTxnRequest {
-
- public static TxnStartRequest INSTANCE = new TxnStartRequest();
-
- private TxnStartRequest() {
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnSuccessfulReply extends AbstractTxnReply {
- public static final TxnSuccessfulReply INSTANCE = new TxnSuccessfulReply();
-
- private TxnSuccessfulReply() {
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-/**
- *
- */
-public final class TxnWrappedRequest extends AbstractTxnRequest {
-
- private final Object wrappedRequest;
-
- public TxnWrappedRequest(final Object request) {
- wrappedRequest = request;
- }
-
- public Object getWrappedRequest() {
- return wrappedRequest;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- *
- */
-public final class TxnXACommitRequest extends AbstractTxnRequest {
- private final Xid xid;
- private final boolean onePhase;
-
- public TxnXACommitRequest(final Xid xid, final boolean onePhase) {
- this.xid = xid;
- this.onePhase = onePhase;
- }
-
- public Xid getXid() {
- return xid;
- }
-
- public boolean isOnePhase() {
- return onePhase;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- *
- */
-public final class TxnXARollbackRequest extends AbstractTxnRequest {
-
- private final Xid xid;
-
- public TxnXARollbackRequest(final Xid xid) {
- this.xid = xid;
- }
-
- public Xid getXid() {
- return xid;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import javax.transaction.xa.Xid;
-
-/**
- *
- */
-public final class TxnXAStartRequest extends AbstractTxnRequest {
-
- private final Xid xid;
- private final int flags;
-
- public TxnXAStartRequest(final Xid xid, final int flags) {
- this.xid = xid;
- this.flags = flags;
- }
-
- public Xid getXid() {
- return xid;
- }
-
- public int getFlags() {
- return flags;
- }
-
- public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
- return visitor.visit(this, param);
- }
-}
Deleted: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java 2009-01-14 22:57:56 UTC (rev 4809)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.txn;
-
-import org.jboss.remoting.spi.RequestHandler;
-import org.jboss.remoting.spi.RemoteRequestContext;
-import org.jboss.remoting.spi.ReplyHandler;
-import org.jboss.remoting.spi.AbstractAutoCloseable;
-import org.jboss.remoting.spi.Handle;
-import org.jboss.remoting.CloseHandler;
-import org.jboss.xnio.IoUtils;
-import java.util.concurrent.Executor;
-import java.io.IOException;
-
-/**
- *
- */
-public final class WrappingRequestHandler extends AbstractAutoCloseable<RequestHandler> implements RequestHandler {
-
- private final Handle<RequestHandler> handle;
- private volatile Key key;
-
- private WrappingRequestHandler(final Executor executor, final RequestHandler handler) throws IOException {
- super(executor);
- handle = handler.getHandle();
- }
-
- static WrappingRequestHandler create(final Executor executor, final RequestHandler handler) throws IOException {
- final WrappingRequestHandler requestHandler = new WrappingRequestHandler(executor, handler);
- requestHandler.key = requestHandler.handle.addCloseHandler(new CloseHandler<Handle<RequestHandler>>() {
- public void handleClose(final Handle<RequestHandler> closed) {
- IoUtils.safeClose(requestHandler);
- }
- });
- return requestHandler;
- }
-
- protected void closeAction() throws IOException {
- try {
- handle.close();
- } finally {
- key.remove();
- key = null;
- }
- }
-
- public RemoteRequestContext receiveRequest(final Object request, final ReplyHandler replyHandler) {
- return handle.getResource().receiveRequest(new TxnWrappedRequest(request), replyHandler);
- }
-}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientImpl.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.impl;
+
+import java.io.IOException;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
+
+import org.jboss.xnio.IoFuture;
+import org.jboss.xnio.IoUtils;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.CloseHandler;
+import org.jboss.remoting.RemoteExecutionException;
+import org.jboss.remoting.txn.request.TxnEndRequest;
+import org.jboss.remoting.txn.request.TxnRollbackRequest;
+import org.jboss.remoting.txn.request.TxnPrepareRequest;
+import org.jboss.remoting.txn.request.TxnGetResourceManagerIdRequest;
+import org.jboss.remoting.txn.request.TxnGetTimeoutRequest;
+import org.jboss.remoting.txn.request.TxnRecoverRequest;
+import org.jboss.remoting.txn.request.TxnForgetRequest;
+import org.jboss.remoting.txn.request.TxnCommitRequest;
+import org.jboss.remoting.txn.request.AbstractTxnRequest;
+import org.jboss.remoting.txn.request.TxnSetTimeoutRequest;
+import org.jboss.remoting.txn.request.TxnXACommitRequest;
+import org.jboss.remoting.txn.request.TxnXARollbackRequest;
+import org.jboss.remoting.txn.request.TxnXAStartRequest;
+import org.jboss.remoting.txn.request.TxnStartRequest;
+import org.jboss.remoting.txn.reply.AbstractTxnReply;
+import org.jboss.remoting.txn.reply.TxnGetResourceManagerIdReply;
+import org.jboss.remoting.txn.reply.TxnGetTimeoutReply;
+import org.jboss.remoting.txn.reply.TxnPrepareReply;
+import org.jboss.remoting.txn.reply.TxnRecoverReply;
+import org.jboss.remoting.txn.reply.TxnSetTimeoutReply;
+import org.jboss.remoting.txn.TransactionalClient;
+
+/**
+ *
+ */
+public final class TransactionalClientImpl<I, O> implements TransactionalClient<I, O> {
+
+ private final Client<I, O> realClient;
+ private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
+
+ private RemotingXAResource remotingXAResource;
+
+ TransactionalClientImpl(final Client<I, O> realClient, final Client<AbstractTxnRequest, AbstractTxnReply> txnClient) throws IOException {
+ this.realClient = realClient;
+ this.txnClient = txnClient;
+ remotingXAResource = new RemotingXAResource(txnClient);
+ }
+
+ private static XAException xaException(IOException ex) {
+ try {
+ throw ex;
+ } catch (RemoteExecutionException e) {
+ try {
+ throw e.getCause();
+ } catch (XAException xae) {
+ return xae;
+ } catch (Throwable throwable) {
+ final XAException xae = new XAException(XAException.XA_RBPROTO);
+ xae.initCause(e);
+ return xae;
+ }
+ } catch (IOException e) {
+ final XAException xae = new XAException(XAException.XA_RBPROTO);
+ xae.initCause(e);
+ return xae;
+ }
+ }
+
+ private static AbstractTxnReply doInvoke(Client<AbstractTxnRequest, AbstractTxnReply> txnClient, AbstractTxnRequest request) throws XAException {
+ try {
+ return txnClient.invoke(request);
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ }
+
+ public void start() throws IOException {
+ txnClient.invoke(TxnStartRequest.INSTANCE);
+ }
+
+ public void commit() throws IOException {
+ txnClient.invoke(TxnCommitRequest.INSTANCE);
+ }
+
+ public void rollback() throws IOException {
+ txnClient.invoke(TxnRollbackRequest.INSTANCE);
+ }
+
+ public XAResource getXaResource() {
+ return remotingXAResource;
+ }
+
+ public O invoke(final I request) throws IOException, CancellationException {
+ return realClient.invoke(request);
+ }
+
+ public IoFuture<? extends O> send(final I request) throws IOException {
+ return realClient.send(request);
+ }
+
+ public ConcurrentMap<Object, Object> getAttributes() {
+ return realClient.getAttributes();
+ }
+
+ public void close() throws IOException {
+ try {
+ realClient.close();
+ txnClient.close();
+ } finally {
+ IoUtils.safeClose(txnClient);
+ }
+ }
+
+ public Key addCloseHandler(final CloseHandler<? super Client<I, O>> handler) {
+ return realClient.addCloseHandler(new CloseHandler<Client<I, O>>() {
+ public void handleClose(final Client<I, O> closed) {
+ handler.handleClose(TransactionalClientImpl.this);
+ }
+ });
+ }
+
+ /**
+ *
+ */
+ public static final class RemotingXAResource implements XAResource {
+ private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
+ private final IoFuture<? extends TxnGetResourceManagerIdReply> futureIdReply;
+
+ public RemotingXAResource(final Client<AbstractTxnRequest, AbstractTxnReply> client) throws IOException {
+ txnClient = client;
+ futureIdReply = IoUtils.cast(txnClient.send(TxnGetResourceManagerIdRequest.INSTANCE), TxnGetResourceManagerIdReply.class);
+ }
+
+ public void commit(final Xid xid, final boolean onePhase) throws XAException {
+ doInvoke(txnClient, new TxnXACommitRequest(xid, onePhase));
+ }
+
+ public void end(final Xid xid, final int flags) throws XAException {
+ doInvoke(txnClient, new TxnEndRequest(xid, flags));
+ }
+
+ public void forget(final Xid xid) throws XAException {
+ doInvoke(txnClient, new TxnForgetRequest(xid));
+ }
+
+ public int getTransactionTimeout() throws XAException {
+ return ((TxnGetTimeoutReply) doInvoke(txnClient, TxnGetTimeoutRequest.INSTANCE)).getTimeout();
+ }
+
+ public boolean isSameRM(final XAResource resource) throws XAException {
+ if (resource instanceof RemotingXAResource) {
+ final RemotingXAResource xaResource = (RemotingXAResource) resource;
+ try {
+ return futureIdReply.get().getId().equals(xaResource.futureIdReply.get().getId());
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public int prepare(final Xid xid) throws XAException {
+ return ((TxnPrepareReply) doInvoke(txnClient, new TxnPrepareRequest(xid))).getVote();
+ }
+
+ public Xid[] recover(final int flag) throws XAException {
+ return ((TxnRecoverReply) doInvoke(txnClient, new TxnRecoverRequest(flag))).getResources();
+ }
+
+ public void rollback(final Xid xid) throws XAException {
+ doInvoke(txnClient, new TxnXARollbackRequest(xid));
+ }
+
+ public boolean setTransactionTimeout(final int timeout) throws XAException {
+ return ((TxnSetTimeoutReply) doInvoke(txnClient, new TxnSetTimeoutRequest(timeout))).getSuccess();
+ }
+
+ public void start(final Xid xid, final int flags) throws XAException {
+ doInvoke(txnClient, new TxnXAStartRequest(xid, flags));
+ }
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/TransactionalClientSourceImpl.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.impl;
+
+import java.io.IOException;
+import java.util.concurrent.Executor;
+import org.jboss.remoting.ClientSource;
+import org.jboss.remoting.Endpoint;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.CloseHandler;
+import org.jboss.remoting.txn.request.AbstractTxnRequest;
+import org.jboss.remoting.txn.reply.AbstractTxnReply;
+import org.jboss.remoting.txn.TransactionalClientSource;
+import org.jboss.remoting.txn.TransactionalClient;
+import org.jboss.remoting.spi.RequestHandlerSource;
+import org.jboss.remoting.spi.Handle;
+import org.jboss.remoting.spi.RequestHandler;
+import org.jboss.remoting.spi.AbstractHandleableCloseable;
+import org.jboss.xnio.IoUtils;
+
+/**
+ *
+ */
+public final class TransactionalClientSourceImpl<I, O> extends AbstractHandleableCloseable<ClientSource<I, O>> implements TransactionalClientSource<I, O> {
+
+ private final Endpoint endpoint;
+ private final RequestHandlerSource requestHandlerSource;
+ private final Class<I> requestClass;
+ private final Class<O> replyClass;
+ private volatile Key key;
+
+ private TransactionalClientSourceImpl(final Executor executor, final Endpoint endpoint, final RequestHandlerSource requestHandlerSource, final Class<I> requestClass, final Class<O> replyClass) {
+ super(executor);
+ this.endpoint = endpoint;
+ this.requestHandlerSource = requestHandlerSource;
+ this.requestClass = requestClass;
+ this.replyClass = replyClass;
+ }
+
+ static <I, O> TransactionalClientSourceImpl<I, O> create(final Executor executor, final Endpoint endpoint, final RequestHandlerSource requestHandlerSource, final Class<I> requestClass, final Class<O> replyClass) {
+ final TransactionalClientSourceImpl<I, O> clientSource = new TransactionalClientSourceImpl<I, O>(executor, endpoint, requestHandlerSource, requestClass, replyClass);
+ final Key key = requestHandlerSource.addCloseHandler(new CloseHandler<RequestHandlerSource>() {
+ public void handleClose(final RequestHandlerSource closed) {
+ IoUtils.safeClose(clientSource);
+ }
+ });
+ clientSource.key = key;
+ return clientSource;
+ }
+
+ protected void closeAction() throws IOException {
+ final Key key = this.key;
+ if (key != null) {
+ key.remove();
+ this.key = null;
+ }
+ }
+
+ public TransactionalClient<I, O> createClient() throws IOException {
+ boolean ok = false;
+ final Handle<RequestHandler> handle = requestHandlerSource.createRequestHandler();
+ try {
+ final RequestHandler requestHandler = handle.getResource();
+ final Client<I, O> realClient = endpoint.createClient(WrappingRequestHandler.create(executor, requestHandler), requestClass, replyClass);
+ try {
+ final Client<AbstractTxnRequest, AbstractTxnReply> txnClient = endpoint.createClient(requestHandler, AbstractTxnRequest.class, AbstractTxnReply.class);
+ try {
+ handle.close();
+ final TransactionalClientImpl<I, O> transactionalClient = new TransactionalClientImpl<I, O>(realClient, txnClient);
+ ok = true;
+ return transactionalClient;
+ } finally {
+ if (! ok) IoUtils.safeClose(txnClient);
+ }
+ } finally {
+ if (! ok) IoUtils.safeClose(realClient);
+ }
+ } finally {
+ IoUtils.safeClose(handle);
+ }
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/impl/WrappingRequestHandler.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.impl;
+
+import org.jboss.remoting.spi.RequestHandler;
+import org.jboss.remoting.spi.RemoteRequestContext;
+import org.jboss.remoting.spi.ReplyHandler;
+import org.jboss.remoting.spi.AbstractAutoCloseable;
+import org.jboss.remoting.spi.Handle;
+import org.jboss.remoting.CloseHandler;
+import org.jboss.remoting.txn.request.TxnWrappedRequest;
+import org.jboss.xnio.IoUtils;
+import java.util.concurrent.Executor;
+import java.io.IOException;
+
+/**
+ *
+ */
+public final class WrappingRequestHandler extends AbstractAutoCloseable<RequestHandler> implements RequestHandler {
+
+ private final Handle<RequestHandler> handle;
+ private volatile Key key;
+
+ private WrappingRequestHandler(final Executor executor, final RequestHandler handler) throws IOException {
+ super(executor);
+ handle = handler.getHandle();
+ }
+
+ static WrappingRequestHandler create(final Executor executor, final RequestHandler handler) throws IOException {
+ final WrappingRequestHandler requestHandler = new WrappingRequestHandler(executor, handler);
+ requestHandler.key = requestHandler.handle.addCloseHandler(new CloseHandler<Handle<RequestHandler>>() {
+ public void handleClose(final Handle<RequestHandler> closed) {
+ IoUtils.safeClose(requestHandler);
+ }
+ });
+ return requestHandler;
+ }
+
+ protected void closeAction() throws IOException {
+ try {
+ handle.close();
+ } finally {
+ key.remove();
+ key = null;
+ }
+ }
+
+ public RemoteRequestContext receiveRequest(final Object request, final ReplyHandler replyHandler) {
+ return handle.getResource().receiveRequest(new TxnWrappedRequest(request), replyHandler);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/AbstractTxnReply.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/AbstractTxnReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/AbstractTxnReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.reply;
+
+/**
+ *
+ */
+public abstract class AbstractTxnReply {
+
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetResourceManagerIdReply.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetResourceManagerIdReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetResourceManagerIdReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.reply;
+
+/**
+ *
+ */
+public final class TxnGetResourceManagerIdReply extends AbstractTxnReply {
+ private final Object id;
+
+ public TxnGetResourceManagerIdReply(final Object id) {
+ this.id = id;
+ }
+
+ public Object getId() {
+ return id;
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetTimeoutReply.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetTimeoutReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnGetTimeoutReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.reply;
+
+/**
+ *
+ */
+public final class TxnGetTimeoutReply extends AbstractTxnReply {
+
+ private final int timeout;
+
+ public TxnGetTimeoutReply(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnPrepareReply.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnPrepareReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnPrepareReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.reply;
+
+/**
+ *
+ */
+public final class TxnPrepareReply extends AbstractTxnReply {
+ private final int vote;
+
+ public TxnPrepareReply(final int vote) {
+ this.vote = vote;
+ }
+
+ public int getVote() {
+ return vote;
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnRecoverReply.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnRecoverReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnRecoverReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.reply;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnRecoverReply extends AbstractTxnReply {
+
+ private final Xid[] resources;
+
+ public TxnRecoverReply(final Xid[] resources) {
+ this.resources = resources;
+ }
+
+ public Xid[] getResources() {
+ return resources;
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSetTimeoutReply.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSetTimeoutReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSetTimeoutReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.reply;
+
+/**
+ *
+ */
+public final class TxnSetTimeoutReply extends AbstractTxnReply {
+
+ private final boolean success;
+
+ public TxnSetTimeoutReply(final boolean success) {
+ this.success = success;
+ }
+
+ public boolean getSuccess() {
+ return success;
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSuccessfulReply.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSuccessfulReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/reply/TxnSuccessfulReply.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.reply;
+
+/**
+ *
+ */
+public final class TxnSuccessfulReply extends AbstractTxnReply {
+ public static final TxnSuccessfulReply INSTANCE = new TxnSuccessfulReply();
+
+ private TxnSuccessfulReply() {
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/AbstractTxnRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/AbstractTxnRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/AbstractTxnRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public abstract class AbstractTxnRequest {
+ public abstract <I, O> O accept(TxnRequestVisitor<I, O> visitor, I param);
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnCommitRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnCommitRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnCommitRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public final class TxnCommitRequest extends AbstractTxnRequest {
+ public static final TxnCommitRequest INSTANCE = new TxnCommitRequest();
+
+ private TxnCommitRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnEndRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnEndRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnEndRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnEndRequest extends AbstractTxnRequest {
+
+ public TxnEndRequest(final Xid xid, final int flags) {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnForgetRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnForgetRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnForgetRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnForgetRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+
+ public TxnForgetRequest(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetResourceManagerIdRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetResourceManagerIdRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetResourceManagerIdRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public final class TxnGetResourceManagerIdRequest extends AbstractTxnRequest {
+
+ public static final TxnGetResourceManagerIdRequest INSTANCE = new TxnGetResourceManagerIdRequest();
+
+ private TxnGetResourceManagerIdRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetTimeoutRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetTimeoutRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnGetTimeoutRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public final class TxnGetTimeoutRequest extends AbstractTxnRequest {
+
+ public static final TxnGetTimeoutRequest INSTANCE = new TxnGetTimeoutRequest();
+
+ private TxnGetTimeoutRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnPrepareRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnPrepareRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnPrepareRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnPrepareRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+
+ public TxnPrepareRequest(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRecoverRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRecoverRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRecoverRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public final class TxnRecoverRequest extends AbstractTxnRequest {
+
+ private final int flag;
+
+ public TxnRecoverRequest(final int flag) {
+ this.flag = flag;
+ }
+
+ public int getFlag() {
+ return flag;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRequestVisitor.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRequestVisitor.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRequestVisitor.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import org.jboss.remoting.txn.request.TxnStartRequest;
+
+/**
+ *
+ */
+public interface TxnRequestVisitor<I, O> {
+
+ O visit(TxnXACommitRequest request, I param);
+
+ O visit(TxnEndRequest request, I param);
+
+ O visit(TxnForgetRequest request, I param);
+
+ O visit(TxnGetTimeoutRequest request, I param);
+
+ O visit(TxnPrepareRequest request, I param);
+
+ O visit(TxnRecoverRequest request, I param);
+
+ O visit(TxnXARollbackRequest request, I param);
+
+ O visit(TxnSetTimeoutRequest request, I param);
+
+ O visit(TxnXAStartRequest request, I param);
+
+ O visit(TxnWrappedRequest request, I param);
+
+ O visit(TxnGetResourceManagerIdRequest request, I param);
+
+ O visit(TxnStartRequest request, I param);
+
+ O visit(TxnCommitRequest request, I param);
+
+ O visit(TxnRollbackRequest request, I param);
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRollbackRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRollbackRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnRollbackRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public final class TxnRollbackRequest extends AbstractTxnRequest {
+
+ public static TxnRollbackRequest INSTANCE = new TxnRollbackRequest();
+
+ private TxnRollbackRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnSetTimeoutRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnSetTimeoutRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnSetTimeoutRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public final class TxnSetTimeoutRequest extends AbstractTxnRequest {
+
+ private final int timeout;
+
+ public TxnSetTimeoutRequest(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnStartRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnStartRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnStartRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import org.jboss.remoting.txn.request.TxnRequestVisitor;
+import org.jboss.remoting.txn.request.AbstractTxnRequest;
+
+/**
+ *
+ */
+public final class TxnStartRequest extends AbstractTxnRequest {
+
+ public static TxnStartRequest INSTANCE = new TxnStartRequest();
+
+ private TxnStartRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnWrappedRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnWrappedRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnWrappedRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+/**
+ *
+ */
+public final class TxnWrappedRequest extends AbstractTxnRequest {
+
+ private final Object wrappedRequest;
+
+ public TxnWrappedRequest(final Object request) {
+ wrappedRequest = request;
+ }
+
+ public Object getWrappedRequest() {
+ return wrappedRequest;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXACommitRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXACommitRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXACommitRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnXACommitRequest extends AbstractTxnRequest {
+ private final Xid xid;
+ private final boolean onePhase;
+
+ public TxnXACommitRequest(final Xid xid, final boolean onePhase) {
+ this.xid = xid;
+ this.onePhase = onePhase;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public boolean isOnePhase() {
+ return onePhase;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXARollbackRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXARollbackRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXARollbackRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnXARollbackRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+
+ public TxnXARollbackRequest(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Copied: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXAStartRequest.java (from rev 4809, remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java)
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXAStartRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/request/TxnXAStartRequest.java 2009-01-15 00:08:49 UTC (rev 4810)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn.request;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnXAStartRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+ private final int flags;
+
+ public TxnXAStartRequest(final Xid xid, final int flags) {
+ this.xid = xid;
+ this.flags = flags;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
15 years, 10 months
JBoss Remoting SVN: r4809 - in remoting-txn/trunk: src and 6 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2009-01-14 17:57:56 -0500 (Wed, 14 Jan 2009)
New Revision: 4809
Added:
remoting-txn/trunk/src/
remoting-txn/trunk/src/main/
remoting-txn/trunk/src/main/java/
remoting-txn/trunk/src/main/java/org/
remoting-txn/trunk/src/main/java/org/jboss/
remoting-txn/trunk/src/main/java/org/jboss/remoting/
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java
remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java
Log:
Initial import of remoting-txn
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnReply.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public abstract class AbstractTxnReply {
+
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/AbstractTxnRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public abstract class AbstractTxnRequest {
+ public abstract <I, O> O accept(TxnRequestVisitor<I, O> visitor, I param);
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClient.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import org.jboss.remoting.Client;
+
+import javax.transaction.xa.XAResource;
+
+import java.io.IOException;
+
+/**
+ *
+ */
+public interface TransactionalClient<I, O> extends Client<I, O> {
+ void start() throws IOException;
+
+ void commit() throws IOException;
+
+ void rollback() throws IOException;
+
+ XAResource getXaResource();
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientImpl.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import java.io.IOException;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
+
+import org.jboss.xnio.IoFuture;
+import org.jboss.xnio.IoUtils;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.CloseHandler;
+import org.jboss.remoting.RemoteExecutionException;
+
+/**
+ *
+ */
+public final class TransactionalClientImpl<I, O> implements TransactionalClient<I, O> {
+
+ private final Client<I, O> realClient;
+ private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
+
+ private RemotingXAResource remotingXAResource;
+
+ TransactionalClientImpl(final Client<I, O> realClient, final Client<AbstractTxnRequest, AbstractTxnReply> txnClient) throws IOException {
+ this.realClient = realClient;
+ this.txnClient = txnClient;
+ remotingXAResource = new RemotingXAResource(txnClient);
+ }
+
+ private static XAException xaException(IOException ex) {
+ try {
+ throw ex;
+ } catch (RemoteExecutionException e) {
+ try {
+ throw e.getCause();
+ } catch (XAException xae) {
+ return xae;
+ } catch (Throwable throwable) {
+ final XAException xae = new XAException(XAException.XA_RBPROTO);
+ xae.initCause(e);
+ return xae;
+ }
+ } catch (IOException e) {
+ final XAException xae = new XAException(XAException.XA_RBPROTO);
+ xae.initCause(e);
+ return xae;
+ }
+ }
+
+ private static AbstractTxnReply doInvoke(Client<AbstractTxnRequest, AbstractTxnReply> txnClient, AbstractTxnRequest request) throws XAException {
+ try {
+ return txnClient.invoke(request);
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ }
+
+ public void start() throws IOException {
+ txnClient.invoke(TxnStartRequest.INSTANCE);
+ }
+
+ public void commit() throws IOException {
+ txnClient.invoke(TxnCommitRequest.INSTANCE);
+ }
+
+ public void rollback() throws IOException {
+ txnClient.invoke(TxnRollbackRequest.INSTANCE);
+ }
+
+ public XAResource getXaResource() {
+ return remotingXAResource;
+ }
+
+ public O invoke(final I request) throws IOException, CancellationException {
+ return realClient.invoke(request);
+ }
+
+ public IoFuture<? extends O> send(final I request) throws IOException {
+ return realClient.send(request);
+ }
+
+ public ConcurrentMap<Object, Object> getAttributes() {
+ return realClient.getAttributes();
+ }
+
+ public void close() throws IOException {
+ try {
+ realClient.close();
+ txnClient.close();
+ } finally {
+ IoUtils.safeClose(txnClient);
+ }
+ }
+
+ public Key addCloseHandler(final CloseHandler<? super Client<I, O>> handler) {
+ return realClient.addCloseHandler(new CloseHandler<Client<I, O>>() {
+ public void handleClose(final Client<I, O> closed) {
+ handler.handleClose(TransactionalClientImpl.this);
+ }
+ });
+ }
+
+ /**
+ *
+ */
+ public static final class RemotingXAResource implements XAResource {
+ private final Client<AbstractTxnRequest, AbstractTxnReply> txnClient;
+ private final IoFuture<? extends TxnGetResourceManagerIdReply> futureIdReply;
+
+ public RemotingXAResource(final Client<AbstractTxnRequest, AbstractTxnReply> client) throws IOException {
+ txnClient = client;
+ futureIdReply = IoUtils.cast(txnClient.send(TxnGetResourceManagerIdRequest.INSTANCE), TxnGetResourceManagerIdReply.class);
+ }
+
+ public void commit(final Xid xid, final boolean onePhase) throws XAException {
+ doInvoke(txnClient, new TxnXACommitRequest(xid, onePhase));
+ }
+
+ public void end(final Xid xid, final int flags) throws XAException {
+ doInvoke(txnClient, new TxnEndRequest(xid, flags));
+ }
+
+ public void forget(final Xid xid) throws XAException {
+ doInvoke(txnClient, new TxnForgetRequest(xid));
+ }
+
+ public int getTransactionTimeout() throws XAException {
+ return ((TxnGetTimeoutReply) doInvoke(txnClient, TxnGetTimeoutRequest.INSTANCE)).getTimeout();
+ }
+
+ public boolean isSameRM(final XAResource resource) throws XAException {
+ if (resource instanceof RemotingXAResource) {
+ final RemotingXAResource xaResource = (RemotingXAResource) resource;
+ try {
+ return futureIdReply.get().getId().equals(xaResource.futureIdReply.get().getId());
+ } catch (IOException e) {
+ throw xaException(e);
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public int prepare(final Xid xid) throws XAException {
+ return ((TxnPrepareReply) doInvoke(txnClient, new TxnPrepareRequest(xid))).getVote();
+ }
+
+ public Xid[] recover(final int flag) throws XAException {
+ return ((TxnRecoverReply) doInvoke(txnClient, new TxnRecoverRequest(flag))).getResources();
+ }
+
+ public void rollback(final Xid xid) throws XAException {
+ doInvoke(txnClient, new TxnXARollbackRequest(xid));
+ }
+
+ public boolean setTransactionTimeout(final int timeout) throws XAException {
+ return ((TxnSetTimeoutReply) doInvoke(txnClient, new TxnSetTimeoutRequest(timeout))).getSuccess();
+ }
+
+ public void start(final Xid xid, final int flags) throws XAException {
+ doInvoke(txnClient, new TxnXAStartRequest(xid, flags));
+ }
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSource.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import org.jboss.remoting.ClientSource;
+import java.io.IOException;
+
+/**
+ *
+ */
+public interface TransactionalClientSource<I, O> extends ClientSource<I, O> {
+
+ TransactionalClient<I, O> createClient() throws IOException;
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TransactionalClientSourceImpl.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import java.io.IOException;
+import java.util.concurrent.Executor;
+import org.jboss.remoting.ClientSource;
+import org.jboss.remoting.Endpoint;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.CloseHandler;
+import org.jboss.remoting.spi.RequestHandlerSource;
+import org.jboss.remoting.spi.Handle;
+import org.jboss.remoting.spi.RequestHandler;
+import org.jboss.remoting.spi.AbstractHandleableCloseable;
+import org.jboss.xnio.IoUtils;
+
+/**
+ *
+ */
+public final class TransactionalClientSourceImpl<I, O> extends AbstractHandleableCloseable<ClientSource<I, O>> implements TransactionalClientSource<I, O> {
+
+ private final Endpoint endpoint;
+ private final RequestHandlerSource requestHandlerSource;
+ private final Class<I> requestClass;
+ private final Class<O> replyClass;
+ private volatile Key key;
+
+ private TransactionalClientSourceImpl(final Executor executor, final Endpoint endpoint, final RequestHandlerSource requestHandlerSource, final Class<I> requestClass, final Class<O> replyClass) {
+ super(executor);
+ this.endpoint = endpoint;
+ this.requestHandlerSource = requestHandlerSource;
+ this.requestClass = requestClass;
+ this.replyClass = replyClass;
+ }
+
+ static <I, O> TransactionalClientSourceImpl<I, O> create(final Executor executor, final Endpoint endpoint, final RequestHandlerSource requestHandlerSource, final Class<I> requestClass, final Class<O> replyClass) {
+ final TransactionalClientSourceImpl<I, O> clientSource = new TransactionalClientSourceImpl<I, O>(executor, endpoint, requestHandlerSource, requestClass, replyClass);
+ final Key key = requestHandlerSource.addCloseHandler(new CloseHandler<RequestHandlerSource>() {
+ public void handleClose(final RequestHandlerSource closed) {
+ IoUtils.safeClose(clientSource);
+ }
+ });
+ clientSource.key = key;
+ return clientSource;
+ }
+
+ protected void closeAction() throws IOException {
+ final Key key = this.key;
+ if (key != null) {
+ key.remove();
+ this.key = null;
+ }
+ }
+
+ public TransactionalClient<I, O> createClient() throws IOException {
+ boolean ok = false;
+ final Handle<RequestHandler> handle = requestHandlerSource.createRequestHandler();
+ try {
+ final RequestHandler requestHandler = handle.getResource();
+ final Client<I, O> realClient = endpoint.createClient(WrappingRequestHandler.create(executor, requestHandler), requestClass, replyClass);
+ try {
+ final Client<AbstractTxnRequest, AbstractTxnReply> txnClient = endpoint.createClient(requestHandler, AbstractTxnRequest.class, AbstractTxnReply.class);
+ try {
+ handle.close();
+ final TransactionalClientImpl<I, O> transactionalClient = new TransactionalClientImpl<I, O>(realClient, txnClient);
+ ok = true;
+ return transactionalClient;
+ } finally {
+ if (! ok) IoUtils.safeClose(txnClient);
+ }
+ } finally {
+ if (! ok) IoUtils.safeClose(realClient);
+ }
+ } finally {
+ IoUtils.safeClose(handle);
+ }
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnCommitRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnCommitRequest extends AbstractTxnRequest {
+ public static final TxnCommitRequest INSTANCE = new TxnCommitRequest();
+
+ private TxnCommitRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnEndRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnEndRequest extends AbstractTxnRequest {
+
+ public TxnEndRequest(final Xid xid, final int flags) {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnForgetRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnForgetRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+
+ public TxnForgetRequest(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdReply.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnGetResourceManagerIdReply extends AbstractTxnReply {
+ private final Object id;
+
+ public TxnGetResourceManagerIdReply(final Object id) {
+ this.id = id;
+ }
+
+ public Object getId() {
+ return id;
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetResourceManagerIdRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnGetResourceManagerIdRequest extends AbstractTxnRequest {
+
+ public static final TxnGetResourceManagerIdRequest INSTANCE = new TxnGetResourceManagerIdRequest();
+
+ private TxnGetResourceManagerIdRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutReply.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnGetTimeoutReply extends AbstractTxnReply {
+
+ private final int timeout;
+
+ public TxnGetTimeoutReply(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnGetTimeoutRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnGetTimeoutRequest extends AbstractTxnRequest {
+
+ public static final TxnGetTimeoutRequest INSTANCE = new TxnGetTimeoutRequest();
+
+ private TxnGetTimeoutRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareReply.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnPrepareReply extends AbstractTxnReply {
+ private final int vote;
+
+ public TxnPrepareReply(final int vote) {
+ this.vote = vote;
+ }
+
+ public int getVote() {
+ return vote;
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnPrepareRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnPrepareRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+
+ public TxnPrepareRequest(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverReply.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnRecoverReply extends AbstractTxnReply {
+
+ private final Xid[] resources;
+
+ public TxnRecoverReply(final Xid[] resources) {
+ this.resources = resources;
+ }
+
+ public Xid[] getResources() {
+ return resources;
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRecoverRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnRecoverRequest extends AbstractTxnRequest {
+
+ private final int flag;
+
+ public TxnRecoverRequest(final int flag) {
+ this.flag = flag;
+ }
+
+ public int getFlag() {
+ return flag;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRequestVisitor.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public interface TxnRequestVisitor<I, O> {
+
+ O visit(TxnXACommitRequest request, I param);
+
+ O visit(TxnEndRequest request, I param);
+
+ O visit(TxnForgetRequest request, I param);
+
+ O visit(TxnGetTimeoutRequest request, I param);
+
+ O visit(TxnPrepareRequest request, I param);
+
+ O visit(TxnRecoverRequest request, I param);
+
+ O visit(TxnXARollbackRequest request, I param);
+
+ O visit(TxnSetTimeoutRequest request, I param);
+
+ O visit(TxnXAStartRequest request, I param);
+
+ O visit(TxnWrappedRequest request, I param);
+
+ O visit(TxnGetResourceManagerIdRequest request, I param);
+
+ O visit(TxnStartRequest request, I param);
+
+ O visit(TxnCommitRequest request, I param);
+
+ O visit(TxnRollbackRequest request, I param);
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnRollbackRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnRollbackRequest extends AbstractTxnRequest {
+
+ public static TxnRollbackRequest INSTANCE = new TxnRollbackRequest();
+
+ private TxnRollbackRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutReply.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnSetTimeoutReply extends AbstractTxnReply {
+
+ private final boolean success;
+
+ public TxnSetTimeoutReply(final boolean success) {
+ this.success = success;
+ }
+
+ public boolean getSuccess() {
+ return success;
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSetTimeoutRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnSetTimeoutRequest extends AbstractTxnRequest {
+
+ private final int timeout;
+
+ public TxnSetTimeoutRequest(final int timeout) {
+ this.timeout = timeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnStartRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnStartRequest extends AbstractTxnRequest {
+
+ public static TxnStartRequest INSTANCE = new TxnStartRequest();
+
+ private TxnStartRequest() {
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnSuccessfulReply.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnSuccessfulReply extends AbstractTxnReply {
+ public static final TxnSuccessfulReply INSTANCE = new TxnSuccessfulReply();
+
+ private TxnSuccessfulReply() {
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnWrappedRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+/**
+ *
+ */
+public final class TxnWrappedRequest extends AbstractTxnRequest {
+
+ private final Object wrappedRequest;
+
+ public TxnWrappedRequest(final Object request) {
+ wrappedRequest = request;
+ }
+
+ public Object getWrappedRequest() {
+ return wrappedRequest;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXACommitRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnXACommitRequest extends AbstractTxnRequest {
+ private final Xid xid;
+ private final boolean onePhase;
+
+ public TxnXACommitRequest(final Xid xid, final boolean onePhase) {
+ this.xid = xid;
+ this.onePhase = onePhase;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public boolean isOnePhase() {
+ return onePhase;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXARollbackRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnXARollbackRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+
+ public TxnXARollbackRequest(final Xid xid) {
+ this.xid = xid;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/TxnXAStartRequest.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import javax.transaction.xa.Xid;
+
+/**
+ *
+ */
+public final class TxnXAStartRequest extends AbstractTxnRequest {
+
+ private final Xid xid;
+ private final int flags;
+
+ public TxnXAStartRequest(final Xid xid, final int flags) {
+ this.xid = xid;
+ this.flags = flags;
+ }
+
+ public Xid getXid() {
+ return xid;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public <I, O> O accept(final TxnRequestVisitor<I, O> visitor, final I param) {
+ return visitor.visit(this, param);
+ }
+}
Added: remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java
===================================================================
--- remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java (rev 0)
+++ remoting-txn/trunk/src/main/java/org/jboss/remoting/txn/WrappingRequestHandler.java 2009-01-14 22:57:56 UTC (rev 4809)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.txn;
+
+import org.jboss.remoting.spi.RequestHandler;
+import org.jboss.remoting.spi.RemoteRequestContext;
+import org.jboss.remoting.spi.ReplyHandler;
+import org.jboss.remoting.spi.AbstractAutoCloseable;
+import org.jboss.remoting.spi.Handle;
+import org.jboss.remoting.CloseHandler;
+import org.jboss.xnio.IoUtils;
+import java.util.concurrent.Executor;
+import java.io.IOException;
+
+/**
+ *
+ */
+public final class WrappingRequestHandler extends AbstractAutoCloseable<RequestHandler> implements RequestHandler {
+
+ private final Handle<RequestHandler> handle;
+ private volatile Key key;
+
+ private WrappingRequestHandler(final Executor executor, final RequestHandler handler) throws IOException {
+ super(executor);
+ handle = handler.getHandle();
+ }
+
+ static WrappingRequestHandler create(final Executor executor, final RequestHandler handler) throws IOException {
+ final WrappingRequestHandler requestHandler = new WrappingRequestHandler(executor, handler);
+ requestHandler.key = requestHandler.handle.addCloseHandler(new CloseHandler<Handle<RequestHandler>>() {
+ public void handleClose(final Handle<RequestHandler> closed) {
+ IoUtils.safeClose(requestHandler);
+ }
+ });
+ return requestHandler;
+ }
+
+ protected void closeAction() throws IOException {
+ try {
+ handle.close();
+ } finally {
+ key.remove();
+ key = null;
+ }
+ }
+
+ public RemoteRequestContext receiveRequest(final Object request, final ReplyHandler replyHandler) {
+ return handle.getResource().receiveRequest(new TxnWrappedRequest(request), replyHandler);
+ }
+}
15 years, 10 months