AnsweredAssumed Answered

Custom Job Executor giving problem in cluster environment

Question asked by tkarthik26 on Sep 3, 2015
Latest reply on Sep 10, 2015 by tkarthik26
Hi,
I am using activiti 5.17.0 and trying to implement my own job executor by extending org.activiti.engine.impl.jobexecutor.JobExecutor, but ended up getting UniversalConnectionPoolException while executing the jobs. Seems like if there are many jobs simultaneously running then this issue is coming. If I am not using any job executor, this exception is not coming. Can anyone throw some light on this one.

Below is the configuration:
<code>
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="customDataSource" />
    <property name="history" value="full" />
    <property name="jobExecutorActivate" value="true" />
    <property name="jobExecutor" ref="customJobExecutor" />
</bean>

  <bean id="customJobExecutor" class="com.uprr.bpm.activiti.custom.CustomJobExecutor">
   <property name="queueSize" value="100"></property>
   <property name="corePoolSize" value="15"></property>
   <property name="maxPoolSize" value="50"></property> 
   <property name="keepAliveTime" value="30"></property>
  </bean>

ucp pool configuration
<ucp:pool-manager id="ncs.ucp.manager.bpe.enpr">
    <ucp:pooled-datasource id="ncs.ucp.datasource.bpe.enpr"
      user="${ncs.datasource.bpe.user}"
      password="${ncs.datasource.bpe.pwd}"
      url="${ncs.datasource.bpe.enpr.url}"
      fast-connection-failover-enabled="${ncs.datasource.bpe.fast-connection-failover-enabled}"
      ONS-configuration="${ncs.datasource.bpe.enpr.ONSConfiguration}"
      initial-pool-size="${ncs.datasource.bpe.pool.initial-pool-size}"
      max-pool-size="${ncs.datasource.bpe.pool.max-pool-size}"
      min-pool-size="${ncs.datasource.bpe.pool.min-pool-size}"
      max-statements="${ncs.datasource.bpe.pool.max-statements}"
      validate-connection-on-borrow="true"
      inactive-connection-timeout="${ncs.datasource.bpe.pool.inactive-connection-timeout}"
       login-timeout="${ncs.datasource.bpe.pool.login-timeout}" />
  </ucp:pool-manager>

ncs.datasource.bpe.fast-connection-failover-enabled = true
ncs.datasource.bpe.pool.max-pool-size = 50
ncs.datasource.bpe.pool.min-pool-size = 5
ncs.datasource.bpe.pool.initial-pool-size = 5
ncs.datasource.bpe.pool.max-statements=5
ncs.datasource.bpe.pool.inactive-connection-timeout = 60
ncs.datasource.bpe.pool.login-timeout = 10

Below is the exception:

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Exception occurred while getting connection: oracle.ucp.UniversalConnectionPoolException: All connections in the Universal Connection Pool are in use
   at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:241)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.handleExistingTransaction(AbstractPlatformTransactionManager.java:424)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:348)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
   at org.activiti.engine.impl.jobexecutor.FailedJobListener.execute(FailedJobListener.java:47)
   at org.activiti.spring.SpringTransactionContext$4.afterCompletion(SpringTransactionContext.java:97)
   at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)
<code>

Outcomes