本文整理汇总了Java中com.sun.corba.se.pept.transport.EventHandler类的典型用法代码示例。如果您正苦于以下问题:Java EventHandler类的具体用法?Java EventHandler怎么用?Java EventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventHandler类属于com.sun.corba.se.pept.transport包,在下文中一共展示了EventHandler类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: destroyListenerThread
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
private void destroyListenerThread(EventHandler eventHandler)
{
if (orb.transportDebugFlag) {
dprint(".destroyListenerThread: " + eventHandler);
}
ListenerThread listenerThread = (ListenerThread)
listenerThreads.get(eventHandler);
if (listenerThread == null) {
if (orb.transportDebugFlag) {
dprint(".destroyListenerThread: cannot find ListenerThread - ignoring.");
}
return;
}
listenerThreads.remove(eventHandler);
listenerThread.close();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:SelectorImpl.java
示例2: destroyReaderThread
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
private void destroyReaderThread(EventHandler eventHandler)
{
if (orb.transportDebugFlag) {
dprint(".destroyReaderThread: " + eventHandler);
}
ReaderThread readerThread = (ReaderThread)
readerThreads.get(eventHandler);
if (readerThread == null) {
if (orb.transportDebugFlag) {
dprint(".destroyReaderThread: cannot find ReaderThread - ignoring.");
}
return;
}
readerThreads.remove(eventHandler);
readerThread.close();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:SelectorImpl.java
示例3: registerInterestOps
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
public void registerInterestOps(EventHandler eventHandler)
{
if (orb.transportDebugFlag) {
dprint(".registerInterestOps:-> " + eventHandler);
}
SelectionKey selectionKey = eventHandler.getSelectionKey();
if (selectionKey.isValid()) {
int ehOps = eventHandler.getInterestOps();
SelectionKeyAndOp keyAndOp = new SelectionKeyAndOp(selectionKey, ehOps);
synchronized(interestOpsList) {
interestOpsList.add(keyAndOp);
}
// tell Selector Thread there's an update to a SelectorKey's Ops
selector.wakeup();
}
else {
wrapper.selectionKeyInvalid(eventHandler.toString());
if (orb.transportDebugFlag) {
dprint(".registerInterestOps: EventHandler SelectionKey not valid " + eventHandler);
}
}
if (orb.transportDebugFlag) {
dprint(".registerInterestOps:<- ");
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:SelectorImpl.java
示例4: registerForEvent
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
public void registerForEvent(EventHandler eventHandler)
{
if (orb.transportDebugFlag) {
dprint(".registerForEvent: " + eventHandler);
}
if (isClosed()) {
if (orb.transportDebugFlag) {
dprint(".registerForEvent: closed: " + eventHandler);
}
return;
}
if (eventHandler.shouldUseSelectThreadToWait()) {
synchronized (deferredRegistrations) {
deferredRegistrations.add(eventHandler);
}
if (! selectorStarted) {
startSelector();
}
selector.wakeup();
return;
}
switch (eventHandler.getInterestOps()) {
case SelectionKey.OP_ACCEPT :
createListenerThread(eventHandler);
break;
case SelectionKey.OP_READ :
createReaderThread(eventHandler);
break;
default:
if (orb.transportDebugFlag) {
dprint(".registerForEvent: default: " + eventHandler);
}
throw new RuntimeException(
"SelectorImpl.registerForEvent: unknown interest ops");
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:SelectorImpl.java
示例5: unregisterForEvent
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
public void unregisterForEvent(EventHandler eventHandler)
{
if (orb.transportDebugFlag) {
dprint(".unregisterForEvent: " + eventHandler);
}
if (isClosed()) {
if (orb.transportDebugFlag) {
dprint(".unregisterForEvent: closed: " + eventHandler);
}
return;
}
if (eventHandler.shouldUseSelectThreadToWait()) {
SelectionKey selectionKey ;
synchronized(deferredRegistrations) {
selectionKey = eventHandler.getSelectionKey();
}
if (selectionKey != null) {
selectionKey.cancel();
}
selector.wakeup();
return;
}
switch (eventHandler.getInterestOps()) {
case SelectionKey.OP_ACCEPT :
destroyListenerThread(eventHandler);
break;
case SelectionKey.OP_READ :
destroyReaderThread(eventHandler);
break;
default:
if (orb.transportDebugFlag) {
dprint(".unregisterForEvent: default: " + eventHandler);
}
throw new RuntimeException(
"SelectorImpl.uregisterForEvent: unknown interest ops");
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:SelectorImpl.java
示例6: handleDeferredRegistrations
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
private void handleDeferredRegistrations()
{
synchronized (deferredRegistrations) {
int deferredListSize = deferredRegistrations.size();
for (int i = 0; i < deferredListSize; i++) {
EventHandler eventHandler =
(EventHandler)deferredRegistrations.get(i);
if (orb.transportDebugFlag) {
dprint(".handleDeferredRegistrations: " + eventHandler);
}
SelectableChannel channel = eventHandler.getChannel();
SelectionKey selectionKey = null;
try {
selectionKey =
channel.register(selector,
eventHandler.getInterestOps(),
(Object)eventHandler);
} catch (ClosedChannelException e) {
if (orb.transportDebugFlag) {
dprint(".handleDeferredRegistrations: " + e);
}
}
eventHandler.setSelectionKey(selectionKey);
}
deferredRegistrations.clear();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:SelectorImpl.java
示例7: registerInterestOps
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
public void registerInterestOps(EventHandler eventHandler)
{
if (orb.transportDebugFlag) {
dprint(".registerInterestOps:-> " + eventHandler);
}
SelectionKey selectionKey = eventHandler.getSelectionKey();
if (selectionKey.isValid()) {
int ehOps = eventHandler.getInterestOps();
SelectionKeyAndOp keyAndOp = new SelectionKeyAndOp(selectionKey, ehOps);
synchronized(interestOpsList) {
interestOpsList.add(keyAndOp);
}
// tell Selector Thread there's an update to a SelectorKey's Ops
try {
if (selector != null) {
// wakeup Selector thread to process close request
selector.wakeup();
}
} catch (Throwable t) {
if (orb.transportDebugFlag) {
dprint(".registerInterestOps: selector.wakeup: ", t);
}
}
}
else {
wrapper.selectionKeyInvalid(eventHandler.toString());
if (orb.transportDebugFlag) {
dprint(".registerInterestOps: EventHandler SelectionKey not valid " + eventHandler);
}
}
if (orb.transportDebugFlag) {
dprint(".registerInterestOps:<- ");
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:SelectorImpl.java
示例8: clearDeferredRegistrations
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
private void clearDeferredRegistrations() {
synchronized (deferredRegistrations) {
int deferredListSize = deferredRegistrations.size();
if (orb.transportDebugFlag) {
dprint(".clearDeferredRegistrations:deferred list size == " + deferredListSize);
}
for (int i = 0; i < deferredListSize; i++) {
EventHandler eventHandler =
(EventHandler)deferredRegistrations.get(i);
if (orb.transportDebugFlag) {
dprint(".clearDeferredRegistrations: " + eventHandler);
}
SelectableChannel channel = eventHandler.getChannel();
SelectionKey selectionKey = null;
try {
if (orb.transportDebugFlag) {
dprint(".clearDeferredRegistrations:close channel == "
+ channel);
dprint(".clearDeferredRegistrations:close channel class == "
+ channel.getClass().getName());
}
channel.close();
selectionKey = eventHandler.getSelectionKey();
if (selectionKey != null) {
selectionKey.cancel();
selectionKey.attach(null);
}
} catch (IOException ioEx) {
if (orb.transportDebugFlag) {
dprint(".clearDeferredRegistrations: ", ioEx);
}
}
}
deferredRegistrations.clear();
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:SelectorImpl.java
示例9: handleDeferredRegistrations
import com.sun.corba.se.pept.transport.EventHandler; //导入依赖的package包/类
private void handleDeferredRegistrations()
{
synchronized (deferredRegistrations) {
int deferredListSize = deferredRegistrations.size();
for (int i = 0; i < deferredListSize; i++) {
EventHandler eventHandler =
(EventHandler)deferredRegistrations.get(i);
if (orb.transportDebugFlag) {
dprint(".handleDeferredRegistrations: " + eventHandler);
}
SelectableChannel channel = eventHandler.getChannel();
SelectionKey selectionKey = null;
try {
selectionKey =
channel.register(selector,
eventHandler.getInterestOps(),
(Object)eventHandler);
} catch (ClosedChannelException e) {
if (orb.transportDebugFlag) {
dprint(".handleDeferredRegistrations: ", e);
}
}
eventHandler.setSelectionKey(selectionKey);
}
deferredRegistrations.clear();
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:SelectorImpl.java
注:本文中的com.sun.corba.se.pept.transport.EventHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论