14
งาน
Java Collections, ระดับ, บทเรียน
Toward an RMI server
Implement the run() method on CLIENT_THREAD. It will simulate a client that will connect to a server.
1) Get the service named UNIC_BINDING_NAME from the registry.
2) Call the returned service's method. Pass any non-empty argument.
3) Display the result of calling the method.
14
งาน
Java Collections, ระดับ, บทเรียน
RMI (part 2)
Implement the run() method on SERVER_THREAD. It will simulate the server:
1) Initialize the registry field. It will accept and process requests on port 2099.
2) Create two objects: a Cat and a Dog.
14
งาน
Java Collections, ระดับ, บทเรียน
Service locator
Read about the Service Locator pattern.
Implement the getService(String jndiName) method in ServiceLocator.
It will implement logic for working with the context and cache.
1) Return the required service from the cache.
2) If the cache doesn't have the required service.