• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JacORB orGeneral CORBA question

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);

}

}
 
reply
    Bookmark Topic Watch Topic
  • New Topic