com.sun.corba.se.impl.encoding.ByteBufferWithInfo Java Examples

The following examples show how to use com.sun.corba.se.impl.encoding.ByteBufferWithInfo. 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: CDROutputObject.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the contents of the CDROutputStream to the specified
 * output stream.  Has the side-effect of pushing any current
 * Message onto the Message list.
 * @param s The output stream to write to.
 */
public void writeTo(CorbaConnection connection)
    throws java.io.IOException
{

    //
    // Update the GIOP MessageHeader size field.
    //

    ByteBufferWithInfo bbwi = getByteBufferWithInfo();

    getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());

    if (orb() != null) {
        if (((ORB)orb()).transportDebugFlag) {
            dprint(".writeTo: " + connection);
        }
        if (((ORB)orb()).giopDebugFlag) {
            CDROutputStream_1_0.printBuffer(bbwi);
        }
    }
    bbwi.byteBuffer.position(0).limit(bbwi.getSize());
    connection.write(bbwi.byteBuffer);
}
 
Example #2
Source File: CDROutputObject.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the contents of the CDROutputStream to the specified
 * output stream.  Has the side-effect of pushing any current
 * Message onto the Message list.
 * @param s The output stream to write to.
 */
public void writeTo(CorbaConnection connection)
    throws java.io.IOException
{

    //
    // Update the GIOP MessageHeader size field.
    //

    ByteBufferWithInfo bbwi = getByteBufferWithInfo();

    getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());

    if (orb() != null) {
        if (((ORB)orb()).transportDebugFlag) {
            dprint(".writeTo: " + connection);
        }
        if (((ORB)orb()).giopDebugFlag) {
            CDROutputStream_1_0.printBuffer(bbwi);
        }
    }
    bbwi.byteBuffer.position(0).limit(bbwi.getSize());
    connection.write(bbwi.byteBuffer);
}
 
Example #3
Source File: CDROutputStream_1_0.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void init(org.omg.CORBA.ORB orb,
                    boolean littleEndian,
                    BufferManagerWrite bufferManager,
                    byte streamFormatVersion,
                    boolean usePooledByteBuffers)
{
    // ORB must not be null.  See CDROutputStream constructor.
    this.orb = (ORB)orb;
    this.wrapper = ORBUtilSystemException.get( this.orb,
        CORBALogDomains.RPC_ENCODING ) ;
    debug = this.orb.transportDebugFlag;

    this.littleEndian = littleEndian;
    this.bufferManagerWrite = bufferManager;
    this.bbwi = new ByteBufferWithInfo(orb, bufferManager, usePooledByteBuffers);
    this.streamFormatVersion = streamFormatVersion;

    createRepositoryIdHandlers();
}
 
Example #4
Source File: CDROutputObject.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Write the contents of the CDROutputStream to the specified
 * output stream.  Has the side-effect of pushing any current
 * Message onto the Message list.
 * @param s The output stream to write to.
 */
public void writeTo(CorbaConnection connection)
    throws java.io.IOException
{

    //
    // Update the GIOP MessageHeader size field.
    //

    ByteBufferWithInfo bbwi = getByteBufferWithInfo();

    getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());

    if (orb() != null) {
        if (((ORB)orb()).transportDebugFlag) {
            dprint(".writeTo: " + connection);
        }
        if (((ORB)orb()).giopDebugFlag) {
            CDROutputStream_1_0.printBuffer(bbwi);
        }
    }
    bbwi.byteBuffer.position(0).limit(bbwi.getSize());
    connection.write(bbwi.byteBuffer);
}
 
Example #5
Source File: CDROutputObject.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the contents of the CDROutputStream to the specified
 * output stream.  Has the side-effect of pushing any current
 * Message onto the Message list.
 * @param s The output stream to write to.
 */
public void writeTo(CorbaConnection connection)
    throws java.io.IOException
{

    //
    // Update the GIOP MessageHeader size field.
    //

    ByteBufferWithInfo bbwi = getByteBufferWithInfo();

    getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());

    if (orb() != null) {
        if (((ORB)orb()).transportDebugFlag) {
            dprint(".writeTo: " + connection);
        }
        if (((ORB)orb()).giopDebugFlag) {
            CDROutputStream_1_0.printBuffer(bbwi);
        }
    }
    bbwi.byteBuffer.position(0).limit(bbwi.getSize());
    connection.write(bbwi.byteBuffer);
}
 
