params[0].value = Integer.toString(portNo_);
ManagedProcessStruct process = null;
String iorString = "";
org.omg.CORBA.Object obj = null;
ICosManagedProcess processRef = null;
long processId = 0;
CosOperationModeEnum operMode = null;
//try connecting to existing/zombie processes
Iterator<ManagedProcessStruct> itProcess = managedProcesses_.values().iterator();
while (itProcess.hasNext())
{
process = itProcess.next();
//get the ior string
iorString = CorbaManager.readIor(process.entity);
if (iorString.length() == 0)
{
continue;
}
//build the managed process reference
obj = CorbaManager.stringToObject(iorString);
if (obj != null)
{
processRef = ICosManagedProcessHelper.narrow(obj);
if (processRef == null)
{
logger_.warn("Invalid IOR to process " + process.entity + ". IOR String: "
+ iorString);
continue;
}
} //if (obj != null)
//critical section
synchronized(managedProcesses_)
{
//reconnect to the zombie process
processId = 0;
for (int i=0; i<CORBA_ERROR_THRESHOLD; i++)
{
try
{
//notify process about our new port
processRef.cosSetParams(params);
//get the process id
processId = processRef.cosGetProcessId();
//get operation mode
operMode = processRef.cosGetOperationMode();
//notify managed process of a restart
//ideally, the managed process should then re-register to the process manager
//TODO
break;
}