org.apache.hadoop.oncrpc
Class RpcProgram
java.lang.Object
org.jboss.netty.channel.SimpleChannelUpstreamHandler
org.apache.hadoop.oncrpc.RpcProgram
- All Implemented Interfaces:
- org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler
public abstract class RpcProgram
- extends org.jboss.netty.channel.SimpleChannelUpstreamHandler
Class for writing RPC server programs based on RFC 1050. Extend this class
and implement handleInternal(org.jboss.netty.channel.ChannelHandlerContext, org.apache.hadoop.oncrpc.RpcInfo) to handle the requests received.
| Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
org.jboss.netty.channel.ChannelHandler.Sharable |
|
Constructor Summary |
protected |
RpcProgram(String program,
String host,
int port,
int progNumber,
int lowProgVersion,
int highProgVersion,
DatagramSocket registrationSocket,
boolean allowInsecurePorts)
Constructor |
| Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler |
channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, exceptionCaught, handleUpstream, writeComplete |
RPCB_PORT
public static final int RPCB_PORT
- See Also:
- Constant Field Values
allowInsecurePorts
protected final boolean allowInsecurePorts
RpcProgram
protected RpcProgram(String program,
String host,
int port,
int progNumber,
int lowProgVersion,
int highProgVersion,
DatagramSocket registrationSocket,
boolean allowInsecurePorts)
- Constructor
- Parameters:
program - program namehost - host where the Rpc server program is startedport - port where the Rpc server program is listening toprogNumber - program number as defined in RFC 1050lowProgVersion - lowest version of the specification supportedhighProgVersion - highest version of the specification supportedDatagramSocket - registrationSocket if not null, use this socket to
register with portmap daemonallowInsecurePorts - true to allow client connections from
unprivileged ports, false otherwise
register
public void register(int transport,
int boundPort)
- Register this program with the local portmapper.
unregister
public void unregister(int transport,
int boundPort)
- Unregister this program with the local portmapper.
register
protected void register(PortmapMapping mapEntry,
boolean set)
- Register the program with Portmap or Rpcbind
startDaemons
public void startDaemons()
stopDaemons
public void stopDaemons()
messageReceived
public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent e)
throws Exception
- Overrides:
messageReceived in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
- Throws:
Exception
doPortMonitoring
public boolean doPortMonitoring(SocketAddress remoteAddress)
sendRejectedReply
protected static void sendRejectedReply(RpcCall call,
SocketAddress remoteAddress,
org.jboss.netty.channel.ChannelHandlerContext ctx)
handleInternal
protected abstract void handleInternal(org.jboss.netty.channel.ChannelHandlerContext ctx,
RpcInfo info)
toString
public String toString()
- Overrides:
toString in class Object
isIdempotent
protected abstract boolean isIdempotent(RpcCall call)
getPort
public int getPort()
Copyright © 2014 Apache Software Foundation. All Rights Reserved.