Class EJBReceiver


  • public abstract class EJBReceiver
    extends Attachable
    A receiver for Enterprise Beans invocations. Receivers can be associated with one or more client contexts. This interface is implemented by providers for Enterprise Beans invocation services.
    Author:
    David M. Lloyd
    • Constructor Detail

      • EJBReceiver

        protected EJBReceiver()
        Construct a new instance.
    • Method Detail

      • processInvocation

        protected abstract void processInvocation​(EJBReceiverInvocationContext receiverContext)
                                           throws Exception
        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.
        Parameters:
        receiverContext - The Enterprise Beans receiver invocation context
        Throws:
        Exception - if the operation throws an exception
      • cancelInvocation

        protected boolean cancelInvocation​(EJBReceiverInvocationContext receiverContext,
                                           boolean cancelIfRunning)
        Attempt to cancel an invocation. Implementations should make a reasonable effort to determine whether the operation was actually cancelled; however it is permissible to fall back to returning false if it cannot be discovered.
        Parameters:
        receiverContext - the Enterprise Beans receiver invocation context
        cancelIfRunning - true to request that the cancellation proceed even if the method is running
        Returns:
        true if the operation was definitely cancelled immediately, false otherwise
      • createSession

        protected SessionID createSession​(EJBReceiverSessionCreationContext receiverContext)
                                   throws Exception
        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. The returned locator should have the same view type as the requested locator.
        Parameters:
        receiverContext - the Enterprise Beans receiver session creation context
        Returns:
        the session ID for the newly opened session
        Throws:
        IllegalArgumentException - if the session creation request is made for a bean which is not a stateful session bean
        Exception
      • getSourceAddress

        protected InetSocketAddress getSourceAddress​(InetSocketAddress destination)
        Query the expected or actual source IP address configured for the given target URI.
        Parameters:
        destination - the supported URI of the peer (not null)
        Returns:
        the socket address, or null if none is known
      • isConnected

        protected boolean isConnected​(URI uri)
        Determine if the given target URI is "connected". Connectionless or connect-per-request protocols can inherit the default, which always returns true.
        Parameters:
        uri - the supported URI of the peer (not null)
        Returns:
        true if the peer is readily available, false otherwise