@Override public void run() { try { if (environmentFactory != null) { environmentFactory.close(); environmentFactory = null; } } catch (final Exception ee) { LOG.severe(Misc.getStackTraceFrom(ee)); } } }
public static Environment openEnvironment(final String xmlString) { final EnvironmentFactory environmentFactory = PvmEnvironmentFactory .parseXmlString(xmlString); return environmentFactory.openEnvironment(); }
public static void clean(EnvironmentFactory environmentFactory) { SessionFactory sessionFactory = environmentFactory .get(SessionFactory.class); String[] cleanSql = (String[]) environmentFactory.get(CLEAN_SQL_KEY); Configuration configuration = environmentFactory.get(Configuration.class); .toArray(new String[cleanSqlList.size()]); environmentFactory.set(CLEAN_SQL_KEY, cleanSql);
public void setUp() throws Exception { super.setUp(); if (isEnvironmentFactoryCached()) { Db.clean(getEnvironmentFactory()); } commandService = getEnvironmentFactory().get(CommandService.class); processService = getEnvironmentFactory().get(ProcessService.class); executionService = getEnvironmentFactory().get(ExecutionService.class); managementService = getEnvironmentFactory().get(ManagementService.class); }
public void init() throws ServletException { String configurationResource = getInitParameter( "bonita.configuration.resource", "bonita.cfg.xml"); EnvironmentFactory environmentFactory = new PvmEnvironmentFactory( configurationResource); jobExecutor = environmentFactory.get(JobExecutor.class); if (jobExecutor == null) { throw new PvmException("no jobImpl executor configured in resource " + configurationResource); } jobExecutor.start(); }
static void closeEnvironmentFactory(String configResource) { EnvironmentFactory environmentFactory = environmentFactories .remove(configResource); if (environmentFactory != null) { LOG.debug("closing environment factory for [" + configResource + "]"); environmentFactory.close(); } }
void openEnvironment() { environment = getEnvironmentFactory().openEnvironment(); } }
public T doInTransaction(TransactionStatus status) { Environment environment = environmentFactory.openEnvironment(); try { return command.execute(environment); } catch (Exception e) { throw new RuntimeException("ooops", e); } finally { environment.close(); } }
public <T> T execute(Command<T> command) { Environment environment = environmentFactory.openEnvironment(); try { return next.execute(command); } finally { environment.close(); } }
public <T> T execute(Command<T> command) { Environment environment = environmentFactory.openEnvironment(); try { log.debug("executing command " + command); return command.execute(environment); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new EJBException("failed to execute command " + command, e); } finally { environment.close(); } }