AnsweredAssumed Answered

Issue with Custom job executor  Activiti 5.17

Question asked by ganeshr on Sep 3, 2015
Latest reply on Sep 15, 2015 by ganeshr
We are using Activiti 5.17.0 version and to improve the performance of jobs tried to implement custom job executor in process engine.
After configuring custom job executor with custom pool configuration we are getting UniversalConnectionPoolException while executing the jobs. We are running activiti engine in cluster environment with four instances.
If we remove the custom job executor setting from process engine configurations then everything is working as expected. Not able to figure out why the custom job configurations are giving UCP connection issues.

Can anyone help on this.

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

ncs.datasource.fast-connection-failover-enabled = true
ncs.datasource.pool.max-pool-size = 50
ncs.datasource.pool.min-pool-size = 5
ncs.datasource.pool.initial-pool-size = 5
ncs.datasource.pool.max-statements=5
ncs.datasource.pool.inactive-connection-timeout = 60
ncs.datasource.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