Code example for AtomicLong

Methods: addAndGet

0
	public long getTransferredBytes(){ 
		return transferredBytes.get();
	} 
	 
	public void messageReceived(ChannelHandlerContext ctx,MessageEvent e){
		transferredBytes.addAndGet(((ChannelBuffer)e.getMessage()).readableBytes());
		e.getChannel().write(e.getMessage());
	} 
	 
	public void exceptionCaught(ChannelHandlerContext ctx,ExceptionEvent e){
		logger.log(Level.WARNING,"Unexpected exception from downstream"+e.getCause());
		e.getChannel().close();
	} 
}