|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.ubik.net.Semaphore
public class Semaphore
This class implements a simple semaphore.
| Nested Class Summary | |
|---|---|
static class |
Semaphore.SemaphoreRunnable
|
| Field Summary | |
|---|---|
static int |
NO_MAX
|
| Constructor Summary | |
|---|---|
Semaphore(int maxThread)
Creates a new instance of this class. |
|
Semaphore(int maxThread,
ThreadFactory fac)
Creates a new instance of this class. |
|
| Method Summary | |
|---|---|
java.lang.Thread |
acquireFor(java.lang.Runnable r)
Returns a thread that wraps the given runnable. |
int |
getThreadCount()
Gets the number of currently running threads that have been borrowed from this instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_MAX
| Constructor Detail |
|---|
public Semaphore(int maxThread)
maxThread - the number of threads this instance will be
allowed to create.
public Semaphore(int maxThread,
ThreadFactory fac)
maxThread - the number of threads this instance will be
allowed to create.fac - a ThreadFactory instance.| Method Detail |
|---|
public int getThreadCount()
public java.lang.Thread acquireFor(java.lang.Runnable r)
throws MaxThreadReachedException
This method uses this semaphore's internal thread factory to create the thread objects - the factory implementation can be specified at semaphore construction time.
Thread instance.
MaxThreadReachedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||