add some of the metrics mentioned in #718

use single static initialization of available metrics monitor registries

* This changes the original implementation to work in a similar way to
how slf4j selects and loads an implementation.
* Uses a single static instance so intialization is done only once.
* Doesn't throw IllegalStateException if multiple implementations are
found on the classpath. It instead selects and uses the first
implementation returned by iterator()
* Class left as an iterable to keep the API the same

add yammer metrics to examples to allow them to publish metrics

publish the number of threads used in an EventLoopGroup see issue #718

* seems like the better place to put this because it sets the default
thread count if the MultithreadEventLoopGroup uses super(0,...)
* It also happens to be the common parent class amongst all the
MultiThreadedEventLoopGroup implementations
* Count is reported for
io.netty.channel.{*,.local,.socket.aio,.socket.nio}

fix cosmetic issues pointed out in pull request and updated notice.txt

see https://github.com/netty/netty/pull/780

count # of channels registered in single threaded event loop

measure how many times Selector.select return before SELECT_TIME
Fix all Xlint:unchecked warnings
Fix inspector warnings introduced by recent mergences
Fix more inspector warnings introduced by recent mergences
Handle the case where JDK notifies aync I/O handler immediately

After some debugging, I found that JDK AIO implementation often performs
I/O immediately from the caller thread if the caller thread is the I/O
thread, and notifies the completion handler also immediately.  This
commit handles such a case correctly during reads and writes.

Additionally, this commit also changes SingleThreadEventExecutor to let
it handle unexpected exceptions such as AssertionError in a robus
manner.
Fix AssertionError from AsyncSocketChannel.beginRead()

An AssertionError is triggered by a ByteBuf when beginRead() attempts to
access the buffer which has been freed already.  This commit ensures the
buffer is not freed before performing an I/O operation.

To determine if the buffer has been freed, UnsafeByteBuf.isFreed() has
been added.
Use correct timeout in AioSocketChannel.beginRead()
Fix invalid memory access in AIO writes

To perform writes in AioSocketChannel, we get a ByteBuffer view of the
outbound buffer and specify it as a parameter when we call
AsynchronousSocketChannel.write().

In most cases, the write() operation is finished immediately.  However,
sometimes, it is scheduled for later execution.  In such a case, there's
a chance for a user's handler to append more data to the outbound
buffer.

When more data is appended to the outbound buffer, the outbound buffer
can expand its capacity by itself.  Changing the capacity of a buffer is
basically made of the following steps:

1. Allocate a larger new internal memory region.
2. Copy the current content of the buffer to the new memory region.
3. Rewire the buffer so that it refers to the new region.
4. Deallocate the old memory region.

Because the old memory region is deallocated at the step 4, the write
operation scheduled later will access the deallocated region, leading
all sort of data corruption or even segfaults.

To prevent this situation, I added suspendIntermediaryDeallocations()
and resumeIntermediaryDeallocations() to UnsafeByteBuf.

AioSocketChannel.doFlushByteBuf() now calls suspendIntermediaryDealloc()
to defer the deallocation of the old memory regions until the completion
handler is notified.
Fix a checkstyle error
[786] Fix possible corruption of first WebSocketFrame caused by WebSocketServerHandshaker*
fix socks5-auth subnegotiation version handling

Conflicts:

	codec-socks/src/main/java/io/netty/codec/socks/SocksAuthRequestDecoder.java
Remove unnecessary empty lines
Add back support for FileRegion. See #668
Cleanup
[maven-release-plugin] prepare release netty-4.0.0.Alpha8
[maven-release-plugin] prepare for next development iteration
Update netty-build to the latest version

From this commit, checkstyle considers an unnecessary empty line as a
violation.
[#787] Move the socks package to the right place
Replace UnsafeByteBuf with ByteBuf.unsafe() again

* UnsafeByteBuf is gone. I added ByteBuf.unsafe() back.
* To avoid extra instantiation, all ByteBuf implementations implement the ByteBuf.Unsafe interface.
* To hide this implementation detail, all ByteBuf implementations are package-private.
* AbstractByteBuf and SwappedByteBuf are public and they do not implement ByteBuf.Unsafe because they don't need to.
* unwrap() is not an unsafe operation anymore.
* ChannelBuf also has unsafe() and Unsafe. ByteBuf.Unsafe extends ChannelBuf.unsafe(). ChannelBuf.unsafe() provides free() operation so that a user does not need to down-cast the buffer in freeInbound/OutboundBuffer().
Fix possible NPE which accour if the inbound/outbound buffer was not lazy allocated yet