Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Hazelcast EJB timer store from Micro available in full profile #1112

Closed
dorpsidioot opened this issue Sep 26, 2016 · 18 comments
Closed
Assignees
Labels
Type: Enhancement Label issue as an enhancement request
Milestone

Comments

@dorpsidioot
Copy link

The current Payara micro feature of being able to store EJB timers in the embedded Hazelcast is a very nice feature that would be very nice to have in the full EE profile server. Is it possible to make this work in the EE server too? Currently I'm writing a custom hazelcast solution to be able to track timers across a hazelcast cluster, but this would make life so much easier.

@mikecroft mikecroft added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Enhancement Label issue as an enhancement request labels Sep 26, 2016
@mikecroft
Copy link
Contributor

created internal issue PAYARA-1079 to track this request

@smillidge
Copy link
Contributor

It is possible to do this now but only by editing the domain.xml. Add the following to the domain.xml to test.

<ejb-container steady-pool-size="0" max-pool-size="32" session-store="${com.sun.aas.instanceRoot}/session-store" pool-resize-quantity="8">
                <ejb-timer-service ejb-timer-service="Hazelcast"></ejb-timer-service>
</ejb-container>

@dorpsidioot
Copy link
Author

So the "Hazelcast" name is the JNDI name of the EJBtimer? Should be able to modify this in the web console too under the EJB timer settings or not?

@smillidge
Copy link
Contributor

No it's an internal name for Payara to initialise a Hazelcast based EJB Timer persistence store. It will be global for all timers and for all servers that use that configuration.

@dorpsidioot
Copy link
Author

Thanks, I'll give it a whirl when I've updated my servers to 4.1.163.1! Is this change coming to the UI in 164?

@mikecroft
Copy link
Contributor

Created PYSVC-91 to document this :)

@dorpsidioot
Copy link
Author

I've just finished the test using 1 simple application with 3 timers (persistent ones with @schedule) and changed the domain-xml config for the server-config bit to Hazelcast timer service but I'm getting this error:

[2016-09-26T16:33:38.308+0200] [Payara 4.1] [SEVERE] [] [javax.enterprise.system.container.ejb.com.sun.ejb.containers] [tid: _ThreadID=142 _ThreadName=admin-thread-pool(3)] [timeMillis: 1474900418308] [levelValue:
000] [[                                                                                                                                                                                                              

javax.ejb.CreateException: Persistent timers are not supported in this setup                                                                                                                                         
        at com.sun.ejb.containers.EJBTimerService._createTimer(EJBTimerService.java:787)                                                                                                                             
        at com.sun.ejb.containers.EJBTimerService.createTimer(EJBTimerService.java:752)                                                                                                                              
        at com.sun.ejb.containers.EJBTimerService.createTimer(EJBTimerService.java:659)                                                                                                                              
        at com.sun.ejb.containers.EJBTimerService.createSchedules(EJBTimerService.java:900)                                                                                                                          
        at com.sun.ejb.containers.EJBTimerService.recoverAndCreateSchedules(EJBTimerService.java:810)                                                                                                                
        at com.sun.ejb.containers.BaseContainer.startApplication(BaseContainer.java:3951)                                                                                                                            
        at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)                                                                                                                                   
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)                                                                                                                                           
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)                                                                                                                                         
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:353)                                                                                                                               
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:501)                                                                                                                   
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)                                                                                                                   
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)                                                                                                                              
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)                                                                                                                         
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)                                                                                                                         
        at java.security.AccessController.doPrivileged(Native Method)                                                                                                                                                
        at javax.security.auth.Subject.doAs(Unknown Source)                                                                                                                                                          
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)                                                                                                                       
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)                                                                                                                           
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)                                                                                                                           
        at java.security.AccessController.doPrivileged(Native Method)                                                                                                                                                
        at javax.security.auth.Subject.doAs(Unknown Source)                                                                                                                                                          
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)                                                                                                                       
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)                                                                                                                      
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)                                                                                                                     
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)                                                                                                       
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)                                                                                                       
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:263)                                                                                                                             
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:234)                                                                                                                             
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:285)                                                                                                                             
        at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:136)                                                                                                 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                               
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                               
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                           
        at java.lang.reflect.Method.invoke(Unknown Source)                                                                                                                                                           
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)                                                                
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)                                                                      
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)                                                                     
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)                                              
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)                                                                    
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)                                                                                                            
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)                                                                                                             
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)                                                                                                             
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)                                                                                                                                   
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)                                                                                                                                              
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)                                                                                                                                              
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)                                                                                                                                             
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)                                                                                                                                             
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)                                                                                                                                             
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)                                                                                                                      
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)                                                                                                                                 
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)                                                                                                                       
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)                                                                                                      
        at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)                                                                                                                              
        at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)                                                                                                                                
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:466)                                                                                                    
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:169)                                                                                                                     
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)                                                                                                                            
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)                                                                                                                              
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)                                                                                                                  
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)                                                                                                                   
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)                                                                                                           
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)                                                                                                        
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)                                                                                                                 
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)                                                                                                                 
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)                                                                                                                                
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)                                                                                                                 
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)                                                                                                              
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)                                                                                                             
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)                                                                                                        
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)                                                                                         
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)                                                                                                            
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)                                                                                                               
        at java.lang.Thread.run(Unknown Source)                                                                                                                                                                      
]]

