Actually, poller had two predefined triggers (interval based and Cron). Obviously for your case, non would work which means you have to implement your own.
The Trigger interface is quite simple as you can see:
Code:
public interface Trigger {
Date nextExecutionTime(TriggerContext triggerContext);
}
All you need to do in the implementation is something like this:
Code:
public class MyTrigger implements Trigger {
private volatile boolean initiaized = false;
public Date nextExecutionTime(TriggerContext triggerContext) {
if (!initiaized){
initialized = true;
return new Date(System.currentTimeMillis());
}
return null;
}
}
As you can see it will return Date only once which means it will only execute once.
Then you inject the above bean via 'trigger' attribute.