sc.setKeepAliveIntervalSeconds(10); // can be set before register
sc.setImmediateConnect(true); // can be set before register
sc.startListener(); // regular
String serviceName = "session-1";
SCSessionServer server = sc.newSessionServer(serviceName); // no other params possible
int maxSess = 100;
int maxConn = 10;
SCSessionServerCallback cbk = newSessionSrvCallback(server);
try {
server.register(maxSess, maxConn, cbk); // regular
// server.registerServer(10, maxSess, maxConn, cbk); //
// alternative with operation timeout
} catch (Exception e) {
LOGGER.error("runSessionServer", e);
server.deregister();
throw e;
}
} catch (Exception e) {
LOGGER.error("runSessionServer", e);
sc.stopListener();
sc.destroy();
}
try {
String serviceName = "cacheGuardian1";
SCPublishServer server = sc.newPublishServer(serviceName);
int maxSess = 100;
int maxConn = 10;
SCPublishServerCallback cbk = newPublishSrvCallback(server);
try {
server.register(maxSess, maxConn, cbk); // regular
// server.registerServer(10, maxSess, maxConn, cbk); //
// alternative with operation timeout
} catch (Exception e) {
LOGGER.error("runSessionServer", e);
server.deregister();
throw e;
}
} catch (Exception e) {
LOGGER.error("runSessionServer", e);
sc.stopListener();