{"id":21565319,"url":"https://github.com/sandeepkv93/delayed-job-scheduler","last_synced_at":"2025-03-18T05:17:57.142Z","repository":{"id":75506310,"uuid":"588784846","full_name":"sandeepkv93/delayed-job-scheduler","owner":"sandeepkv93","description":"This is a simple implementation of a delayed job scheduler written in Java. The scheduler allows you to schedule jobs with a specific date and time, and will execute the job when the specified time is reached.","archived":false,"fork":false,"pushed_at":"2024-04-19T17:56:11.000Z","size":13,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-24T11:44:49.946Z","etag":null,"topics":["java","java8","multithreading","scheduledexecutorservice"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandeepkv93.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-14T01:58:54.000Z","updated_at":"2023-01-14T08:58:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"fea2aa7d-8ea5-46a9-81ef-17c6492b25c5","html_url":"https://github.com/sandeepkv93/delayed-job-scheduler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandeepkv93%2Fdelayed-job-scheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandeepkv93%2Fdelayed-job-scheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandeepkv93%2Fdelayed-job-scheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandeepkv93%2Fdelayed-job-scheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandeepkv93","download_url":"https://codeload.github.com/sandeepkv93/delayed-job-scheduler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244160057,"owners_count":20408021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","java8","multithreading","scheduledexecutorservice"],"created_at":"2024-11-24T10:19:13.411Z","updated_at":"2025-03-18T05:17:57.118Z","avatar_url":"https://github.com/sandeepkv93.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Delayed Job Scheduler\n\n|Implementation                     |Link  |\n|-----------------------------------|------|\n|Using java.util.concurrent.ScheduledExecutorService| https://github.com/sandeepkv93/delayed-job-scheduler/tree/UsingJavaUtilScheduledExecutorService|\n|Using custom built ScheduledExector| https://github.com/sandeepkv93/delayed-job-scheduler/tree/UsingCustomScheduledExecutor|\n\nThis repository contains a simple implementation of a delayed job scheduler in Java. The scheduler allows you to schedule jobs to run at a specific date and time, and also provides the ability to cancel scheduled jobs.\n\n### Features\n- Schedule jobs with a specific date and time\n- Cancel scheduled jobs\n- Shut down the scheduler\n\n### Getting Started\nTo start using the delayed job scheduler, you will need to create an instance of the DelayedJobScheduler class. You can then use this instance to schedule jobs and cancel scheduled jobs.\n\n#### Scheduling a Job\nTo schedule a job, you can use the scheduleJob method of the DelayedJobScheduler class. This method takes three arguments:\n\n- The name of the job (a string)\n- The date and time when the job should run (a LocalDateTime object)\n- The task that should be executed when the job runs (a Runnable object)\n- The method returns an integer, which is the ID of the scheduled job. You can use this ID to cancel the job later, if needed.\n\n#### Canceling a Job\nTo cancel a job, you can use the cancelJob method of the DelayedJobScheduler class. This method takes a single argument: the ID of the job that you want to cancel.\n\n#### Shutting Down the Scheduler\nWhen you are finished scheduling jobs, you can shut down the scheduler using the shutdown method of the DelayedJobScheduler class. This method stops the scheduler's internal thread and releases any resources that it is using.\n\n### Usage\nTo use the scheduler, you first need to create an instance of the DelayedJobScheduler class. You can then use the scheduleJob method to schedule a job with a specific date and time, and a Runnable task to be executed. The method returns an int jobId, which can be used to cancel the job later.\n```java\nDelayedJobScheduler scheduler = new DelayedJobScheduler();\nLocalDateTime dateTime = LocalDateTime.now().plusSeconds(5);\nint jobId = scheduler.scheduleJob(\"Job 1\", dateTime, () -\u003e System.out.println(\"Running job 1\"));\n```\nYou can also cancel a scheduled job using the cancelJob method and passing in the jobId.\n```java\nscheduler.cancelJob(jobId);\n```\nFinally, you can shut down the scheduler using the shutdown method.\n```java\nscheduler.shutdown();\n```\n\n### Conclusion\nThe delayed job scheduler is a simple, yet powerful tool that can be used to schedule tasks to run at specific times. It is easy to use, and provides the ability to cancel scheduled jobs. It is a lightweight library and easy to implement.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandeepkv93%2Fdelayed-job-scheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandeepkv93%2Fdelayed-job-scheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandeepkv93%2Fdelayed-job-scheduler/lists"}