Hi Joe,
Yes, you are right. The EnvironmentFactory isn't a part of public api. So if we want to get access environment, the recommanded way is using Command. As followed:
processEngine.execute(new Command() {
public Object execute(Environment env) {
// do something.
return null;
}
});
And yes, the Environment interface didn't declared close() method, because we didn't need it. The EnvironmentInterceptor will open/close the Environment instance automaticly.
At last, if you want to do something transactional, please use Command to replace 'EnvironmentFactory.openEnvironment()', EnvironmentFactory wouldn't manage transaction, so it could cause some transactional issues.
Cheers. :)