private final void socketrun() {
   do {
     if (link.socketport != 0) {
       try {
         Socket socket =
             new Socket(InetAddress.getByName(getCodeBase().getHost()), link.socketport);
         socket.setSoTimeout(30000);
         socket.setTcpNoDelay(true);
         link.s = socket;
       } catch (Exception _ex) {
         link.s = null;
       }
       link.socketport = 0;
     }
     if (link.runme != null) {
       Thread thread = new Thread(link.runme);
       thread.setDaemon(true);
       thread.start();
       link.runme = null;
     }
     if (link.iplookup != null) {
       String s = "unknown";
       try {
         s = InetAddress.getByName(link.iplookup).getHostName();
       } catch (Exception _ex) {
       }
       link.host = s;
       link.iplookup = null;
     }
     try {
       Thread.sleep(100L);
     } catch (Exception _ex) {
     }
   } while (true);
 }
Example #2
1
  // --------------------------------actionConnect------------------------------
  private void actionConnect() {
    if (oParty == null) {
      JOptionPane.showMessageDialog(frame, "Make a party before trying to connect.");
      return;
    }

    String[] oResults = (String[]) DialogManager.show(DialogManager.CONNECT, frame);

    if (oResults[DialogManager.RETURN_IP].equals("cancel")) return;

    lblStatus3.setText("Connecting...");
    try {
      oConn.connect(
          oResults[DialogManager.RETURN_IP], Integer.parseInt(oResults[DialogManager.RETURN_PORT]));
    } catch (UnknownHostException e) {
      JOptionPane.showMessageDialog(
          frame,
          "The IP of the host cannot be determined.",
          "Unknown Host Exception",
          JOptionPane.ERROR_MESSAGE);
      frame.repaint();
      return;
    } catch (IOException e) {
      JOptionPane.showMessageDialog(
          frame, e.getMessage(), "Input/Output Exception", JOptionPane.ERROR_MESSAGE);
      frame.repaint();
      return;
    }
    echo("Connected to opponent!");

    tConn = new Thread(oConn, "conn");
    tConn.start();
    tMain = new Thread(this, "main");
    tMain.start();
  }
Example #3
1
  /**
   * Start this server. If we manage an own HttpServer, then the HttpServer will be started as well.
   */
  public void start() {
    // URL as configured takes precedence
    String configUrl =
        NetworkUtil.replaceExpression(config.getJolokiaConfig().get(ConfigKey.DISCOVERY_AGENT_URL));
    jolokiaHttpHandler.start(
        lazy, configUrl != null ? configUrl : url, config.getAuthenticator() != null);

    if (httpServer != null) {
      // Starting our own server in an own thread group with a fixed name
      // so that the cleanup thread can recognize it.
      ThreadGroup threadGroup = new ThreadGroup("jolokia");
      threadGroup.setDaemon(false);

      Thread starterThread =
          new Thread(
              threadGroup,
              new Runnable() {
                @Override
                public void run() {
                  httpServer.start();
                }
              });
      starterThread.start();
      cleaner = new CleanupThread(httpServer, threadGroup);
      cleaner.start();
    }
  }
Example #4
1
 void start() {
   if (t == null) {
     t = new Thread(this, "UDP.OutgoingPacketHandler thread");
     t.setDaemon(true);
     t.start();
   }
 }
Example #5
0
 /** Redirect a VMs output and error streams to System.out and System.err */
 protected void redirectStreams(VirtualMachine vm) {
   MessageSiphon ms = new MessageSiphon(process.getErrorStream(), this);
   errThread = ms.getThread();
   outThread = new StreamRedirectThread("VM output reader", process.getInputStream(), System.out);
   errThread.start();
   outThread.start();
 }
 public void start() {
     gatewayThread = new Thread(new GatewayRunner());
     feedbackThread = new Thread(new FeedbackRunner());
     gatewayThread.start();
     feedbackThread.start();
     startUp.acquireUninterruptibly(2);
 }
  /**
   * After deserialization hook. Puts all vehicles on separate threads so everything will work as it
   * should
   *
   * @param in Fired on readobject
   * @throws IOException
   * @throws ClassNotFoundException
   */
  private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();

    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {

    }

    for (int i = 0; i < getVehicles().size(); i++) {
      Thread t = new Thread(getVehicles().get(i));
      t.start();
    }

    for (int i = 0; i < getIntersections().size(); i++) {
      Thread t = new Thread(getIntersections().get(i));
      t.start();
    }

    Passenger p = passengers.poll();
    while (p != null) {
      Thread t = new Thread(p);
      t.start();

      p = passengers.poll();
    }
  }
