builder.setVersion(echoRequestMessage.getVersion());
builder.setXid(echoRequestMessage.getXid());
builder.setData(echoRequestMessage.getData());
-
+
getConnectionAdapter().echoReply(builder.build());
}
- }).start();
+ }).start();
}
@Override
* 2. If HelloMessage contains bitmap and common version found in bitmap
* then continue connection processing. if no common version found, just disconnect.
* 3. If HelloMessage version is not supported, send HelloMessage with lower supported version.
- * If Hello message received again with not supported version, just disconnect.
+ * 4. If Hello message received again with not supported version, just disconnect.
*
* TODO: Better to handle handshake into a maintainable innerclass which uses State-Pattern.
*/
// TODO:: get from configuration
return 2000;
}
-
+
/**
* @return milliseconds
*/
EchoInputBuilder builder = new EchoInputBuilder();
builder.setVersion(getVersion());
builder.setXid(getSessionContext().getNextXid());
-
+
Future<RpcResult<EchoOutput>> echoReplyFuture = getConnectionAdapter()
.echo(builder.build());
-
+
try {
RpcResult<EchoOutput> echoReplyValue = echoReplyFuture.get(getMaxTimeout(),
getMaxTimeoutUnit());
}
}
}
-
+
}).start();
}
@Override
public Future<Boolean> disconnect() {
LOG.info("disconnecting: sessionCtx="+sessionContext+"|auxId="+auxiliaryKey);
-
+
Future<Boolean> result = null;
if (connectionAdapter.isAlive()) {
result = connectionAdapter.disconnect();
LOG.debug("connection already disconnected");
result = Futures.immediateFuture(true);
}
-
- return result;
+
+ return result;
}
@Override
public SessionContext getSessionContext() {
return sessionContext;
}
-
+
@Override
public ConnectionAdapter getConnectionAdapter() {
return connectionAdapter;