Class Chronos

java.lang.Object
com.elex_project.chronos.Chronos

public class Chronos extends Object
API entry point for scheduling tasks.
  
  Chronos.init(16);

  Chronos.scheduler()
      .task(() -> { })
      .every(1, TimeUnit.SECONDS)
      .schedule();

  Chronos.shutdown();
  
 
Since:
2026-06-28
  • Method Details

    • init

      public static void init(int corePoolSize)
      원하는 스레드 풀 크기로 최초 1회 초기화합니다.
      Parameters:
      corePoolSize - the number of threads in the pool, default is 4.
      Throws:
      IllegalStateException - if the instance is already initialized.
    • getInstance

      public static Chronos getInstance()
      Returns:
      ChronosManager instance
    • getTaskIds

      public Set<String> getTaskIds()
    • isRegistered

      public boolean isRegistered(String taskId)
    • getTaskContext

      public TaskContext getTaskContext(String taskId)
    • getScheduledFuture

      public ScheduledFuture<?> getScheduledFuture(String taskId)
    • register

      public void register(TaskContext context, ScheduledFuture<?> initialFuture)
      새로운 태스크를 매니저에 등록하고 스케줄링을 시작합니다.
    • updateFuture

      public void updateFuture(String taskId, ScheduledFuture<?> newFuture)
      실행 중인 특정 Future 자원을 업데이트합니다 (엔진 내부 재귀 호출 시 사용)
    • pause

      public void pause(String taskId)
      특정 태스크를 일시 정지합니다. (스케줄 루프는 돌지만 비즈니스 로직 실행이 차단됨)
      Parameters:
      taskId - unique identifier for the task
    • resume

      public void resume(String taskId)
      일시 정지된 태스크를 다시 재개합니다.
      Parameters:
      taskId - unique identifier for the task
    • isPaused

      public boolean isPaused(String taskId)
      태스크의 일시 정지 여부를 확인합니다.
      Parameters:
      taskId - unique identifier for the task
    • cancel

      public void cancel(String taskId)
      특정 태스크를 완전히 취소하고 스케줄러에서 제거합니다.
      Parameters:
      taskId - unique identifier for the task
    • shutdown

      public void shutdown()
      모든 태스크를 종료하고 스케줄러 엔진을 폐쇄합니다.
    • scheduler

      public static ChronosBuilder.JobStep scheduler()
      Starts a new task scheduling process.
      Returns:
      builder for fluent API
    • scheduler

      public static ChronosBuilder.JobStep scheduler(String taskId)
      Starts a new task scheduling process.
      Parameters:
      taskId - unique identifier for the task
      Returns:
      builder for fluent API
    • scanAndRegister

      public static void scanAndRegister(String basePackage)
      특정 패키지 내의 @TaskComponent 클래스들을 찾아 내부 @Task 메서드를 엔진에 등록합니다.