com.waveset.adapter
Class LDAPResourceAdapterBase.VLVAcctIter

java.lang.Object
  extended bycom.waveset.adapter.DblBufIterator
      extended bycom.waveset.adapter.DblBufAcctIter
          extended bycom.waveset.adapter.LDAPResourceAdapterBase.VLVAcctIter
All Implemented Interfaces:
AccountIterator, java.lang.Runnable
Enclosing class:
LDAPResourceAdapterBase

public class LDAPResourceAdapterBase.VLVAcctIter
extends DblBufAcctIter

The VLVAcctIter class uses the VirtualListViewControl from JNDI to get users from the LDAP server in blocks with blocksize users. When instantiated, the first block of users is loaded. A thread is then started that loads the next block of users. It then waits for the the first block of users to be retrieved through calls to getNext(). Once all of the users in the first block are retrieved, additional calls to get next will retrieve users from the second block. Meanwhile, the thread will fill up the first block with additional users. I guess you would call this a double-buffer scheme. Synchronization of the thread getting the users from the LDAP server (the producer) and the thread calling getNext() (the consumer) is done using Java's built in locking mechanisms on the 2 ArrayList instances containing the users. When the producer finishes filling up an ArrayList it does a notify on it. It then tries to get a lock on the other ArrayList. Once it does, it checks to see if it is empty. If it is not, it waits on the the ArrayList's lock. The consumer thread will do a notify when it finishes with that ArrayList and clears it. This will wake up the producer. If the array was empty when the producer checked it, it will proceed to fill it while maintaining the lock on the ArrayList. When the consumer attempts to access an ArrayList it waits until it can get a lock on it. If it contains any entries, then it gets one off the list and returns it. If there are no entries, it waits on the ArrayList (this gives the producer control, if it is waiting for the lock).


Field Summary
 
Fields inherited from class com.waveset.adapter.DblBufAcctIter
code_id
 
Fields inherited from class com.waveset.adapter.DblBufIterator
_trace
 
Constructor Summary
LDAPResourceAdapterBase.VLVAcctIter(javax.naming.ldap.LdapContext ctx, int blockSize, java.lang.String filter, javax.naming.directory.SearchControls searchControls)
           
LDAPResourceAdapterBase.VLVAcctIter(javax.naming.ldap.LdapContext ctx, int blockSize, java.lang.String filter, javax.naming.directory.SearchControls searchControls, java.util.List baseDns)
           
 
Method Summary
protected  void subClose()
           
protected  void subFillArray(java.util.ArrayList arrayList)
           
 
Methods inherited from class com.waveset.adapter.DblBufAcctIter
close, getCache, hasNext, next, setCache
 
Methods inherited from class com.waveset.adapter.DblBufIterator
finalize, getCurrentArray, getError, getFillArray, getNextArray, getNextIndex, hasError, isDone, isRun, nextObject, notifyArrays, run, setCurrentArray, setDone, setError, setRun, start
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPResourceAdapterBase.VLVAcctIter

public LDAPResourceAdapterBase.VLVAcctIter(javax.naming.ldap.LdapContext ctx,
                                           int blockSize,
                                           java.lang.String filter,
                                           javax.naming.directory.SearchControls searchControls)
                                    throws WavesetException

LDAPResourceAdapterBase.VLVAcctIter

public LDAPResourceAdapterBase.VLVAcctIter(javax.naming.ldap.LdapContext ctx,
                                           int blockSize,
                                           java.lang.String filter,
                                           javax.naming.directory.SearchControls searchControls,
                                           java.util.List baseDns)
                                    throws WavesetException
Method Detail

subFillArray

protected void subFillArray(java.util.ArrayList arrayList)
                     throws java.lang.Exception
Specified by:
subFillArray in class DblBufAcctIter
Throws:
java.lang.Exception

subClose

protected void subClose()
Specified by:
subClose in class DblBufAcctIter