I'm building an application that might or might not be deployed in a clustered environment. It's an open-source project (http://subetha.tigris.org/) that provides a fair amount of latitude to administrators in how they want JBoss configured. Most folks will just have a single standalone instance, but some will want a big cluster of nodes.
Our application needs a service that wakes up once a night and performs housecleaning. In a clustered environment, it would naturally be a HASingletonService. However, if I actually use an HASingletonService and place dependencies on the cluster serivce, then my application will not run in a non-clustered JBoss.
What I need is a way to make a service that will be HASingletonService if clustering is enabled, and a normal service if clustering is not enabled. Is this possible?
I realize the temptation to say "just run a single JBoss node with clustered configuration". If I were only deploying SubEtha on my own system, I would be fine with that. However, replacing Mailman with a JBoss-based system becomes a harder and harder sell with every service and listening port we include in the minimal install.