public Environment openEnvironment() {
return openEnvironment(null);
}
public Environment openEnvironment(List<WireObject> txWireObjects) {
PvmEnvironment environment = new PvmEnvironment(this);
if (log.isTraceEnabled()) log.trace("opening " + environment);
// set the classloader
ClassLoader classLoader = processEngineWireContext.getClassLoader();
if (classLoader != null) {
environment.setClassLoader(classLoader);
}
// add the process-engine context
environment.setContext(processEngineWireContext);
// add the transaction context
WireDefinition usedWireDefinition = transactionWireDefinition;
if (txWireObjects!=null) {
usedWireDefinition = new WireDefinition(transactionWireDefinition, txWireObjects);
}
WireContext transactionContext = new WireContext(usedWireDefinition, Context.CONTEXTNAME_TRANSACTION, environment, true);
// add the environment block context to the environment
environment.setContext(transactionContext);
Environment.pushEnvironment(environment);
try {
// finish the creation of the environment wire context
transactionContext.create();