Package org.apache.mina.util

Examples of org.apache.mina.util.ExpiringStack


        stacks.remove(buf);
      }
    }
    ExpiringStack[] bufferStacks = buf.buf().isDirect() ? directBufferStacks
        : heapBufferStacks;
    ExpiringStack stack = bufferStacks[getBufferStackIndex(bufferStacks,
        buf.buf().capacity())];

    synchronized (stack) {
      // push back
      stack.push(buf);
    }
  }
View Full Code Here


        synchronized (containerStack) {
          containerStack.expireBefore(expirationTime);
        }

        for (int i = directBufferStacks.length - 1; i >= 0; i--) {
          ExpiringStack stack = directBufferStacks[i];
          synchronized (stack) {
            stack.expireBefore(expirationTime);
          }
        }

        for (int i = heapBufferStacks.length - 1; i >= 0; i--) {
          ExpiringStack stack = heapBufferStacks[i];
          synchronized (stack) {
            stack.expireBefore(expirationTime);
          }
        }
      }
    }
View Full Code Here

    private UnexpandableByteBuffer allocate0( int capacity, boolean direct )
    {
        ExpiringStack[] bufferStacks = direct ? directBufferStacks : heapBufferStacks;
        int idx = getBufferStackIndex( bufferStacks, capacity );
        ExpiringStack stack = bufferStacks[idx];

        UnexpandableByteBuffer buf;
        synchronized( stack )
        {
            buf = ( UnexpandableByteBuffer ) stack.pop();
        }

        if( buf == null )
        {
            java.nio.ByteBuffer nioBuf =
View Full Code Here

    }

    private void release0( UnexpandableByteBuffer buf )
    {
        ExpiringStack[] bufferStacks = buf.buf().isDirect() ? directBufferStacks : heapBufferStacks;
        ExpiringStack stack = bufferStacks[getBufferStackIndex( bufferStacks, buf.buf().capacity() )];

        synchronized( stack )
        {
            // push back
            stack.push( buf );
        }
    }
View Full Code Here

                // Expire old buffers
                long expirationTime = System.currentTimeMillis() - timeout;

                for( int i = directBufferStacks.length - 1; i >= 0; i -- )
                {
                    ExpiringStack stack = directBufferStacks[i];
                    synchronized( stack )
                    {
                        stack.expireBefore( expirationTime );
                    }
                }

                for( int i = heapBufferStacks.length - 1; i >= 0; i -- )
                {
                    ExpiringStack stack = heapBufferStacks[i];
                    synchronized( stack )
                    {
                        stack.expireBefore( expirationTime );
                    }
                }
            }
        }
View Full Code Here

        expirer.shutdown();

        for( int i = directBufferStacks.length - 1; i >= 0; i -- )
        {
            ExpiringStack stack = directBufferStacks[i];
            synchronized( stack )
            {
                stack.clear();
            }
        }
        for( int i = heapBufferStacks.length - 1; i >= 0; i -- )
        {
            ExpiringStack stack = heapBufferStacks[i];
            synchronized( stack )
            {
                stack.clear();
            }
        }
        disposed = true;
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.util.ExpiringStack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.