JBoss EJB client 1.0.3.Final

org.jboss.ejb.client.remoting
Class RemotingConnectionEJBReceiver

java.lang.Object
  extended by org.jboss.ejb.client.Attachable
      extended by org.jboss.ejb.client.EJBReceiver
          extended by org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver

public final class RemotingConnectionEJBReceiver
extends EJBReceiver

A EJBReceiver which uses JBoss Remoting to communicate with the server for EJB invocations

Author:
David M. Lloyd

Constructor Summary
RemotingConnectionEJBReceiver(org.jboss.remoting3.Connection connection)
          Construct a new instance.
RemotingConnectionEJBReceiver(org.jboss.remoting3.Connection connection, ReconnectHandler reconnectHandler, org.xnio.OptionMap channelCreationOptions)
          Construct a new instance.
 
Method Summary
 void associate(EJBReceiverContext context)
          Handle the association of this EJB receiver with the EJB client context.
protected  void beforeCompletion(EJBReceiverContext receiverContext, TransactionID transactionID)
          The before-completion hook.
 boolean exists(String appName, String moduleName, String distinctName, String beanName)
          Verify the existence of a remote EJB.
protected
<T> StatefulEJBLocator<T>
openSession(EJBReceiverContext receiverContext, Class<T> viewType, String appName, String moduleName, String distinctName, String beanName)
          Creates a session for a stateful session bean represented by the passed app name, module name, distinct name and bean name combination.
 void processInvocation(EJBClientInvocationContext clientInvocationContext, EJBReceiverInvocationContext ejbReceiverInvocationContext)
          Process the invocation.
protected  void sendCommit(EJBReceiverContext receiverContext, TransactionID transactionID, boolean onePhase)
          Send a transaction-commit message for the given transaction ID.
protected  void sendForget(EJBReceiverContext receiverContext, TransactionID transactionID)
          Send a transaction-forget message for the given transaction ID.
protected  int sendPrepare(EJBReceiverContext receiverContext, TransactionID transactionID)
          Send a transaction-prepare message for the given transaction ID.
protected  void sendRollback(EJBReceiverContext receiverContext, TransactionID transactionID)
          Send a transaction-rollback message for the given transaction ID.
 String toString()
           
 
Methods inherited from class org.jboss.ejb.client.EJBReceiver
cancelInvocation, deregisterModule, getNodeName, registerModule
 
Methods inherited from class org.jboss.ejb.client.Attachable
getAttachment, putAttachment, putAttachmentIfAbsent, removeAttachment, removeAttachment, replaceAttachment, replaceAttachment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemotingConnectionEJBReceiver

public RemotingConnectionEJBReceiver(org.jboss.remoting3.Connection connection)
Construct a new instance.

Parameters:
connection - the connection to associate with

RemotingConnectionEJBReceiver

public RemotingConnectionEJBReceiver(org.jboss.remoting3.Connection connection,
                                     ReconnectHandler reconnectHandler,
                                     org.xnio.OptionMap channelCreationOptions)
Construct a new instance.

Parameters:
connection - the connection to associate with
reconnectHandler - The ReconnectHandler to use when the connection breaks
channelCreationOptions - The options to be used during channel creation
Method Detail

associate

public void associate(EJBReceiverContext context)
Description copied from class: EJBReceiver
Handle the association of this EJB receiver with the EJB client context. After this method is called, the EJB receiver should notify the EJB receiver context of the available module identifiers that it can service, and it should maintain that availability list for the life of the receiver association.

Specified by:
associate in class EJBReceiver
Parameters:
context - the receiver context

processInvocation

public void processInvocation(EJBClientInvocationContext clientInvocationContext,
                              EJBReceiverInvocationContext ejbReceiverInvocationContext)
                       throws Exception
Description copied from class: EJBReceiver
Process the invocation. Implementations of this method should always execute the operation asynchronously. The operation result should be passed in to the receiver invocation context. To ensure ideal GC behavior, the receiver should discard any reference to the invocation context(s) once the result producer has been set.

