FileDocCategorySizeDatePackage
ListenerThreadImpl.javaAPI DocJava SE 5 API2744Fri Aug 26 14:54:32 BST 2005com.sun.corba.se.impl.transport

ListenerThreadImpl

public class ListenerThreadImpl extends Object implements com.sun.corba.se.pept.transport.ListenerThread, com.sun.corba.se.spi.orbutil.threadpool.Work

Fields Summary
private com.sun.corba.se.spi.orb.ORB
orb
private com.sun.corba.se.pept.transport.Acceptor
acceptor
private com.sun.corba.se.pept.transport.Selector
selector
private boolean
keepRunning
private long
enqueueTime
Constructors Summary
public ListenerThreadImpl(com.sun.corba.se.spi.orb.ORB orb, com.sun.corba.se.pept.transport.Acceptor acceptor, com.sun.corba.se.pept.transport.Selector selector)

	this.orb = orb;
	this.acceptor = acceptor;
	this.selector = selector;
	keepRunning = true;
    
Methods Summary
public voidclose()

	if (orb.transportDebugFlag) {
	    dprint(".close: " + acceptor);
	}

	keepRunning = false;
    
public voiddoWork()

	try {
	    if (orb.transportDebugFlag) {
		dprint(".doWork: Start ListenerThread: " + acceptor);
	    }
	    while (keepRunning) {
		try {
		    if (orb.transportDebugFlag) {
			dprint(".doWork: BEFORE ACCEPT CYCLE: " + acceptor);
		    }

		    acceptor.accept();

		    if (orb.transportDebugFlag) {
			dprint(".doWork: AFTER ACCEPT CYCLE: " + acceptor);
		    }
		} catch (Throwable t) {
		    if (orb.transportDebugFlag) {
			dprint(".doWork: Exception in accept: " + acceptor,t);
		    }
		    orb.getTransportManager().getSelector(0)
			.unregisterForEvent(getAcceptor().getEventHandler());
		    getAcceptor().close();
		}
	    }
	} finally {
	    if (orb.transportDebugFlag) {
		dprint(".doWork: Terminated ListenerThread: " + acceptor);
	    }
	}
    
private voiddprint(java.lang.String msg)

	ORBUtility.dprint("ListenerThreadImpl", msg);
    
private voiddprint(java.lang.String msg, java.lang.Throwable t)

	dprint(msg);
	t.printStackTrace(System.out);
    
public com.sun.corba.se.pept.transport.AcceptorgetAcceptor()

	return acceptor;
    
public longgetEnqueueTime()

	return enqueueTime;
    
public java.lang.StringgetName()

 return "ListenerThread"; 
public voidsetEnqueueTime(long timeInMillis)

	enqueueTime = timeInMillis;