Finally I am brave enough to publish our Sun RPC implementation code.
http://code.google.com/p/nio-jrpc/
There are two ways to use it.
Direct usage from your code:
final ProtocolFilter protocolKeeper = new ProtocolKeeperFilter();
final ProtocolFilter rpcFilter = new RpcParserProtocolFilter();
final ProtocolFilter rpcProcessor = new RpcProtocolFilter();
final ProtocolFilter rpcDispatcher = new RpcDispatcher(_programs);
final ProtocolChain protocolChain = new DefaultProtocolChain();
protocolChain.addFilter(protocolKeeper);
protocolChain.addFilter(rpcFilter);
protocolChain.addFilter(rpcProcessor);
// use GSS if configures
if (_gssSessionManager != null ) {
final ProtocolFilter gssManager = new
GssProtocolFilter(_gssSessionManager);
protocolChain.addFilter(gssManager);
}
protocolChain.addFilter(rpcDispatcher);
or provided helper class:
final int PORT = 1717;
final int PROG_NUMBER = 100017;
final int PROG_VERS = 1;
RpcDispatchable dummy = new RpcDispatchable() {
@Override
public void dispatchOncRpcCall(RpcCall call) throws
OncRpcException, IOException {
call.reply(XdrVoid.XDR_VOID);
}
};
OncRpcSvc service = new OncRpcSvc(PORT);
service.register(new OncRpcProgram(PROG_NUMBER, PROG_VERS), dummy);
service.start();
The code used in out NFS implementation and since September 2009 in
production serving 12K requests per second.
Regards,
Tigran.