I would like to wait for a server to bind himself into the CORBA Naming Service.
Firstly I tried to use the following code, which is polling the Naming Service
Object expectedObj = null;
do
{
try { expectedObj = ncRef.resolve_str("expectedToBeInNameService"); }
catch (NotFound e) {}
Thread.sleep(2000);
} while(expectedObj == null;
My biggest problem is that this blocking. What is the easiest way to wait for it non-blocking?
You could wait in another thread and use a callback to notify the “original” thread or object that the request to the naming service was resolved.
The caller has to implement the interface CallBackObj and will create this thread by