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

The following examples show how to use com.sun.corba.se.impl.protocol.RequestCanceledException. 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
Source File: CorbaMessageMediatorImpl.java    From jdk1.8-source-analysis with Apache License 2.0 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 #2
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 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 #3
Source File: CorbaMessageMediatorImpl.java    From openjdk-8 with GNU General Public License v2.0 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 #4
Source File: CorbaMessageMediatorImpl.java    From jdk8u60 with GNU General Public License v2.0 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
Source File: CorbaMessageMediatorImpl.java    From JDKSourceCode1.8 with 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 #6
Source File: CorbaMessageMediatorImpl.java    From openjdk-8-source with GNU General Public License v2.0 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 #7
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 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 #8
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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 #9
Source File: CorbaMessageMediatorImpl.java    From hottub with GNU General Public License v2.0 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 #10
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 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 #11
Source File: BufferManagerReadStream.java    From openjdk-8 with GNU General Public License v2.0 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 #12
Source File: BufferManagerReadStream.java    From openjdk-8-source with GNU General Public License v2.0 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 #13
Source File: BufferManagerReadStream.java    From hottub with GNU General Public License v2.0 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 #14
Source File: BufferManagerReadStream.java    From openjdk-jdk9 with GNU General Public License v2.0 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
Source File: BufferManagerReadStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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 #16
Source File: BufferManagerReadStream.java    From openjdk-jdk8u with GNU General Public License v2.0 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 #17
Source File: BufferManagerReadStream.java    From JDKSourceCode1.8 with 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 #18
Source File: BufferManagerReadStream.java    From jdk8u60 with GNU General Public License v2.0 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 #19
Source File: BufferManagerReadStream.java    From TencentKona-8 with GNU General Public License v2.0 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 #20
Source File: BufferManagerReadStream.java    From jdk1.8-source-analysis with Apache License 2.0 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");
  }
}