title: Getting date and time from a NTPUDPClient fails sometimes
body: <p>I've been working on this program using NetBeans for 6 months and I've never experienced such an issue. It has began when I added org.apache.commons library (I needed it to get time from a online server) , when I run the program ,sometimes everything goes fine and sometimes it hangs on running state creating a process in the background. Here's the Class with the main method.</p>
  
  <pre><code>package samplefx.ctrl;
  
  import java.io.IOException;
  import java.net.InetAddress;
  import java.sql.Date;
  import java.text.ParseException;
  import javafx.application.Application;
  import javafx.application.Platform;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Scene;
  import javafx.scene.layout.BorderPane;
  import javafx.scene.layout.VBox;
  import javafx.stage.Stage;
  import javafx.stage.StageStyle;
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  import org.apache.commons.net.ntp.NTPUDPClient;
  import org.apache.commons.net.ntp.TimeInfo;
  
  public class Optilight extends Application {
  
      public static EntityManagerFactory emf;
      EntityManager em;
  
      @Override
      public void start(Stage primaryStage) throws IOException, ParseException {
  
          emf = Persistence.createEntityManagerFactory("SampleFXPU");
  
          String TIME_SERVER = "time-a.nist.gov";
          NTPUDPClient timeClient = new NTPUDPClient();
          InetAddress inetAddress = InetAddress.getByName(TIME_SERVER);
          TimeInfo timeInfo = timeClient.getTime(inetAddress);
          long returnTime = timeInfo.getMessage().getTransmitTimeStamp().getTime();
          Date time = new Date(returnTime);
  
          Access access = new Access();
          String fix = "XC193283R";
          String var = access.Y();
  
          Date start = Date.valueOf("2016-08-23");
          Date end = Date.valueOf("2016-08-31");
  
          Boolean j = false;
          if (start.before(time) &amp;&amp; time.before(end)) {
              j = true;
          }
          boolean i = false;
          if (fix.equals(var)) {
              i = true;
          }
  
          if (!j || !i) {
  
              System.exit(0);
  
          }
  
          // load main form in to VBox (Root)
          BorderPane mainPane = (BorderPane) FXMLLoader.load(getClass().getResource("/samplefx/view/Login.fxml"));
          // add main form into the scene
          Scene scene = new Scene(mainPane);
  
          //primaryStage.setTitle("Optilight 2.2.1");
          primaryStage.setScene(scene);
          primaryStage.initStyle(StageStyle.UNDECORATED);
  
          //primaryStage.setMaximized(true);    // make the main form fit to the screen
          primaryStage.show();
  
          primaryStage.setOnCloseRequest(e -&gt; {
              emf.close();
              Platform.exit();
              System.exit(0);
  
          });
  
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
  
          launch(args);
  
      }
  }
  </code></pre>