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

SnmpQManager

public final class SnmpQManager extends Object implements Serializable
This class implements a server queue manager. This class is for internal use.

Fields Summary
private SendQ
newq
private WaitQ
waitq
private ThreadGroup
queueThreadGroup
private Thread
requestQThread
private Thread
timerQThread
static String
dbgTag
Constructors Summary
SnmpQManager()

    
    
    // CONSTRUCTORS
    //-------------
    
     
        newq = new SendQ(20, 5) ;
        waitq = new WaitQ(20, 5) ;

        queueThreadGroup = new ThreadGroup("Qmanager Thread Group") ;
    
        // TIME BOMB HERE
        startQThreads() ;
    
Methods Summary
public voidaddRequest(SnmpInformRequest reqc)

        newq.addRequest(reqc) ;
        return ;
    
public voidaddWaiting(SnmpInformRequest reqc)

        waitq.addWaiting(reqc) ;
        return ;
    
static 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);
    
static 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);
    
static voiddebug(java.lang.String func, java.lang.String info)

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

        SnmpQManager.debug(dbgTag, func, exception);
    
public java.util.VectorgetAllOutstandingRequest(long range)

        return newq.getAllOutstandingRequest(range) ;
    
public SnmpInformRequestgetTimeoutRequests()

        return waitq.getTimeoutRequests() ;
    
static booleanisDebugOn()

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

        return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_ADAPTOR_SNMP);
    
public voidremoveRequest(SnmpInformRequest reqc)

        newq.removeElement(reqc) ;
        waitq.removeElement(reqc) ;
    
public SnmpInformRequestremoveRequest(long reqid)

        SnmpInformRequest reqc = null ;

        if ((reqc = newq.removeRequest(reqid)) == null) 
            reqc = waitq.removeRequest(reqid) ;
	
        return reqc ;
    
public voidstartQThreads()

        if (timerQThread == null || timerQThread.isAlive() == false) {
            timerQThread   = new SnmpTimerServer(queueThreadGroup, this) ;
        }
        if (requestQThread == null || requestQThread.isAlive() == false) {
            requestQThread = new SnmpSendServer(queueThreadGroup, this) ;
        }
    
public voidstopQThreads()

        
        ((SnmpTimerServer)timerQThread).isBeingDestroyed = true;
        waitq.isBeingDestroyed = true;
        ((SnmpSendServer)requestQThread).isBeingDestroyed = true;
        newq.isBeingDestroyed = true;
        
        if (timerQThread != null && timerQThread.isAlive() == true) {   
            ((SnmpTimerServer)timerQThread).stopTimerServer();
        }
        waitq = null;
        timerQThread = null;
        
        if (requestQThread != null && requestQThread.isAlive() == true) {            
            ((SnmpSendServer)requestQThread).stopSendServer();
        }
        newq = null;
        requestQThread = null;
    
static 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);
    
static voidtrace(java.lang.String func, java.lang.String info)

        SnmpQManager.trace(dbgTag, func, info);