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


Java CorbaConnection.shouldRegisterServerReadEvent方法代码示例

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


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

示例1: accept

import com.sun.corba.se.spi.transport.CorbaConnection; //导入方法依赖的package包/类
public void accept()
{
    try {
        SocketChannel socketChannel = null;
        Socket socket = null;
        if (serverSocketChannel == null) {
            socket = serverSocket.accept();
        } else {
            socketChannel = serverSocketChannel.accept();
            socket = socketChannel.socket();
        }
        orb.getORBData().getSocketFactory()
            .setAcceptedSocketOptions(this, serverSocket, socket);
        if (orb.transportDebugFlag) {
            dprint(".accept: " +
                   (serverSocketChannel == null
                    ? serverSocket.toString()
                    : serverSocketChannel.toString()));
        }

        CorbaConnection connection =
            new SocketOrChannelConnectionImpl(orb, this, socket);
        if (orb.transportDebugFlag) {
            dprint(".accept: new: " + connection);
        }

        // NOTE: The connection MUST be put in the cache BEFORE being
        // registered with the selector.  Otherwise if the bytes
        // are read on the connection it will attempt a time stamp
        // but the cache will be null, resulting in NPE.

        // A connection needs to be timestamped before putting to the cache.
        // Otherwise the newly created connection (with 0 timestamp) could be
        // incorrectly reclaimed by concurrent reclaim() call OR if there
        // will be no events on this connection then it could be reclaimed
        // by upcoming reclaim() call.
        getConnectionCache().stampTime(connection);
        getConnectionCache().put(this, connection);

        if (connection.shouldRegisterServerReadEvent()) {
            Selector selector = orb.getTransportManager().getSelector(0);
            selector.registerForEvent(connection.getEventHandler());
        }

        getConnectionCache().reclaim();

    } catch (IOException e) {
        if (orb.transportDebugFlag) {
            dprint(".accept:", e);
        }
        orb.getTransportManager().getSelector(0).unregisterForEvent(this);
        // REVISIT - need to close - recreate - then register new one.
        orb.getTransportManager().getSelector(0).registerForEvent(this);
        // NOTE: if register cycling we do not want to shut down ORB
        // since local beans will still work.  Instead one will see
        // a growing log file to alert admin of problem.
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:SocketOrChannelAcceptorImpl.java

示例2: accept

import com.sun.corba.se.spi.transport.CorbaConnection; //导入方法依赖的package包/类
public void accept()
{
    try {
        SocketChannel socketChannel = null;
        Socket socket = null;
        if (serverSocketChannel == null) {
            socket = serverSocket.accept();
        } else {
            socketChannel = serverSocketChannel.accept();
            socket = socketChannel.socket();
        }
        orb.getORBData().getSocketFactory()
            .setAcceptedSocketOptions(this, serverSocket, socket);
        if (orb.transportDebugFlag) {
            dprint(".accept: " +
                   (serverSocketChannel == null
                    ? serverSocket.toString()
                    : serverSocketChannel.toString()));
        }

        CorbaConnection connection =
            new SocketOrChannelConnectionImpl(orb, this, socket);
        if (orb.transportDebugFlag) {
            dprint(".accept: new: " + connection);
        }

        // NOTE: The connection MUST be put in the cache BEFORE being
        // registered with the selector.  Otherwise if the bytes
        // are read on the connection it will attempt a time stamp
        // but the cache will be null, resulting in NPE.
        getConnectionCache().put(this, connection);

        if (connection.shouldRegisterServerReadEvent()) {
            Selector selector = orb.getTransportManager().getSelector(0);
            selector.registerForEvent(connection.getEventHandler());
        }

        getConnectionCache().reclaim();

    } catch (IOException e) {
        if (orb.transportDebugFlag) {
            dprint(".accept:", e);
        }
        orb.getTransportManager().getSelector(0).unregisterForEvent(this);
        // REVISIT - need to close - recreate - then register new one.
        orb.getTransportManager().getSelector(0).registerForEvent(this);
        // NOTE: if register cycling we do not want to shut down ORB
        // since local beans will still work.  Instead one will see
        // a growing log file to alert admin of problem.
    }
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:52,代码来源:SocketOrChannelAcceptorImpl.java


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