Example #6
Source File: CDROutputObject.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the contents of the CDROutputStream to the specified
 * output stream.  Has the side-effect of pushing any current
 * Message onto the Message list.
 * @param s The output stream to write to.
 */
public void writeTo(CorbaConnection connection)
    throws java.io.IOException
{

    //
    // Update the GIOP MessageHeader size field.
    //

    ByteBufferWithInfo bbwi = getByteBufferWithInfo();

    getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());

    if (orb() != null) {
        if (((ORB)orb()).transportDebugFlag) {
            dprint(".writeTo: " + connection);
        }
        if (((ORB)orb()).giopDebugFlag) {
            CDROutputStream_1_0.printBuffer(bbwi);
        }
    }
    bbwi.byteBuffer.position(0).limit(bbwi.getSize());
    connection.write(bbwi.byteBuffer);
}
 
Example #7
Source File: CDROutputObject.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the contents of the CDROutputStream to the specified
 * output stream.  Has the side-effect of pushing any current
 * Message onto the Message list.
 * @param s The output stream to write to.
 */
public void writeTo(CorbaConnection connection)
    throws java.io.IOException
{

    //
    // Update the GIOP MessageHeader size field.
    //

    ByteBufferWithInfo bbwi = getByteBufferWithInfo();

    getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());

    if (orb() != null) {
        if (((ORB)orb()).transportDebugFlag) {
            dprint(".writeTo: " + connection);
        }
        if (((ORB)orb()).giopDebugFlag) {
            CDROutputStream_1_0.printBuffer(bbwi);
        }
    }
    bbwi.byteBuffer.position(0).limit(bbwi.getSize());
    connection.write(bbwi.byteBuffer);
}
 
Example #8
Source File: CDROutputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void init(org.omg.CORBA.ORB orb,
                    boolean littleEndian,
                    BufferManagerWrite bufferManager,
                    byte streamFormatVersion,
                    boolean usePooledByteBuffers)
{
    // ORB must not be null.  See CDROutputStream constructor.
    this.orb = (ORB)orb;
    this.wrapper = ORBUtilSystemException.get( this.orb,
        CORBALogDomains.RPC_ENCODING ) ;
    debug = this.orb.transportDebugFlag;

    this.littleEndian = littleEndian;
    this.bufferManagerWrite = bufferManager;
    this.bbwi = new ByteBufferWithInfo(orb, bufferManager, usePooledByteBuffers);
    this.streamFormatVersion = streamFormatVersion;

    createRepositoryIdHandlers();
}
 
Example #9
Source File: BufferManagerWriteCollect.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    // Enqueue the previous fragment
    queue.enqueue(bbwi);

    // Create a new bbwi
    ByteBufferWithInfo newBbwi = new ByteBufferWithInfo(orb, this);
    newBbwi.fragmented = true;

    // XREVISIT - Downcast
    ((CDROutputObject)outputObject).setByteBufferWithInfo(newBbwi);

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    // XREVISIT - Downcast
    FragmentMessage header =
          ((CDROutputObject)outputObject).getMessageHeader()
                                         .createFragmentMessage();

    header.write((CDROutputObject)outputObject);
}
 
Example #10
Source File: BufferManagerWriteStream.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    try {
       sendFragment(false);
    } catch(SystemException se){
            orb.getPIHandler().invokeClientPIEndingPoint(
                    ReplyMessage.SYSTEM_EXCEPTION, se);
            throw se;
    }

    // Reuse the old buffer

    // REVISIT - need to account for case when needed > available
    // even after fragmenting.  This is the large array case, so
    // the caller should retry when it runs out of space.
    bbwi.position(0);
    bbwi.buflen = bbwi.byteBuffer.limit();
    bbwi.fragmented = true;

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();

    header.write(((CDROutputObject)outputObject));
}
 
Example #11
Source File: BufferManagerWriteCollect.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Close the BufferManagerWrite - do any outstanding cleanup.
 *
 * For a BufferManagerWriteGrow any queued ByteBufferWithInfo must
 * have its ByteBuffer released to the ByteBufferPool.
 */
