io.dropwizard.servlets.tasks.Task Java Examples

The following examples show how to use io.dropwizard.servlets.tasks.Task. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DropwizardModule.java    From dropwizard-guicier with Apache License 2.0 6 votes vote down vote up
@Override
public void configure(final Binder binder) {
  binder.bindListener(Matchers.any(), new ProvisionListener() {
    @Override
    public <T> void onProvision(ProvisionInvocation<T> provision) {
      Object obj = provision.provision();

      if (obj instanceof Managed) {
        handle((Managed) obj);
      }

      if (obj instanceof Task) {
        handle((Task) obj);
      }

      if (obj instanceof HealthCheck) {
        handle((HealthCheck) obj);
      }

      if (obj instanceof ServerLifecycleListener) {
        handle((ServerLifecycleListener) obj);
      }
    }
  });
}
 
Example #2
Source File: TaskScanner.java    From robe with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void scanAndAdd(Environment environment, Injector injector, Reflections reflections) {
    Set<Class<? extends Task>> taskClasses = reflections.getSubTypesOf(Task.class);
    for (Class<? extends Task> task : taskClasses) {
        environment.admin().addTask(injector.getInstance(task));
        LOGGER.info("Added task: " + task);
    }
}
 
Example #3
Source File: DropwizardTaskRegistry.java    From emodb with Apache License 2.0 4 votes vote down vote up
@Override
public void addTask(Task task) {
    _environment.admin().addTask(task);
}
 
Example #4
Source File: IgnoreAllTaskRegistry.java    From emodb with Apache License 2.0 4 votes vote down vote up
@Override
public void addTask(Task task) {
    // ignore
}
 
Example #5
Source File: DropwizardModule.java    From dropwizard-guicier with Apache License 2.0 4 votes vote down vote up
private void handle(Task task) {
  environment.admin().addTask(task);
  LOG.info("Added guice injected Task: {}", task.getClass().getName());
}
 
Example #6
Source File: TaskInstaller.java    From dropwizard-guicey with MIT License 4 votes vote down vote up
@Override
public boolean matches(final Class<?> type) {
    return FeatureUtils.is(type, Task.class);
}
 
Example #7
Source File: TaskInstaller.java    From dropwizard-guicey with MIT License 4 votes vote down vote up
@Override
public void install(final Environment environment, final Task instance) {
    environment.admin().addTask(instance);
}
 
Example #8
Source File: TaskRegistry.java    From emodb with Apache License 2.0 votes vote down vote up
void addTask(Task task);