assertEquals(ksession1Id, ksession.getId()); sessions = em.createQuery("from SessionInfo").getResultList(); assertEquals(1, sessions.size());
@Override public int getId() { return kieSession.getId(); }
@Override public int getId() { return kieSession.getId(); }
public int getId() { return kieSession.getId(); }
@Override public int getId() { return getKieSession().getId(); }
@Override public int getId() { return getKieSession().getId(); }
@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Integer ksessionId = mapper.findMapping(context, getIdentifier()); if (ksessionId == null) { return; } if (ksession.getId() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
@Test public void testPersistenceTimer2() throws Exception { KieSession service = (KieSession) ctx.getBean( "jpaSingleSessionCommandService" ); int sessionId = service.getId(); ProcessInstance processInstance = service.startProcess( "org.drools.test.ProcessTimer2" ); log.info( "Started process instance {}", processInstance.getId() ); Thread.sleep( 2000 ); final Environment env = (Environment) ctx.getBean( "env" ); /* Environment env = KnowledgeBaseFactory.newEnvironment(); env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, ctx.getBean( "myEmf" ) ); env.set( EnvironmentName.TRANSACTION_MANAGER, ctx.getBean( "txManager" ) ); */ KieStoreServices kstore = (KieStoreServices) ctx.getBean( "kstore1" ); KieBase kbase1 = (KieBase) ctx.getBean( "kbProcessWorkItems" ); service = kstore.loadKieSession( sessionId, kbase1, null, env ); processInstance = service.getProcessInstance( processInstance.getId() ); assertNull( processInstance ); }
public void initStartDisposeAndLoadSession() { try { EntityManager em = txm.getEntityManagerFactory().createEntityManager(); // create new ksession with kstore KieSession ksession = kstore.newKieSession( kbase, null, getEnvironment() ); sessionId = ksession.getId(); logger.info( "\n\tSession id: " + sessionId + "\n" ); ksession.getWorkItemManager().registerWorkItemHandler( "testWorkItemHandler", workItemHandler ); ksession.startProcess( "timer-flow", null ); Thread.sleep( 4000 ); ksession.dispose(); } catch ( Exception ex ) { throw new IllegalStateException("The endTheProcess method has been interrupted", ex); } }
KieSession service = (KieSession) ctx.getBean( "jpaSingleSessionCommandService" ); int sessionId = service.getId(); log.info( "---> created SingleSessionCommandService id: " + sessionId );
@Test public void testPersistenceTimer2() throws Exception { KieSession service = (KieSession) ctx.getBean( "jpaSingleSessionCommandService" ); int sessionId = service.getId(); ProcessInstance processInstance = service.startProcess( "org.drools.test.ProcessTimer2" ); log.info( "Started process instance {}", processInstance.getId() ); Thread.sleep( 2000 ); Environment env = new EnvironmentAdapter( KnowledgeBaseFactory.newEnvironment() ); env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, ctx.getBean( "myEmf" ) ); env.set( EnvironmentName.TRANSACTION_MANAGER, ctx.getBean( "txManager" ) ); KieStoreServices kstore = (KieStoreServices) ctx.getBean( "kstore1" ); KieBase kbase1 = (KieBase) ctx.getBean( "kbProcessWorkItems" ); service = kstore.loadKieSession( sessionId, kbase1, null, env ); processInstance = service.getProcessInstance( processInstance.getId() ); assertNull( processInstance ); }
KieSession service = (KieSession) ctx.getBean( "jpaSingleSessionCommandService" ); int sessionId = service.getId(); log.info( "---> created SingleSessionCommandService id: " + sessionId );
ksessionId = ksession.getId(); } else { //Otherwhise, we try to find it through the database or thread local variables RuntimeEngine localRuntime = findLocalRuntime(contextId); if (ksessionId == null) { //if we cannot find a KIE session, we will create one ksession = factory.newKieSession(); ksessionId = ksession.getId(); } else { ksession = factory.findKieSessionById(ksessionId);
KieSession service = (KieSession) ctx.getBean( "jpaSingleSessionCommandService" ); int sessionId = service.getId(); log.info( "---> created SingleSessionCommandService id: " + sessionId );
KieSession service = (KieSession) ctx.getBean( "jpaSingleSessionCommandService" ); int sessionId = service.getId();
int sessionId = service.getId();
int sessionId = service.getId(); log.info( "---> created SingleSessionCommandService id: " + sessionId );
int sessionId = service.getId(); log.info( "---> created SingleSessionCommandService id: " + sessionId );
int sessionId = service.getId(); ProcessInstance processInstance = service.startProcess( "org.drools.test.TestProcess" ); log.info( "Started process instance {}",
int sessionId = service.getId(); ProcessInstance processInstance = service.startProcess( "org.drools.test.TestProcess" ); log.info( "Started process instance {}",