2
I need to create a task runner where it will call a method from time to time.
I saw an example and it was like this my implementation:
public class Agendador {
// Scheduler
private final ScheduledExecutorService s = Executors.newScheduledThreadPool(1);
final Runnable beeper = new Runnable() {
@Override
public void run() {
EncomendaController controller = new EncomendaController();
controller.pesquisar();
}
};
// Beeper Handler
final ScheduledFuture<?> b = s.scheduleAtFixedRate(beeper, 0, 1, TimeUnit.MINUTES);
}
How can I make Wildfly execute the scheduling and execution of this task?
How different from them?
– Roknauta
Stateless does not maintain the state of the object, Singleton as stateless with only 1 instance, Stateful retains the whole state of the object. I recommend reading about Design Patterns (Design Patterns) and EJB Session Status as the question is complex.
– ℛɑƒæĿᴿᴹᴿ
I get it, he’s calling the method but he’s giving nullpointer on the method I don’t know pq :(
– Roknauta
Just by mistake it becomes difficult to know, anything opens a new question...
– ℛɑƒæĿᴿᴹᴿ
I’ve seen what it was, thank you :)
– Roknauta