public void setKeepAliveTime (long time, TimeUnit unit)

Sets the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated. Threads that wait this amount of time without processing a task will be terminated if there are more than the core number of threads currently in the pool, or if this pool allows core thread timeout. This overrides any value set in the constructor.

Parameters:
time    the time to wait. A time value of zero will cause excess threads to terminate immediately after executing tasks.
unit    the time unit of the time argument

Exceptions:
IllegalArgumentException    if time less than zero or if time is zero and allowsCoreThreadTimeOut

See also:
getKeepAliveTime(TimeUnit)