netscape.ldap
Class LDAPConnThread

java.lang.Object
  extended byjava.lang.Thread
      extended bynetscape.ldap.LDAPConnThread
All Implemented Interfaces:
java.lang.Runnable

class LDAPConnThread
extends java.lang.Thread

Multiple LDAPConnection clones can share a single physical connection, which is maintained by a thread. +----------------+ | LDAPConnection | --------+ +----------------+ | | +----------------+ | +----------------+ | LDAPConnection | --------+------- | LDAPConnThread | +----------------+ | +----------------+ | +----------------+ | | LDAPConnection | --------+ +----------------+ All LDAPConnections send requests and get responses from LDAPConnThread (a thread).


Field Summary
(package private)  LDAPConnSetupMgr m_connMgr
           
(package private)  java.lang.Object m_sendRequestLock
           
(package private)  java.lang.Object m_traceOutput
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LDAPConnThread(LDAPConnSetupMgr connMgr, LDAPCache cache, java.lang.Object traceOutput)
          Constructs a connection thread that maintains connection to the LDAP server.
 
Method Summary
(package private)  void abandon(int id)
          Stop dispatching responses for a particular message ID.
 void deregister(LDAPConnection conn)
          De-Register with this connection thread.
(package private)  int getClientCount()
           
(package private)  java.io.InputStream getInputStream()
           
(package private)  java.io.OutputStream getOutputStream()
           
(package private)  void logLDAPMessage(LDAPMessage msg)
           
 void register(LDAPConnection conn)
          Register with this connection thread.
(package private)  void resultRetrieved()
          This is called when a search result has been retrieved from the incoming queue.
 void run()
          Reads from the LDAP server input stream for incoming LDAP messages.
(package private)  void sendRequest(LDAPConnection conn, JDAPProtocolOp request, LDAPMessageQueue toNotify, LDAPConstraints cons)
          Sends LDAP request via this connection thread.
(package private)  void setCache(LDAPCache cache)
          Set the cache to use for searches.
(package private)  void setInputStream(java.io.InputStream is)
           
(package private)  void setOutputStream(java.io.OutputStream os)
           
(package private)  void setTraceOutput(java.lang.Object traceOutput)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_sendRequestLock

transient java.lang.Object m_sendRequestLock

m_connMgr

transient LDAPConnSetupMgr m_connMgr

m_traceOutput

transient java.lang.Object m_traceOutput
Constructor Detail

LDAPConnThread

public LDAPConnThread(LDAPConnSetupMgr connMgr,
                      LDAPCache cache,
                      java.lang.Object traceOutput)
               throws LDAPException
Constructs a connection thread that maintains connection to the LDAP server.

Method Detail

getInputStream

java.io.InputStream getInputStream()

setInputStream

void setInputStream(java.io.InputStream is)

getOutputStream

java.io.OutputStream getOutputStream()

setOutputStream

void setOutputStream(java.io.OutputStream os)

setTraceOutput

void setTraceOutput(java.lang.Object traceOutput)

logLDAPMessage

void logLDAPMessage(LDAPMessage msg)

setCache

void setCache(LDAPCache cache)
Set the cache to use for searches.

Parameters:
cache - The cache to use for searches; null for no cache

sendRequest

void sendRequest(LDAPConnection conn,
                 JDAPProtocolOp request,
                 LDAPMessageQueue toNotify,
                 LDAPConstraints cons)
           throws LDAPException
Sends LDAP request via this connection thread.

Parameters:
request - request to send
toNotify - response listener to invoke when the response is ready
Throws:
LDAPException

register

public void register(LDAPConnection conn)
Register with this connection thread.

Parameters:
conn - LDAP connection

getClientCount

int getClientCount()

deregister

public void deregister(LDAPConnection conn)
De-Register with this connection thread. If all the connection is deregistered. Then, this thread should be killed.

Parameters:
conn - LDAP connection

resultRetrieved

void resultRetrieved()
This is called when a search result has been retrieved from the incoming queue. We use the notification to unblock the listener thread, if it is waiting for the backlog to lighten.


run

public void run()
Reads from the LDAP server input stream for incoming LDAP messages.


abandon

void abandon(int id)
Stop dispatching responses for a particular message ID.

Parameters:
id - Message ID for which to discard responses.