Provide a proper way to remove thread-local variables

See #2483 and #2522

Motivation:

When Netty runs in a managed environment such as web application server,
Netty needs to provide an explicit way to remove the thread-local
variables it created to prevent class loader leaks.

Modifications:

- FastThreadLocal now keeps track of all thread local variables it has
  initialized, and calling FastThreadLocal.removeAll() will remove all
  thread-local variables of the caller thread.
- Added ThreadDeathWatcher.unwatch() so that PooledByteBufAllocator
  tells it to stop watching when its thread-local cache has been freed
  by FastThreadLocal.removeAll().
- Added FastThreadLocalTest to ensure that removeAll() works

Result:

A user can remove all thread-local variables Netty created, as long as
he or she did not exit from the current thread. (Note that there's no
way to remove a thread-local variable from outside of the thread.)

Ahh, will fix that.  So, is what you were saying that a user can do the
decoration by overriding newThread()? (i.e. no need for another protected
method) If so, yeah, let's remove decorateRunnable and do the decoration in
newThread.
2014. 6. 17. 오후 9:16에 "Norman Maurer" <notifications@github.com>님이 작성:

> In common/src/main/java/io/netty/util/concurrent/DefaultThreadFactory.java:
>
> > @@ -123,4 +124,26 @@ public Thread newThread(Runnable r) {
> >      protected Thread newThread(Runnable r, String name) {
> >          return new FastThreadLocalThread(r, name);
> >      }
> > +
> > +    protected Runnable decorateRunnable(Runnable r) {
>
> @trustin <https://github.com/trustin> I think you not used
> decorateRunnable(...) in this class.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/netty/netty/pull/2578/files#r13855192>.
>