本文整理汇总了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.
}
}
示例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.
}
}