TransactionProxy txnProxy)
throws Exception
{
super(properties, systemRegistry, txnProxy, logger);
logger.log(Level.CONFIG, "Creating ClientSessionServiceImpl");
PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
try {
/*
* Get the property for controlling session event processing
* and connection disconnection.
*/
writeBufferSize = wrappedProps.getIntProperty(
WRITE_BUFFER_SIZE_PROPERTY, DEFAULT_WRITE_BUFFER_SIZE,
8192, Integer.MAX_VALUE);
eventsPerTxn = wrappedProps.getIntProperty(
EVENTS_PER_TXN_PROPERTY, DEFAULT_EVENTS_PER_TXN,
1, Integer.MAX_VALUE);
allowNewLogin = wrappedProps.getBooleanProperty(
ALLOW_NEW_LOGIN_PROPERTY, false);
loginHighWater = wrappedProps.getIntProperty(
LOGIN_HIGH_WATER_PROPERTY,
Integer.MAX_VALUE / 2, 0, Integer.MAX_VALUE / 2);
relocationKeyLength = wrappedProps.getIntProperty(
RELOCATION_KEY_LENGTH_PROPERTY, DEFAULT_RELOCATION_KEY_LENGTH,
16, Integer.MAX_VALUE);
relocationTimeout = wrappedProps.getLongProperty(
StandardProperties.SESSION_RELOCATION_TIMEOUT_PROPERTY,
StandardProperties.DEFAULT_SESSION_RELOCATION_TIMEOUT,
1000L, Long.MAX_VALUE);
/* Export the ClientSessionServer. */
int serverPort = wrappedProps.getIntProperty(
SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 0, 65535);
serverImpl = new SessionServerImpl();
exporter =
new Exporter<ClientSessionServer>(ClientSessionServer.class);
try {
int port = exporter.export(serverImpl, serverPort);
serverProxy = exporter.getProxy();
if (logger.isLoggable(Level.CONFIG)) {
logger.log(Level.CONFIG,
"export successful. port:{0,number,#}", port);
}
} catch (Exception e) {
try {
exporter.unexport();
} catch (RuntimeException re) {
}
throw e;
}
/* Get services and check service version. */
flushContextsThread.start();
contextFactory = new ContextFactory(txnProxy);
watchdogService = txnProxy.getService(WatchdogService.class);
nodeMapService = txnProxy.getService(NodeMappingService.class);
taskService = txnProxy.getService(TaskService.class);
localNodeId = dataService.getLocalNodeId();
watchdogService.addRecoveryListener(
new ClientSessionServiceRecoveryListener());
transactionScheduler.runTask(
new AbstractKernelRunnable("CheckServiceVersion") {
public void run() {
checkServiceVersion(
VERSION_KEY, MAJOR_VERSION, MINOR_VERSION);
} }, taskOwner);
/* Store the ClientSessionServer proxy in the data store. */
transactionScheduler.runTask(
new AbstractKernelRunnable("StoreClientSessionServiceProxy") {
public void run() {
// TBD: this could use a BindingKeyedMap.
dataService.setServiceBinding(
getClientSessionServerKey(localNodeId),
new ManagedSerializable<ClientSessionServer>(
serverProxy));
} },
taskOwner);
/* Register the identity relocation and node mapping listeners. */
nodeMapService.addIdentityRelocationListener(
new IdentityRelocationListenerImpl());
nodeMapService.addNodeMappingListener(
new NodeMappingListenerImpl());
/*
* Create the protocol listener and acceptor.
*/
protocolListener = new ProtocolListenerImpl();
protocolAcceptor =
wrappedProps.getClassInstanceProperty(
PROTOCOL_ACCEPTOR_PROPERTY,
DEFAULT_PROTOCOL_ACCEPTOR,
ProtocolAcceptor.class,
new Class[] {
Properties.class, ComponentRegistry.class,