|
From: Bryan T. <br...@sy...> - 2010-09-08 12:19:36
|
Brian,
I am wondering how we should construct and expose for configuration ServerSockets for custom data transfer services. Right now we have two such services which open ServerSockets to do NIO operations on ByteBuffers. These are the HA write replication pipeline and the ResourceService used to send shards around. I am currently extending the ResourceService to also ship around the intermediate results during distributed query evaluation.
Reading the javadoc, it would appear that we should be using the following form of the ServerSocket contructor:
public ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException;
This allows us to specify the port (or pass 0 for a random port) and to specify the local IP address on which the service will communicate. The backlog can be specified as 0 to use the default. For both of these services the port may be random since it will be disclosed by an RMI message, but it could also be nice to have the service talking on a configured port (for example, in order to simplify firewall configuration).
It seems that the pattern in use right now to specify the INetAddress is:
InetAddress.getByName(
NicUtil.getIpAddress("default.nic"/*systemPropertyName*/, "default"/*defaultNicName*/, false/*loopback*/)
);
Presumably, the "default.nic" value could be replaced by the name of a different system property if we wanted to bind high volume data transfers onto a specific. It that is the intention, then perhaps we should define an alternative system property name for those cases and begin to use it at the appropriate locations in the code base.
However, this still leaves unspecified a pattern to configure the port for the service. Would you envision a "PortUtil" (or an extension to NicUtil) which uses a similar pattern specifying the system property name and the default port name (or port number)?
Thanks,
Bryan
|