740 |
|
* Sets the thread factory used to create new threads. |
741 |
|
* |
742 |
|
* @param threadFactory the new thread factory |
743 |
+ |
* @see #getThreadFactory |
744 |
|
*/ |
745 |
|
public void setThreadFactory(ThreadFactory threadFactory) { |
746 |
|
this.threadFactory = threadFactory; |
750 |
|
* Returns the thread factory used to create new threads. |
751 |
|
* |
752 |
|
* @return the current thread factory |
753 |
+ |
* @see #setThreadFactory |
754 |
|
*/ |
755 |
|
public ThreadFactory getThreadFactory() { |
756 |
|
return threadFactory; |
760 |
|
* Sets a new handler for unexecutable tasks. |
761 |
|
* |
762 |
|
* @param handler the new handler |
763 |
+ |
* @see #getRejectedExecutionHandler |
764 |
|
*/ |
765 |
|
public void setRejectedExecutionHandler(RejectedExecutionHandler handler) { |
766 |
|
this.handler = handler; |
770 |
|
* Returns the current handler for unexecutable tasks. |
771 |
|
* |
772 |
|
* @return the current handler |
773 |
+ |
* @see #setRejectedExecutionHandler |
774 |
|
*/ |
775 |
|
public RejectedExecutionHandler getRejectedExecutionHandler() { |
776 |
|
return handler; |
831 |
|
* @param corePoolSize the new core size |
832 |
|
* @throws IllegalArgumentException if <tt>corePoolSize</tt> |
833 |
|
* less than zero |
834 |
+ |
* @see #getCorePoolSize |
835 |
|
*/ |
836 |
|
public void setCorePoolSize(int corePoolSize) { |
837 |
|
if (corePoolSize < 0) |
861 |
|
* Returns the core number of threads. |
862 |
|
* |
863 |
|
* @return the core number of threads |
864 |
+ |
* @see #setCorePoolSize |
865 |
|
*/ |
866 |
|
public int getCorePoolSize() { |
867 |
|
return corePoolSize; |
876 |
|
* @param maximumPoolSize the new maximum |
877 |
|
* @throws IllegalArgumentException if maximumPoolSize less than zero or |
878 |
|
* the {@link #getCorePoolSize core pool size} |
879 |
+ |
* @see #getMaximumPoolSize |
880 |
|
*/ |
881 |
|
public void setMaximumPoolSize(int maximumPoolSize) { |
882 |
|
if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize) |
904 |
|
* Returns the maximum allowed number of threads. |
905 |
|
* |
906 |
|
* @return the maximum allowed number of threads |
907 |
+ |
* @see #setMaximumPoolSize |
908 |
|
*/ |
909 |
|
public int getMaximumPoolSize() { |
910 |
|
return maximumPoolSize; |
920 |
|
* excess threads to terminate immediately after executing tasks. |
921 |
|
* @param unit the time unit of the time argument |
922 |
|
* @throws IllegalArgumentException if msecs less than zero |
923 |
+ |
* @see #getKeepAliveTime |
924 |
|
*/ |
925 |
|
public void setKeepAliveTime(long time, TimeUnit unit) { |
926 |
|
if (time < 0) |
935 |
|
* |
936 |
|
* @param unit the desired time unit of the result |
937 |
|
* @return the time limit |
938 |
+ |
* @see #setKeepAliveTime |
939 |
|
*/ |
940 |
|
public long getKeepAliveTime(TimeUnit unit) { |
941 |
|
return unit.convert(keepAliveTime, TimeUnit.NANOSECONDS); |