} catch (InterruptedException ie) {
logger.severe("Exception while waiting for port to be released", ie);
}
}
if (pInfo.isRemoved())
throw new PortNotDefinedException("Provides port : " + portName +
" has been removed");
pInfo.setInUse(true);
return pInfo.getProvidesPortReference();
}
}
// For uses ports
UsesPortInfo uInfo =
(UsesPortInfo) usesPortMap.get(portName);
if (uInfo != null) {
synchronized(uInfo) {
while (uInfo.getInUse() || uInfo.getInMigration()) {
try {
logger.finest("wait till the port is available");
uInfo.wait();
} catch (InterruptedException ie) {
logger.severe("Exception while waiting for port to be released", ie);
}
}
if (uInfo.isUnregistered())
throw new PortNotDefinedException("Uses port: " + portName +
" has been unregistered");
if (uInfo.getConnectionID() == null)
throw new PortNotConnectedException("Port " + portName
+ " not connected");
uInfo.setInUse(true);
return uInfo.getProvidesPortReference();
}
}
logger.severe("Port " + portName + " not defined");
throw new PortNotDefinedException("Port " + portName + " not defined");
}