@smillidge
Copy link
Contributor

Did you enable Hazelcast?

@smillidge
Copy link
Contributor

Actually I have been dumb the Hazelcast based EJB timer store is not packaged into this version of Payara Server, although it does work if you get the module and drop it into the modules directory. If you want to test it we can put the module up somewhere. Sorry :-(

@smillidge
Copy link
Contributor

smillidge commented Sep 26, 2016

Here's the Hazelcast EJB Timer Store module.
Drop the jar file into the glassfish/modules directory and restart the server. Note this is prerelease.

@dorpsidioot
Copy link
Author

Thanks. I will test this asap! Will this be included in 164 release? That way I know I can already use this beforehand, thus enabling us to use a baked-in timer storage solution rather than having to reinvent the wheel again. We're using MongoDB as a database, so I can't really use the standard database-based EJB timer storage.

@dorpsidioot
Copy link
Author

Ok first test results:
I've created a simple app in a war with 1 EJB with 3 timers (@schedule). Each of them is marked as persistent and they execute once every 5 seconds(so 0/15, 5/15 and 10/15). Upon first deployment I noticed the timers were being created but they were executed on both of the instances instead of just on one of them!

So I thought: hmm, maybe I was being stupid and I disabled both applications at the same time and then re-enabled them, but on both of the servers this caused these exceptions to occurr:

java.util.ConcurrentModificationException                                                                                                                                                                   
        at java.util.HashMap$HashIterator.nextNode(Unknown Source)                                                                                                                                          
        at java.util.HashMap$EntryIterator.next(Unknown Source)                                                                                                                                             
        at java.util.HashMap$EntryIterator.next(Unknown Source)                                                                                                                                             
        at fish.payara.ejb.timer.hazelcast.HazelcastTimerStore.recoverAndCreateSchedules(HazelcastTimerStore.java:605)                                                                                      
        at com.sun.ejb.containers.BaseContainer.startApplication(BaseContainer.java:3951)                                                                                                                   
        at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)                                                                                                                          
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)                                                                                                                                  
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)                                                                                                                                
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:353)                                                                                                                      
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:501)                                                                                                          
        at com.sun.enterprise.v3.server.ApplicationLifecycle.enable(ApplicationLifecycle.java:2168)                                                                                                         
        at com.sun.enterprise.v3.server.ApplicationLifecycle.enable(ApplicationLifecycle.java:114)                                                                                                          
        at org.glassfish.deployment.admin.EnableCommand.execute(EnableCommand.java:262)                                                                                                                     
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)                                                                                                                
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)                                                                                                                
        at java.security.AccessController.doPrivileged(Native Method)                                                                                                                                       
        at javax.security.auth.Subject.doAs(Unknown Source)                                                                                                                                                 
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)                                                                                                              
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)                                                                                                                  
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)                                                                                                                  
        at java.security.AccessController.doPrivileged(Native Method)                                                                                                                                       
        at javax.security.auth.Subject.doAs(Unknown Source)                                                                                                                                                 
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)                                                                                                              
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)                                                                                                             
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)                                                                                                            
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)                                                                                              
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)                                                                                              
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:263)                                                                                                                    
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:234)                                                                                                                    
        at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommandLegacyFormat(TemplateExecCommand.java:159)                                                                                  
        at org.glassfish.admin.rest.resources.TemplateCommandPostResource.processPostLegacyFormat(TemplateCommandPostResource.java:100)                                                                     
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                      
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                      
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                  
        at java.lang.reflect.Method.invoke(Unknown Source)                                                                                                                                                  
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)                                                       
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)                                                             
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)                                                            
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)                                     
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)                                                           
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)                                                                                                   
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)                                                                                                    
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)                                                                                                    
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)                                                                                                                          
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)                                                                                                                                     
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)                                                                                                                                     
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)                                                                                                                                    
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)                                                                                                                                    
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)                                                                                                                                    
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)                                                                                                             
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)                                                                                                                        
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)                                                                                                              
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)                                                                                             
        at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)                                                                                                                     
        at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)                                                                                                                       
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:466)                                                                                           
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:169)                                                                                                            
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)                                                                                                                   
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)                                                                                                                     
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)                                                                                                         
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)                                                                                                          
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)                                                                                                  
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)                                                                                               
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)                                                                                                        
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)                                                                                                        
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)                                                                                                                       
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)                                                                                                        
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)                                                                                                     
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)                                                                                                    
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)                                                                                               
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)                                                                                
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)                                                                                                   
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)                                                                                                      
        at java.lang.Thread.run(Unknown Source)                                                                                                                                                             
]]                                                                                                                                                                                                          

