views:

169

answers:

1

How can I get a timer task on a WebSphere cluster to execute once and only once? I know this is possible on other app servers but can't figure out how to do this in WebSphere.

A: 

I'm not sure if your problem is a cluster or something else. But if you want to stop a TimerListener after one execution you would just use the inputed timer variable and cancel it.

Ex:

public static class MyTimer implements TimerListener {
     public void timerExpired(Timer timer) {    
         timer.cancel();
     }
}

If you are having a problem with the cluster environment running the task once per instance than my apologies for posting this simple answer.

Zach