question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabling the scheduler

See original GitHub issue

Hi!

I am using db-scheduler-boot-starter and in my tests I don’t want the scheduler to run. I keep getting this output because I don’t want to configure flyway to create the tables in h2 database which I am using in my tests.

Something like this is in the outputs:

28/01/2020 12:50:32.740 [main] INFO  c.g.kagkarlsson.scheduler.Scheduler - Starting scheduler.
28/01/2020 12:50:32.776 [db-scheduler-execute-due-pool-2-thread-1] ERROR c.g.k.scheduler.RunUntilShutdown - Unhandled exception. Will keep running.
com.github.kagkarlsson.jdbc.SQLRuntimeException: Error when preparing statement.
	at com.github.kagkarlsson.jdbc.JdbcRunner.lambda$execute$3(JdbcRunner.java:56)
	at com.github.kagkarlsson.jdbc.JdbcRunner.withConnection(JdbcRunner.java:97)
	at com.github.kagkarlsson.jdbc.JdbcRunner.execute(JdbcRunner.java:48)
	at com.github.kagkarlsson.jdbc.JdbcRunner.query(JdbcRunner.java:44)
	at com.github.kagkarlsson.scheduler.JdbcTaskRepository.getDue(JdbcTaskRepository.java:125)
	at com.github.kagkarlsson.scheduler.Scheduler.executeDue(Scheduler.java:181)
	at com.github.kagkarlsson.scheduler.RunUntilShutdown.run(RunUntilShutdown.java:40)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "scheduled_tasks" not found; SQL statement:
select * from scheduled_tasks where picked = ? and execution_time <= ? order by execution_time asc [42102-200]

It would be nice with a property in spring where I could easily disable the scheduler from initilazing. For instance kagkarlsson.db-scheduler.enabled = false which would not initialize the and start the scheduler so that I can keep my logs clean in the tests.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kagkarlssoncommented, Feb 1, 2020

Hey btw, may I ask you @cash1981 , are you using db-scheduler at Nordea? I see you are a member of their Github org. Just trying to get a sense of where it is being used 😃

0reactions
kagkarlssoncommented, Feb 2, 2020

Ok thanks, appreciate it! FYI it is also in use at Digipost and Vy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable or Disable Scheduled Task in Windows 10 - Winaero
To Disable Scheduled Task in Windows 10 ... Click the Task Scheduler icon. ... Select the task, and click Disable in the right...
Read more >
How to disable the scheduler using SCHEDULER_DISABLED ...
Is it possible to disable the Scheduler, for maintenance work by executing the following statement: DBMS_SCHEDULER.set_scheduler_attribute(' ...
Read more >
Disabling a scheduled task - IBM
Log in to the Copy Services Manager GUI as a user with administrator privileges. · Click Settings > Scheduled Tasks. · From the...
Read more >
How to enable or disable Scheduled ... - The Windows Club
1] Using Task Scheduler · Click on the Windows Search box · Type task scheduler · Press the Enter key to open the...
Read more >
Disable-ScheduledTask - Microsoft Learn
This command uses the Get-Scheduledtask cmdlet to get all scheduled tasks in the \UpdateTasks\ folder. The command pipes this information to the Disable- ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found