protected Scheduler createScheduler() { SimpleScheduler scheduler = new SimpleScheduler( new GUID().toString(), new JdbcDelegate(_db.getDataSource()), _odeConfig.getProperties()); scheduler.setExecutorService(_executorService); scheduler.setTransactionManager(_txMgr); return scheduler; }
private void initBpelServer(EndpointReferenceContextImpl eprContext) { if (__log.isDebugEnabled()) { __log.debug("ODE initializing"); } ThreadFactory threadFactory = new ThreadFactory() { int threadNumber = 0; public Thread newThread(Runnable r) { threadNumber += 1; Thread t = new Thread(r, "ODEServer-" + threadNumber); t.setDaemon(true); return t; } }; if (_odeConfig.getThreadPoolMaxSize() == 0) _executorService = Executors.newCachedThreadPool(threadFactory); else _executorService = Executors.newFixedThreadPool(_odeConfig.getThreadPoolMaxSize(), threadFactory); { List<String> targets = new ArrayList<String>(); Collections.addAll( targets, _odeConfig.getProperty("cluster.localRoute.targets", "").split(",")); _clusterUrlTransformer = new ClusterUrlTransformer( targets, _odeConfig.getProperty( "cluster.localRoute.base", "http://localhost:8080/ode/processes/")); } _bpelServer = new BpelServerImpl(); _scheduler = createScheduler(); _scheduler.setJobProcessor(_bpelServer); BpelServerImpl.PolledRunnableProcessor polledRunnableProcessor = new BpelServerImpl.PolledRunnableProcessor(); polledRunnableProcessor.setPolledRunnableExecutorService(_executorService); polledRunnableProcessor.setContexts(_bpelServer.getContexts()); _scheduler.setPolledRunnableProcesser(polledRunnableProcessor); _cronScheduler = new CronScheduler(); _cronScheduler.setScheduledTaskExec(_executorService); _cronScheduler.setContexts(_bpelServer.getContexts()); _bpelServer.setCronScheduler(_cronScheduler); _bpelServer.setDaoConnectionFactory(_daoCF); _bpelServer.setInMemDaoConnectionFactory( new BpelDAOConnectionFactoryImpl(_scheduler, _odeConfig.getInMemMexTtl())); _bpelServer.setEndpointReferenceContext(eprContext); _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this)); _bpelServer.setBindingContext(new BindingContextImpl(this)); _bpelServer.setScheduler(_scheduler); if (_odeConfig.isDehydrationEnabled()) { CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy(); dehy.setProcessMaxAge(_odeConfig.getDehydrationMaximumAge()); dehy.setProcessMaxCount(_odeConfig.getDehydrationMaximumCount()); _bpelServer.setDehydrationPolicy(dehy); } _bpelServer.setMigrationTransactionTimeout(_odeConfig.getMigrationTransactionTimeout()); _bpelServer.setConfigProperties(_odeConfig.getProperties()); _bpelServer.init(); _bpelServer.setInstanceThrottledMaximumCount(_odeConfig.getInstanceThrottledMaximumCount()); _bpelServer.setProcessThrottledMaximumCount(_odeConfig.getProcessThrottledMaximumCount()); _bpelServer.setProcessThrottledMaximumSize(_odeConfig.getProcessThrottledMaximumSize()); _bpelServer.setHydrationLazy(_odeConfig.isHydrationLazy()); _bpelServer.setHydrationLazyMinimumSize(_odeConfig.getHydrationLazyMinimumSize()); }