Q:

How to run method every night on JEE Cluster

I have a Java EE Application running on Glassfish 3.1.2 in a clustered environement. 
I want to execute a specific method once a day (i.e. delete some entries from the database). 
I created a Timer:
@Singleton
public class TimerService {
    @Schedule(second = "0", minute = "0", hour = "0", persistent=false)
    public void runEveryDay() {
        LOG.info("### runEveryDay");
    }   

When I look into the logs, the method is executed on both cluster nodes.  I fear that when executing the method on both nodes at the same time I might run into problems because of stale data. 
Is there a way that the method is executed only on one node?  Or can I synchronize the methods somehow? 

A:

Set your timer to be persistent.  It then should only execute on one server node in the cluster. 