@SuppressWarnings("unchecked") private void transferChunk(){
  final LinkedList<V> c=new LinkedList<V>();
  queue.drainTo(c,buffer.getMinimumChunkSize());
  final int chunkSize=c.size();
  if (chunkSize == 0)   return;
  final V[] a=(V[])java.lang.reflect.Array.newInstance(c.getFirst().getClass(),chunkSize);
  int i=0;
  for (  V v : c) {
    assert v != null : "null @ index=" + i;
    a[i++]=v;
  }
  assert i == chunkSize : "i=" + i + ", chunkSize="+ chunkSize;
  if (log.isInfoEnabled()) {
    log.info("chunkSize=" + chunkSize + ", naccepted="+ acceptCount+ ", chunkCount="+ chunkCount);
  }
  buffer.add(a);
  chunkCount.incrementAndGet();
}

@ SuppressWarnings ( "unchecked" ) private void transferChunk ( ) { final LinkedList < V > c = new LinkedList < V > ( ) ; queue . drainTo ( c , buffer . getMinimumChunkSize ( ) ) ; final int chunkSize = c . size ( ) ; if ( chunkSize == 0 ) return ; final V [ ] a = ( V [ ] ) java . lang . reflect . Array . newInstance ( c . getFirst ( ) . getClass ( ) , chunkSize ) ; int i = 0 ; for ( V v : c ) { assert v != null : "null @ index=" + i ; a [ i ++ ] = v ; } assert i == chunkSize : "i=" + i + ", chunkSize=" + chunkSize ; if ( log . isInfoEnabled ( ) ) { log . info ( "chunkSize=" + chunkSize + ", naccepted=" + acceptCount + ", chunkCount=" + chunkCount ) ; } buffer . add ( a ) ; chunkCount . incrementAndGet ( ) ; }
drain a chunk from the queue , transferring it to the buffer ( blocks if the buffer is full ) .
