Interface JCoServer
- 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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addServerErrorListener
(JCoServerErrorListener listener) Adds a new listener to the list of error listeners.void
Adds a new listener to the list of exception listeners.void
Adds a new listener to the list of state change listeners.int
int
Returns the maximum number of server connections that can be registered.getProperty
(String key) Returns the value for a property defined by the server configuration.Returns the default repository instance used by this server instance.getRepository
(JCoServerContextInfo serverContext) Returns the repository instance used by this server instance for the specified request context.Returns the repository destination name for obtaining the default repository.getState()
Returns the current state of this server.Returns the throughput instance.int
Returns the current WebSocket port under which this server has been started on this machine.boolean
isValid()
Returns true if the corresponding server configuration was neither changed nor removed, false otherwise.void
release()
Releases all resources allocated by the server instance.void
Removes a listener from the list of error listeners.void
Removes a listener from the list of exception listeners.void
Removes a listener from the list of state change listeners.void
Removes the throughput instance from this server.void
setRepository
(JCoDestination destination) Sets the destination instance which is used for obtaining the default repository for querying RFC metadata.void
setRepository
(JCoRepository repository) Sets the default repository instance which is being used for querying RFC metadata.void
setRepository
(String sID, String client, JCoDestination destination) Sets the repository destination instance for incoming RFC calls from the system with the system ID sID and - if defined - with the appropriate client.void
setRepository
(String sID, String client, JCoRepository repository) Sets the repository instance for incoming RFC calls from the system with the system ID sID and - if defined - with the appropriate client.void
setThroughput
(JCoThroughput throughput) Sets the throughput instance for measuring the RFC requests dispatched by this server.
-
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
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
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 callingsetRepository(JCoRepository)
will be overwritten by this method.- Parameters:
destination
- a destination being used for obtaining the default repository- Since:
- JCo 3.0.11
-
setRepository
Sets the default repository instance which is being used for querying RFC metadata. A previously defined repository destination that has been set by callingsetRepository(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 callingsetRepository(String, String, JCoRepository)
will be overwritten by this method.- Parameters:
sID
- system ID of the SAP ABAP system containing exactly 3-lettersclient
- null or the client containing exactly 3 digitsdestination
- 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
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 callingsetRepository(String, String, JCoDestination)
will be overwritten by this method.- Parameters:
sID
- system ID of the SAP ABAP System containing exactly 3-lettersclient
- null or the client containing exactly 3 digitsrepository
- 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
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
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
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
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
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
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
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
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
-