public void close()
{
    // iterate thru queue and release any ByteBufferWithInfo's
    // ByteBuffer that may be remaining on the queue to the
    // ByteBufferPool.

    Iterator bufs = iterator();

    ByteBufferPool byteBufferPool = orb.getByteBufferPool();

    while (bufs.hasNext())
    {
        ByteBufferWithInfo bbwi = (ByteBufferWithInfo)bufs.next();
        if (bbwi != null && bbwi.byteBuffer != null)
        {
            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("close() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }
             byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
             bbwi.byteBuffer = null;
             bbwi = null;
        }
    }
}
 
Example #12
Source File: BufferManagerWriteGrow.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // The code that once lived directly in CDROutputStream.grow()
    // has been moved ByteBufferWithInfo.growBuffer().

    // Grow ByteBufferWithInfo to a larger size.
    bbwi.growBuffer(orb);

    // Must be false for the grow case
    bbwi.fragmented = false;
}
 
Example #13
Source File: MessageBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static Message readGIOPBody(ORB orb,
                                   CorbaConnection connection,
                                   Message msg)
{
    ReadTimeouts readTimeouts =
                       orb.getORBData().getTransportTCPReadTimeouts();
    ByteBuffer buf = msg.getByteBuffer();

    buf.position(MessageBase.GIOPMessageHeaderLength);
    int msgSizeMinusHeader =
        msg.getSize() - MessageBase.GIOPMessageHeaderLength;
    try {
        buf = connection.read(buf,
                      GIOPMessageHeaderLength, msgSizeMinusHeader,
                      readTimeouts.get_max_time_to_wait());
    } catch (IOException e) {
        throw wrapper.ioexceptionWhenReadingConnection(e);
    }

    msg.setByteBuffer(buf);

    if (orb.giopDebugFlag) {
        dprint(".readGIOPBody: received message:");
        ByteBuffer viewBuffer = buf.asReadOnlyBuffer();
        viewBuffer.position(0).limit(msg.getSize());
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb, viewBuffer);
        CDRInputStream_1_0.printBuffer(bbwi);
    }

    return msg;
}
 
Example #14
Source File: BufferManagerWriteGrow.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // The code that once lived directly in CDROutputStream.grow()
    // has been moved ByteBufferWithInfo.growBuffer().

    // Grow ByteBufferWithInfo to a larger size.
    bbwi.growBuffer(orb);

    // Must be false for the grow case
    bbwi.fragmented = false;
}
 
Example #15
Source File: Test6852078.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Test6852078(String [] args) {

        int capacity = 128;
        ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo( CorbaUtils.getOrb(null, -1, new Hashtable()), bb);
        byte[] tmpBuf;
        tmpBuf = new byte[bbwi.buflen];

        for (int i = 0; i < capacity; i++)
            tmpBuf[i] = bbwi.byteBuffer.get(i);
    }
 
Example #16
Source File: MessageBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static Message readGIOPBody(ORB orb,
                                   CorbaConnection connection,
                                   Message msg)
{
    ReadTimeouts readTimeouts =
                       orb.getORBData().getTransportTCPReadTimeouts();
    ByteBuffer buf = msg.getByteBuffer();

    buf.position(MessageBase.GIOPMessageHeaderLength);
    int msgSizeMinusHeader =
        msg.getSize() - MessageBase.GIOPMessageHeaderLength;
    try {
        buf = connection.read(buf,
                      GIOPMessageHeaderLength, msgSizeMinusHeader,
                      readTimeouts.get_max_time_to_wait());
    } catch (IOException e) {
        throw wrapper.ioexceptionWhenReadingConnection(e);
    }

    msg.setByteBuffer(buf);

    if (orb.giopDebugFlag) {
        dprint(".readGIOPBody: received message:");
        ByteBuffer viewBuffer = buf.asReadOnlyBuffer();
        viewBuffer.position(0).limit(msg.getSize());
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb, viewBuffer);
        CDRInputStream_1_0.printBuffer(bbwi);
    }

    return msg;
}
 
Example #17
Source File: BufferManagerWriteStream.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    try {
       sendFragment(false);
    } catch(SystemException se){
            orb.getPIHandler().invokeClientPIEndingPoint(
                    ReplyMessage.SYSTEM_EXCEPTION, se);
            throw se;
    }

    // Reuse the old buffer

    // REVISIT - need to account for case when needed > available
    // even after fragmenting.  This is the large array case, so
    // the caller should retry when it runs out of space.
    bbwi.position(0);
    bbwi.buflen = bbwi.byteBuffer.limit();
    bbwi.fragmented = true;

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();

    header.write(((CDROutputObject)outputObject));
}
 
