Skip to content

Commit

Permalink
Change the CoordinatorFactory deprecated methods to default
Browse files Browse the repository at this point in the history
Changed the CoordinatorFactory methods to be default methods.  This
will not require an implementer to implement the deprecated methods.

Updated the documentation on the methods to indicate resolve order as
a list.
  • Loading branch information
pfifer committed Aug 30, 2018
1 parent 03af17f commit 106c055
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import software.amazon.kinesis.processor.Checkpointer;

/**
*
* Used in the process of configuring and providing instances to the {@link Scheduler}
*/
public interface CoordinatorFactory {
/**
Expand All @@ -35,30 +35,48 @@ public interface CoordinatorFactory {
/**
* Creates GracefulShutdownCoordinator to be used by the Scheduler.
*
* <h3>Method Deprecated</h3>
* <p>
* Note: This method has been deprecated, and will be removed in a future release. Use the configuration in
* <strong>Note: This method has been deprecated, and will be removed in a future release. Use the configuration in
* {@link CoordinatorConfig#gracefulShutdownCoordinator}. Set the
* {@link CoordinatorConfig#gracefulShutdownCoordinator} to null in order to use this method.
* {@link CoordinatorConfig#gracefulShutdownCoordinator} to null in order to use this method.</strong>
* </p>
* <h4>Resolution Order</h3>
* <ol>
* <li>{@link CoordinatorConfig#gracefulShutdownCoordinator()}</li>
* <li>{@link CoordinatorFactory#createGracefulShutdownCoordinator()}</li>
* </ol>
*
*
* @return GracefulShutdownCoordinator
* @return a {@link GracefulShutdownCoordinator} that manages the process of shutting down the scheduler.
*/
@Deprecated
GracefulShutdownCoordinator createGracefulShutdownCoordinator();
default GracefulShutdownCoordinator createGracefulShutdownCoordinator() {
return new GracefulShutdownCoordinator();
}

/**
* Creates a WorkerStateChangeListener to be used by the Scheduler.
*
* <h3>Method Deprecated</h3>
* <p>
* Note: This method has been deprecated, and will be removed in a future release. Use the configuration in
* <strong>Note: This method has been deprecated, and will be removed in a future release. Use the configuration in
* {@link CoordinatorConfig#workerStateChangeListener}. Set the
* {@link CoordinatorConfig#workerStateChangeListener} to null in order to use this method.
* {@link CoordinatorConfig#workerStateChangeListener} to null in order to use this method.</strong>
* </p>
*
* @return
* <h4>Resolution Order</h3>
* <ol>
* <li>{@link CoordinatorConfig#workerStateChangeListener()}</li>
* <li>{@link CoordinatorFactory#createWorkerStateChangeListener()}</li>
* </ol>
*
* @return a {@link WorkerStateChangeListener} instance that will be notified for specific {@link Scheduler} steps.
*/
@Deprecated
WorkerStateChangeListener createWorkerStateChangeListener();
default WorkerStateChangeListener createWorkerStateChangeListener() {
return new NoOpWorkerStateChangeListener();
}

/**
* Creates a RecordProcessorChedckpointer to be used by the Scheduler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,6 @@ public ExecutorService createExecutorService() {
new ThreadFactoryBuilder().setNameFormat("ShardRecordProcessor-%04d").build());
}

/**
* {@inheritDoc}
*/
@Deprecated
@Override
public GracefulShutdownCoordinator createGracefulShutdownCoordinator() {
return new GracefulShutdownCoordinator();
}

/**
* {@inheritDoc}
*/
@Deprecated
@Override
public WorkerStateChangeListener createWorkerStateChangeListener() {
return new NoOpWorkerStateChangeListener();
}

static class SchedulerThreadPoolExecutor extends ThreadPoolExecutor {
private static final long DEFAULT_KEEP_ALIVE = 60L;
SchedulerThreadPoolExecutor(ThreadFactory threadFactory) {
Expand Down

0 comments on commit 106c055

Please sign in to comment.