R
R
ring0za2016-02-08 04:53:13
Java
ring0za, 2016-02-08 04:53:13

How to execute code in Java once on a certain date?

Using the ScheduledExecutorService, what parameters should be passed to it so that it starts at a certain time and does not start again? Everywhere on "SO" only saw that "periodically" and "intervals".

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
protven, 2016-02-08
@protven

Use the quartz library https://quartz-scheduler.org/documentation

I
ivan19631224, 2016-02-08
@ivan19631224

https://docs.oracle.com/javase/7/docs/api/java/uti...
Isn't the ScheduledExecutorService.schedule() method suitable for you?

schedule(Runnable command, long delay, TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.

Runs once at the specified interval.

C
cthulhudx, 2016-02-08
@cthulhudx

There is a Timer class for this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question