Let's see how these classes work. Before launching them, be sure to have the following direc-
tories in your work directory:
• clientdir . Contains the client properties file and the directory “ cached ”that holds all
cached resources coming from the server.
• serverdir . Contains the deployment server properties file and all the files that the client
can request. It is important to copy all the files here that are to be deployed, classes
included; otherwise, the server will not find them.
First, we launch the BankServer ,through its main method. Then, we invoke the
ApplicationHelper on the client computer.
At the end of the transaction, we can see in Listing 6.8 the output on the client, and we can see
the server output in Listing 6.9.
L ISTING 6.8 The Client Output
ApplicationHelper- saved in cache: BankClient.class
ApplicationHelper- saved in cache: downloadPolicy.properties
ApplicationHelper- saved in cache: Clazz.class
ApplicationHelper- saved in cache: BankClientLoader.java
BankClientLoader- class: java.lang.Object loaded from super classloader
BankClientLoader- class: java.lang.Throwable loaded from super classloader
BankClientLoader- class: java.lang.Exception loaded from super classloader
BankClientLoader- class: com.marinilli.b2.c6.bank.
BankClientManager loaded from super classloader
BankClientManager() - Connectiom established.
BankClientLoader- class: java.lang.System loaded from super classloader
BankClientLoader- class: java.io.PrintStream loaded from super
classloaderBankClient- BankClient Executing.
BankClientLoader- class: java.lang.Class loaded from super classloader
BankClientLoader- class: java.lang.ClassLoader loaded from super classloader
BankClientLoader- getResource( test.txt ) EMPTY: look for it on the server
ApplicationHelper- saved in cache: test.txt
BankClientLoader- class: java.io.InputStream loaded from super classloader
BankClientLoader- class: Clazz loaded from local cache
BankClientManager- send command p
BankClientManager- send command qBankClient- Client Log out.
ApplicationHelper- appl. launched creating:
ApplicationHelper- closing application.
After the server is ready for accepting connections (line 1 in Listing 6.9), the
ApplicationHelper client connects, and the server forks a thread (line 2 in Listing 6.9).
Subsequently, the ApplicationHelper instance issues a CHECK command. Thus, the server
thread recognizes its client as a deployment client, and changes its thread name accordingly