@Override public EntityManager getCommandScopedEntityManager() { EntityManager em = super.getCommandScopedEntityManager(); // ensure em is set in the environment to cover situation when em is taken from tx directly // when using per process instance runtime strategy if (env.get(EnvironmentName.CMD_SCOPED_ENTITY_MANAGER) == null) { env.set(EnvironmentName.CMD_SCOPED_ENTITY_MANAGER, em); } return em; }
@Override public void endCommandScopedEntityManager() { EntityManager cmdScopedEntityManager = (EntityManager) env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if(cmdScopedEntityManager != null && cmdScopedEntityManager.isOpen()) { cmdScopedEntityManager.clear(); } super.endCommandScopedEntityManager(); }
protected void addInterceptors(KieSession ksession) { PersistableRunner runner = (PersistableRunner) ((CommandBasedStatefulKnowledgeSession) ksession).getRunner(); runner.addInterceptor(new OptimisticLockRetryInterceptor()); // even though it's added always TransactionLockInterceptor is by default disabled so won't do anything runner.addInterceptor(new TransactionLockInterceptor(ksession.getEnvironment())); runner.addInterceptor(new ExecutionErrorHandlerInterceptor(ksession.getEnvironment())); }
public static StatefulKnowledgeSession loadStatefulKnowledgeSession(Long id, KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment) { return getJPAKnowledgeServiceProvider().loadStatefulKnowledgeSession( id, kbase, configuration, environment ); }
public static StatefulKnowledgeSession newStatefulKnowledgeSession(KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment) { return getJPAKnowledgeServiceProvider().newStatefulKnowledgeSession( kbase, configuration, environment ); }
public PersistenceContext getCommandScopedPersistenceContext() { return new JpaPersistenceContext( getCommandScopedEntityManager(), txm ); }
public Object getObject() throws Exception { return new KnowledgeStoreServiceImpl(); }
public PersistenceContext getApplicationScopedPersistenceContext() { return new JpaPersistenceContext( getApplicationScopedEntityManager(), txm ); }
private static synchronized KnowledgeStoreService getJPAKnowledgeServiceProvider() { if ( provider == null ) { loadProvider(); } return provider; }
protected void setDefaultImplementations() { setCommandServiceClass( PersistableRunner.class ); setProcessInstanceManagerFactoryClass( "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory" ); setWorkItemManagerFactoryClass( JPAWorkItemManagerFactory.class ); setProcessSignalManagerFactoryClass( "org.jbpm.persistence.processinstance.JPASignalManagerFactory" ); }
boolean success = false; try { JDKCallableJobCommand command = new JDKCallableJobCommand( this ); if (scheduler == null) { scheduler = (InternalSchedulerService) TimerServiceRegistry.getInstance().get(timerServiceId);
assertEquals(OptimisticLockRetryInterceptor.class, internalCommandService.getClass()); internalCommandService = (ChainableRunner) ((OptimisticLockRetryInterceptor) internalCommandService).getNext(); assertEquals("org.drools.persistence.PersistableRunner$TransactionInterceptor", internalCommandService.getClass().getName());
public static StatefulKnowledgeSession loadStatefulKnowledgeSession(int id, KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment) { return getJPAKnowledgeServiceProvider().loadStatefulKnowledgeSession( id, kbase, configuration, environment ); }
public static StatefulKnowledgeSession newStatefulKnowledgeSession(KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment) { return getJPAKnowledgeServiceProvider().newStatefulKnowledgeSession( kbase, configuration, environment ); }
public Object getObject() throws Exception { return new KnowledgeStoreServiceImpl(); }
private static synchronized KnowledgeStoreService getJPAKnowledgeServiceProvider() { if ( provider == null ) { loadProvider(); } return provider; }
public static StatefulKnowledgeSession loadStatefulKnowledgeSession(int id, KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment) { return getJPAKnowledgeServiceProvider().loadStatefulKnowledgeSession( id, kbase, configuration, environment ); }
public static StatefulKnowledgeSession newStatefulKnowledgeSession(KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment) { return getJPAKnowledgeServiceProvider().newStatefulKnowledgeSession( kbase, configuration, environment ); }
private static synchronized KnowledgeStoreService getJPAKnowledgeServiceProvider() { if ( provider == null ) { loadProvider(); } return provider; }
@Deprecated public static StatefulKnowledgeSession loadStatefulKnowledgeSession(int id, KnowledgeBase kbase, KnowledgeSessionConfiguration configuration, Environment environment) { return getJPAKnowledgeServiceProvider().loadStatefulKnowledgeSession( id, kbase, configuration, environment ); }