Java Code Examples for com.sun.corba.se.pept.transport.EventHandler#getSelectionKey()
The following examples show how to use
com.sun.corba.se.pept.transport.EventHandler#getSelectionKey() .
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: SelectorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
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:<- "); } }
Example 2
Source File: SelectorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
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(); } }
Example 3
Source File: SelectorImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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"); } }
Example 4
Source File: SelectorImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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"); } }
Example 5
Source File: SelectorImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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(); } }
Example 6
Source File: SelectorImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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:<- "); } }
Example 7
Source File: SelectorImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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"); } }
Example 8
Source File: SelectorImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
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:<- "); } }
Example 9
Source File: SelectorImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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:<- "); } }
Example 10
Source File: SelectorImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
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(); } }
Example 11
Source File: SelectorImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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:<- "); } }
Example 12
Source File: SelectorImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
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:<- "); } }
Example 13
Source File: SelectorImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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(); } }
Example 14
Source File: SelectorImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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:<- "); } }
Example 15
Source File: SelectorImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
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(); } if (selector != null) { 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"); } }
Example 16
Source File: SelectorImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
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(); } if (selector != null) { 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"); } }
Example 17
Source File: SelectorImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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(); } if (selector != null) { 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"); } }
Example 18
Source File: SelectorImpl.java From JDKSourceCode1.8 with MIT License | 4 votes |
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(); } if (selector != null) { 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"); } }
Example 19
Source File: SelectorImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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(); } if (selector != null) { 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"); } }
Example 20
Source File: SelectorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
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(); } if (selector != null) { 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"); } }