Java Code Examples for com.sun.corba.se.spi.transport.CorbaConnection#shouldRegisterServerReadEvent()

The following examples show how to use com.sun.corba.se.spi.transport.CorbaConnection#shouldRegisterServerReadEvent() . 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: SocketOrChannelAcceptorImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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.
    }
}
 
Example 2
Source File: SocketOrChannelAcceptorImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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.
    }
}
 
Example 3
Source File: SocketOrChannelAcceptorImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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.
    }
}