Package org.serviceconnector.server
Class StatefulServer
java.lang.Object
org.serviceconnector.server.Server
org.serviceconnector.server.StatefulServer
- All Implemented Interfaces:
IServer,IStatefulServer
The Class StatefulServer.
-
Field Summary
Fields inherited from class org.serviceconnector.server.Server
destroyed, operationTimeoutMultiplier, remoteNodeConfiguration, requester, serverKey, serverTimeoutMillis, socketAddress -
Constructor Summary
ConstructorsConstructorDescriptionStatefulServer(RemoteNodeConfiguration remoteNodeConfiguration, String serviceName, InetSocketAddress socketAddress) Instantiates a new stateful server. -
Method Summary
Modifier and TypeMethodDescriptionvoidabortSession(AbstractSession session, String reason) Abort session.voidabortSessionAndWaitMech(int oti, SCMPMessage abortMessage, String reason, boolean abortSubscription) Abort session and wait mech.voidabortSessionsAndDestroy(String reason) Abort sessions and destroy.voidaddSession(AbstractSession session) Adds the session.voidchangeSubscription(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) Change subscription.voidcreateSession(SCMPMessage msgToForward, ISCMPMessageCallback callback, int timeoutMillis) Creates the session.voiddeleteSession(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) Delete session.voiddestroy()Destroy.voiddump(XMLDumpWriter writer) Dump the server into the xml writer.voidexecute(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) Send data.intGets the max sessions.Gets the service.Gets the service name.intGets the session count.Gets the sessions.booleanChecks for free session.voidremoveSession(AbstractSession session) Removes the session.voidsetService(StatefulService service) Sets the service.voidsubscribe(SCMPMessage msgToForward, ISCMPMessageCallback callback, int timeoutMillis) Subscribe.toString()To string.voidunsubscribe(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) Unsubscribe.Methods inherited from class org.serviceconnector.server.Server
getConnectionType, getHost, getMaxConnections, getPortNr, getRequester, getServerKey, getServerTimeoutMillis, getSocketAddress, getTimeout, getTimeouterTask, getType, immediateConnect, isDestroyed, setTimeout, setTimeouterTaskMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.serviceconnector.server.IStatefulServer
getType
-
Constructor Details
-
StatefulServer
public StatefulServer(RemoteNodeConfiguration remoteNodeConfiguration, String serviceName, InetSocketAddress socketAddress) Instantiates a new stateful server.- Parameters:
remoteNodeConfiguration- the remote node configurationserviceName- the service namesocketAddress- the socket address
-
-
Method Details
-
hasFreeSession
public boolean hasFreeSession()Checks for free session.- Specified by:
hasFreeSessionin interfaceIStatefulServer- Returns:
- true, if successful true, if successful
-
addSession
Adds the session.- Specified by:
addSessionin interfaceIStatefulServer- Parameters:
session- the session the session
-
removeSession
Removes the session.- Specified by:
removeSessionin interfaceIStatefulServer- Parameters:
session- the session the abstract session
-
getSessions
Gets the sessions.- Specified by:
getSessionsin interfaceIStatefulServer- Returns:
- the sessions the sessions
-
getSessionCount
public int getSessionCount()Gets the session count.- Specified by:
getSessionCountin interfaceIStatefulServer- Returns:
- the session count
-
getMaxSessions
public int getMaxSessions()Gets the max sessions.- Specified by:
getMaxSessionsin interfaceIStatefulServer- Returns:
- the max sessions the max sessions
-
getServiceName
Gets the service name.- Returns:
- the service name
-
createSession
public void createSession(SCMPMessage msgToForward, ISCMPMessageCallback callback, int timeoutMillis) throws ConnectionPoolBusyException Creates the session.- Parameters:
msgToForward- the message to forwardcallback- the callbacktimeoutMillis- the timeout millis- Throws:
ConnectionPoolBusyException- the connection pool busy exception
-
deleteSession
public void deleteSession(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) throws ConnectionPoolBusyException Delete session.- Parameters:
message- the messagecallback- the callbacktimeoutMillis- the timeout millis- Throws:
ConnectionPoolBusyException- the connection pool busy exception
-
subscribe
public void subscribe(SCMPMessage msgToForward, ISCMPMessageCallback callback, int timeoutMillis) throws ConnectionPoolBusyException Subscribe.- Parameters:
msgToForward- the message to forwardcallback- the callbacktimeoutMillis- the timeout millis- Throws:
ConnectionPoolBusyException- the connection pool busy exception
-
unsubscribe
public void unsubscribe(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) throws ConnectionPoolBusyException Unsubscribe.- Parameters:
message- the messagecallback- the callbacktimeoutMillis- the timeout millis- Throws:
ConnectionPoolBusyException- the connection pool busy exception
-
changeSubscription
public void changeSubscription(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) throws ConnectionPoolBusyException Change subscription.- Parameters:
message- the messagecallback- the callbacktimeoutMillis- the timeout milliseconds- Throws:
ConnectionPoolBusyException- the connection pool busy exception
-
execute
public void execute(SCMPMessage message, ISCMPMessageCallback callback, int timeoutMillis) throws ConnectionPoolBusyException Send data. Tries sending data to server asynchronous.- Parameters:
message- the messagecallback- the callbacktimeoutMillis- the timeout millis- Throws:
ConnectionPoolBusyException- the connection pool busy exception
-
abortSession
Abort session.- Specified by:
abortSessionin interfaceIServer- Specified by:
abortSessionin interfaceIStatefulServer- Parameters:
session- the sessionreason- the reason the reason
-
abortSessionAndWaitMech
public void abortSessionAndWaitMech(int oti, SCMPMessage abortMessage, String reason, boolean abortSubscription) Abort session and wait mech.- Parameters:
oti- the otiabortMessage- the abort messagereason- the reasonabortSubscription- the abort subscription
-
abortSessionsAndDestroy
Abort sessions and destroy. All sessions are aborted and server gets destroyed.- Parameters:
reason- the reason
-
getService
Gets the service.- Returns:
- the service
-
setService
Sets the service.- Parameters:
service- the new service
-
destroy
public void destroy()Destroy. Destroy server. -
toString
To string. -
dump
Dump the server into the xml writer.
-