Package com.netscape.certsrv.util
Class AsyncLoader
- java.lang.Object
-
- com.netscape.certsrv.util.AsyncLoader
-
public class AsyncLoader extends java.lang.Object
A locking mechanism for loading or reloading an initially unknown number of items. The "producer" is the thread that loads items, informing the Loader when each item is loaded and how many items there are (when that fact becomes known). Other threads can await the completion of a (re)loading process.
-
-
Constructor Summary
Constructors Constructor Description AsyncLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awaitLoadDone()
void
increment()
Increment the number of items loaded by 1.void
setNumItems(java.lang.Integer n)
Set the number of items.void
startLoading()
Acquire the lock as a producer.
-
-
-
Method Detail
-
startLoading
public void startLoading()
Acquire the lock as a producer.
-
increment
public void increment()
Increment the number of items loaded by 1. If the number of items is known and that many items have been loaded, unlock the loader.
-
setNumItems
public void setNumItems(java.lang.Integer n)
Set the number of items. If the number of items already loaded is equal to or greater than the number, unlock the loader.
-
awaitLoadDone
public void awaitLoadDone() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-