Merge pull request #388 from pfifer/default-deprecated

Change the CoordinatorFactory deprecated methods to default
This commit is contained in:
Justin Pfifer 2018-08-30 08:17:33 -07:00 committed by GitHub
commit 0634a3c836
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 27 deletions

View file

@ -22,7 +22,7 @@ import software.amazon.kinesis.leases.ShardInfo;
import software.amazon.kinesis.processor.Checkpointer;
/**
*
* Used in the process of configuring and providing instances to the {@link Scheduler}
*/
public interface CoordinatorFactory {
/**
@ -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.

View file

@ -45,24 +45,6 @@ public class SchedulerCoordinatorFactory implements CoordinatorFactory {
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) {