@Documented @Retention(value=SOURCE) @Target(value={CONSTRUCTOR,METHOD}) public @interface ThreadNamed
ThreadNamed sets the thread name during method or constructor
execution, restoring it when the method or constructor completes (normally or
exceptionally).public abstract String value
value is treated as a formatted string for String.format(String, Object...) with any method or constructor
parameters passed in as formatting args. Use positional
notation to skip parameters, or they may be ignroed entirely in
which case value is treated as a plain string.
Example with formatting:
&64;ThreadNamed("Foo #%2$s")
public void doFoo(final String name, final int slot, final Object data) {
// Do something interesting with method parameters
} when called with "apple", 2, 3.14159 will set the current
thread name to
"Foo #2" while doFoo executes.FormatterCopyright © 2013–2014 binkley's BLOG. All rights reserved.