geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject cvs commit: incubator-geronimo/modules/network/src/java/org/apache/geronimo/network SelectorManager.java
Date Sat, 24 Apr 2004 17:55:02 GMT
chirino     2004/04/24 10:55:02

  Modified:    modules/network/src/java/org/apache/geronimo/network
                        SelectorManager.java
  Log:
  Better trace logging.
  
  Revision  Changes    Path
  1.5       +21 -21    incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/SelectorManager.java
  
  Index: SelectorManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/SelectorManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SelectorManager.java	3 Apr 2004 00:07:51 -0000	1.4
  +++ SelectorManager.java	24 Apr 2004 17:55:02 -0000	1.5
  @@ -127,14 +127,15 @@
           try {
   
               log.debug("Selector Work thread has started.");
  +            log.debug("Selector Manager timeout: "+timeout);
               while (running) {
   
                   synchronized (guard) { /* do nothing */
  +                    log.trace("Waiting for selector to return.");
                   }
  -
  -                log.trace("Waiting for selector to return");
  +                
                   if (selector.select(timeout) == 0) continue;
  -
  +                
                   // Get a java.util.Set containing the SelectionKey objects for
                   // all channels that are ready for I/O.
                   Set keys = selector.selectedKeys();
  @@ -143,31 +144,30 @@
                   for (Iterator i = keys.iterator(); i.hasNext();) {
                       final SelectionKey key = (SelectionKey) i.next();
   
  -                    try {
  -                        if (key.isReadable())key.interestOps(key.interestOps() & (~SelectionKey.OP_READ));
  -                        if (key.isWritable())key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
  -                        if (key.isAcceptable())key.interestOps(key.interestOps() &
(~SelectionKey.OP_ACCEPT));
  -
  -                        threadPool.getWorkManager().execute(new Runnable() {
  -                            public void run() {
  -                                try {
  -                                    ((SelectionEventListner) key.attachment()).selectionEvent(key);
  -                                } catch (Throwable e) {
  -                                    log.trace("Request Failed.", e);
  -                                }
  +                    if (key.isReadable())key.interestOps(key.interestOps() & (~SelectionKey.OP_READ));
  +                    if (key.isWritable())key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
  +                    if (key.isAcceptable())key.interestOps(key.interestOps() & (~SelectionKey.OP_ACCEPT));
  +
  +                    threadPool.getWorkManager().execute(new Runnable() {
  +                        public void run() {
  +                            try {
  +                                ((SelectionEventListner) key.attachment()).selectionEvent(key);
  +                            } catch (Throwable e) {
  +                                log.trace("Request Failed.", e);
                               }
  -                        });
  -                    } catch (InterruptedException e) {
  -                        Thread.currentThread().interrupt();
  -                    }
  +                        }
  +                    });
   
                       i.remove(); // Remove the key from the set of selected keys
                   }
               }
           } catch (CancelledKeyException e) {
  +            log.debug("Key has Been Cancelled: "+e);
           } catch (IOException e) {
               log.warn("IOException occured.", e);
  -        } finally {
  +        } catch (InterruptedException e) {
  +            log.debug("Selector Work thread has been interrupted.");
  +		} finally {
               log.debug("Selector Work thread has stopped.");
           }
       }
  
  
  

Mime
View raw message