[2016-09-27T09:04:35.850+0200] [Payara 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=172 _ThreadName=admin-thread-pool(2)] [timeMillis: 1474959875850] [levelValue: 1000] [
  Exception during lifecycle processing                                                                                                                                                                     
java.util.ConcurrentModificationException                                                                                                                                                                   
        at java.util.HashMap$HashIterator.nextNode(Unknown Source)                                                                                                                                          
        at java.util.HashMap$EntryIterator.next(Unknown Source)                                                                                                                                             
        at java.util.HashMap$EntryIterator.next(Unknown Source)                                                                                                                                             
        at fish.payara.ejb.timer.hazelcast.HazelcastTimerStore.recoverAndCreateSchedules(HazelcastTimerStore.java:605)                                                                                      
        at com.sun.ejb.containers.BaseContainer.startApplication(BaseContainer.java:3951)                                                                                                                   
        at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)                                                                                                                          
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)                                                                                                                                  
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)                                                                                                                                
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:353)                                                                                                                      
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:501)                                                                                                          
        at com.sun.enterprise.v3.server.ApplicationLifecycle.enable(ApplicationLifecycle.java:2168)                                                                                                         
        at com.sun.enterprise.v3.server.ApplicationLifecycle.enable(ApplicationLifecycle.java:114)                                                                                                          
        at org.glassfish.deployment.admin.EnableCommand.execute(EnableCommand.java:262)                                                                                                                     
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)                                                                                                                
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)                                                                                                                
        at java.security.AccessController.doPrivileged(Native Method)                                                                                                                                       
        at javax.security.auth.Subject.doAs(Unknown Source)                                                                                                                                                 
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)                                                                                                              
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)                                                                                                                  
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)                                                                                                                  
        at java.security.AccessController.doPrivileged(Native Method)                                                                                                                                       
        at javax.security.auth.Subject.doAs(Unknown Source)                                                                                                                                                 
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)                                                                                                              
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)                                                                                                             
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)                                                                                                            
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)                                                                                              
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)                                                                                              
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:263)                                                                                                                    
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:234)                                                                                                                    
        at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommandLegacyFormat(TemplateExecCommand.java:159)                                                                                  
        at org.glassfish.admin.rest.resources.TemplateCommandPostResource.processPostLegacyFormat(TemplateCommandPostResource.java:100)                                                                     
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                      
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                      
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                  
        at java.lang.reflect.Method.invoke(Unknown Source)                                                                                                                                                  
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)                                                       
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)                                                             
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)                                                            
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)                                     
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)                                                           
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)                                                                                                   
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)                                                                                                    
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)                                                                                                    
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)                                                                                                                          
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)                                                                                                                                     
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)                                                                                                                                     
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)                                                                                                                                    
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)                                                                                                                                    
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)                                                                                                                                    
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)                                                                                                             
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)                                                                                                                        
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)                                                                                                              
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)                                                                                             
        at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)                                                                                                                     
        at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)                                                                                                                       
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:466)                                                                                           
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:169)                                                                                                            
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)                                                                                                                   
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)                                                                                                                     
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)                                                                                                         
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)                                                                                                          
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)                                                                                                  
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)                                                                                               
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)                                                                                                        
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)                                                                                                        
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)                                                                                                                       
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)                                                                                                        
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)                                                                                                     
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)                                                                                                    
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)                                                                                               
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)                                                                                
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)                                                                                                   
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)                                                                                                      
        at java.lang.Thread.run(Unknown Source)                                                                                                                                                             
]]

