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

Chapter 21. Multithreaded Clients

Up until this point, we’ve assumed that there’s a sharp distinction between clients and servers. Our clients have been simple applications and make easily handled calls to servers in response to user actions. This model, while a good starting point, often leads to clumsy user interfaces. In this chapter, we explore ways to build more sophisticated clients. Along the way, we’ll revisit our threading assumptions and talk again about remote iterators.

Different Types of Remote Methods

Consider, once again, the Account interface:

public interface Account extends Remote {
	public Money getBalance(  ) throws RemoteException;
	public void makeDeposit(Money amount) throws RemoteException,
         NegativeAmountException;
	public void makeWithdrawal(Money amount) throws RemoteException,
         OverdraftException, NegativeAmountException;
}

Each of the methods contained in the Account interface shares the following five characteristics:

  • Their arguments don’t require a lot of bandwidth to send over the wire.

  • Actually performing the business logic doesn’t require much computational effort on the part of the server.

  • All the methods require similar amounts of bandwidth and computational effort. Distinct calls, even ones from different clients accessing different accounts, have the same computational profile.

  • They require a timely response.

  • It’s hard to say that one request is more important than another.[92]

When all five of these characteristics are present, requests are fairly ...

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