"Hei, Amigo! Jeg har en oppgave, men jeg kommer ikke til å gi den til deg."
"Ok, jeg tuller. Gå og gjør oppgaven din i IntelliJ IDEA."
14
Oppgave
Java Collections, nivå, lekse
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
Oppgave
Java Collections, nivå, lekse
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
Oppgave
Java Collections, nivå, lekse
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.