Class RemoteCaller<S,​T>


  • public abstract class RemoteCaller<S,​T>
    extends RemoteCall<S>
    An implementation wrapper for stateful services. The wrapped call is implemented by overriding call(ClientContext,SessionHolder).
    Since:
    1.0.0
    Version:
    $Id: RemoteCaller.java 16154 2012-07-14 16:34:05Z colin $
    Author:
    tlerios@marketcetera.com
    • Constructor Detail

      • RemoteCaller

        public RemoteCaller​(TagFilter versionIdFilter,
                            TagFilter appIdFilter,
                            TagFilter clientIdFilter,
                            SessionManager<S> sessionManager,
                            TagFilter sessionIdFilter)
        Creates a new wrapper which uses the given (optional) session manager for session ID mappings, and which applies the given filters to the client context.
        Parameters:
        versionIdFilter - The version ID filter, which may be null.
        appIdFilter - The application ID filter, which may be null.
        clientIdFilter - The client ID filter, which may be null.
        sessionManager - The session manager, which may be null.
        sessionIdFilter - The session ID filter, which may be null.
      • RemoteCaller

        public RemoteCaller​(SessionManager<S> sessionManager)
        Creates a new wrapper which uses the given (optional) session manager for session ID mappings, and which applies two filters to the client context. The first filter ensures that the client's version ID is equal to the server's version ID; the second ensures that the session ID maps to an active session.
        Parameters:
        sessionManager - The session manager, which may be null.
    • Method Detail

      • execute

        public T execute​(ClientContext context)
                  throws RemoteException
        Invokes the service implementation on behalf of the client with the given context.
        Parameters:
        context - The context.
        Returns:
        The result returned by the implementation.
        Throws:
        RemoteException - Thrown if the implementation fails; it wraps the throwable thrown by the actual implementation.
      • call

        protected abstract T call​(ClientContext context,
                                  SessionHolder<S> sessionHolder)
                           throws Exception
        The service implementation, executed on behalf of the client with the given context and associated session holder.
        Parameters:
        context - The context.
        sessionHolder - The holder, which may be null.
        Returns:
        The result returned by the implementation.
        Throws:
        Exception - Thrown if the implementation fails.