Example #8
0
 public static void main(String[] args) throws IOException, InterruptedException {
   long start = System.currentTimeMillis();
   initialbuild();
   System.out.println("Start highwatermark " + Highwatermark.get());
   for (int i = 0; i < 10; i++) {
     Thread t1 =
         new Thread("test 1") {
           public void run() {
             _test();
           }
         };
     Thread t2 =
         new Thread("test 2") {
           public void run() {
             _test();
           }
         };
     Thread t3 =
         new Thread("test 3") {
           public void run() {
             _test();
           }
         };
     t1.start();
     t2.start();
     t3.start();
     _test();
     t1.join();
     t2.join();
     t3.join();
   }
   System.out.println("End highwatermark " + Highwatermark.get());
   long time = System.currentTimeMillis() - start;
   System.out.printf("End to end took %.1f%n", time / 1e3);
 }
  public static void main(String[] args) throws Exception {
    int minTokenCount = 5;
    File corpusFile = new File(args[0]);
    CharSequence[] articleTexts = LdaWormbase.readCorpus(corpusFile);
    SymbolTable symbolTable = new MapSymbolTable();
    TokenizerFactory tokenizerFactory = LdaWormbase.WORMBASE_TOKENIZER_FACTORY;
    int[][] docTokens =
        LatentDirichletAllocation.tokenizeDocuments(
            articleTexts, tokenizerFactory, symbolTable, minTokenCount);

    LdaRunnable runnable1 =
        new LdaRunnable(docTokens, new LdaReportingHandler(symbolTable), new Random());

    LdaRunnable runnable2 =
        new LdaRunnable(docTokens, new LdaReportingHandler(symbolTable), new Random());

    Thread thread1 = new Thread(runnable1);
    Thread thread2 = new Thread(runnable2);

    thread1.start();
    thread2.start();

    thread1.join();
    thread2.join();

    LatentDirichletAllocation lda0 = runnable1.mLda;

    LatentDirichletAllocation lda1 = runnable2.mLda;

    System.out.println("\nComputing Greedy Aligned Symmetrized KL Divergences");
    double[] scores = similarity(lda0, lda1);
    for (int i = 0; i < scores.length; ++i) System.out.printf("%4d %15.3f\n", i, scores[i]);
  }
Example #10
0
 public static void initialbuild() throws IOException, InterruptedException {
   System.out.println("building an empty map");
   long start = System.currentTimeMillis();
   Thread t1 =
       new Thread("test 1") {
         public void run() {
           populate(1);
         }
       };
   t1.start();
   Thread t2 =
       new Thread("test 2") {
         public void run() {
           populate(2);
         }
       };
   t2.start();
   Thread t3 =
       new Thread("test 3") {
         public void run() {
           populate(3);
         }
       };
   t3.start();
   populate(0);
   t1.join();
   t2.join();
   t3.join();
   long now = System.currentTimeMillis();
   System.out.println(builder);
   System.out.println("Time taken to insert all entries " + ((now - start) / 1000.0) + " seconds");
 }
 /** @param args the command line arguments */
 public static void main(String[] args) throws Exception {
   try {
     conf = new JsonFile("config.json").read();
     address = conf.getJson().get("bind_IP").toString();
     port = Integer.parseInt(conf.getJson().get("port").toString());
     collection = new CollectThread(conf);
     collection.start();
     s = new ServerSocket(port, 50, InetAddress.getByName(address));
     System.out.print("(" + new GregorianCalendar().getTime() + ") -> ");
     System.out.print("listening on: " + address + ":" + port + "\n");
   } catch (Exception e) {
     System.out.print("(" + new GregorianCalendar().getTime() + ") -> ");
     System.out.print("error: " + e);
   }
   while (true) {
     try {
       sock = s.accept();
       System.out.print("(" + new GregorianCalendar().getTime() + ") -> ");
       System.out.print("connection from " + sock.getInetAddress() + ":");
       System.out.print(sock.getPort() + "\n");
       server = new ConsoleThread(conf, sock);
       server.start();
     } catch (Exception e) {
       System.out.print("(" + new GregorianCalendar().getTime() + ") -> ");
       System.out.print("error: " + e);
       continue;
     }
   }
 }
