[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] JAVA universe job problem-JAVA multithread



If I recall correctly, and your stack trace supports this, the Java
Universe code in Condor will call your ThreadTester.main method and when
it returns your job is considered done. I'd suggest your main method
call Thread.join on each of your threads before returning.

However, that's just the problem you'll run into next. You need to
transfer the PrintThread.class along with your job.

Best,


matt

P.S. Please implement Runnable and don't extend Thread.

bulato wrote:
> I got some problem with submitting JAVA multithread program.
> The machine  is Ubuntu8.0.4 / intelX86  and condor version is 7.0.4
> 
> JAVA source sode :
> 
> public class ThreadTester
> {
>  public static void main(String args[])
>  {
>   PrintThread thread1, thread2, thread3, thread4;
> 
>   thread1 = new PrintThread("threadA");
>   thread2 = new PrintThread("threadB");
>   thread3 = new PrintThread("threadC");
>   thread4 = new PrintThread("threadD");
>   thread1.setDaemon(false);
>   thread2.setDaemon(false);
>   thread3.setDaemon(false);
>   thread4.setDaemon(false);
> 
>   System.out.println("\nStarting threads");
>   thread1.start();
>   thread2.start();
>   thread3.start();
>   thread4.start();
>   System.out.println("\n Threads started\n");
>  }
> }
> 
> class PrintThread extends Thread
> {
>  private int sleepTime;
> 
>  public PrintThread (String name)
>  {
>   super(name);
>   sleepTime = (int) (10000* Math.random());
>   System.out.println("Name: " + getName()+"; sleep: " + sleepTime);
>  }
> 
>  public void run()
>  {
>   try
>   {
>    System.out.println(getName() + " going to sleep");
>    Thread.sleep(sleepTime);
>   }
>   catch( InterruptedException exception)
>   {
>    System.out.println(exception.toString());
>   }
>   System.out.println(getName() + " done sleeping");
>  }
> }
> 
> The description file :
> 
> Universe = java
> Executable = ThreadTester.class
> Arguments = ThreadTester
> Log = ThreadTester.log
> Output = ThreadTester.out
> Error = ThreadTester.error
> should_transfer_files = YES
> when_to_transfer_output = ON_EXIT
> Queue
> 
> The program run well when I execute it directly.
> But when I submit it to the condor pool , I got the message in ThreadTester.error
> 
> java.lang.NoClassDefFoundError: PrintThread
>  at ThreadTester.main(ThreadTester.java:7)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:616)
>  at CondorJavaWrapper.main(CondorJavaWrapper.java:106)
> Caused by: java.lang.ClassNotFoundException: PrintThread
>  at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
>  ... 6 more
> 
> And the ThreadTester.log :
> 
> 000 (393.000.000) 10/23 18:59:37 Job submitted from host: <140.115.52.24:38667>
> ...
> 001 (393.000.000) 10/23 18:59:40 Job executing on host: <140.115.52.24:55164>
> ...
> 005 (393.000.000) 10/23 18:59:40 Job terminated.
>     (0) Abnormal termination (signal 15)
>     (0) No core file
>         Usr 0 00:00:00, Sys 0 00:00:00  -  Run Remote Usage
>         Usr 0 00:00:00, Sys 0 00:00:00  -  Run Local Usage
>         Usr 0 00:00:00, Sys 0 00:00:00  -  Total Remote Usage
>         Usr 0 00:00:00, Sys 0 00:00:00  -  Total Local Usage
>     933  -  Run Bytes Sent By Job
>     724  -  Run Bytes Received By Job
>     933  -  Total Bytes Sent By Job
>     724  -  Total Bytes Received By Job
> 
> 
> Does condor support JAVA multithread? or the some configuration item should be modify?
> Thanks.
> 
>             Bulato
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Condor-users mailing list
> To unsubscribe, send a message to condor-users-request@xxxxxxxxxxx with a
> subject: Unsubscribe
> You can also unsubscribe by visiting
> https://lists.cs.wisc.edu/mailman/listinfo/condor-users
> 
> The archives can be found at: 
> https://lists.cs.wisc.edu/archive/condor-users/