Package org.apache.ignite.testframework
Class GridTestSafeThreadFactory
java.lang.Object
org.apache.ignite.testframework.GridTestSafeThreadFactory
- All Implemented Interfaces:
ThreadFactory
Threads factory for safe test-threads management.
-
Constructor Summary
ConstructorsConstructorDescriptionGridTestSafeThreadFactory(String threadName) Constructs threads factory for safe test-threads management.GridTestSafeThreadFactory(String threadName, boolean interruptAll) Constructs threads factory for safe test-threads management. -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck and throws an exception if happens during this factory threads execution.voidInterrupts all threads, created by this thread factory.Create new thread around runnable task.Create new thread around callable task.
-
Constructor Details
-
GridTestSafeThreadFactory
Constructs threads factory for safe test-threads management.- Parameters:
threadName- threads name prefix.
-
GridTestSafeThreadFactory
Constructs threads factory for safe test-threads management.- Parameters:
threadName- Threads name prefix.interruptAll- Interrupt all threads in factory if any thread fails with unexpected exception.
-
-
Method Details
-
newThread
Create new thread around callable task.- Parameters:
c- Callable task to execute in the thread.- Returns:
- New thread around callable task.
- See Also:
-
newThread
Create new thread around runnable task.- Specified by:
newThreadin interfaceThreadFactory- Parameters:
r- Runnable task to execute in the thread.- Returns:
- New thread around runnable task.
- See Also:
-
checkError
Check and throws an exception if happens during this factory threads execution.- Throws:
Exception- If there is error.
-
interruptAllThreads
public void interruptAllThreads()Interrupts all threads, created by this thread factory.
-