/usr/share/doc/libjsr166y-java/api/jsr166y/forkjoin/ForkJoinWorkerThread.html is in libjsr166y-java 0.1.20080107-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_18) on Mon Nov 15 19:31:41 UTC 2010 -->
<TITLE>
ForkJoinWorkerThread
</TITLE>
<META NAME="date" CONTENT="2010-11-15">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ForkJoinWorkerThread";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin"><B>PREV CLASS</B></A>
<A HREF="../../jsr166y/forkjoin/LinkedAsyncAction.html" title="class in jsr166y.forkjoin"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?jsr166y/forkjoin/ForkJoinWorkerThread.html" target="_top"><B>FRAMES</B></A>
<A HREF="ForkJoinWorkerThread.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_java.lang.Thread">NESTED</A> | <A HREF="#fields_inherited_from_class_java.lang.Thread">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
jsr166y.forkjoin</FONT>
<BR>
Class ForkJoinWorkerThread</H2>
<PRE>
java.lang.Object
<IMG SRC="../../resources/inherit.gif" ALT="extended by ">java.lang.Thread
<IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>jsr166y.forkjoin.ForkJoinWorkerThread</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.lang.Runnable</DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>ForkJoinWorkerThread</B><DT>extends java.lang.Thread</DL>
</PRE>
<P>
A thread that is internally managed by a ForkJoinPool to execute
ForkJoinTasks. This class additionally provides public
<tt>static</tt> methods accessing some basic scheduling and
execution mechanics for the <em>current</em>
ForkJoinWorkerThread. These methods may be invoked only from within
other ForkJoinTask computations. Attempts to invoke in other
contexts result in exceptions or errors including
ClassCastException. These methods enable construction of
special-purpose task classes, as well as specialized idioms
occasionally useful in ForkJoinTask processing.
<p>The form of supported static methods reflects the fact that
worker threads may access and process tasks obtained in any of
three ways. In preference order: <em>Local</em> tasks are processed
in LIFO (newest first) order. <em>Stolen</em> tasks are obtained
from other threads in FIFO (oldest first) order, only if there are
no local tasks to run. <em>Submissions</em> form a FIFO queue
common to the entire pool, and are started only if no other
work is available.
<p> This class is subclassable solely for the sake of adding
functionality -- there are no overridable methods dealing with
scheduling or execution. However, you can override initialization
and termination cleanup methods surrounding the main task
processing loop. If you do create such a subclass, you will also
need to supply a custom ForkJoinWorkerThreadFactory to use it in a
ForkJoinPool.
<P>
<P>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_java.lang.Thread"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class java.lang.Thread</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler</CODE></TD>
</TR>
</TABLE>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_java.lang.Thread"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class java.lang.Thread</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY</CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#ForkJoinWorkerThread(jsr166y.forkjoin.ForkJoinPool)">ForkJoinWorkerThread</A></B>(<A HREF="../../jsr166y/forkjoin/ForkJoinPool.html" title="class in jsr166y.forkjoin">ForkJoinPool</A> pool)</CODE>
<BR>
Creates a ForkJoinWorkerThread operating in the given pool.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#executeLocalTask()">executeLocalTask</A></B>()</CODE>
<BR>
Execute the next task locally queued by the current worker, if
one is available.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#executeTask()">executeTask</A></B>()</CODE>
<BR>
Helps this program complete by processing a local, stolen or
submitted task, if one is available.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#getEstimatedSurplusTaskCount()">getEstimatedSurplusTaskCount</A></B>()</CODE>
<BR>
Returns an estimate of how many more locally queued tasks there
are than idle worker threads that might steal them.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#getLocalQueueSize()">getLocalQueueSize</A></B>()</CODE>
<BR>
Returns the number of tasks waiting to be run by the current
worker thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../jsr166y/forkjoin/ForkJoinPool.html" title="class in jsr166y.forkjoin">ForkJoinPool</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#getPool()">getPool</A></B>()</CODE>
<BR>
Returns the pool hosting the current task execution.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#getPoolIndex()">getPoolIndex</A></B>()</CODE>
<BR>
Returns the index number of the current worker thread in its
pool.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#nextRandomDouble()">nextRandomDouble</A></B>()</CODE>
<BR>
Returns a random double using a per-worker random
number generator with the same properties as
<CODE>Random.nextDouble()</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#nextRandomInt()">nextRandomInt</A></B>()</CODE>
<BR>
Returns a random integer using a per-worker random
number generator with the same properties as
<CODE>Random.nextInt()</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#nextRandomInt(int)">nextRandomInt</A></B>(int n)</CODE>
<BR>
Returns a random integer using a per-worker random
number generator with the same properties as
<CODE>Random.nextInt(int)</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#nextRandomLong()">nextRandomLong</A></B>()</CODE>
<BR>
Returns a random long using a per-worker random
number generator with the same properties as
<CODE>Random.nextLong()</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#nextRandomLong(long)">nextRandomLong</A></B>(long n)</CODE>
<BR>
Returns a random integer using a per-worker random
number generator with the same properties as
<CODE>Random.nextInt(int)</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#onStart()">onStart</A></B>()</CODE>
<BR>
Initializes internal state after construction but before
processing any tasks.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#onTermination(java.lang.Throwable)">onTermination</A></B>(java.lang.Throwable exception)</CODE>
<BR>
Perform cleanup associated with termination of this worker
thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#peekLocalTask()">peekLocalTask</A></B>()</CODE>
<BR>
Returns, but does not remove or execute, the next task locally
queued for execution by the current worker thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#pollLocalTask()">pollLocalTask</A></B>()</CODE>
<BR>
Removes and returns, without executing, the next task queued
for execution in the current worker thread's local queue.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#pollTask()">pollTask</A></B>()</CODE>
<BR>
Removes and returns, without executing, the next task available
for execution by the current worker thread, which may be a
locally queued task, one stolen from another worker, or a pool
submission.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#removeIfNextLocalTask(jsr166y.forkjoin.ForkJoinTask)">removeIfNextLocalTask</A></B>(<A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?> task)</CODE>
<BR>
Removes and returns, without executing, the given task from the
queue hosting current execution only if it would be the next
task executed by the current worker.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../jsr166y/forkjoin/ForkJoinWorkerThread.html#run()">run</A></B>()</CODE>
<BR>
This method is required to be public, but should never be
called explicitly.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Thread"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Thread</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ForkJoinWorkerThread(jsr166y.forkjoin.ForkJoinPool)"><!-- --></A><H3>
ForkJoinWorkerThread</H3>
<PRE>
protected <B>ForkJoinWorkerThread</B>(<A HREF="../../jsr166y/forkjoin/ForkJoinPool.html" title="class in jsr166y.forkjoin">ForkJoinPool</A> pool)</PRE>
<DL>
<DD>Creates a ForkJoinWorkerThread operating in the given pool.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>pool</CODE> - the pool this thread works in
<DT><B>Throws:</B>
<DD><CODE>java.lang.NullPointerException</CODE> - if pool is null;</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="run()"><!-- --></A><H3>
run</H3>
<PRE>
public void <B>run</B>()</PRE>
<DL>
<DD>This method is required to be public, but should never be
called explicitly. It executes the main run loop to execute
ForkJoinTasks.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE>run</CODE> in interface <CODE>java.lang.Runnable</CODE><DT><B>Overrides:</B><DD><CODE>run</CODE> in class <CODE>java.lang.Thread</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="onStart()"><!-- --></A><H3>
onStart</H3>
<PRE>
protected void <B>onStart</B>()</PRE>
<DL>
<DD>Initializes internal state after construction but before
processing any tasks. If you override this method, you must
invoke super.onStart() at the beginning of the method.
Initialization requires care: Most fields must have legal
default values, to ensure that attempted accesses from other
threads work correctly even before this thread starts
processing tasks.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="onTermination(java.lang.Throwable)"><!-- --></A><H3>
onTermination</H3>
<PRE>
protected void <B>onTermination</B>(java.lang.Throwable exception)</PRE>
<DL>
<DD>Perform cleanup associated with termination of this worker
thread. If you override this method, you must invoke
super.onTermination at the end of the overridden method.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>exception</CODE> - the exception causing this thread to abort due
to an unrecoverable error, or null if completed normally.</DL>
</DD>
</DL>
<HR>
<A NAME="getPool()"><!-- --></A><H3>
getPool</H3>
<PRE>
public static <A HREF="../../jsr166y/forkjoin/ForkJoinPool.html" title="class in jsr166y.forkjoin">ForkJoinPool</A> <B>getPool</B>()</PRE>
<DL>
<DD>Returns the pool hosting the current task execution.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the pool</DL>
</DD>
</DL>
<HR>
<A NAME="getPoolIndex()"><!-- --></A><H3>
getPoolIndex</H3>
<PRE>
public static int <B>getPoolIndex</B>()</PRE>
<DL>
<DD>Returns the index number of the current worker thread in its
pool. The return value is in the range
<tt>0...getPool().getPoolSize()-1</tt>. This method may be
useful for applications that track status or collect results
per-worker rather than per-task.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the index number.</DL>
</DD>
</DL>
<HR>
<A NAME="getLocalQueueSize()"><!-- --></A><H3>
getLocalQueueSize</H3>
<PRE>
public static int <B>getLocalQueueSize</B>()</PRE>
<DL>
<DD>Returns the number of tasks waiting to be run by the current
worker thread. This value may be useful for heuristic decisions
about whether to fork other tasks.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the number of tasks</DL>
</DD>
</DL>
<HR>
<A NAME="getEstimatedSurplusTaskCount()"><!-- --></A><H3>
getEstimatedSurplusTaskCount</H3>
<PRE>
public static int <B>getEstimatedSurplusTaskCount</B>()</PRE>
<DL>
<DD>Returns an estimate of how many more locally queued tasks there
are than idle worker threads that might steal them. This value
may be useful for heuristic decisions about whether to fork
other tasks.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the number of tasks, which is negative if there are
fewer tasks than idle workers</DL>
</DD>
</DL>
<HR>
<A NAME="peekLocalTask()"><!-- --></A><H3>
peekLocalTask</H3>
<PRE>
public static <A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?> <B>peekLocalTask</B>()</PRE>
<DL>
<DD>Returns, but does not remove or execute, the next task locally
queued for execution by the current worker thread. There is no
guarantee that this task will be the next one actually returned
or executed from other polling or execution methods.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the next task or null if none</DL>
</DD>
</DL>
<HR>
<A NAME="pollLocalTask()"><!-- --></A><H3>
pollLocalTask</H3>
<PRE>
public static <A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?> <B>pollLocalTask</B>()</PRE>
<DL>
<DD>Removes and returns, without executing, the next task queued
for execution in the current worker thread's local queue.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the next task to execute, or null if none</DL>
</DD>
</DL>
<HR>
<A NAME="removeIfNextLocalTask(jsr166y.forkjoin.ForkJoinTask)"><!-- --></A><H3>
removeIfNextLocalTask</H3>
<PRE>
public static boolean <B>removeIfNextLocalTask</B>(<A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?> task)</PRE>
<DL>
<DD>Removes and returns, without executing, the given task from the
queue hosting current execution only if it would be the next
task executed by the current worker. Among other usages, this
method may be used to bypass task execution during
cancellation.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>task</CODE> - the task
<DT><B>Returns:</B><DD>true if removed</DL>
</DD>
</DL>
<HR>
<A NAME="executeLocalTask()"><!-- --></A><H3>
executeLocalTask</H3>
<PRE>
public static boolean <B>executeLocalTask</B>()</PRE>
<DL>
<DD>Execute the next task locally queued by the current worker, if
one is available.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>true if a task was run; a false return indicates
that no task was available.</DL>
</DD>
</DL>
<HR>
<A NAME="pollTask()"><!-- --></A><H3>
pollTask</H3>
<PRE>
public static <A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin">ForkJoinTask</A><?> <B>pollTask</B>()</PRE>
<DL>
<DD>Removes and returns, without executing, the next task available
for execution by the current worker thread, which may be a
locally queued task, one stolen from another worker, or a pool
submission.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the next task to execute, or null if none</DL>
</DD>
</DL>
<HR>
<A NAME="executeTask()"><!-- --></A><H3>
executeTask</H3>
<PRE>
public static boolean <B>executeTask</B>()</PRE>
<DL>
<DD>Helps this program complete by processing a local, stolen or
submitted task, if one is available. This method may be useful
when several tasks are forked, and only one of them must be
joined, as in:
<pre>
while (!t1.isDone() && !t2.isDone())
ForkJoinWorkerThread.executeTask();
</pre>
Similarly, you can help process tasks until all computations
complete via
<pre>
while(ForkJoinWorkerThread.executeTask() ||
!ForkJoinWorkerThread.getPool().isQuiescent())
;
</pre>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>true if a task was run; a false return indicates
that no task was available.</DL>
</DD>
</DL>
<HR>
<A NAME="nextRandomInt()"><!-- --></A><H3>
nextRandomInt</H3>
<PRE>
public static int <B>nextRandomInt</B>()</PRE>
<DL>
<DD>Returns a random integer using a per-worker random
number generator with the same properties as
<CODE>Random.nextInt()</CODE>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the next pseudorandom, uniformly distributed <code>int</code>
value from this worker's random number generator's sequence</DL>
</DD>
</DL>
<HR>
<A NAME="nextRandomInt(int)"><!-- --></A><H3>
nextRandomInt</H3>
<PRE>
public static int <B>nextRandomInt</B>(int n)</PRE>
<DL>
<DD>Returns a random integer using a per-worker random
number generator with the same properties as
<CODE>Random.nextInt(int)</CODE>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>n</CODE> - the bound on the random number to be returned. Must be
positive.
<DT><B>Returns:</B><DD>the next pseudorandom, uniformly distributed <code>int</code>
value between <code>0</code> (inclusive) and <code>n</code> (exclusive)
from this worker's random number generator's sequence
<DT><B>Throws:</B>
<DD><CODE>java.lang.IllegalArgumentException</CODE> - if n is not positive</DL>
</DD>
</DL>
<HR>
<A NAME="nextRandomLong()"><!-- --></A><H3>
nextRandomLong</H3>
<PRE>
public static long <B>nextRandomLong</B>()</PRE>
<DL>
<DD>Returns a random long using a per-worker random
number generator with the same properties as
<CODE>Random.nextLong()</CODE>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the next pseudorandom, uniformly distributed <code>long</code>
value from this worker's random number generator's sequence</DL>
</DD>
</DL>
<HR>
<A NAME="nextRandomLong(long)"><!-- --></A><H3>
nextRandomLong</H3>
<PRE>
public static long <B>nextRandomLong</B>(long n)</PRE>
<DL>
<DD>Returns a random integer using a per-worker random
number generator with the same properties as
<CODE>Random.nextInt(int)</CODE>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>n</CODE> - the bound on the random number to be returned. Must be
positive.
<DT><B>Returns:</B><DD>the next pseudorandom, uniformly distributed <code>int</code>
value between <code>0</code> (inclusive) and <code>n</code> (exclusive)
from this worker's random number generator's sequence
<DT><B>Throws:</B>
<DD><CODE>java.lang.IllegalArgumentException</CODE> - if n is not positive</DL>
</DD>
</DL>
<HR>
<A NAME="nextRandomDouble()"><!-- --></A><H3>
nextRandomDouble</H3>
<PRE>
public static double <B>nextRandomDouble</B>()</PRE>
<DL>
<DD>Returns a random double using a per-worker random
number generator with the same properties as
<CODE>Random.nextDouble()</CODE>
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the next pseudorandom, uniformly distributed <code>double</code>
value between <code>0.0</code> and <code>1.0</code> from this
worker's random number generator's sequence</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../jsr166y/forkjoin/ForkJoinTask.html" title="class in jsr166y.forkjoin"><B>PREV CLASS</B></A>
<A HREF="../../jsr166y/forkjoin/LinkedAsyncAction.html" title="class in jsr166y.forkjoin"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?jsr166y/forkjoin/ForkJoinWorkerThread.html" target="_top"><B>FRAMES</B></A>
<A HREF="ForkJoinWorkerThread.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_java.lang.Thread">NESTED</A> | <A HREF="#fields_inherited_from_class_java.lang.Thread">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
|