ClientHandlerpublic abstract class ClientHandler extends Object implements RunnableThe 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.Thread | createThread(java.lang.Runnable r)
return new Thread(this);
| protected void | debug(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 void | debug(java.lang.String func, java.lang.String info)
debug(dbgTag, func, info);
| public abstract void | doRun()
| public void | interrupt()
if (isTraceOn()) {
trace("interrupt","start") ;
}
interruptCalled = true ;
if (thread != null) {
thread.interrupt() ;
}
if (isTraceOn()) {
trace("interrupt","end") ;
}
| protected boolean | isDebugOn()
return Trace.isSelected(Trace.LEVEL_DEBUG, Trace.INFO_ADAPTOR_SNMP);
| protected boolean | isTraceOn()
return Trace.isSelected(Trace.LEVEL_TRACE, Trace.INFO_ADAPTOR_SNMP);
| public void | join()
if (thread != null) {
try {
thread.join() ;
}
catch(InterruptedException x) {
}
}
| protected java.lang.String | makeDebugTag()
return "ClientHandler[" + adaptorServer.getProtocol() + ":" + adaptorServer.getPort() + "][" + requestId + "]";
| public void | run()
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 void | trace(java.lang.String func, java.lang.String info)
trace(dbgTag, func, info);
| protected void | trace(java.lang.String clz, java.lang.String func, java.lang.String info)
Trace.send(Trace.LEVEL_TRACE, Trace.INFO_ADAPTOR_SNMP, clz, func, info);
|
|