In the previous chapter, we discussed the interfaces and data objects for the bank example. In this chapter, we’ll continue with the development cycle by building the servers and discussing the various design options that are available. This chapter is much shorter than the previous two because most of the intellectual heavyweight lifting has already been done. Nonetheless, by the end of this chapter, we will have fully implemented the servers for the bank example.
The server objects you write in RMI are just the tip of the iceberg. When you add the automatically generated code and the pre-existing libraries and runtime, every RMI server has the layered structure at runtime shown in Figure 8-1.
Figure 8-1. Runtime structure for RMI servers
These components have the following roles:
are just instances of
ServerSocket, exactly as discussed in
The number of sockets is explicitly controlled by
the RMI runtime and is usually proportional to the
number of RMI clients connected to a JVM.
listens and receives any data coming in over the
socket. Because it knows the wire protocol that
RMI uses, the RMI runtime can take the data that
comes in from the socket and break it apart into
distinct method calls (encapsulated as instances