81 |
|
* Returns a new worker thread operating in the given pool. |
82 |
|
* |
83 |
|
* @param pool the pool this thread works in |
84 |
< |
* @throws NullPointerException if pool is null; |
84 |
> |
* @throws NullPointerException if pool is null |
85 |
|
*/ |
86 |
|
public ForkJoinWorkerThread newThread(ForkJoinPool pool); |
87 |
|
} |
273 |
|
/** |
274 |
|
* Try incrementing active count; fail on contention. Called by |
275 |
|
* workers before/during executing tasks. |
276 |
< |
* @return true on success; |
276 |
> |
* @return true on success |
277 |
|
*/ |
278 |
|
final boolean tryIncrementActiveCount() { |
279 |
|
int c = runControl; |
376 |
|
* @param parallelism the targeted number of worker threads |
377 |
|
* @param factory the factory for creating new threads |
378 |
|
* @throws IllegalArgumentException if parallelism less than or |
379 |
< |
* equal to zero, or greater than implementation limit. |
379 |
> |
* equal to zero, or greater than implementation limit |
380 |
|
* @throws NullPointerException if factory is null |
381 |
|
* @throws SecurityException if a security manager exists and |
382 |
|
* the caller is not permitted to modify threads |
719 |
|
* Sets the target parallelism level of this pool. |
720 |
|
* @param parallelism the target parallelism |
721 |
|
* @throws IllegalArgumentException if parallelism less than or |
722 |
< |
* equal to zero or greater than maximum size bounds. |
722 |
> |
* equal to zero or greater than maximum size bounds |
723 |
|
* @throws SecurityException if a security manager exists and |
724 |
|
* the caller is not permitted to modify threads |
725 |
|
* because it does not hold {@link |
782 |
|
* Setting this value has no effect on current pool size. It |
783 |
|
* controls construction of new threads. |
784 |
|
* @throws IllegalArgumentException if negative or greater then |
785 |
< |
* internal implementation limit. |
785 |
> |
* internal implementation limit |
786 |
|
*/ |
787 |
|
public void setMaximumPoolSize(int newMax) { |
788 |
|
if (newMax < 0 || newMax > MAX_THREADS) |
822 |
|
* invocations at other times may be unpredictable. |
823 |
|
* |
824 |
|
* @param async if true, use locally FIFO scheduling |
825 |
< |
* @return the previous mode. |
825 |
> |
* @return the previous mode |
826 |
|
*/ |
827 |
|
public boolean setAsyncMode(boolean async) { |
828 |
|
boolean oldMode = locallyFifo; |
842 |
|
* Returns true if this pool uses local first-in-first-out |
843 |
|
* scheduling mode for forked tasks that are never joined. |
844 |
|
* |
845 |
< |
* @return true if this pool uses async mode. |
845 |
> |
* @return true if this pool uses async mode |
846 |
|
*/ |
847 |
|
public boolean getAsyncMode() { |
848 |
|
return locallyFifo; |
863 |
|
* Returns an estimate of the number of threads that are currently |
864 |
|
* stealing or executing tasks. This method may overestimate the |
865 |
|
* number of active threads. |
866 |
< |
* @return the number of active threads. |
866 |
> |
* @return the number of active threads |
867 |
|
*/ |
868 |
|
public int getActiveThreadCount() { |
869 |
|
return activeCountOf(runControl); |
873 |
|
* Returns an estimate of the number of threads that are currently |
874 |
|
* idle waiting for tasks. This method may underestimate the |
875 |
|
* number of idle threads. |
876 |
< |
* @return the number of idle threads. |
876 |
> |
* @return the number of idle threads |
877 |
|
*/ |
878 |
|
final int getIdleThreadCount() { |
879 |
|
int c = runningCountOf(workerCounts) - activeCountOf(runControl); |
902 |
|
* tuning fork/join programs: In general, steal counts should be |
903 |
|
* high enough to keep threads busy, but low enough to avoid |
904 |
|
* overhead and contention across threads. |
905 |
< |
* @return the number of steals. |
905 |
> |
* @return the number of steals |
906 |
|
*/ |
907 |
|
public long getStealCount() { |
908 |
|
return stealCount.get(); |
925 |
|
* an approximation, obtained by iterating across all threads in |
926 |
|
* the pool. This method may be useful for tuning task |
927 |
|
* granularities. |
928 |
< |
* @return the number of queued tasks. |
928 |
> |
* @return the number of queued tasks |
929 |
|
*/ |
930 |
|
public long getQueuedTaskCount() { |
931 |
|
long count = 0; |
944 |
|
* Returns an estimate of the number tasks submitted to this pool |
945 |
|
* that have not yet begun executing. This method takes time |
946 |
|
* proportional to the number of submissions. |
947 |
< |
* @return the number of queued submissions. |
947 |
> |
* @return the number of queued submissions |
948 |
|
*/ |
949 |
|
public int getQueuedSubmissionCount() { |
950 |
|
return submissionQueue.size(); |
953 |
|
/** |
954 |
|
* Returns true if there are any tasks submitted to this pool |
955 |
|
* that have not yet begun executing. |
956 |
< |
* @return {@code true} if there are any queued submissions. |
956 |
> |
* @return {@code true} if there are any queued submissions |
957 |
|
*/ |
958 |
|
public boolean hasQueuedSubmissions() { |
959 |
|
return !submissionQueue.isEmpty(); |
1717 |
|
* Possibly blocks the current thread, for example waiting for |
1718 |
|
* a lock or condition. |
1719 |
|
* @return true if no additional blocking is necessary (i.e., |
1720 |
< |
* if isReleasable would return true). |
1720 |
> |
* if isReleasable would return true) |
1721 |
|
* @throws InterruptedException if interrupted while waiting |
1722 |
|
* (the method is not required to do so, but is allowed to). |
1723 |
|
*/ |
1756 |
|
* attempt to maintain the pool's nominal parallelism; otherwise |
1757 |
|
* activate a thread only if necessary to avoid complete |
1758 |
|
* starvation. |
1759 |
< |
* @throws InterruptedException if blocker.block did so. |
1759 |
> |
* @throws InterruptedException if blocker.block did so |
1760 |
|
*/ |
1761 |
|
public static void managedBlock(ManagedBlocker blocker, |
1762 |
|
boolean maintainParallelism) |