< prev index next >

test/runtime/Thread/Fibonacci.java

Print this page




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @summary Calculates Fibonacci numbers "recursively" via threads and compares
  27  *     the result with the classical calculation.
  28  *     This test is skipped on 32-bit Windows: limited virtual space on Win-32
  29  *     make this test inherently unstable on Windows with 32-bit VM data model.
  30  * @requires !(os.family == "windows" & sun.arch.data.model == "32")
  31  * @modules java.base/jdk.internal.misc
  32  * @library /testlibrary
  33  * @run main/othervm Fibonacci 15
  34  */
  35 
  36 import jdk.test.lib.Asserts;
  37 
  38 public class Fibonacci extends Thread {
  39     private int index;
  40     private int value;
  41     private Fibonacci left;
  42     private Fibonacci right;
  43 
  44     public Fibonacci(int i) {
  45         index = i;
  46     }
  47 
  48     private int getValue() {
  49         return value;
  50     }
  51 
  52     @Override




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  * @test
  26  * @summary Calculates Fibonacci numbers "recursively" via threads and compares
  27  *     the result with the classical calculation.
  28  *     This test is skipped on 32-bit Windows: limited virtual space on Win-32
  29  *     make this test inherently unstable on Windows with 32-bit VM data model.
  30  * @requires !(os.family == "windows" & sun.arch.data.model == "32")
  31  * @modules java.base/jdk.internal.misc
  32  * @library /test/lib
  33  * @run main/othervm Fibonacci 15
  34  */
  35 
  36 import jdk.test.lib.Asserts;
  37 
  38 public class Fibonacci extends Thread {
  39     private int index;
  40     private int value;
  41     private Fibonacci left;
  42     private Fibonacci right;
  43 
  44     public Fibonacci(int i) {
  45         index = i;
  46     }
  47 
  48     private int getValue() {
  49         return value;
  50     }
  51 
  52     @Override


< prev index next >