Class RPCServer


  • public class RPCServer
    extends Object
    pvAccess RPC server implementation.
    Author:
    msekoranja
    • Constructor Detail

      • RPCServer

        public RPCServer()
        Default constructor. Creates a simple RPC server that processes requests directly in pvAccess receive thread.
      • RPCServer

        public RPCServer​(int threads,
                         int queueSize)
        Creates a RPC server with a thread-pool used to process requests.
        Parameters:
        threads - number of threads in a thread-pool.
        queueSize - thread-pool request queue size.
    • Method Detail

      • printInfo

        public void printInfo()
        Display basic information about the context.
      • run

        public void run​(int seconds)
                 throws PVAException
        Run the server for a given amount of time.
        Parameters:
        seconds - time (in seconds) to run the server, if 0 server is run until destroyed.
        Throws:
        PVAException - exception thrown in case of an unexpected error.
      • destroy

        public void destroy()
                     throws PVAException
        Destroy (shutdown) the server.
        Throws:
        PVAException - exception thrown in case of an unexpected error.
      • registerService

        public void registerService​(String serviceName,
                                    RPCService service)
        Register RPC service. Multiple services (with different name) can be registered. In case of name duplicates, the last registered service (with the same name) is used.
        Parameters:
        serviceName - RPC service name. This name is used by client to discover/connect to the service.
        service - service implementation.
      • registerService

        public void registerService​(String serviceName,
                                    RPCServiceAsync service)
        Register async. RPC service. Multiple services (with different name) can be registered. In case of name duplicates, the last registered service (with the same name) is used.
        Parameters:
        serviceName - RPC service name. This name is used by client to discover/connect to the service.
        service - async. service implementation.
      • unregisterService

        public void unregisterService​(String serviceName)
        Unregister RPC service.
        Parameters:
        serviceName - name of the RPC service to be unregistered.