Some times you want to execute a method for each specified period of time, so you
1- Make a class that implements TimerListener interface and implements timerExpired method.
2- Make a weblogic time manager that executes timerExpired method for every 30 seconds
The control returns back to the user and request goes into the queue for processing.
This allows to continue normal user actions in ADF session and run long running jobs in the background, otherwise ADF applications session would be blocked.
To cancel the request make "JobTime" class implements interfae called CancelTimerListener
and overrides method:
public void timerCancel(Timer timer) {
}
and within code of timerExpired Method write
public void timerExpired(Timer timer) {
//Based on your condition cancel the timer
timer.cancel();
}
1- Make a class that implements TimerListener interface and implements timerExpired method.
Class JobTime implements TimerListener
public void timerExpired(Timer timer) {
}
2- Make a weblogic time manager that executes timerExpired method for every 30 seconds
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 30);
InitialContext ic = new InitialContext();
TimerManager tm = (TimerManager)ic.lookup("java:comp/env/tm/TimerManager");
tm.scheduleAtFixedRate(new JobTime(), cal.getTime(), 30 * 1000);
The control returns back to the user and request goes into the queue for processing.
This allows to continue normal user actions in ADF session and run long running jobs in the background, otherwise ADF applications session would be blocked.
To cancel the request make "JobTime" class implements interfae called CancelTimerListener
and overrides method:
public void timerCancel(Timer timer) {
}
and within code of timerExpired Method write
public void timerExpired(Timer timer) {
//Based on your condition cancel the timer
timer.cancel();
}
No comments:
Post a Comment