com.aelitis.azureus.core.networkmanager.impl.tcp
Class SelectorGuard

java.lang.Object
  extended by com.aelitis.azureus.core.networkmanager.impl.tcp.SelectorGuard

public class SelectorGuard
extends java.lang.Object

Temp class designed to help detect Selector anomalies and cleanly re-open if necessary. NOTE: As of JVM 1.4.2_03, after network connection disconnect/reconnect, usually-blocking select() and select(long) calls no longer block, and will instead return immediately. This can cause selector spinning and 100% cpu usage. See: http://forum.java.sun.com/thread.jsp?forum=4&thread=293213 http://developer.java.sun.com/developer/bugParade/bugs/4850373.html http://developer.java.sun.com/developer/bugParade/bugs/4881228.html Fixed in JVM 1.4.2_05+ and 1.5b2+


Nested Class Summary
static interface SelectorGuard.GuardListener
           
 
Constructor Summary
SelectorGuard(java.lang.String _type, SelectorGuard.GuardListener _listener)
          Create a new SelectorGuard with the given failed count threshold.
 
Method Summary
 java.lang.String getType()
           
 void markPreSelectTime()
          Run this method right before the select() operation to mark the start time.
 void verifySelectorIntegrity(int num_keys_ready, long time_threshold)
          Checks whether selector is still OK, and not spinning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectorGuard

public SelectorGuard(java.lang.String _type,
                     SelectorGuard.GuardListener _listener)
Create a new SelectorGuard with the given failed count threshold.

Method Detail

getType

public java.lang.String getType()

markPreSelectTime

public void markPreSelectTime()
Run this method right before the select() operation to mark the start time.


verifySelectorIntegrity

public void verifySelectorIntegrity(int num_keys_ready,
                                    long time_threshold)
Checks whether selector is still OK, and not spinning.