Examples of asynchronous method call and dynamic load balancing.

* description

A method suffixed by _Async can be called as an asynchronous method.
A call of an asynchronous method separates in two part, request
and receive. For example, method_Async() can be called as
method_Request() and method_Receive().

	server.method_Request(arguments);
	// do some work here
	value = server.method_Receive(timeout);

timeout is in milli second. When timeout occurs, HORBException("timeout")
will be thrown.

You may not start another method for the proxy before
receiving the result. You have to receive the result eventually after timeout
in the current version.

* example0  Client.java

Client.java is the most basic one. 

	method_Request()
	//
	method_Receive()

Server sleeps for three seconds before returning an answer.

* example1  Client1.java

An asynchronous method can be called as a sychronous method, just
as;

	method_Async();

* example2 Client2.java

An example of polling. _available() returns true if data is ready.

* example3   Client3.java

You can wait for data with _wait().

* example4  Client4.java

An example of callback handler object. You can set callback
handler object that is called when data is ready. AsyncMethodHandler
is an interface of callback handler object.

* example5 Client5.java

Client5 aborts the previous request by _release(). Before releasing
the connection, it establishes another connection to the server.

* example6  Client6.java

Example of dynamic load balancing. HORB supports OR parallelism
and multiple wait by asynchronous method and callback. 

You can enjoy parallel programming with HORB!


* version

Author: HIRANO Satoshi
Versioin: 1.0

* How to compile and run

c:> horbc Server.java
c:> horbc -c Client.java

c:> horb -v		             (start ORB in another window)
c:> java horb.test.async.Client
c:> java horb.test.async.Client1
c:> java horb.test.async.Client2
c:> java horb.test.async.Client3
c:> java horb.test.async.Client4
c:> java horb.test.async.Client5
c:> java horb.test.async.Client6


* Classes

   Server.java		simple server class
   Client.java		method_Request(), method_Receive()
   Client1.java		method_Async()
   Client2.java		method_Request(), _available(), method_Receive()
   Client3.java		method_Request(), _wait(), method_Receive()
   Client4.java         method_Request(), sleep(), method_Receive()
   Client5.java         method_Request(), _release(), method_Async()
   Client6.java         dynamic load balancing