Example #18
Source File: BufferManagerWriteGrow.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // The code that once lived directly in CDROutputStream.grow()
    // has been moved ByteBufferWithInfo.growBuffer().

    // Grow ByteBufferWithInfo to a larger size.
    bbwi.growBuffer(orb);

    // Must be false for the grow case
    bbwi.fragmented = false;
}
 
Example #19
Source File: BufferManagerWriteGrow.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // The code that once lived directly in CDROutputStream.grow()
    // has been moved ByteBufferWithInfo.growBuffer().

    // Grow ByteBufferWithInfo to a larger size.
    bbwi.growBuffer(orb);

    // Must be false for the grow case
    bbwi.fragmented = false;
}
 
Example #20
Source File: BufferManagerWriteStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    try {
       sendFragment(false);
    } catch(SystemException se){
            orb.getPIHandler().invokeClientPIEndingPoint(
                    ReplyMessage.SYSTEM_EXCEPTION, se);
            throw se;
    }

    // Reuse the old buffer

    // REVISIT - need to account for case when needed > available
    // even after fragmenting.  This is the large array case, so
    // the caller should retry when it runs out of space.
    bbwi.position(0);
    bbwi.buflen = bbwi.byteBuffer.limit();
    bbwi.fragmented = true;

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();

    header.write(((CDROutputObject)outputObject));
}
 
Example #21
Source File: BufferManagerWriteStream.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    try {
       sendFragment(false);
    } catch(SystemException se){
            orb.getPIHandler().invokeClientPIEndingPoint(
                    ReplyMessage.SYSTEM_EXCEPTION, se);
            throw se;
    }

    // Reuse the old buffer

    // REVISIT - need to account for case when needed > available
    // even after fragmenting.  This is the large array case, so
    // the caller should retry when it runs out of space.
    bbwi.position(0);
    bbwi.buflen = bbwi.byteBuffer.limit();
    bbwi.fragmented = true;

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();

    header.write(((CDROutputObject)outputObject));
}
 
Example #22
Source File: BufferManagerWriteGrow.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // The code that once lived directly in CDROutputStream.grow()
    // has been moved ByteBufferWithInfo.growBuffer().

    // Grow ByteBufferWithInfo to a larger size.
    bbwi.growBuffer(orb);

    // Must be false for the grow case
    bbwi.fragmented = false;
}
 
Example #23
Source File: BufferManagerWriteCollect.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    // Enqueue the previous fragment
    queue.enqueue(bbwi);

    // Create a new bbwi
    ByteBufferWithInfo newBbwi = new ByteBufferWithInfo(orb, this);
    newBbwi.fragmented = true;

    // XREVISIT - Downcast
    ((CDROutputObject)outputObject).setByteBufferWithInfo(newBbwi);

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    // XREVISIT - Downcast
    FragmentMessage header =
          ((CDROutputObject)outputObject).getMessageHeader()
                                         .createFragmentMessage();

    header.write((CDROutputObject)outputObject);
}
 
Example #24
Source File: MessageBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static Message readGIOPBody(ORB orb,
                                   CorbaConnection connection,
                                   Message msg)
{
    ReadTimeouts readTimeouts =
                       orb.getORBData().getTransportTCPReadTimeouts();
    ByteBuffer buf = msg.getByteBuffer();

    buf.position(MessageBase.GIOPMessageHeaderLength);
    int msgSizeMinusHeader =
        msg.getSize() - MessageBase.GIOPMessageHeaderLength;
    try {
        buf = connection.read(buf,
                      GIOPMessageHeaderLength, msgSizeMinusHeader,
                      readTimeouts.get_max_time_to_wait());
    } catch (IOException e) {
        throw wrapper.ioexceptionWhenReadingConnection(e);
    }

    msg.setByteBuffer(buf);

    if (orb.giopDebugFlag) {
        dprint(".readGIOPBody: received message:");
        ByteBuffer viewBuffer = buf.asReadOnlyBuffer();
        viewBuffer.position(0).limit(msg.getSize());
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb, viewBuffer);
        CDRInputStream_1_0.printBuffer(bbwi);
    }

    return msg;
}
 
