Timer Service in ejb 3.1 - schedule calling timeout issue

后端 未结 1 1867
不知归路
不知归路 2021-01-03 03:34

I have created simple example with @Singleton, @Schedule and @Timeout annotations to try if they would solve my problem.

The scenario is this: EJB calls \'check\' fu

1条回答
  •  -上瘾入骨i
    2021-01-03 04:12

    The default @ConcurrencyManagement for singletons is ConcurrencyManagementType.CONTAINER with default @Lock of LockType.WRITE. Basically, that means every method (including generateReports) is effectively marked with the synchronized keyword, which means that checkQueueState will block while generateReport is running.

    Consider using ConcurrencyManagement(ConcurrencyManagementType.BEAN) or @Lock(LockType.READ). If neither suggestion helps, I suspect you've found a Glassfish bug.

    As an aside, you probably want persistent=false since you probably don't need to guarantee that the checkQueueState method fires every 5 seconds even when your server is offline. In other words, you probably don't need the container to fire "catch ups" when you bring your server back online.

    0 讨论(0)
提交回复
热议问题