Package org.serviceconnector.api.srv
Class SCSessionServer
java.lang.Object
org.serviceconnector.api.srv.SCSessionServer
- Direct Known Subclasses:
SCPublishServer
The Class SCServer. Basic class for any kind of a server which communicates with an SC.
- Author:
- JTraber
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classThe Class SCServerCallback. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanThe registered.protected SCRequesterThe requester.protected SCServerThe SC server.protected ScheduledFuture<TimeoutWrapper>The serverTimeout, timeout runs when server entry on SC need to be refreshed.protected StringThe service name. -
Constructor Summary
ConstructorsConstructorDescriptionSCSessionServer(SCServer scServer, String serviceName, SCRequester requester) Instantiates a new SCSessionServer. -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck registration with default operation timeout.voidcheckRegistration(int operationTimeoutSeconds) Check registration.voidDeregister server with default operation timeout.voidderegister(int operationTimeoutSeconds) Deregister server.protected voiddoRegister(int operationTimeoutSeconds, int maxSessions, int maxConnections) Do register.intGets the check registration interval seconds.Gets the connection type which is used to communicate with SC.intGets the keep alive interval in seconds.Gets the interfaces on which server is listening.intGets the port on which server is listening.intGets the max connections which the pool uses to connect to SC.intGets the max sessions the server is serving for service.Gets the SC host.intGets the SC port.Gets the SC server.Gets the service name.booleanChecks if server has its immediate connect flag set.booleanChecks if server is listening.booleanChecks if serve is registered to an SC.voidregister(int operationTimeoutSeconds, int maxSessions, int maxConnections, SCSessionServerCallback scCallback) Register server.voidregister(int maxSessions, int maxConnections, SCSessionServerCallback scCallback) Register server with default operation timeout.
-
Field Details
-
registered
protected boolean registeredThe registered. Indicates if a server is already registered to an SC. -
serviceName
The service name. -
requester
The requester. -
scServer
The SC server. -
serverTimeout
The serverTimeout, timeout runs when server entry on SC need to be refreshed.
-
-
Constructor Details
-
SCSessionServer
Instantiates a new SCSessionServer.- Parameters:
scServer- the sc serverserviceName- the service namerequester- the requester
-
-
Method Details
-
getKeepAliveIntervalSeconds
public int getKeepAliveIntervalSeconds()Gets the keep alive interval in seconds.- Returns:
- the keep alive interval in seconds
-
getCheckRegistrationIntervalSeconds
public int getCheckRegistrationIntervalSeconds()Gets the check registration interval seconds.- Returns:
- the check registration interval seconds
-
getMaxSessions
public int getMaxSessions()Gets the max sessions the server is serving for service.- Returns:
- the max sessions
-
getMaxConnections
public int getMaxConnections()Gets the max connections which the pool uses to connect to SC.- Returns:
- the max connections
-
register
public void register(int maxSessions, int maxConnections, SCSessionServerCallback scCallback) throws SCServiceException, SCMPValidatorException Register server with default operation timeout.- Parameters:
maxSessions- the max sessions to servemaxConnections- the max connections pool uses to connect to SCscCallback- the SC callback- Throws:
SCServiceException- listener not started yet
server already registered for service
register server on SC failed
error message received from SCSCMPValidatorException- callback is not set
-
register
public void register(int operationTimeoutSeconds, int maxSessions, int maxConnections, SCSessionServerCallback scCallback) throws SCServiceException, SCMPValidatorException Register server.- Parameters:
operationTimeoutSeconds- the allowed time in seconds to complete the operationmaxSessions- the max sessions to servemaxConnections- the max connections pool uses to connect to SCscCallback- the SC callback- Throws:
SCServiceException- listener not started yet
server already registered for service
register server on SC failed
error message received from SCSCMPValidatorException- callback is not set
-
doRegister
protected void doRegister(int operationTimeoutSeconds, int maxSessions, int maxConnections) throws SCServiceException Do register.- Parameters:
operationTimeoutSeconds- the allowed time in seconds to complete the operationmaxSessions- the max sessions to servemaxConnections- the max connections pool uses to connect to SC- Throws:
SCServiceException- listener not started yet
server already registered for service
register server on SC failed
error message received from SC
-
checkRegistration
Check registration with default operation timeout. This message can be sent from the registered server to SC in order to check its registration.- Throws:
SCServiceException- server is not registered for a service
check registration failed
error message received from SC
-
checkRegistration
Check registration. This message can be sent from the registered server to SC in order to check its registration.- Parameters:
operationTimeoutSeconds- the allowed time in seconds to complete the operation- Throws:
SCServiceException- server is not registered for a service
check registration failed
error message received from SC
-
deregister
Deregister server with default operation timeout.- Throws:
SCServiceException- deregister failed
error message received from SC
-
deregister
Deregister server.- Parameters:
operationTimeoutSeconds- the allowed time in seconds to complete the operation- Throws:
SCServiceException- deregister failed
error message received from SC
-
isListening
public boolean isListening()Checks if server is listening.- Returns:
- true, if is listening
-
isRegistered
public boolean isRegistered()Checks if serve is registered to an SC.- Returns:
- true, if is registered
-
isImmediateConnect
public boolean isImmediateConnect()Checks if server has its immediate connect flag set.- Returns:
- true, if is immediate connect
-
getSCHost
Gets the SC host.- Returns:
- the SC host
-
getSCPort
public int getSCPort()Gets the SC port.- Returns:
- the SC port
-
getListenerInterfaces
Gets the interfaces on which server is listening.- Returns:
- the interfaces
-
getListenerPort
public int getListenerPort()Gets the port on which server is listening.- Returns:
- the listening port
-
getConnectionType
Gets the connection type which is used to communicate with SC.- Returns:
- the connection type
-
getServiceName
Gets the service name.- Returns:
- the service name
-
getSCServer
Gets the SC server.- Returns:
- the SC server
-