In DW Core
(https://www.dropwizard.io/en/latest/manual/core.html#managed-objects), the
sample code below talks about configuring Executor Service in Application
run method.
If I want to access executorService in my class, what is the right way to
get a reference?
<<<<<<snip>>>>>>
It should be noted that Environment has built-in factory methods
for ExecutorService and ScheduledExecutorService instances which are
managed. These managed instances use InstrumentedThreadFactory that
monitors the number of threads created, running and terminated
public class MyApplication extends Application<MyConfiguration> {
@Override
public void run(MyConfiguration configuration, Environment environment) {
ExecutorService executorService = environment.lifecycle()
.executorService(nameFormat)
.maxThreads(maxThreads) .build();
ScheduledExecutorService scheduledExecutorService =
environment.lifecycle() .scheduledExecutorService(nameFormat)
.build();
}
}
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dropwizard-user/e19b94f3-7627-431b-a9a8-6ef015777b39n%40googlegroups.com.