protected boolean canDestroy(RuntimeEngine runtime) { if (((RuntimeEngineImpl) runtime).isAfterCompletion()) { return false; } TransactionManager tm = getTransactionManager(runtime.getKieSession().getEnvironment()); if (tm.getStatus() == TransactionManager.STATUS_NO_TRANSACTION || tm.getStatus() == TransactionManager.STATUS_ACTIVE) { return true; } return false; }
protected boolean canDispose(RuntimeEngine runtime) { // avoid duplicated dispose if (((RuntimeEngineImpl)runtime).isDisposed()) { return false; } // if this method was called as part of afterCompletion allow to dispose if (((RuntimeEngineImpl)runtime).isAfterCompletion()) { return true; } try { // check tx status to disallow dispose when within active transaction TransactionManager tm = getTransactionManager(runtime.getKieSession().getEnvironment()); if (tm.getStatus() != TransactionManager.STATUS_NO_TRANSACTION && tm.getStatus() != TransactionManager.STATUS_ROLLEDBACK && tm.getStatus() != TransactionManager.STATUS_COMMITTED) { return false; } } catch (SessionNotFoundException e) { // ignore it as it might be thrown for per process instance } return true; }
protected boolean canDestroy(RuntimeEngine runtime) { if (((RuntimeEngineImpl) runtime).isAfterCompletion()) { return false; } TransactionManager tm = getTransactionManager(runtime.getKieSession().getEnvironment()); if (tm.getStatus() == TransactionManager.STATUS_NO_TRANSACTION || tm.getStatus() == TransactionManager.STATUS_ACTIVE) { return true; } return false; }
protected boolean canDispose(RuntimeEngine runtime) { // avoid duplicated dispose if (((RuntimeEngineImpl)runtime).isDisposed()) { return false; } // if this method was called as part of afterCompletion allow to dispose if (((RuntimeEngineImpl)runtime).isAfterCompletion()) { return true; } try { // check tx status to disallow dispose when within active transaction TransactionManager tm = getTransactionManager(runtime.getKieSession().getEnvironment()); if (tm.getStatus() != TransactionManager.STATUS_NO_TRANSACTION && tm.getStatus() != TransactionManager.STATUS_ROLLEDBACK && tm.getStatus() != TransactionManager.STATUS_COMMITTED) { return false; } } catch (SessionNotFoundException e) { // ignore it as it might be thrown for per process instance } return true; }