Last active
June 26, 2019 21:12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ReadyReminderClientMokapot { | |
public static void main(String[] args) throws Exception { | |
// create and start the communicator | |
DistributedCommunicator communicator = | |
new DistributedCommunicator("test2.p12", | |
"testpassword1".toCharArray()); | |
communicator.startCommunication(); | |
// retrieve communicator address | |
CommunicationAddress serverAddress = | |
communicator.lookupAddress | |
(InetAddress.getLoopbackAddress(), 15238); | |
// use the communicator to create a remote server | |
ReadyReminderServer<String> server = | |
communicator.runRemotely | |
(ReadyReminderServer<String>::new, serverAddress); | |
//old client code starts here | |
server.submitEvent("two seconds", Instant.now().plusSeconds(2)); | |
server.submitEvent("one second", Instant.now().plusSeconds(1)); | |
server.submitEvent("three seconds", Instant.now().plusSeconds(3)); | |
System.out.println(Objects.toString(server.extractReadyEvent())); | |
Thread.sleep(2500); | |
System.out.println(Objects.toString(server.extractReadyEvent())); | |
System.out.println(Objects.toString(server.extractReadyEvent())); | |
System.out.println(Objects.toString(server.extractReadyEvent())); | |
// old code ends here | |
//shut down the server | |
server = null; | |
communicator.stopCommunication(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment