Native events are generated on a native event callback thread. It is not allowed to call back into LibVLC from this thread, if you do either the call will be ineffective, strange behaviour will happen, or a fatal JVM crash may occur.
To mitigate this, tasks can be submitted, serialised and executed using this service.
Internally a single-threaded executor service is used to execute tasks that need to be off-loaded from a native callback thread.
See submit(Runnable)
.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TaskExecutor
public TaskExecutor()
-
-
Method Details
-
submit
Submit a task for asynchronous execution.- Parameters:
r
- task to submit
-
release
public void release()Release this component.An attempt is made to perform an orderly shutdown, so any tasks in the queue are given a chance to complete cleanly within the default timeout period.
Consequently there may be a short delay before this method returns.
If there are no tasks waiting, this method will return immediately.
-
release
public void release(long timeout) Release this component.An attempt is made to perform an orderly shutdown, so any tasks in the queue are given a chance to complete cleanly within the specified timeout period.
Consequently there may be a short delay before this method returns.
If there are no tasks waiting, this method will return immediately.
- Parameters:
timeout
- timeout, milliseconds
-