O'Reilly logo

Java RMI by William Grosso

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Factories

Fortunately for us, this problem is easy to solve. All we have to do is find a crucial underlying assumption and then reject it utterly. In this case, the assumption is this: the server must already be running when the client attempts to connect to it.

At first glance, this seems like an eminently reasonable assumption to make. After all, the idea of client-server computing is based on the idea that the client and the server are programs running on different machines. This means that the client can’t launch the server. Moreover, even if this was possible, allowing the client to do so would probably involve security holes you could drive a truck through.

What the client can do, however, is ask an intermediate server to start the account server running. This intermediate server is usually called the factory.

Tip

In distributed computing, the term factory usually refers to a server whose sole purpose in life is to start, and shut down, other servers in response to client requests.

When we add a factory, our application architecture looks something like the diagram shown in Figure 17-1.

Application architecture with factories

Figure 17-1. Application architecture with factories

The idea is that the client uses the factory in much the same way as it used a naming service. That is, we have the following three-step procedure for a client application:

  1. The client calls the naming service to get a reference to the factory. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required