MCPcopy Create free account
hub / github.com/antlr/codebuff / renamingDecorator

Method renamingDecorator

output/java_guava/1.4.18/MoreExecutors.java:817–832  ·  view source on GitHub ↗

Creates an Executor that renames the Thread threads that its tasks run in. The names are retrieved from the nameSupplier on the thread that is being renamed right before each task is run. The renaming is best effort, if a SecurityManager prevents the renaming then

(
    final Executor executor, final Supplier<String> nameSupplier)

Source from the content-addressed store, hash-verified

815 */
816
817 @GwtIncompatible // concurrency
818 static Executor renamingDecorator(
819 final Executor executor, final Supplier<String> nameSupplier) {
820 checkNotNull(executor);
821 checkNotNull(nameSupplier);
822 if (isAppEngine()) {
823 // AppEngine doesn't support thread renaming, so don't even try
824 return executor;
825 }
826 return new Executor() {
827 @Override
828 public void execute(Runnable command) {
829 executor.execute(Callables.threadRenaming(command, nameSupplier));
830 }
831 };
832 }
833
834 /**
835 * Creates an {@link ExecutorService} that renames the {@link Thread threads} that its tasks run

Callers 4

doStartMethod · 0.95
doStopMethod · 0.95
doStartMethod · 0.95
doStartMethod · 0.95

Calls 2

isAppEngineMethod · 0.95
checkNotNullMethod · 0.45

Tested by

no test coverage detected