
When an object on a client tries to invoke a
method of a remote object on a server, the object gets
the stub object which is corresponding with the re-
mote object from server’s RMI registry. After that,
the object invokes the method for the stub object.
By client’s RMI runtime, a socket is created by the
RMIClientSocketFactory object which is contained
in the stub object. Next, client’s RMI runtime com-
municates with server’s RMI runtime by the socket.
Furthermore, server’s RMI runtime creates a server
socket by the RMIServerSocketFactory object which
is registered in server’s RMI runtime, after that the
server socket communicates with the socket.
2.2 The Reason that we Cannot Use
Sun’s Implementation of RMI
The behaviors of RMI which we require are that a
client can use sockets of different types at the same
time and a server can accept incoming call from the
sockets on only one port. In order to realize the be-
haviors, the following mechanisms are necessary.
1. An RMIServerSocketFactory object must be able
to create multiple server sockets which are corre-
sponding with client’s sockets.
2. A client must be able to select sockets from differ-
ent types which are created by an RMIClientSock-
etFactory object.
In order to implement first mechanism, behaviors of
RMIServerSocketFactory and RMIClientSocketFac-
tory are customized. And, it is necessary to solve ei-
ther of the following two problems to realize the sec-
ond mechanism.
1. An RMIClientSocketFactory object is created by
a server, after that when a client tries to use the
object, the object is managed by the RMI runtime
on the client. Therefore, an object on the client
cannot invoke methods of the RMIClientSocket-
Factory object. Namely, the client cannot create
sockets of different types by the RMIClientSock-
etFactory object.
2. A server exports using a pair of an RMI-
ClientSocketFactory object, an RMIServerSock-
etFactory object and a port. If a server exports
using pairs of multiple RMIClientSocketFactory
objects and the same port, a client selects requir-
ing RMIClientSocketFactory object.
It is impossible to solve the first problem since RMI
Specification does not define the manner to access
an RMI runtime. Moreover, Sun’s implementation of
RMI does not provide the manner to solve the second
problem.
3 ONEPORT RMI
In chapter 2, we mentioned about the reason why
a client cannot use sockets of different types at the
same time by using Sun’s implementation of RMI.
Therefore, we develop new implementation of RMI
named OnePort RMI which consists of new RMI run-
time, classes which are implemented interfaces de-
fined by RMI specification, and MultiChannelSock-
etFactory which are described the following section.
First, MultiChannelSocketFactory is described, after
that propsed RMI runtime is described.
3.1 MultiChannel Socket Factory
In a system which uses Sun’s implementation of RMI,
when a server receives a request from a client, the
server creates an object of ServerSocket class which
is contained in java’s core library by an RMIServer-
SocketFactory object. Next, the ServerSocket object
creates a server socket, after that the server socket
waits for incoming calls. In order to create multiple
server sockets which are corresponding with connect-
ing sockets, steps of above execution must be changed
as follows:
1. A server socket which is created by an object of
ServerSocket class receives a kind of sockets from
a client.
2. The other server socket which is corresponding
with the kind of sockets is created, after that the
server socket communicates with client’s socket.
For the above, on the client side, a socket which is
created by an RMIClientSocketFactory object is nec-
essary to send the kind of sockets, so that MultiChan-
nelClientSocketFactory class which is implemented
RMIClientSocketFactory interface is developed. On
the server side, in order to receive the kind of sock-
ets, MultiChannelServerSocketFactory class which
is implemented RMIServerSocketFactory interface is
developed. Furthermore, MultiChannelServerSocket
class is developed so that the server socket which
is corresponding with the kind of sockets is created.
Figure 2 shows a relation of above classes. The above
classes are defined as MultiChannelSocketFactory.
3.2 Proposed RMI Runtime
In order to export remote objects in which identi-
cal port number is associated with multiple RMI-
ClientSocketFactory, we develop new RMI runtime.
Our RMI runtime is based on an Object Request Bro-
ker (hereafter referred to as ORB) which we have de-
veloped. The main components of our ORB are de-
scribed as follows:
WEBIST 2007 - International Conference on Web Information Systems and Technologies
366