Package java.lang

Examples of java.lang.Thread$UncaughtExceptionHandler


  {
    if (thr == null);
    {
      counter.resetRate();

      thr = new Thread(this, "Xmt " + owner.port.getName());

      thr.start();
    }
  }
View Full Code Here


          String[] ijarg = new String[3];
            ijarg[0] = "-p";
            ijarg[1] = propString;
            ijarg[2] = scriptPath;
      RunIJ ij = new RunIJ(ijarg);
      Thread ijThread = new Thread(ij);
      try
      {
        ijThread.start();
        if (timeout < 0)
        {
          ijThread.join();
        }
        else
        {
            ijThread.join(timeout * 60 * 1000);
        }
      }
      catch (Exception e)
      {
        System.out.println("Aiiie! Got some kind of exception " + e);
      }

      // Now make sure a shutdown is complete if necessary
      if (shutdownurl != null)
      {
          String[] sdargs = new String[2];
          sdargs[0] = systemHome;
          sdargs[1] = shutdownurl;
          shutdown.main(sdargs);
      }
      // Reset ij.defaultResourcePackage
      ptmp = System.getProperties();
                        ptmp.put("ij.defaultResourcePackage", "/org/apache/derbyTesting/");
      ptmp.put("usesystem", "");
      System.setProperties(ptmp);
        }
        else if (testType.equals("java"))
        {
            sysProp.put("user.dir", outDir.getCanonicalPath());
            javaPath = "org.apache.derbyTesting." + testDirName;
            String[] args = new String[2];
            args[0] = "-p";
            args[1] = propString;
            Class[] classArray = new Class[1];
            classArray[0] = args.getClass();
            String testName = javaPath + "." + testBase;
            Class JavaTest = Class.forName(testName);
            // Get the tests's main method and invoke it
            Method testMain = JavaTest.getMethod("main", classArray);
            Object[] argObj = new Object[1];
            argObj[0] = args;
      RunClass testObject = new RunClass(JavaTest, testMain, argObj);
      Thread testThread = new Thread(testObject);
      try
      {
        testThread.start();
        if (timeout < 0)
        {
          testThread.join();
        }
        else
        {
          testThread.join(timeout * 1000);
        }
      }
      catch(Exception e)
      {
        System.out.println("Exception upon invoking test..." + e);
View Full Code Here

    startDownload();
  }
 
  private long startDownload(){
    ApplicationProtocol protocolHandler;
    Thread newThread=null;//=new Thread();
    switch(protocol){
    case Protocol.HTTP : {
      protocolHandler=new HTTPHandler();
      //newThread = new GetFileStartDownload(protocolHandler,"http://"+hostname+"/"+url,"aa",0,100);
      //threadManagerList.add(new ThreadManager(protocolHandler,newThread));
      //(new GetFileConnect(protocolHandler,hostname)).run();
      //newThread.run();
      break;
    }
    }
    return newThread.getId();
  }
View Full Code Here

            PrintStream stdout = System.out;
            PrintStream stderr = System.err;
            System.setOut(ps);
            System.setErr(ps);
      RunIJ ij = new RunIJ(ijarg);
      Thread ijThread = new Thread(ij);
      try
      {
        ijThread.start();
        if (timeout < 0)
        {
          ijThread.join();
        }
        else
        {
            ijThread.join(timeout * 60 * 1000);
        }
      }
      catch (Exception e)
      {
        System.out.println("Aiiie! Got some kind of exception " + e);
      }

      // Now make sure a shutdown is complete if necessary
      if (shutdownurl != null)
      {
          String[] sdargs = new String[2];
          sdargs[0] = systemHome;
          sdargs[1] = shutdownurl;
          shutdown.main(sdargs);
      }
      // Reset ij.defaultResourcePackage
      ptmp = System.getProperties();
                        ptmp.put("ij.defaultResourcePackage", "/org/apache/derbyTesting/");
      ptmp.put("usesystem", "");
      System.setProperties(ptmp);
      // Reset System.out and System.err
      System.setOut(stdout);
      System.setErr(stderr);
        }
        else if (testType.equals("java"))
        {
      if (javaPath == null)
              javaPath = "org.apache.derbyTesting.functionTests.tests." + testDirName;
     
            String[] args = new String[2];
            args[0] = "-p";
            args[1] = propString;
            Class[] classArray = new Class[1];
            classArray[0] = args.getClass();
            String testName = javaPath + "." + testBase;
            Class JavaTest = Class.forName(testName);
            PrintStream stdout = System.out;
            PrintStream stderr = System.err;
            System.setOut(ps);
            System.setErr(ps);
            // Get the tests's main method and invoke it
            Method testMain = JavaTest.getMethod("main", classArray);
            Object[] argObj = new Object[1];
            argObj[0] = args;
      RunClass testObject = new RunClass(testMain, argObj);
      Thread testThread = new Thread(testObject);
      try
      {
        testThread.start();
        if (timeout < 0)
        {
          testThread.join();
        }
        else
        {
          testThread.join(timeout * 60 * 1000);
        }
      }
      catch(Exception e)
      {
        System.out.println("Exception upon invoking test..." + e);
View Full Code Here

    assertEquals("foo", p.deref());
  }

  @Test
  public void threadTest() throws IOException {
    new Thread(new Runnable() {
      public void run() {
        try {
          Thread.sleep(100);
        } catch (InterruptedException e) {
          System.out.println("interrupted");
View Full Code Here

  @Test
  public void timeoutTest() throws IOException {
    assertEquals(null, p.deref(1, TimeUnit.MILLISECONDS));
    assertEquals("failed", p.deref(1, TimeUnit.MILLISECONDS, "failed"));
   
    new Thread(new Runnable() {
      public void run() {
        try {
          Thread.sleep(100);
        } catch (InterruptedException e) {
          System.out.println("interrupted");
View Full Code Here

          String[] ijarg = new String[3];
            ijarg[0] = "-p";
            ijarg[1] = propString;
            ijarg[2] = scriptPath;
      RunIJ ij = new RunIJ(ijarg);
      Thread ijThread = new Thread(ij);
      try
      {
        ijThread.start();
        if (timeout < 0)
        {
          ijThread.join();
        }
        else
        {
            ijThread.join(timeout * 60 * 1000);
        }
      }
      catch (Exception e)
      {
        System.out.println("Aiiie! Got some kind of exception " + e);
      }

      // Now make sure a shutdown is complete if necessary
      if (shutdownurl != null)
      {
          String[] sdargs = new String[2];
          sdargs[0] = systemHome;
          sdargs[1] = shutdownurl;
          shutdown.main(sdargs);
      }
      // Reset ij.defaultResourcePackage
      ptmp = System.getProperties();
                        ptmp.put("ij.defaultResourcePackage", "/org/apache/derbyTesting/");
      ptmp.put("usesystem", "");
      System.setProperties(ptmp);
        }
        else if (testType.equals("java"))
        {
            sysProp.put("user.dir", outDir.getCanonicalPath());
            javaPath = "org.apache.derbyTesting.functionTests.tests." + testDirName;
            String[] args = new String[2];
            args[0] = "-p";
            args[1] = propString;
            Class[] classArray = new Class[1];
            classArray[0] = args.getClass();
            String testName = javaPath + "." + testBase;
            Class JavaTest = Class.forName(testName);
            // Get the tests's main method and invoke it
            Method testMain = JavaTest.getMethod("main", classArray);
            Object[] argObj = new Object[1];
            argObj[0] = args;
      RunClass testObject = new RunClass(JavaTest, testMain, argObj);
      Thread testThread = new Thread(testObject);
      try
      {
        testThread.start();
        if (timeout < 0)
        {
          testThread.join();
        }
        else
        {
          testThread.join(timeout * 1000);
        }
      }
      catch(Exception e)
      {
        System.out.println("Exception upon invoking test..." + e);
View Full Code Here

   * current changes.
   */

  public static void pushAction (BasicAction a, boolean register)
  {
    Thread t = Thread.currentThread();
    Stack txs = (Stack) _threadList.get();

    if (txs == null)
    {
      txs = new Stack();
View Full Code Here

            PrintStream stdout = System.out;
            PrintStream stderr = System.err;
            System.setOut(ps);
            System.setErr(ps);
      RunIJ ij = new RunIJ(ijarg);
      Thread ijThread = new Thread(ij);
      try
      {
        ijThread.start();
        if (timeout < 0)
        {
          ijThread.join();
        }
        else
        {
            ijThread.join(timeout * 60 * 1000);
        }
      }
      catch (Exception e)
      {
        System.out.println("Aiiie! Got some kind of exception " + e);
      }

      // Now make sure a shutdown is complete if necessary
      if (shutdownurl != null)
      {
          String[] sdargs = new String[2];
          sdargs[0] = systemHome;
          sdargs[1] = shutdownurl;
          shutdown.main(sdargs);
      }
      // Reset ij.defaultResourcePackage
      ptmp = System.getProperties();
                        ptmp.put("ij.defaultResourcePackage", "/org/apache/derbyTesting/");
      ptmp.put("usesystem", "");
      System.setProperties(ptmp);
      // Reset System.out and System.err
      System.setOut(stdout);
      System.setErr(stderr);
        }
        else if (testType.equals("java"))
        {
      if (javaPath == null)
              javaPath = "org.apache.derbyTesting.functionTests.tests." + testDirName;
     
            String[] args = new String[2];
            args[0] = "-p";
            args[1] = propString;
            Class[] classArray = new Class[1];
            classArray[0] = args.getClass();
            String testName = javaPath + "." + testBase;
            Class JavaTest = Class.forName(testName);
            PrintStream stdout = System.out;
            PrintStream stderr = System.err;
            System.setOut(ps);
            System.setErr(ps);
            // Get the tests's main method and invoke it
            Method testMain = JavaTest.getMethod("main", classArray);
            Object[] argObj = new Object[1];
            argObj[0] = args;
      RunClass testObject = new RunClass(testMain, argObj);
      Thread testThread = new Thread(testObject);
      try
      {
        testThread.start();
        if (timeout < 0)
        {
          testThread.join();
        }
        else
        {
          testThread.join(timeout * 60 * 1000);
        }
      }
      catch(Exception e)
      {
        System.out.println("Exception upon invoking test..." + e);
View Full Code Here

   * current changes.
   */

  public static void pushAction (BasicAction a, boolean register)
  {
    Thread t = Thread.currentThread();
    Stack txs = (Stack) _threadList.get();

    if (txs == null)
    {
      txs = new Stack();
View Full Code Here

TOP

Related Classes of java.lang.Thread$UncaughtExceptionHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.