@smillidge
Copy link
Contributor

OK. First thing is that store fires the timers on all cluster members not on a single member. It just uses Hazelcast for persistent storage not for cluster coordination. So if you need a singleton timer it won't work for you currently.

I'll take a look at the error above.

@dorpsidioot
Copy link
Author

In 164 the timer store can now be safely changed to Hazelcast it seems, according to https://payara.gitbooks.io/payara-server/content/documentation/extended-documentation/alternate-store-for-ejb-timers.html. Is this store supposed to fire the timers on all the cluster members or on just one?

@mikecroft
Copy link
Contributor

@dorpsidioot looks like we released that part of the documentation early! It should be pre-release only, not part of the released stuff. I'll see what I can do about correcting it

@pdudits
Copy link
Contributor

pdudits commented Nov 23, 2016

In my experience, there are practical limits what Hazelcast based store can provide to you, as the TimerService API is not designed with distributed systems in mind.

In our project we rolled our own timer coordination (before this store existed), by creating an EJB interceptor. We wanted to have "hot standby" node, so we needed to have all timers on all nodes (but actually run it on currently active node), and also rolling upgrades.

In rolling upgrade scenario the timer ids will not match and there's no way for application server to match two timers with similar intent in two different versions of application, as equals on the TimerConfig payload is too restrictive, and especially the spec does not say that it should have any particular meaning.

We ended up with application providing the TimerService with specific id in the payload, and also version counter, as the servers might skip some updates to the timer while offline (but I think this will not be the case with Hazelcast store).

@dorpsidioot
Copy link
Author

@pdudits We used locks and a persistent table to coordinate tasks that can only run once on a cluster. Each member fires the timer, but only the first one to get the lock executes the task and tracks it in the database. This provides us with fast-fail when one of the members goes down and avoids having to add custom pojo lib's to the payara's because of hazelcast classloader issues. It's not the most elegant solution, but in my experience it seems to be working.

maxencelaurent added a commit to maxencelaurent/Payara that referenced this issue Jan 24, 2017
@mikecroft mikecroft added this to the Payara 5 milestone Jul 6, 2017
@smillidge smillidge modified the milestones: Payara-Beta-1, Payara 5-alpha1 Sep 12, 2017
@smillidge smillidge removed this from the Payara-5-Beta-1 milestone Dec 9, 2017
@fturizo fturizo added 3:DevInProgress and removed Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev labels Feb 13, 2018
@smillidge
Copy link
Contributor

Fixed by #2394

@smillidge smillidge added this to the Payara 5.181 milestone Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Label issue as an enhancement request
Projects
None yet
Development

No branches or pull requests

5 participants