|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.concurrent.MulticoreWrapper<I,O>
I
- input typeO
- output typepublic class MulticoreWrapper<I,O>
Provides convenient multicore processing for threadsafe objects. Objects that can be wrapped by MulticoreWrapper must implement the ThreadsafeProcessor interface. TODO(spenceg): Make lastSubmittedId and lastReturnedId threadsafe. Should support independent threads writing and reading from the queue.
Constructor Summary | |
---|---|
MulticoreWrapper(int nThreads,
ThreadsafeProcessor<I,O> processor)
|
Method Summary | |
---|---|
boolean |
hasNext()
Indicates whether a not a new result is available. |
boolean |
join()
Waits for all active processes to finish, then returns true only if all results have been returned via calls to next(). |
O |
next()
Returns the next available result. |
void |
submit(I inputInstance)
Allocate instance to a process and return. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MulticoreWrapper(int nThreads, ThreadsafeProcessor<I,O> processor)
Method Detail |
---|
public void submit(I inputInstance)
inputInstance
- public boolean join()
public boolean hasNext()
public O next()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |