Java Code Examples for com.sun.corba.se.impl.protocol.RequestCanceledException

The following examples show how to use com.sun.corba.se.impl.protocol.RequestCanceledException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 2
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 3
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 4
Source Project: JDKSourceCode1.8   Source File: CorbaMessageMediatorImpl.java    License: MIT License 5 votes vote down vote up
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 5
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 6
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 7
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 8
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 9
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 10
protected SystemException convertThrowableToSystemException(
    Throwable throwable,
    CompletionStatus completionStatus)
{
    if (throwable instanceof SystemException) {
        return (SystemException)throwable;
    }

    if (throwable instanceof RequestCanceledException) {
        // Reporting an exception response causes the
        // poa current stack, the interceptor stacks, etc.
        // to be balanced.  It also notifies interceptors
        // that the request was cancelled.

        return wrapper.requestCanceled( throwable ) ;
    }

    // NOTE: We do not trap ThreadDeath above Throwable.
    // There is no reason to stop the thread.  It is
    // just a worker thread.  The ORB never throws
    // ThreadDeath.  Client code may (e.g., in ServantManagers,
    // interceptors, or servants) but that should not
    // effect the ORB threads.  So it is just handled
    // generically.

    //
    // Last resort.
    // If user code throws a non-SystemException report it generically.
    //

    return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
}
 
Example 11
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 12
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 13
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 14
Source Project: JDKSourceCode1.8   Source File: BufferManagerReadStream.java    License: MIT License 4 votes vote down vote up
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 15
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 16
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 17
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 18
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 19
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}
 
Example 20
public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
{

  ByteBufferWithInfo result = null;

  try {
      //System.out.println("ENTER underflow");

    synchronized (fragmentQueue) {

        if (receivedCancel) {
            throw new RequestCanceledException(cancelReqId);
        }

        while (fragmentQueue.size() == 0) {

            if (endOfStream) {
                throw wrapper.endOfStream() ;
            }

            boolean interrupted = false;
            try {
                fragmentQueue.wait(FRAGMENT_TIMEOUT);
            } catch (InterruptedException e) {
                interrupted = true;
            }

            if (!interrupted && fragmentQueue.size() == 0) {
                throw wrapper.bufferReadManagerTimeout();
            }

            if (receivedCancel) {
                throw new RequestCanceledException(cancelReqId);
            }
        }

        result = fragmentQueue.dequeue();
        result.fragmented = true;

        if (debug)
        {
            // print address of ByteBuffer being dequeued
            int bbAddr = System.identityHashCode(result.byteBuffer);
            StringBuffer sb1 = new StringBuffer(80);
            sb1.append("underflow() - dequeued ByteBuffer id (");
            sb1.append(bbAddr).append(") from fragment queue.");
            String msg1 = sb1.toString();
            dprint(msg1);
        }

        // VERY IMPORTANT
        // Release bbwi.byteBuffer to the ByteBufferPool only if
        // this BufferManagerStream is not marked for potential restore.
        if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
        {
            ByteBufferPool byteBufferPool = getByteBufferPool();

            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("underflow() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }

            byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
            bbwi.byteBuffer = null;
            bbwi = null;
        }
    }
    return result;
  } finally {
      //System.out.println("EXIT underflow");
  }
}