title: Java - Timer is not being removed after execution
body: <p>I have an application that starts a timer to splash a message on user actions. In JDK profiler it seems that all other threads are being removed after execution by GC (I guess) but the timers a created is not being removed. What could be happening there?</p>
  
  <p>my timer: </p>
  
  <pre><code>/**
   * @param owner
   * @param added
   */
  public static void splashParentWithAnimation(AnchorPane owner, Parent added,double posX,double posY) {
      // addParentWithAnimation(owner, added);
      owner.getChildren().add(added);
  
      AnchorPane.setLeftAnchor(added, posX);
  
      AnchorPane.setTopAnchor(added,  posY);
  
      FadeTransition ft1 = new FadeTransition(Duration.millis(300), added);
      ft1.setFromValue(0.0);
      ft1.setToValue(1.0);
      ft1.play();
  
  
      Timer messagePrinter = new Timer();
      messagePrinter.schedule(new TimerTask() {
  
          @Override
          public void run() {
              Platform.runLater(() -&gt; {
  
                  if (!owner.getChildren().contains(added))
                      return;
  
                  FadeTransition ft1 = new FadeTransition(Duration.millis(300), added);
                  ft1.setFromValue(1.0);
                  ft1.setToValue(0.0);
                  ft1.play();
                  ft1.setOnFinished((e) -&gt; {
  
                      if (owner.getChildren().contains(added))
                          owner.getChildren().remove(added);
                  });
  
              });
  
          }
      },  1000);
  }
  </code></pre>
  
  <p>JDK profiler : 
  <a href="https://i.stack.imgur.com/MMsrN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MMsrN.png" alt="enter image description here"></a></p>
  
  <p>Is it because I am using a static method or should I destroy it myself?</p>