try {
_oprocess = deserializeCompiledProcess(_pconf.getCBPInputStream());
} catch (Exception e) {
String errmsg = "Error reloading compiled process " + _pid + "; the file appears to be corrupted.";
__log.error(errmsg);
throw new BpelEngineException(errmsg, e);
}
_replacementMap = new ReplacementMapImpl(_oprocess);
// Create an expression language registry for this process
ExpressionLanguageRuntimeRegistry elangRegistry = new ExpressionLanguageRuntimeRegistry();
for (OExpressionLanguage elang : _oprocess.expressionLanguages) {
try {
elangRegistry.registerRuntime(elang);
} catch (ConfigurationException e) {
String msg = __msgs.msgExpLangRegistrationError(elang.expressionLanguageUri, elang.properties);
__log.error(msg, e);
throw new BpelEngineException(msg, e);
}
}
_expLangRuntimeRegistry = elangRegistry;
setRoles(_oprocess);
if (!_hydratedOnce) {
for (PartnerLinkPartnerRoleImpl prole : _partnerRoles.values()) {
PartnerRoleChannel channel = _engine._contexts.bindingContext.createPartnerRoleChannel(_pid,
prole._plinkDef.partnerRolePortType, prole._initialPartner);
prole._channel = channel;
_partnerChannels.put(prole._initialPartner, prole._channel);
EndpointReference epr = channel.getInitialEndpointReference();
if (epr != null) {
prole._initialEPR = epr;
_partnerEprs.put(prole._initialPartner, epr);
}
__log.debug("Activated " + _pid + " partnerrole " + prole.getPartnerLinkName() + ": EPR is "
+ prole._initialEPR);
}
_hydratedOnce = true;
}
for (PartnerLinkMyRoleImpl myrole : _myRoles.values()) {
myrole._initialEPR = _myEprs.get(myrole._endpoint);
}
for (PartnerLinkPartnerRoleImpl prole : _partnerRoles.values()) {
prole._channel = _partnerChannels.get(prole._initialPartner);
if (_partnerEprs.get(prole._initialPartner) != null) {
prole._initialEPR = _partnerEprs.get(prole._initialPartner);
}
}
if (isInMemory()) {
bounceProcessDAO(_engine._contexts.inMemDao.getConnection(), _pid, _pconf.getVersion(), _oprocess);
} else if (_engine._contexts.scheduler.isTransacted()) {
// If we have a transaction, we do this in the current transaction.
bounceProcessDAO(_engine._contexts.dao.getConnection(), _pid, _pconf.getVersion(), _oprocess);
} else {
// If we do not have a transaction we need to create one.
try {
_engine._contexts.scheduler.execIsolatedTransaction(new Callable<Object>() {
public Object call() throws Exception {
bounceProcessDAO(_engine._contexts.dao.getConnection(), _pid, _pconf.getVersion(), _oprocess);
return null;
}
}).get(); // needs to be synchronous
} catch (Exception ex) {
String errmsg = "DbError";
__log.error(errmsg, ex);
throw new BpelEngineException(errmsg, ex);
}
}
}