org.apache.hadoop.util
Class ShutdownThreadsHelper
java.lang.Object
org.apache.hadoop.util.ShutdownThreadsHelper
public class ShutdownThreadsHelper
- extends Object
Helper class to shutdown Thread
s and ExecutorService
s.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShutdownThreadsHelper
public ShutdownThreadsHelper()
shutdownThread
public static boolean shutdownThread(Thread thread)
- Parameters:
thread
- to be shutdown
- Returns:
- true if the thread is successfully interrupted,
false otherwise
- Throws:
InterruptedException
shutdownThread
public static boolean shutdownThread(Thread thread,
long timeoutInMilliSeconds)
- Parameters:
thread
- to be shutdown
timeoutInMilliSeconds
- time to wait for thread to join after being
interrupted
- Returns:
- true if the thread is successfully interrupted,
false otherwise
- Throws:
InterruptedException
shutdownExecutorService
public static boolean shutdownExecutorService(ExecutorService service)
throws InterruptedException
- Parameters:
service
- to be shutdown
- Returns:
- true if the service is terminated,
false otherwise
- Throws:
InterruptedException
shutdownExecutorService
public static boolean shutdownExecutorService(ExecutorService service,
long timeoutInMs)
throws InterruptedException
- Parameters:
service
- to be shutdown
timeoutInMs
- time to wait for ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)
calls in milli seconds.
- Returns:
- true if the service is terminated,
false otherwise
- Throws:
InterruptedException
Copyright © 2013 Apache Software Foundation. All Rights Reserved.