I'm using JBoss 4.2.1 GA and I'm trying to deploy a singleton service bean into a cluster and I've found three ways to do it:
1) deploy as a true HA singleton (didn't manage to get it to work),
2) deploy through a .sar archive with jboss-service.xml descriptor with a HASingletonDeployer Barrier dependency (the service gets created on each node, but only starts on one, which seems to work fine),
3) deploy with .jar and @Service annotation, without a descriptor file (works fine, only one node creates and starts the service).
Next, I want to add a scheduler that would call this singleton service on specified intervals. If I go with no. 2, it works fine, I add a SchedulerProvider with dependency on my mbean and also on HASingletonDeployer Barrier, so that the scheduler also only runs on one node.
This works fine, but I'm trying to deploy the service as described in no. 3. I'd have to rename the file to .jar, since @Service annotation doesn't get picked up if it's present inside a .sar archive, so the service isn't started and the scheduler reports a dependancy error (of course). I'd prefer to deploy my service as a "true" service, not simulate it via singleton-barrier dependency.
So; how can I deploy a @Service and a scheduler at the same time? I can't find any annotations for scheduling. I've searched around quite a lot, but can't find The Answer.
Perhaps I'm going the wrong way about it, but I need some sort of a singleton timer that would serve as the main job manager that would delegate work to specific beans in the cluster -- scheduled calls to clustered downloading, log processing, and such.
Thanks and best regards,
Perhaps I should make it shorter and more precise.
1) Is it possible to deploy a @Service-annotated service through a .sar file? So far, this only works via jar for me.
2) Is it possible to set up a scheduler with annotations?
The problem is, that @Service annotation is ignored with sar-deployer, and at the same time jboss-service.xml Scheduler configuration is ignore with jar-deployer.