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

ClientHandler

public abstract class ClientHandler extends Object implements Runnable
The ClientHandler class is the base class of each adaptor.

Fields Summary
protected CommunicatorServer
adaptorServer
protected int
requestId
protected MBeanServer
mbs
protected ObjectName
objectName
protected Thread
thread
protected boolean
interruptCalled
protected String
dbgTag
Constructors Summary
public ClientHandler(CommunicatorServer server, int id, MBeanServer f, ObjectName n)

        adaptorServer = server ;
        requestId = id ;
        mbs = f ;
        objectName = n ;
        interruptCalled = false ;
        dbgTag = makeDebugTag() ;
	//if (mbs == null ){
	//thread = new Thread (this) ;
	thread =  createThread(this);

	//} else {
	//thread = mbs.getThreadAllocatorSrvIf().obtainThread(objectName,this) ;
	//}
        // Note: the thread will be started by the subclass.
    
Methods Summary
java.lang.ThreadcreateThread(java.lang.Runnable r)

	return new Thread(this);
    
protected 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);
    
protected voiddebug(java.lang.String func, java.lang.String info)

        debug(dbgTag, func, info);
    
public abstract voiddoRun()

public voidinterrupt()

        if (isTraceOn()) {
            trace("interrupt","start") ;
        }
        interruptCalled = true ;
	if (thread != null) {
            thread.interrupt() ;
	}
        if (isTraceOn()) {
            trace("interrupt","end") ;
        }
    
protected booleanisDebugOn()

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


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

	if (thread != null) {
        try {
            thread.join() ;
        }
        catch(InterruptedException x) {
        }
	}
    
protected java.lang.StringmakeDebugTag()

        return "ClientHandler[" + adaptorServer.getProtocol() + ":" + adaptorServer.getPort() + "][" + requestId + "]";
    
public voidrun()


        try {
            //
            // Notify the server we are now active
            //
            adaptorServer.notifyClientHandlerCreated(this) ;

            //
            // Call protocol specific sequence
            //
            doRun() ;
        }
        finally {
            //
            // Now notify the adaptor server that the handler is terminating.
            // This is important because the server may be blocked waiting for
            // a handler to terminate.
            //
            adaptorServer.notifyClientHandlerDeleted(this) ;
        }
    
protected voidtrace(java.lang.String func, java.lang.String info)

        trace(dbgTag, func, info);
    
protected 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);