Specified by:
processInvocation in class EJBReceiver
Parameters:
clientInvocationContext - the interceptor clientInvocationContext
ejbReceiverInvocationContext - The EJB receiver invocation context
Throws:
Exception - if the operation throws an exception

openSession

protected <T> StatefulEJBLocator<T> openSession(EJBReceiverContext receiverContext,
                                                Class<T> viewType,
                                                String appName,
                                                String moduleName,
                                                String distinctName,
                                                String beanName)
                                     throws IllegalArgumentException
Description copied from class: EJBReceiver
Creates a session for a stateful session bean represented by the passed app name, module name, distinct name and bean name combination. Returns a StatefulEJBLocator representing the newly created session.

Specified by:
openSession in class EJBReceiver
Parameters:
receiverContext - The receiver context
viewType - View class
appName - The application name
moduleName - The module name
distinctName - The distinct name
beanName - The name of the bean
Returns:
Throws:
IllegalArgumentException - If the session creation request is made for a bean which is not a stateful session bean.

exists

public boolean exists(String appName,
                      String moduleName,
                      String distinctName,
                      String beanName)
Description copied from class: EJBReceiver
Verify the existence of a remote EJB. Returns true if a bean identified by the passed appname, module name, distinct name and bean name combination exists. Else returns false.

Specified by:
exists in class EJBReceiver
Parameters:
appName - The application name
moduleName - The module name
distinctName - The distinct name
beanName - The bean name

sendCommit

protected void sendCommit(EJBReceiverContext receiverContext,
                          TransactionID transactionID,
                          boolean onePhase)
                   throws XAException
Description copied from class: EJBReceiver
Send a transaction-commit message for the given transaction ID.

Overrides:
sendCommit in class EJBReceiver
Parameters:
receiverContext - the receiver context
transactionID - the transaction ID
onePhase - true to perform a one-phase commit
Throws:
XAException - if the transaction commit failed

sendRollback

protected void sendRollback(EJBReceiverContext receiverContext,
                            TransactionID transactionID)
                     throws XAException
Description copied from class: EJBReceiver
Send a transaction-rollback message for the given transaction ID.

Overrides:
sendRollback in class EJBReceiver
Parameters:
receiverContext - the receiver context
transactionID - the transaction ID
Throws:
XAException - if the transaction rollback failed

sendPrepare

protected int sendPrepare(EJBReceiverContext receiverContext,
                          TransactionID transactionID)
                   throws XAException
Description copied from class: EJBReceiver
Send a transaction-prepare message for the given transaction ID.

Overrides:
sendPrepare in class EJBReceiver
Parameters:
receiverContext - the receiver context
transactionID - the transaction ID
Returns:
a value indicating the resource manager's vote on the outcome of the transaction; the possible values are: XA_RDONLY or XA_OK
Throws:
XAException - to roll back the transaction

sendForget

protected void sendForget(EJBReceiverContext receiverContext,
                          TransactionID transactionID)
                   throws XAException
Description copied from class: EJBReceiver
Send a transaction-forget message for the given transaction ID.

Overrides:
sendForget in class EJBReceiver
Parameters:
receiverContext - the receiver context
transactionID - the transaction ID
Throws:
XAException - if the forget message failed

beforeCompletion

protected void beforeCompletion(EJBReceiverContext receiverContext,
                                TransactionID transactionID)
Description copied from class: EJBReceiver
The before-completion hook. Cause all connected subordinate transaction managers to invoke their beforeCompletion methods. This method should not return until all remote beforeCompletions have been called.

Overrides:
beforeCompletion in class EJBReceiver
Parameters:
receiverContext - the receiver context
transactionID - the transaction ID

toString

public String toString()
Overrides:
toString in class Object

JBoss EJB client 1.0.3.Final

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.