Example #12
0
  public static void main(String[] args) throws Exception {
    if (args.length == 0) {
      System.err.println("Usage: java PortForward <local-port> <listen-port>");
      return;
    }
    int localPort = Integer.parseInt(args[0]);
    int listenPort = Integer.parseInt(args[1]);
    ServerSocket ss = new ServerSocket(listenPort);
    final Socket in = ss.accept();
    final Socket out = new Socket("127.0.0.1", localPort);

    Thread in2out =
        new Thread() {
          public void run() {
            try {
              InputStream i = in.getInputStream();
              OutputStream o = out.getOutputStream();
              int b = i.read();
              while (b >= 0) {
                o.write((byte) b);
                b = i.read();
              }
              o.close();
              i.close();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    in2out.start();

    Thread out2in =
        new Thread() {
          public void run() {
            try {
              InputStream i = out.getInputStream();
              OutputStream o = in.getOutputStream();
              int b = i.read();
              while (b >= 0) {
                o.write((byte) b);
                b = i.read();
              }
              o.close();
              i.close();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    out2in.start();

    in2out.join();
    out2in.join();
    in.close();
    out.close();
  }
  public static void main(String[] args) throws Exception {
    int counter = 0;
    while (true) {
      Thread outThread = null;
      Thread errThread = null;
      try {
        // org.pitest.mutationtest.instrument.MutationTestUnit#runTestInSeperateProcessForMutationRange

        // *** start slave

        ServerSocket commSocket = new ServerSocket(0);
        int commPort = commSocket.getLocalPort();
        System.out.println("commPort = " + commPort);

        // org.pitest.mutationtest.execute.MutationTestProcess#start
        //   - org.pitest.util.CommunicationThread#start
        FutureTask<Integer> commFuture = createFuture(commSocket);
        //   - org.pitest.util.WrappingProcess#start
        //       - org.pitest.util.JavaProcess#launch
        Process slaveProcess = startSlaveProcess(commPort);
        outThread = new Thread(new ReadFromInputStream(slaveProcess.getInputStream()), "stdout");
        errThread = new Thread(new ReadFromInputStream(slaveProcess.getErrorStream()), "stderr");
        outThread.start();
        errThread.start();

        // *** wait for slave to die

        // org.pitest.mutationtest.execute.MutationTestProcess#waitToDie
        //    - org.pitest.util.CommunicationThread#waitToFinish
        System.out.println("waitToFinish");
        Integer controlReturned = commFuture.get();
        System.out.println("controlReturned = " + controlReturned);
        // NOTE: the following won't get called if commFuture.get() fails!
        //    - org.pitest.util.JavaProcess#destroy
        outThread.interrupt(); // org.pitest.util.AbstractMonitor#requestStop
        errThread.interrupt(); // org.pitest.util.AbstractMonitor#requestStop
        slaveProcess.destroy();
      } catch (Exception e) {
        e.printStackTrace(System.out);
      }

      // test: the threads should exit eventually
      outThread.join();
      errThread.join();
      counter++;
      System.out.println("try " + counter + ": stdout and stderr threads exited normally");
    }
  }
 void asyncUpdate() throws BundleException {
   if (getEquinoxContainer().getConfiguration().getDebug().DEBUG_SYSTEM_BUNDLE) {
     Debug.printStackTrace(
         new Exception("Framework has been requested to update (restart).")); // $NON-NLS-1$
   }
   lockStateChange(ModuleEvent.UPDATED);
   try {
     if (Module.ACTIVE_SET.contains(getState())) {
       Thread t =
           new Thread(
               new Runnable() {
                 @Override
                 public void run() {
                   try {
                     update();
                   } catch (Throwable e) {
                     SystemBundle.this
                         .getEquinoxContainer()
                         .getLogServices()
                         .log(
                             EquinoxContainer.NAME,
                             FrameworkLogEntry.ERROR,
                             "Error updating the framework.",
                             e); //$NON-NLS-1$
                   }
                 }
               },
               "Framework update"); //$NON-NLS-1$
       t.start();
     }
   } finally {
     unlockStateChange(ModuleEvent.UPDATED);
   }
 }
    protected void openFromPath(final String path) {
      Thread t =
          new Thread(
              new Runnable() {
                public void run() {
                  final ArrayList<Airspace> airspaces = new ArrayList<Airspace>();
                  try {
                    loadAirspacesFromPath(path, airspaces);
                  } finally {
                    SwingUtilities.invokeLater(
                        new Runnable() {
                          public void run() {
                            setAirspaces(airspaces);
                            setEnabled(true);
                            getApp().setCursor(null);
                            getApp().getWwd().redraw();
                          }
                        });
                  }
                }
              });

      this.setEnabled(false);
      getApp().setCursor(new Cursor(Cursor.WAIT_CURSOR));
      t.start();
    }
Example #16
0
 public void actionPerformed(ActionEvent ae) {
   String action = ae.getActionCommand();
   if (action.equals("refresh")) {
     routerThread = new Thread(this);
     routerThread.start();
   }
 }
Example #17
0
  public Integer call() {
    count = 0;
    try {
      File[] files = directory.listFiles();
      ArrayList<Future<Integer>> results = new ArrayList<Future<Integer>>();

      for (File file : files)
        if (file.isDirectory()) {
          MatchCounter counter = new MatchCounter(file, keyword);
          FutureTask<Integer> task = new FutureTask<Integer>(counter);
          results.add(task);
          Thread t = new Thread(task);
          t.start();
        } else {
          if (search(file)) count++;
        }

      for (Future<Integer> result : results)
        try {
          count += result.get();
        } catch (ExecutionException e) {
          e.printStackTrace();
        }
    } catch (InterruptedException e) {
    }
    return count;
  }
  public boolean request(Object soaprequest) {
    if (!checkSoapMemberVariable()) return false;

    ServiceRequest req =
        new ServiceRequest(
            this.ServerUrl,
            this.SoapAction,
            this.NameSpace,
            this.MethodName,
            this.SoapVersion,
            this.DotNet,
            (SoapObject) soaprequest);
    Thread thread = new Thread(req);

    try {
      thread.start();
      thread.join();
    } catch (Exception e) {
      this.Response = null;
      e.printStackTrace();
      return false;
    }

    this.Response = req.getResponse();
    if (this.Response == null) return false;
    return true;
  }
Example #19
0
  // Do some simple concurrent testing
  public void testConcurrentSimple() throws InterruptedException {
    final NonBlockingIdentityHashMap<String, String> nbhm =
        new NonBlockingIdentityHashMap<String, String>();
    final String[] keys = new String[20000];
    for (int i = 0; i < 20000; i++) keys[i] = "k" + i;

    // In 2 threads, add & remove even & odd elements concurrently
    Thread t1 =
        new Thread() {
          public void run() {
            work_helper(nbhm, "T1", 1, keys);
          }
        };
    t1.start();
    work_helper(nbhm, "T0", 0, keys);
    t1.join();

    // In the end, all members should be removed
    StringBuffer buf = new StringBuffer();
    buf.append("Should be emptyset but has these elements: {");
    boolean found = false;
    for (String x : nbhm.keySet()) {
      buf.append(" ").append(x);
      found = true;
    }
    if (found) System.out.println(buf + " }");
    assertThat("concurrent size=0", nbhm.size(), is(0));
    for (String x : nbhm.keySet()) {
      assertTrue("No elements so never get here", false);
    }
  }
  public static void main(String[] args) {
    BufferedReader in;

    try {
      in =
          new BufferedReader(
              new FileReader(
                  "/Users/rahulkhairwar/Documents/IntelliJ IDEA Workspace/Competitive "
                      + "Programming/src/com/google/codejam16/qualificationround/inputB.txt"));

      OutputWriter out = new OutputWriter(System.out);
      Thread thread = new Thread(null, new Solver(in, out), "Solver", 1 << 28);

      thread.start();

      try {
        thread.join();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      out.flush();

      in.close();
      out.close();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Example #21
0
 public void run() {
   if (Thread.currentThread() != this.mt)
     throw (new RuntimeException("MainFrame is being run from an invalid context"));
   Thread ui = new HackThread(p, "Haven UI thread");
   ui.start();
   try {
     try {
       Session sess = null;
       while (true) {
         UI.Runner fun;
         if (sess == null) {
           Bootstrap bill = new Bootstrap(Config.defserv, Config.mainport);
           if ((Config.authuser != null) && (Config.authck != null)) {
             bill.setinitcookie(Config.authuser, Config.authck);
             Config.authck = null;
           }
           fun = bill;
           setTitle(String.format("Amish Paradise %s", version));
         } else {
           fun = new RemoteUI(sess);
           setTitle(String.format("Amish Paradise %s \u2013 %s", version, sess.username));
         }
         sess = fun.run(p.newui(sess));
       }
     } catch (InterruptedException e) {
     }
     savewndstate();
   } finally {
     ui.interrupt();
     dispose();
   }
 }
Example #22
0
  private void setBoardListener() {
    scene.setOnKeyPressed(
        event -> {
          Thread thread =
              new Thread() {
                @Override
                public void run() {
                  if (directionsMapping.keySet().contains(event.getCode().toString())) {
                    if ((inputDirection == 0 && event.getCode().toString().equals("W"))
                        || (inputDirection == 1 && event.getCode().toString().equals("A"))
                        || (inputDirection == 2 && event.getCode().toString().equals("S"))
                        || (inputDirection == 3 && event.getCode().toString().equals("D"))) return;

                    inputDirection = directionsMapping.get(event.getCode().toString());
                  }

                  if (event.getCode().equals(KeyCode.Q)) {
                    if (isPause) isPause = false;
                    else isPause = true;
                  }

                  if (event.getCode().equals(KeyCode.R)) {
                    isReload = true;
                  }
                }
              };
          thread.start();
        });
  }
Example #23
0
  /**
   * 'handler' can be of any type that implements 'exportedInterface', but only methods declared by
   * the interface (and its superinterfaces) will be invocable.
   */
  public <T> InAppServer(
      String name,
      String portFilename,
      InetAddress inetAddress,
      Class<T> exportedInterface,
      T handler) {
    this.fullName = name + "Server";
    this.exportedInterface = exportedInterface;
    this.handler = handler;

    // In the absence of authentication, we shouldn't risk starting a server as root.
    if (System.getProperty("user.name").equals("root")) {
      Log.warn(
          "InAppServer: refusing to start unauthenticated server \"" + fullName + "\" as root!");
      return;
    }

    try {
      File portFile = FileUtilities.fileFromString(portFilename);
      secretFile = new File(portFile.getPath() + ".secret");
      Thread serverThread = new Thread(new ConnectionAccepter(portFile, inetAddress), fullName);
      // If there are no other threads left, the InApp server shouldn't keep us alive.
      serverThread.setDaemon(true);
      serverThread.start();
    } catch (Throwable th) {
      Log.warn("InAppServer: couldn't start \"" + fullName + "\".", th);
    }
    writeNewSecret();
  }
  /** Second part of debugger start procedure. */
  private void startDebugger() {
    threadManager = new ThreadManager(this);

    setBreakpoints();
    updateWatches();
    println(bundle.getString("CTL_Debugger_running"), STL_OUT);
    setDebuggerState(DEBUGGER_RUNNING);

    virtualMachine.resume();

    // start refresh thread .................................................
    if (debuggerThread != null) debuggerThread.stop();
    debuggerThread =
        new Thread(
            new Runnable() {
              public void run() {
                for (; ; ) {
                  try {
                    Thread.sleep(5000);
                  } catch (InterruptedException ex) {
                  }
                  if (getState() == DEBUGGER_RUNNING) threadGroup.refresh();
                }
              }
            },
            "Debugger refresh thread"); // NOI18N
    debuggerThread.setPriority(Thread.MIN_PRIORITY);
    debuggerThread.start();
  }
  public SetIfModifiedSince() throws Exception {

    serverSock = new ServerSocket(0);
    int port = serverSock.getLocalPort();

    Thread thr = new Thread(this);
    thr.start();

    Date date = new Date(new Date().getTime() - 1440000); // this time yesterday
    URL url;
    HttpURLConnection con;

    // url = new URL(args[0]);
    url = new URL("http://localhost:" + String.valueOf(port) + "/anything");
    con = (HttpURLConnection) url.openConnection();

    con.setIfModifiedSince(date.getTime());
    con.connect();
    int ret = con.getResponseCode();

    if (ret == 304) {
      System.out.println("Success!");
    } else {
      throw new RuntimeException(
          "Test failed! Http return code using setIfModified method is:"
              + ret
              + "\nNOTE:some web servers are not implemented according to RFC, thus a failed test does not necessarily indicate a bug in setIfModifiedSince method");
    }
  }
Example #26
0
    @Override
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showOpenDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      if (f.isFile() && f.canRead()) {
        Document oldDoc = getEditor().getDocument();
        if (oldDoc != null) {
          oldDoc.removeUndoableEditListener(undoHandler);
        }
        if (elementTreePanel != null) {
          elementTreePanel.setEditor(null);
        }
        getEditor().setDocument(new PlainDocument());
        frame.setTitle(f.getName());
        Thread loader = new FileLoader(f, editor.getDocument());
        loader.start();
      } else {
        JOptionPane.showMessageDialog(
            getFrame(),
            "Could not open file: " + f,
            "Error opening file",
            JOptionPane.ERROR_MESSAGE);
      }
    }
Example #27
0
  /** Starts thread to update user state cache used by the Outlook plugin */
  public void startStateCacheUpdate(
      final Customer customer,
      final int transitionId,
      final CustomerState newState,
      final Latch dbLatch,
      ThreadMonitor threadMonitor) {
    Thread thd =
        new Thread(
            new Runnable() {
              public void run() {
                // TODO:  Use EEngine.
                updateStateCache(customer, transitionId, newState, dbLatch);
              }
            },
            "State cache update " + transitionId);
    thd.start();

    if (threadMonitor != null && CustomerState.ACTIVE.equals(newState)) {
      try {
        threadMonitor.addThread(thd);
      } catch (IllegalArgumentException iae) {
        LOGGER.warn("failed to add (null) thread to monitor?", iae);
      }
    }
  }
Example #28
0
 /** Called by ImageJ when the user selects Quit. */
 public void quit() {
   quitMacro = IJ.macroRunning();
   Thread thread = new Thread(this, "Quit");
   thread.setPriority(Thread.NORM_PRIORITY);
   thread.start();
   IJ.wait(10);
 }
Example #29
0
  private void startListening() {
    // if listener thread is alive and listening now, no need to recreate. Just reuse it.
    if (listenerThread != null && listenerThread.isAlive()) {
      return;
    }

    Runnable listeningAction =
        () -> {
          boolean running = true;
          while (connected && running) {
            List<String> list = getMessages();

            localHistory.addAll(list);

            try {
              Thread.sleep(POLLING_PERIOD_MILLIS);
            } catch (InterruptedException e) {
              logger.error("The message listening thread was interrupted", e);
              running = false;
            }
          }
        };
    listenerThread = new Thread(listeningAction);
    listenerThread.start();
  }
Example #30
0
  public Gif(PApplet parent, String filename) {
    // this creates a fake image so that the first time this
    // attempts to draw, something happens that's not an exception
    super(1, 1, ARGB);

    this.parent = parent;

    // create the GifDecoder
    GifDecoder gifDecoder = createDecoder(parent, filename);

    // fill up the PImage and the delay arrays
    frames = extractFrames(gifDecoder);
    delays = extractDelays(gifDecoder);

    // get the GIFs repeat count
    repeatSetting = gifDecoder.getLoopCount();

    // re-init our PImage with the new size
    super.init(frames[0].width, frames[0].height, ARGB);
    jump(0);
    parent.registerMethod("dispose", this);

    // and now, make the magic happen
    runner = new Thread(this);
    runner.start();
  }