Example #25
Source File: Test6852078.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Test6852078(String [] args) {

        int capacity = 128;
        ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo( CorbaUtils.getOrb(null, -1, new Hashtable()), bb);
        byte[] tmpBuf;
        tmpBuf = new byte[bbwi.buflen];

        for (int i = 0; i < capacity; i++)
            tmpBuf[i] = bbwi.byteBuffer.get(i);
    }
 
Example #26
Source File: Test6852078.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Test6852078(String [] args) {

        int capacity = 128;
        ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo( CorbaUtils.getOrb(null, -1, new Hashtable()), bb);
        byte[] tmpBuf;
        tmpBuf = new byte[bbwi.buflen];

        for (int i = 0; i < capacity; i++)
            tmpBuf[i] = bbwi.byteBuffer.get(i);
    }
 
Example #27
Source File: MessageBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static Message readGIOPBody(ORB orb,
                                   CorbaConnection connection,
                                   Message msg)
{
    ReadTimeouts readTimeouts =
                       orb.getORBData().getTransportTCPReadTimeouts();
    ByteBuffer buf = msg.getByteBuffer();

    buf.position(MessageBase.GIOPMessageHeaderLength);
    int msgSizeMinusHeader =
        msg.getSize() - MessageBase.GIOPMessageHeaderLength;
    try {
        buf = connection.read(buf,
                      GIOPMessageHeaderLength, msgSizeMinusHeader,
                      readTimeouts.get_max_time_to_wait());
    } catch (IOException e) {
        throw wrapper.ioexceptionWhenReadingConnection(e);
    }

    msg.setByteBuffer(buf);

    if (orb.giopDebugFlag) {
        dprint(".readGIOPBody: received message:");
        ByteBuffer viewBuffer = buf.asReadOnlyBuffer();
        viewBuffer.position(0).limit(msg.getSize());
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb, viewBuffer);
        CDRInputStream_1_0.printBuffer(bbwi);
    }

    return msg;
}
 
Example #28
Source File: BufferManagerWriteGrow.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // The code that once lived directly in CDROutputStream.grow()
    // has been moved ByteBufferWithInfo.growBuffer().

    // Grow ByteBufferWithInfo to a larger size.
    bbwi.growBuffer(orb);

    // Must be false for the grow case
    bbwi.fragmented = false;
}
 
Example #29
Source File: BufferManagerWriteCollect.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Close the BufferManagerWrite - do any outstanding cleanup.
 *
 * For a BufferManagerWriteGrow any queued ByteBufferWithInfo must
 * have its ByteBuffer released to the ByteBufferPool.
 */
public void close()
{
    // iterate thru queue and release any ByteBufferWithInfo's
    // ByteBuffer that may be remaining on the queue to the
    // ByteBufferPool.

    Iterator bufs = iterator();

    ByteBufferPool byteBufferPool = orb.getByteBufferPool();

    while (bufs.hasNext())
    {
        ByteBufferWithInfo bbwi = (ByteBufferWithInfo)bufs.next();
        if (bbwi != null && bbwi.byteBuffer != null)
        {
            if (debug)
            {
                // print address of ByteBuffer being released
                int bbAddress = System.identityHashCode(bbwi.byteBuffer);
                StringBuffer sb = new StringBuffer(80);
                sb.append("close() - releasing ByteBuffer id (");
                sb.append(bbAddress).append(") to ByteBufferPool.");
                String msg = sb.toString();
                dprint(msg);
            }
             byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
             bbwi.byteBuffer = null;
             bbwi = null;
        }
    }
}
 
Example #30
Source File: BufferManagerWriteCollect.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void overflow (ByteBufferWithInfo bbwi)
{
    // Set the fragment's moreFragments field to true
    MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);

    // Enqueue the previous fragment
    queue.enqueue(bbwi);

    // Create a new bbwi
    ByteBufferWithInfo newBbwi = new ByteBufferWithInfo(orb, this);
    newBbwi.fragmented = true;

    // XREVISIT - Downcast
    ((CDROutputObject)outputObject).setByteBufferWithInfo(newBbwi);

    // Now we must marshal in the fragment header/GIOP header

    // REVISIT - we can optimize this by not creating the fragment message
    // each time.

    // XREVISIT - Downcast
    FragmentMessage header =
          ((CDROutputObject)outputObject).getMessageHeader()
                                         .createFragmentMessage();

    header.write((CDROutputObject)outputObject);
}