Package ghidra.app.util
Class DecompilerConcurrentQ<I,R>
java.lang.Object
ghidra.app.util.DecompilerConcurrentQ<I,R>
- Type Parameters:
I
- The input data needed by the suppliedQCallback
R
- The result data (can be the same asI
if there is no result) returned by theQCallback.process(Object, TaskMonitor)
method.
A class to perform some of the boilerplate setup of the
ConcurrentQ
that is shared
amongst clients that perform decompilation in parallel.
This class can be used in a blocking or non-blocking fashion.
- For blocking usage, call
one of the
add
methods to put items in the queue and then callwaitForResults()
. - For non-blocking usage, simply call
process(Iterator, Consumer)
, passing the consumer of the results.
-
Constructor Summary
ConstructorDescriptionDecompilerConcurrentQ
(QCallback<I, R> callback, GThreadPool pool, boolean collectResults, TaskMonitor monitor) DecompilerConcurrentQ
(QCallback<I, R> callback, TaskMonitor monitor) DecompilerConcurrentQ
(QCallback<I, R> callback, String threadPoolName, TaskMonitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addAll
(Collection<I> collection) void
void
dispose()
void
dispose
(long timeoutSeconds) Calls dispose on the queue being processed.void
Adds all items to the queue for processing.Collection
<QResult<I, R>> Waits for all results to be delivered.void
Waits for all work to finish.
-
Constructor Details
-
DecompilerConcurrentQ
-
DecompilerConcurrentQ
-
DecompilerConcurrentQ
public DecompilerConcurrentQ(QCallback<I, R> callback, GThreadPool pool, boolean collectResults, TaskMonitor monitor)
-
-
Method Details
-
addAll
-
addAll
-
add
-
process
Adds all items to the queue for processing. The results will be passed to the given consumer as they are produced.- Parameters:
functions
- the functions to processconsumer
- the results consumer
-
waitForResults
Waits for all results to be delivered. The client is responsible for processing the results and handling any exceptions that may have occurred.- Returns:
- all results
- Throws:
InterruptedException
- if interrupted while waiting
-
waitUntilDone
Waits for all work to finish. Any exception encountered will trigger all processing to stop. If you wish for the work to continue despite exceptions, then usewaitForResults()
.- Throws:
InterruptedException
- if interrupted while waitingException
- any exception that is encountered while processing items.
-
dispose
public void dispose() -
dispose
public void dispose(long timeoutSeconds) Calls dispose on the queue being processed. Further, the call will block for up to timeoutSeconds while waiting for the queue to finish processing.- Parameters:
timeoutSeconds
- the number of seconds to wait for the disposed queue to finish processing
-