FileDocCategorySizeDatePackage
SnmpTimerServer.javaAPI DocJava SE 5 API3985Fri Aug 26 14:55:06 BST 2005com.sun.jmx.snmp.daemon

SnmpTimerServer

public final class SnmpTimerServer extends Thread
This class retries any timed out inform requests. This class is for internal use.

Fields Summary
private SnmpInformRequest
req
SnmpQManager
snmpq
String
dbgTag
boolean
isBeingDestroyed
Constructors Summary
public SnmpTimerServer(ThreadGroup grp, SnmpQManager q)

    
    // CONSTRUCTORS
    //-------------
    
          
        super(grp, "SnmpTimerServer") ;
        setName(dbgTag) ;
        snmpq = q ;
        start() ;
    
Methods Summary
voiddebug(java.lang.String func, java.lang.String info)

        debug(dbgTag, func, info);
    
voiddebug(java.lang.String func, java.lang.Throwable exception)

        debug(dbgTag, func, exception);
    
voiddebug(java.lang.String clz, java.lang.String func, java.lang.String info)

        Trace.send(Trace.LEVEL_DEBUG, Trace.INFO_ADAPTOR_SNMP, clz, func, info);
    
voiddebug(java.lang.String clz, java.lang.String func, java.lang.Throwable exception)

        Trace.send(Trace.LEVEL_DEBUG, Trace.INFO_ADAPTOR_SNMP, clz, func, exception);
    
booleanisDebugOn()

        return Trace.isSelected(Trace.LEVEL_DEBUG, Trace.INFO_ADAPTOR_SNMP);
    
booleanisTraceOn()

        return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_ADAPTOR_SNMP);
    
public voidrun()

        Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
        
        if (isTraceOn()) {
            trace("run", "Timer Thread started");
        }

        while (true) {
                        
            try {
                if (isTraceOn()) {
                    trace("run", "Blocking for inform requests");
                }
                if (req == null) {
                    req = snmpq.getTimeoutRequests() ;
                }
                if (req != null && req.inProgress()) {
                    if (isTraceOn()) {
                        trace("run", "Handle timeout inform request " + req.getRequestId());
                    }
                    req.action() ;
                    req = null ;
                }
                if (isBeingDestroyed == true)
                    break;
            } catch (Exception e) {
                if (isDebugOn()) {
                    debug("run", e.getMessage());
                }
            } catch (ThreadDeath d) {
                if (isDebugOn()) {
                    debug("run", "Timer server unexpectedly shutting down");
                    debug("run", d);
                }
                throw d ;
            } catch (OutOfMemoryError ome) {
                if (isDebugOn()) {
                    debug("run", "Received OutOfMemory");
                }
                yield();
            } catch (Error err) {
                if (isDebugOn()) {
                    debug("run", "Received Internal error");
                    debug("run", err);
                }
            }
        }
    
public synchronized voidstopTimerServer()

                
        if (isAlive()) {
            interrupt();
            try {
                // Wait until the thread die.
                //
                join();
            } catch (InterruptedException e) {
                // Ignore...
            }
        }
    
voidtrace(java.lang.String clz, java.lang.String func, java.lang.String info)

        Trace.send(Trace.LEVEL_TRACE, Trace.INFO_ADAPTOR_SNMP, clz, func, info);
    
voidtrace(java.lang.String func, java.lang.String info)

        trace(dbgTag, func, info);