aspose file tools*
The moose likes Distributed Java and the fly likes JacORB orGeneral CORBA question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "JacORB orGeneral CORBA question" Watch "JacORB orGeneral CORBA question" New topic
Author

JacORB orGeneral CORBA question

junchen liu
Greenhorn

Joined: Feb 19, 2008
Posts: 26
Hello all, my code looks like this:

org.omg.PortableServer.POA poa = null;
while(poa = null)
try {
org.omg.CORBA.Object rootPOA = orb.resolve_initial_references("RootPOA");

poa = org.omg.PortableServer.POAHelper.narrow(rootPOA);
}catch (org.omg.CORBA.ORBPackage.InvalidName invalid) {
invalid.printStackTrace();
}
catch (org.omg.CORBA.INITIALIZE in) {
in.printStackTrace();
} catch (Error er) {
er.printStackTrace();
} catch (RuntimeException re) {
re.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}

}

my problem is, I specify OAPort = 3000 in my property file
so, if the port is being used, the above code only throw
exception once, then without throw exception, Jacorb
return a valid poa object without create a server port

I could just stop the program, with error detected, but
I intended to let the problem retry, before the occupied port is released,
becasue it throws exception only once. my retry won't work


can you help please
junchen liu
Greenhorn

Joined: Feb 19, 2008
Posts: 26
for answer my own question


orb.destory is the key

get it cleared up, if you can not

make connection! and keep retry


while (poa == null) {
try {
orb = org.omg.CORBA.ORB.init(args, props);

org.omg.CORBA.Object rootPOA = orb.resolve_initial_references("RootPOA");

poa = org.omg.PortableServer.POAHelper.narrow(rootPOA);

} catch (RuntimeException re) {
orb.destroy();
re.printStackTrace();
retry_counter++;
poa = null;
if (retry_counter == NUMBER_OF_ROOT_POA_CREATION_RETRY_BEFORE_LOG_ERROR) {
LoggingUtil.loggerErrorCall(logger, (long) 1, "createRootPOA", "(String[] args, Properties props)", false, "CDB is unable to create CORBA Server on port : " + App_Configuration.getString("cdbPortNumber"), new Class[]{});
} else if (retry_counter > NUMBER_OF_ROOT_POA_CREATION_RETRY_BEFORE_LOG_ERROR) {
LoggingUtil.loggerInternalDebugCall(logger, (long) 1, "bindNamingService", "()", false, re, true, "CDB is unable to create CORBA Server on port : " + App_Configuration.getString("cdbPortNumber") + "will retry in the next " + this.LOCAL_ROOT_POA_CREATION_RETRY_INTERVEL + "seconds", new Class[]{String.class});
}
this.waitToCurrentThread(LOCAL_ROOT_POA_CREATION_RETRY_INTERVEL * 1000);

}

}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JacORB orGeneral CORBA question