Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8164201

Newest version of JDK lengthened load time 3-4 times

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_92"
      Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)




      ADDITIONAL OS VERSION INFORMATION :
      Linux localhost.localdomain 4.1.5-100.fc21.x86_64 #1 SMP Tue Aug 11 00:24:23 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      In my JavaFX application I have to load many fxml files (200+) in the same time. I have decided to load them in background Task. Everything works fine (load time was acceptable) until JDK update. Newest version of JDK lengthened load time 3-4 times.

      I have checked previous JDK releases and that problem appears from the JDK 8u92.

      REGRESSION. Last worked in version 8u91

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_91"
      Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      To test that issue I created new simple JavaFX FXML Application in Netbeans 8.1 and use only generated classes and fxml. Creating view from code works fine.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ----------------------------------- Main classs -----------------------------------

      public class FXMLLoaderTest extends Application {

          private static Executor ex = Executors.newCachedThreadPool();
          //private static Executor ex = Executors.newFixedThreadPool(400);
          //private static Executor ex = Executors.newSingleThreadExecutor();

          @Override
          public void start(Stage stage) throws Exception {

              VBox box = new VBox();
              ScrollPane root = new ScrollPane(box);

              Button b = new Button("GENERATE");

              b.setOnAction(e -> {
                  IntStream.range(0, 1000).forEach(i -> {

                      Task<Parent> task = new Task<Parent>() {
                          @Override
                          protected Parent call() throws Exception {
                              FXMLLoader loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml"));

                              Parent root = null;
                              try {
                                  root = loader.load();
                              } catch (IOException ex) {
                                  Logger.getLogger(Loader.class.getName()).log(Level.SEVERE, null, ex);
                              }

                             // StackPane root= new StackPane();
                             // Button click = new Button("Click");
                             // root.setPrefSize(300, 300);
                             // root.getChildren().add(click);
                              return root;
                          }
                      };

                      task.setOnSucceeded(ev -> {
                          final Parent parent = task.getValue();
                          box.getChildren().add(parent);
                      });

                      task.setOnFailed(ev -> task.getException().printStackTrace());

                      ex.execute(task);
                  });

              });

              box.getChildren().add(b);

              Scene scene = new Scene(root, 400, 500);

              stage.setScene(scene);
              stage.show();
          }

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }
      }

      -------------------------------------- FXML file ----------------------------------------

      <AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxmlloader.FXMLDocumentController">
          <children>
              <Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" />
              <Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" />
          </children>
      </AnchorPane>

      ------------------------------------ FXML Controller -----------------------------------

      public class FXMLDocumentController implements Initializable {

          @FXML
          private Label label;

          @FXML
          private void handleButtonAction(ActionEvent event) {
              System.out.println("You clicked me!");
              label.setText("Hello World!");
          }

          @Override
          public void initialize(URL url, ResourceBundle rb) {
              // TODO
          }

      }
      ---------- END SOURCE ----------

            vadim Vadim Pakhnushev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: