当前位置: 首页>>代码示例>>Java>>正文


Java CDROutputObject.setByteBuffer方法代码示例

本文整理汇总了Java中com.sun.corba.se.impl.encoding.CDROutputObject.setByteBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java CDROutputObject.setByteBuffer方法的具体用法?Java CDROutputObject.setByteBuffer怎么用?Java CDROutputObject.setByteBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.corba.se.impl.encoding.CDROutputObject的用法示例。


在下文中一共展示了CDROutputObject.setByteBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import com.sun.corba.se.impl.encoding.CDROutputObject; //导入方法依赖的package包/类
public void close() throws IOException
{

    // tell BufferManagerRead to release any ByteBuffers
    getBufferManager().close(bbwi);

    // It's possible bbwi.byteBuffer is shared between
    // this InputStream and an OutputStream. Thus, we check
    // if the Input/Output streams are using the same ByteBuffer.
    // If they sharing the same ByteBuffer we need to ensure only
    // one of those ByteBuffers are released to the ByteBufferPool.

    if (bbwi != null && getByteBuffer() != null)
    {
        MessageMediator messageMediator = parent.getMessageMediator();
        if (messageMediator != null)
        {
            CDROutputObject outputObj =
                         (CDROutputObject)messageMediator.getOutputObject();
            if (outputObj != null)
            {
                if (outputObj.isSharing(getByteBuffer()))
                {
                    // Set OutputStream's ByteBuffer and bbwi to null
                    // so its ByteBuffer cannot be released to the pool
                    outputObj.setByteBuffer(null);
                    outputObj.setByteBufferWithInfo(null);
                }
            }
        }

        // release this stream's ByteBuffer to the pool
        ByteBufferPool byteBufferPool = orb.getByteBufferPool();
        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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:CDRInputStream_1_0.java

示例2: close

import com.sun.corba.se.impl.encoding.CDROutputObject; //导入方法依赖的package包/类
public void close() throws IOException
{

    // tell BufferManagerRead to release any ByteBuffers
    getBufferManager().close(bbwi);

    // It's possible bbwi.byteBuffer is shared between
    // this InputStream and an OutputStream. Thus, we check
    // if the Input/Output streams are using the same ByteBuffer.
    // If they sharing the same ByteBuffer we need to ensure only
    // one of those ByteBuffers are released to the ByteBufferPool.

    if (bbwi != null && getByteBuffer() != null)
    {
        int bbHash = System.identityHashCode(bbwi.byteBuffer);
        MessageMediator messageMediator = parent.getMessageMediator();
        if (messageMediator != null)
        {
            CDROutputObject outputObj =
                         (CDROutputObject)messageMediator.getOutputObject();
            if (outputObj != null)
            {
                ByteBuffer outputBb = outputObj.getByteBuffer();

                int oBbHash = 0;
                if (outputBb != null)
                {
                    oBbHash = System.identityHashCode(outputBb);
                    if (bbHash == oBbHash)  // shared?
                    {
                        // Set OutputStream's ByteBuffer and bbwi to null
                        // so its ByteBuffer cannot be released to the pool
                        outputObj.setByteBuffer(null);
                        outputObj.setByteBufferWithInfo(null);
                    }
                }
            }
        }

        // release this stream's ByteBuffer to the pool
        ByteBufferPool byteBufferPool = orb.getByteBufferPool();
        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;
    }
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:57,代码来源:CDRInputStream_1_0.java


注:本文中的com.sun.corba.se.impl.encoding.CDROutputObject.setByteBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。