How would you go about implementing the equivellent of a wait until complete method call in Java?
Basically what I want to do is hava a method that sends a message over the network to a server application and waits till it gets the appropriate Ack message from the server with either an operation completed successfully or operation failed and an error message.
I already have a non blocking version of my method which passes a callback class in which has a method that is called on callback.
would it make sense to construct a callback class pass it in to my previous method and then perform a wait operation and on the callback have that class do a notify?