Interface JCoServer


public interface JCoServer
The JCoServer interface provides access to the public APIs in the JCo server implementation. Applications using the server functionality use JCoServerFactoryCF to access the instance of the JCoServer where it can be customized. The JCoServer provides the following features:
  • Management of worker threads used for dispatching of requests
    The JCoServer opens and manages the worker threads used for dispatching requests on demand. The maximum number of threads is defined by the maximum connection count.
  • Request queueing
    The JCoServer puts all incoming requests in an internal queue. A cached request will be dispatched as soon as at least one worker thread is available.
  • Support for an application or environment specific implementation for transaction handlers.
The JCo standalone distribution contains an example StepByStepServer.java, which is covering the basic topics. StatefulServerExample.java covers the implementation of stateful requests.
See Also:
  • Method Details

    • getConnectionCount

      int getConnectionCount()
      Returns:
      connection count
    • getMaxConnectionCount

      int getMaxConnectionCount()
      Returns the maximum number of server connections that can be registered. This includes stateless as well as stateful connections.
      The default value is 0, which means there is no limitation.
      Returns:
      maximum connection count
      Since:
      JCo 3.1.0
    • release

      void release()
      Releases all resources allocated by the server instance. This method can be used only after all server worker threads have been stopped.
      Throws:
      JCoRuntimeException - in case some workers are still running
    • getRepository

      JCoRepository getRepository()
      Returns the default repository instance used by this server instance.
      Returns:
      server's default repository
    • getRepository

      JCoRepository getRepository(JCoServerContextInfo serverContext)
      Returns the repository instance used by this server instance for the specified request context.
      Parameters:
      serverContext - request context
      Returns:
      server's repository
      Since:
      JCo 3.0.5
    • setRepository

      void setRepository(JCoDestination destination)
      Sets the destination instance which is used for obtaining the default repository for querying RFC metadata. A previously defined default repository that has been set by calling setRepository(JCoRepository) will be overwritten by this method.
      Parameters:
      destination - a destination being used for obtaining the default repository
      Since:
      JCo 3.0.11
    • setRepository

      void setRepository(JCoRepository repository)
      Sets the default repository instance which is being used for querying RFC metadata. A previously defined repository destination that has been set by calling setRepository(JCoDestination) will be overwritten by this method.
      Parameters:
      repository - either a custom repository or a repository connected to an ABAP server
    • setRepository

      void setRepository(String sID, String client, JCoDestination destination) throws JCoRuntimeException
      Sets the repository destination instance for incoming RFC calls from the system with the system ID sID and - if defined - with the appropriate client. If the client is not relevant it may be null. If no matching SID and client combination is defined, the repository for the specified SID only will be used. If also no SID is defined, the current default repository will be used for processing the appropriate RFC call.
      An already defined corresponding repository rule that has been set before by calling setRepository(String, String, JCoRepository) will be overwritten by this method.
      Parameters:
      sID - system ID of the SAP ABAP system containing exactly 3-letters
      client - null or the client containing exactly 3 digits
      destination - destination instance to be used for obtaining a repository if sID and client are matching
      Throws:
      JCoRuntimeException - is thrown if sID or client is illegal.
      Since:
      JCo 3.0.11
    • setRepository

      void setRepository(String sID, String client, JCoRepository repository) throws JCoRuntimeException
      Sets the repository instance for incoming RFC calls from the system with the system ID sID and - if defined - with the appropriate client. If the client is not relevant it may be null. If no matching SID and client combination is defined, the repository for the specified SID only will be used. If also no SID is defined, the current default repository will be used for processing the appropriate RFC call.
      An already defined corresponding repository destination rule that has been set before by calling setRepository(String, String, JCoDestination) will be overwritten by this method.
      Parameters:
      sID - system ID of the SAP ABAP System containing exactly 3-letters
      client - null or the client containing exactly 3 digits
      repository - repository instance to be used if sID and client are matching
      Throws:
      JCoRuntimeException - is thrown if sID or client is illegal.
      Since:
      JCo 3.0.5
    • getProperty

      String getProperty(String key)
      Returns the value for a property defined by the server configuration.
      Parameters:
      key - property key for looking up the property value to return
      Returns:
      value for the specified property key
    • getRepositoryDestination

      String getRepositoryDestination()
      Returns the repository destination name for obtaining the default repository.
      Returns:
      the specified default repository destination name
    • addServerErrorListener

      void addServerErrorListener(JCoServerErrorListener listener)
      Adds a new listener to the list of error listeners.

      If a listener is added to the list of error listeners during firing an event, it won't be notified about this event.

      Parameters:
      listener - the error listener to add
      See Also:
    • addServerExceptionListener

      void addServerExceptionListener(JCoServerExceptionListener listener)
      Adds a new listener to the list of exception listeners.

      If a listener is added to the list of exception listeners during firing an event, it won't be notified about this event.

      Parameters:
      listener - the listener to add
      See Also:
    • addServerStateChangedListener

      void addServerStateChangedListener(JCoServerStateChangedListener listener)
      Adds a new listener to the list of state change listeners.

      If a listener is added to the list of state change listeners during firing an event, it won't be notified about this event.

      Parameters:
      listener - the listener to add
      See Also:
    • removeServerErrorListener

      void removeServerErrorListener(JCoServerErrorListener listener)
      Removes a listener from the list of error listeners.

      If a listener is removed from the list of error listeners during firing an event, it will be still notified about this event.

      Parameters:
      listener - the listener to remove
      See Also:
    • removeServerExceptionListener

      void removeServerExceptionListener(JCoServerExceptionListener listener)
      Removes a listener from the list of exception listeners.

      If a listener is removed from the list of exception listeners during firing an event, it will be still notified about this event.

      Parameters:
      listener - the listener to remove
      See Also:
    • removeServerStateChangedListener

      void removeServerStateChangedListener(JCoServerStateChangedListener listener)
      Removes a listener from the list of state change listeners.

      If a listener is removed from the list of state change listeners during firing an event, it will be still notified about this event.

      Parameters:
      listener - the listener to remove
      See Also:
    • setThroughput

      void setThroughput(JCoThroughput throughput)
      Sets the throughput instance for measuring the RFC requests dispatched by this server. A previously defined throughput instance will be overwritten.
      Parameters:
      throughput - the throughput instance for storing the performance data
    • getThroughput

      JCoThroughput getThroughput()
      Returns the throughput instance.
      Returns:
      the throughput instance
    • removeThroughput

      void removeThroughput()
      Removes the throughput instance from this server. The measuring will be deactivated.
    • getState

      JCoServerState getState()
      Returns the current state of this server.
      Returns:
      the current state of this server
    • isValid

      boolean isValid()
      Returns true if the corresponding server configuration was neither changed nor removed, false otherwise.
      Returns:
      true if server configuration was neither changed nor removed
      Since:
      JCo 3.0.7
    • getTenant

      String getTenant()
      Returns:
      the tenant associated with the server
      Since:
      JCo 3.1.0
    • getWebSocketPort

      int getWebSocketPort()
      Returns the current WebSocket port under which this server has been started on this machine.
      Returns:
      the port this server is running on, or -1 if it is not a WebSocket server or not valid
      Since:
      JCo 3.1.3