Package org.serviceconnector.api.srv
Class SCServer
java.lang.Object
org.serviceconnector.api.srv.SCServer
The Class SCServer. Server to a SC.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new SC server.SCServer(String scHost, int scPort, int listenerPort, ConnectionType connectionType) Instantiates a new SC server.SCServer(String scHost, int scPort, List<String> networkInterfaces, int listenerPort, ConnectionType connectionType) Instantiates a new SC server. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy server.intGets the check registration interval seconds.intGets the check registration timeout seconds.Gets the connection type.intGets the keep alive interval seconds.intGets the keep alive timeout seconds.Gets the listener interfaces.intGets the listener port.Gets the SC host.intGets the SC port.Gets the TCP keep alive setting for initiated connections.Gets the TCP keep alive setting for incoming connections.booleanChecks if is immediate connect flag is set.booleanChecks if server is listening.newPublishServer(String serviceName) New publish server.newSessionServer(String serviceName) New session server.voidsetCheckRegistrationIntervalSeconds(int checkRegistrationIntervalSeconds) Sets the check registration interval in seconds.voidsetCheckRegistrationTimeoutSeconds(int checkRegistrationTimeoutSeconds) Sets the check registration timeout in seconds.voidsetImmediateConnect(boolean immediateConnect) Sets the immediate connect.voidsetKeepAliveIntervalSeconds(int keepAliveIntervalSeconds) Sets the keep alive interval in seconds.voidsetKeepAliveTimeoutSeconds(int keepAliveTimeoutSeconds) Sets the keep alive timeout in seconds.voidsetTCPKeepAliveInitiator(boolean tcpKeepAliveInitiator) Sets the TCP keep alive.voidsetTCPKeepAliveListener(boolean tcpKeepAliveListener) Sets the TCP keep alive.voidStart listener.voidStopListener.
-
Constructor Details
-
SCServer
Instantiates a new SC server.- Parameters:
scHost- the SC hostscPort- the SC portlistenerPort- the listener port
-
SCServer
Instantiates a new SC server.- Parameters:
scHost- the SC hostscPort- the SC portlistenerPort- the listener portconnectionType- the connection type
-
SCServer
public SCServer(String scHost, int scPort, List<String> networkInterfaces, int listenerPort, ConnectionType connectionType) Instantiates a new SC server.- Parameters:
scHost- the SC hostscPort- the SC portnetworkInterfaces- the network interfaceslistenerPort- the listener portconnectionType- the connection type
-
-
Method Details
-
getConnectionType
Gets the connection type.- Returns:
- the connection type
-
getSCHost
Gets the SC host.- Returns:
- the SC host
-
getSCPort
public int getSCPort()Gets the SC port.- Returns:
- the SC port
-
getListenerPort
public int getListenerPort()Gets the listener port.- Returns:
- the listener port
-
getListenerInterfaces
Gets the listener interfaces.- Returns:
- the listener interfaces
-
setImmediateConnect
Sets the immediate connect. Affects connecting behavior from SC. If immediateConnect is set SC establishes connection to server at the time registerServer is received.- Parameters:
immediateConnect- immediate connect- Throws:
SCServiceException- listener is already started
-
isImmediateConnect
public boolean isImmediateConnect()Checks if is immediate connect flag is set.- Returns:
- true, if is immediate connect
-
isListening
public boolean isListening()Checks if server is listening.- Returns:
- true, if is listening
-
getKeepAliveIntervalSeconds
public int getKeepAliveIntervalSeconds()Gets the keep alive interval seconds.- Returns:
- the keep alive interval seconds
-
setKeepAliveIntervalSeconds
Sets the keep alive interval in seconds. Interval in seconds between two subsequent keepAlive requests (KRQ). The keepAlive message is solely used to refresh the firewall timeout on the network path. KeepAlive message is only sent on an idle connection. The value = 0 means no keep alive messages will be sent.- Parameters:
keepAliveIntervalSeconds- Example: 360- Throws:
SCServiceException- listener is already started
-
setKeepAliveTimeoutSeconds
public void setKeepAliveTimeoutSeconds(int keepAliveTimeoutSeconds) throws SCMPValidatorException, SCServiceException Sets the keep alive timeout in seconds. Time in seconds a keep alive request waits to be confirmed. If no confirmation is received single connection gets closed.- Parameters:
keepAliveTimeoutSeconds- time to wait for completion of a keep alive request Example: 10- Throws:
SCMPValidatorException- keepAliveTimeoutSeconds > 1 and < 3600SCServiceException- listener is already started
-
getKeepAliveTimeoutSeconds
public int getKeepAliveTimeoutSeconds()Gets the keep alive timeout seconds.- Returns:
- the keep alive timeout seconds
-
setTCPKeepAliveInitiator
Sets the TCP keep alive. True to enable sending of TCP keep alive on initiated connections (if underlying OS properly configures keep alive). False to disable sending.- Parameters:
tcpKeepAliveInitiator- the new TCP keep alive- Throws:
SCServiceException- called method after attach
-
getTCPKeepAliveInitiator
Gets the TCP keep alive setting for initiated connections.- Returns:
- the TCP keep alive TRUE - TCP keep alive is enabled FALSE - TCP keep alive is disabled
-
setTCPKeepAliveListener
Sets the TCP keep alive. True to enable sending of TCP keep alive on incoming connections (if underlying OS properly configures keep alive). False to disable sending.- Parameters:
tcpKeepAliveListener- the new TCP keep alive- Throws:
SCServiceException- called method after attach
-
getTCPKeepAliveListener
Gets the TCP keep alive setting for incoming connections.- Returns:
- the TCP keep alive TRUE - TCP keep alive is enabled FALSE - TCP keep alive is disabled
-
setCheckRegistrationTimeoutSeconds
public void setCheckRegistrationTimeoutSeconds(int checkRegistrationTimeoutSeconds) throws SCMPValidatorException, SCServiceException Sets the check registration timeout in seconds. Time in seconds a check registration request waits to be confirmed. If no confirmation is received server for specific service is dead.- Parameters:
checkRegistrationTimeoutSeconds- time to wait for completion of a check registration request Example: 10- Throws:
SCMPValidatorException- checkRegistrationTimeoutSeconds > 1 and < 3600SCServiceException- listener is already started
-
getCheckRegistrationTimeoutSeconds
public int getCheckRegistrationTimeoutSeconds()Gets the check registration timeout seconds.- Returns:
- the check registration timeout seconds
-
setCheckRegistrationIntervalSeconds
public void setCheckRegistrationIntervalSeconds(int checkRegistrationIntervalSeconds) throws SCServiceException Sets the check registration interval in seconds. Interval in seconds between two subsequent check registration requests (CRG). The check registration message is used to refresh the server timeout on the SC. If the SC no check registration message receives within the interval the server gets destroyed. The value = 0 means no observation will be active on SC. Check registration message can be sent any time to verify SC is alive and Server is registered properly.- Parameters:
checkRegistrationIntervalSeconds- Example: 360- Throws:
SCServiceException- listener is already started
-
getCheckRegistrationIntervalSeconds
public int getCheckRegistrationIntervalSeconds()Gets the check registration interval seconds.- Returns:
- the check registration interval seconds
-
startListener
Start listener.- Throws:
SCServiceException- listener is already started
SC host not set
ConnectionType not set
starting listener failsSCMPValidatorException- scPort Number > 1 and < 65535
listenerPort Number > 1 and < 65535
SC port and listener port are the same
bind to interface failed
-
stopListener
public void stopListener()StopListener. Stop listening and clean up. -
destroy
public void destroy()Destroy server. Destroys server and releases all resources. No more communication to SC is possible after calling destroy. Deregister servers and stop listener before calling destroy. -
newSessionServer
public SCSessionServer newSessionServer(String serviceName) throws SCServiceException, SCMPValidatorException New session server.- Parameters:
serviceName- the service name- Returns:
- the SC session server
- Throws:
SCServiceException- server not listeningSCMPValidatorException- service name not set
-
newPublishServer
public SCPublishServer newPublishServer(String serviceName) throws SCServiceException, SCMPValidatorException New publish server.- Parameters:
serviceName- the service name- Returns:
- the SC publish server
- Throws:
SCServiceException- server not listeningSCMPValidatorException- service name not set
-