this.serverSocket = serverSocket;
}
public static void main(String[] vargs) throws Exception {
// Example of using VoltProcedureListener: prints procedure name, returns empty array
NIOEventLoop eventLoop = new NIOEventLoop();
class PrintHandler implements Handler {
@Override
public long getInstanceId() {
return 0;
}
@Override
public void invocationQueue(ByteBuffer serializedRequest, RpcCallback<byte[]> done) {
StoredProcedureInvocation invocation = null;
try {
invocation = FastDeserializer.deserialize(serializedRequest, StoredProcedureInvocation.class);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
LOG.debug("request: " + invocation.getProcName() + " " +
invocation.getParams().toArray().length);
done.run(serializeResponse(new VoltTable[0], invocation.getClientHandle()));
}
}
PrintHandler printer = new PrintHandler();
VoltProcedureListener listener = new VoltProcedureListener(0, eventLoop, printer);
listener.bind();
eventLoop.run();
}