FileDocCategorySizeDatePackage
ReaderThreadImpl.javaAPI DocJava SE 5 API2851Fri Aug 26 14:54:34 BST 2005com.sun.corba.se.impl.transport

ReaderThreadImpl

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

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

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

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

	keepRunning = false;
    
public voiddoWork()

	try {
	    if (orb.transportDebugFlag) {
		dprint(".doWork: Start ReaderThread: " + connection);
	    }
	    while (keepRunning) {
		try {

		    if (orb.transportDebugFlag) {
			dprint(".doWork: Start ReaderThread cycle: " 
			       + connection);
		    }

		    if (connection.read()) {
			// REVISIT - put in pool;
			return;
		    }

		    if (orb.transportDebugFlag) {
			dprint(".doWork: End ReaderThread cycle: "
			       + connection);
		    }

		} catch (Throwable t) {
		    if (orb.transportDebugFlag) {
			dprint(".doWork: exception in read: " + connection,t);
		    }
		    orb.getTransportManager().getSelector(0)
			.unregisterForEvent(getConnection().getEventHandler());
		    getConnection().close();
		}
	    }
	} finally {
	    if (orb.transportDebugFlag) {
		dprint(".doWork: Terminated ReaderThread: " + connection);
	    }
	}
    
private voiddprint(java.lang.String msg)

	ORBUtility.dprint("ReaderThreadImpl", msg);
    
protected voiddprint(java.lang.String msg, java.lang.Throwable t)

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

	return connection;
    
public longgetEnqueueTime()

	return enqueueTime;
    
public java.lang.StringgetName()

 return "ReaderThread"; 
public voidsetEnqueueTime(long timeInMillis)

	enqueueTime = timeInMillis;