Thread suspension problem

I have a swing problem, which needs some threading code, but I barely understand it.
My text field components change the underlying data when the focus is lost. When I click on a different tab in the JTabbedPane while editing a field, at the time the ChangeListener runs, the focus is not lost, so data for the input field is not updated. I tried the following to wait for one of the new tab pane components to be shown, but it does not work.
class TabFocusListener implements ComponentListener
     private Component comp;
     public TabFocusListener(Component comp)
          this.comp = comp;
          comp.addComponentListener(this);
          try
               // prg. gets the lock for this object and waits until comp. shown
               synchronized(this) { wait(10000); }
          catch(InterruptedException ex)
     public void componentShown(ComponentEvent e)
          comp.removeComponentListener(this);
          // frees prg. thread that holds the lock for this object
          notifyAll();
     public void componentHidden(ComponentEvent e){}
     public void componentMoved(ComponentEvent e){}
     public void componentResized(ComponentEvent e){}
}

There's a Swing forum for Swing problems. Those guys probably have a solution since they do Swing all day.
You're waiting/notifying on different objects. "this" refers to the current object. If two different thread call the constructor then there will be two different objects ("this").
It's also a very bad idea to put a wait inside a constructor. See Brian Goetz's article here: http://www-128.ibm.com/developerworks/java/library/j-jtp0618.html
You cannot use the object until it is fully constructed.

Similar Messages

  • Java Threads compilation problem

    Hi everyone,
    I've having problems getting a simple thread program to compile, the programs says " ; " expected when there is already one present. I've gone through the program many times and still can't put my finger on whats going wrong. If someone could take a quick look and if possible tell me where I am going wrong.
    Many Thanks
    Its class ThreadA that will not compile
    ***code********************************************
    public class ThreadA extends Thread
    private int id;
    public ThreadA(int i) (id = i);
    public void run()
    for (int i=0}; i < 10; i++);
    try {sleep(1000};)catch (InterruptedException e)();
    System.out.println("Output from Thread " + id);
    import java.io.*;
    public class TestThreads1
    public static void main (String args [] )
    Thread t1 = new ThreadA (1);
    Thread t2 = new ThreadA (2);
    Thread t3 = new ThreadA (3);
    t1.start();
    t2.start();
    t3.start();
    **code***********************************************************

    public class ThreadA extends Thread
    private int id;
    public ThreadA(int i) (id = i); // <-- problem
    public void run()
    for (int i=0}; i < 10; i++); // <-- two problems
    try {sleep(1000};)catch (InterruptedException e)(); // <-- more problems
    System.out.println("Output from Thread " + id);
    }

  • 64-bit JNI C++ to JAVA invocation multiple threads classloader problem

    Hi ALL,
    I have a C++ app that invokes Java classes on 64-bit Solaris 10 with 64-bit JVM.
    Here is the problem:
    The native non-main (not the thread that initializes the JVM) threads would not be able to find any user-define class.
    Here are the symptoms and observations:
    1. JNIEnv::ExceptionDescribe() showed the following StackOverflowError:
    Exception in thread "Thread-0" java.lang.StackOverflowError
            at java.util.Arrays.copyOf(Arrays.java:2734)
            at java.util.Vector.ensureCapacityHelper(Vector.java:226)
            at java.util.Vector.addElement(Vector.java:573)
            at java.lang.ClassLoader.addClass(ClassLoader.java:173)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)2. The "main thread" that instantiates the JVM has no problem finding and loading any class or method
    3. But the other threads (non-main threads) would not be able to find the user-defined classes unless the classes were already loaded by the main thread.
    4. The non-main threads can find the "standard" java classes with no problem
    5. The same app ran fine on 32-bit system.
    6. Except for the JVM reference is global, each thread acquired JNIEnv by either GetEnv() or AttachCurrentThread().
    Any idea why it is a problem with 64-bit?
    I have the sample program to reproduce this issue in this thread: http://forums.sun.com/thread.jspa?messageID=10885363&#10885363. That was the original thread I raised but I have narrowed it down to a more concrete scenario. That's why I am creating this new thread. I hope this does not break any rule on this forum. If it does, I apologize.
    I really appreciate it if anyone can provide any help/suggestion.
    Regards,
    - Triet

    Here is the sample program. Again, this works on 32-bit but not 64-bit.
    #include <string>
    #include "jni.h"
    #include "TestThread.h"
    static JavaVM *g_pjvm = NULL;  /* denotes a Java VM */
    static JNIEnv *g_penv = NULL;  /* pointer to native method interface */
    void initJVM(char** jvmOptions) {
        printf("RJniTest init starts...\n");
        JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */
        JavaVMOption* poptions;
        int optionLen = 0;
        while (jvmOptions[optionLen]) {
            optionLen++;
        printf("RJniTest::init len=%d\n", optionLen);
        if (optionLen > 0) {
            printf("RJniWrapper::init jvmOptions\n");
            poptions = new JavaVMOption[optionLen];
            //poptions[0].optionString = "-Djava.class.path=/usr/lib/java";
            int idx = 0;
            while (jvmOptions[idx]) {
                poptions[idx].optionString = jvmOptions[idx];
                idx++;
        printf("RJniTest::init vm_args: version(%x), nOptions(%d)\n",
                JNI_VERSION_1_6, optionLen);
        vm_args.version = JNI_VERSION_1_6;
        vm_args.nOptions = optionLen;
        vm_args.options = poptions;
        vm_args.ignoreUnrecognized = JNI_FALSE;
        // load and initialize a Java VM, return a JNI interface
        // pointer in env
        printf("RJniTest::init creates JVM\n");
        JNI_CreateJavaVM(&g_pjvm, (void**)&g_penv, &vm_args);
        printf("RJniTest init ends\n");
    void findClass(const char* classname) {
        static const char* fname = "justFindClasses";
        printf("%s: findClass: %s\n", fname, classname);
        JNIEnv* jenv;
        jint ret = g_pjvm->GetEnv((void**)&jenv, JNI_VERSION_1_6);
        if (ret == JNI_EDETACHED) {
            ret = g_pjvm->AttachCurrentThread((void**)&jenv, NULL);
            if (ret != JNI_OK || jenv == NULL) {
                printf("%s: get env error: ret=%d\n", ret, fname);
            } else {
                printf("%s: got new env\n", fname);
        } else if (ret == JNI_OK) {
            printf("%s: env already there\n");
        jclass classref;
        classref = jenv->FindClass(classname);
        if (classref == NULL) {
            printf("%s: %s class not found!\n", fname, classname);
            if (jenv->ExceptionOccurred()) {
                jenv->ExceptionDescribe();
                jenv->ExceptionClear();
        printf("%s: found class: %s\n", fname, classname);
    class RJniTestThread : public TestThread {
    public:
        void threadmain();
    void RJniTestThread::threadmain() {
        printf("RJniTestThread::threadmain: Starting testing\n");
        findClass("org/apache/commons/logging/Log");
        findClass("java/util/List");
        printf("RJniTestThread::threadmain: done.\n");
    int main(int argc, char** argv) {
        char **jvmOptions = NULL;
        printf("RJniTestDriver starts...\n");
        if (argc > 1) {
            jvmOptions = new char*[argc];
            for (int i = 0; i < argc ; i ++) {
                jvmOptions[i] = argv[i + 1];
            jvmOptions[argc - 1] = NULL;
        } else {
            int size = 8;
            int i = 0;
            jvmOptions = new char*[size];
            jvmOptions[i++] = (char*) "-Djava.class.path=<list of jar files and path here>";
            jvmOptions[i++] = (char*) "-Djava.library.path=/sandbox/mxdev/3rdparty/java/unix/jdk1.6.0_14/jre/lib/sparc";
            jvmOptions[i++] = (char*) "-Djava.compiler=NONE";
            jvmOptions[i++] = (char*) "-verbose:jni";
            jvmOptions[i++] = (char*) "-Xcheck:jni";
            jvmOptions[i++] = NULL;
        printf("init JVM\n");
        initJVM(jvmOptions);
        // UNCOMMENT HERE
        // findClass("org/apache/commons/logging/Log");
        // findClass("java/util/List");
        // UNCOMMENT END
        printf("start test thread\n");
        RJniTestThread testThread;
        ThreadId tid = testThread.launch();
        printf("wait for test thread\n");
        int ret = pthread_join(tid, NULL);
        printf("RJniTestDriver ends\n");
    }

  • Error thread java : problem with the function "resume 0x***"  (forum sun)

    One problem with the function of jdb occured when I tried to use it to
    pilot the processor with differents threads. In fact, I use a simple example with 2 threads.
    I stop the two threads with two breakpoint, and I want to resume one or the other (with the function "resume 0x****"), the one wich I resumed stop again on the breackpoint and I decide again to resume one or the other. All of that to obtain a tree of execution.
    I give you the code of the class and the code of jdb.
    CLASS: (it's just a object Room with a variable degre that I increment and decrement with two threads increase and decrease)
    public class Test{
         public static void main(String[] args){
              Room r = new Room();
              decrease de = new decrease(r);
              increase in = new increase(r);
              de.start();
              in.start();
    class Room {
         private volatile int degre=20;
         public void more(){
         degre += 4;
         public void less(){      
         degre -= 3;
    class decrease extends Thread{
    private Room room;
    public decrease(Room r){
              room =r;
    public void run(){
    try{ 
         while (!interrupted()){ 
              room.less();
    catch(InterruptedException e) {}
    class increase extends Thread{
    private Room room;
    public increase(Room r){
         room =r;
    public void run(){ 
         try{ 
              while (!interrupted()){
                   room.more();
    catch(InterruptedException e) {}
    JDB:
    Initializing jdb ...
    stop at Test:7Deferring breakpoint Test:7.
    It will be set after the class is loaded.
    runrun Test
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >
    VM Started: Set deferred breakpoint Test:7
    Breakpoint hit: "thread=main", Test.main(), line=7 bci=30
    7 in.start();
    main[1] stop at room:16
    Set breakpoint room:16
    main[1] stop at room:20
    Set breakpoint room:20
    main[1] resume
    All threads resumed.
    >
    Breakpoint hit: "thread=Thread-0", room.less(), line=20 bci=0
    20 degre -= 3;
    Thread-0[1] threads
    Group system:
    (java.lang.ref.Reference$ReferenceHandler)0x10d Reference Handler cond. waiting
    (java.lang.ref.Finalizer$FinalizerThread)0x10c Finalizer cond. waiting
    (java.lang.Thread)0x10b Signal Dispatcher running
    Group main:
    (decrease)0x146 Thread-0 running (at breakpoint)
    (increase)0x147 Thread-1 running (at breakpoint)
    (java.lang.Thread)0x148 DestroyJavaVM running
    Thread-0[1] resume 0x147
    Thread-0[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] print degre
    degre = 24
    Thread-1[1] resume 0x146 //It's here the problem, thread 0x146 have to stop on the //next breakpoint of decrease but nothing happen
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] clear
    Breakpoints set:
    breakpoint Test:7
    breakpoint room:16
    breakpoint room:20
    PS: I tried many other examples with other class and other kind of breakpoints, but, in any cases, on thread doesn't manage to resume. When I try with general resume (no specification of the thread), It works but it isn't interresting for me because I want to decide wich thread continue his execution.

    Hi,
    I have read the FAQ of the JMF.
    The problem was the jar files of the JMF were not in the JRE\BIN\EXT
    folder of the Java runtime!
    now it works!
    thanks
    Reg

  • Killing a thread ( runnable ) - problem

    Hi,
    I already posted about this, and got a good answer.
    But, I still have a probalem :
    Here is a piece of my code :
    // this is the bean which is in the EPN and I want it to create a thread that prints something :
    public class EventListener implements StreamSink,com.bea.wlevs.ede.api.DisposableBean ,InitializingBean {
    // the relevant methods:
    RunnableTestBean runnableTestBean; // this is the thread which suppose to print ..
    public void destroy() throws Exception {
              System.out.println("destroydestroydestroydestroydestroydestroydestroy");
              runnableTestBean.suspend();
         public void afterPropertiesSet() throws Exception {
              runnableTestBean=new RunnableTestBean();
              runnableTestBean.run();
              //System.out.println("afterPropertiesSetafterPropertiesSetafterPropertiesSet");
    and the class RunnableTestBean :
    public class RunnableTestBean implements RunnableBean {
         boolean stopped=false;
         public void run() {
              while ( !stopped){
                   System.out.println(" printing...");
                   try {
                   wait(5000);
                        //Thread.sleep(1000);
                   } catch (InterruptedException e) {
                        System.out.println(" Stoping thread ??");
                        e.printStackTrace();
         public void suspend() throws Exception {
              stopped=true;
    The thing is that when I use the method as above :
    public void run() {
              while ( !stopped){
                   System.out.println(" printing...");
                   try {
                   wait(5000);
                        //Thread.sleep(1000);
                   } catch (InterruptedException e) {
                        System.out.println(" Stoping thread ??");
                        e.printStackTrace();
    When I undeploy the application , the destoy method ( in EventListener class ) is not called !
    but,
    if I implement the run "run" method like this :
    public void run() {
    System.out.println(" Something ");
    than everything is fine!
    The differrence as you can see , is that when I use an infinite loop - the destroy method never called ( seems that the caller waits for it to stop , and that's why the
    destroy method not called )
    When i don't use the infinaie loop- it's OK.
    So, any help ?
    Thanks ..

    Looking at the code that you have posted, the problem is that you are calling runnablebean.run() method in afterPropertiesSet (instead of starting a thread in which the run method is called). So, it looks like it will get stuck in afterPropertiesSet for ever.
    The recommended approach for what you are trying to do is to make the EventListener class implement RunnableBean (instead of having a separate class that implements RunnableBean that gets called from afterPropertiesSet). This means that at application startup time, this EventListener's run() method will be called by OCEP framework code in a separate thread. You can still use the suspend() method to stop the thread similar to how you are doing in your code now.

  • Nokia 603 SMS thread view problem

    Hi All, My nokia 603 is unable to display the message in thread view. whenever the SMS is sent or recieved it will show some random integers. but if i enter to the folder view I am able to view the entire message. This is happening all of a sudden without any change done in the phone. Some one pls clarify whether it is the known issue, if so please gimme the solution. Thanks, Muralids

    Hi muralids,
    Thank you for your post. 
    We haven't confirmed if this is a known bug as it's not included in the list of Nokia 603 reported issues posted here: Firmware change logs for Symbian (S60) devices.
    However, you may try these troubleshooting steps to fix the problem:
    1. Check if the conversation view is still activated. Go to Menu, tap on Messaging, and then hit Options ( ≡ ). After that, choose View folders, hit Options ( ≡ ) again, and then select Message View. Set it to Conversations View.
    2. If the first option didn't work, try the steps provided in this link: Nokia 603 - Need help in fixing a problem?
    Hope this information helps. Cheers! 

  • Thread Problem - (Thread Blocking Problems?)

    Hi Friends
    In my program while using thread i found a problem in this code .
    In this whlie running the 'msg' was printen only after all 5 inputs are given .
    why i was not getting output after one input.why the thread out was waiting for remaining threads input.
    my code is
    import java.io.*;
    class MyThread extends Thread
      BufferedReader bin;
       MyThread()
         super();
         start();
       public void run()
          try
           bin=new BufferedReader(new InputStreamReader(System.in));
           String msg=bin.readLine();
           System.out.println(msg);
          catch(IOException e)
             System.out.println(e);
    public class Threads
         public static void main(String args[])
              for(int i=0;i<5;i++)
                new MyThread();
    }

    Hi Friends
    In my program while using thread i found a problem
    em in this code .
    In this whlie running the 'msg' was printen only
    after all 5 inputs are given .
    why i was not getting output after one input.why
    hy the thread out was waiting for remaining threads
    input.Probably because of how the scheduler was rotating among the threads while waiting for input and queueing up output.
    When you call readLine, that thread blocks until a line is available. So it probably goes to the next thread's readLine, and so on. All threads are probably blocked waiting for input before you enter a single character.
    Something inside the VM has to coordinate the interaction with the console, and between that and your threads, the out stuff just doesn't get a chance to display right away.
    In general, you can't predict the order of execution of separate threads.

  • Thread concurrency problem - how to know when thread is dead?

    My applet uses a thread to draw an iteration graph step by step.
    The user as the option of pressing two buttons:
    - PLAY button - iteration Points are stored in an arrayList and drawn step by step (a sleeping time follows each step) (drawIterations thread)
    - TO_END button - iteration Points are all stored in the arrayList (swingworker thread) and after all of them have been stored the graph is drawn instantly.
    I have problems in this situation:
    When executing the PLAY-button thread, if the user presses TO_END button, the remaining graph lines should draw instantly. Sometimes I get more points on the graph than I should. It seems that the PLAY thread, which I stop when TO_END buton is pressed, still remains storing new points into the arrayList concurrently to the new thread created after TO_END button was pressed .
    Any ideas?
    I'm already using synchronization.
    private volatile Thread drawIterations;
    public void playButtonClick(JToggleButton btn) {
         pointSet1 = new ArrayList<Point2D.Double>();
         if (drawIterations == null) drawIterations = new Thread(this,   "drawIterations");
         drawIterations.start();
    public void toEndButtonClick(JToggleButton btn) {
         stopThread() ;
         pointSet1 = new ArrayList<Point2D.Double>();
         computeIterationGraphPointsAndRefreshGraph();
    public synchronized void stopThread() {
         drawIterations = null;
         notify();
    private void computeIterationGraphPointsAndRefreshGraphs() {
         SwingWorker worker = new SwingWorker() {
              public Object construct() {
                   // compute all iteration points
                         //repaint graph
         worker.start();
    }Is there a way of testing if a thread is actually dead after setting the thread object to null??

    In general, a Thread keeps running until it's run
    method completes. Threads don't stop when their
    handle is set to null. Your run method should
    constantly be checking on a variable to know when to
    stop running and exit the run method. In this case,
    you could check on the drawIterations variable to see
    if it's null.<br>
    <br>Even using the following line on my run method I get the the same problem:
    <br>
    <br>while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
    <br>...
    <br>
    <br>Here's the whole method:
    <br>(actually there are 2 graphs being drawn and the second is only refreshed every 2 steps:)
    <br>
    <br>     <br>public void run() {
         <br>  Thread myThread = Thread.currentThread();
         <br>  int totalIterations = transientIterations +iterationsToDraw ;
              <br>  while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
              <br>     computeNextHalfIterationGraphPoint( );
              <br>      if (!TRANSIENT_IS_ENABLED || halfStep >= 2*transientIterations ) {// is     not in transient calculations
              <br>                       graphArea1.repaint();
              <br>                       if (halfStep%2 ==0 ) graphArea2.repaint();
              <br>                       if (halfStep < 2*totalIterations){//no need to execute the following block if at last iteration point
                   <br>                         if (lastIterationPointsFallOutsideGraphArea(toEndCPButtonActive)) break;
                        <br>          try {
                             <br>                      Thread.sleep(sleepingTimeBetweenHalfIterationRendering);
                             <br>                      if (threadInterrupted ){//if clause included to avoid stepping into a synchronized block if unnecessary
                                  <br>                        synchronized (this) {
                                       <br>                          while (threadInterrupted && myThread==drawIterations ) wait();
                                                      <br>    }
    <br>                                               }
         <br>                                   } catch (InterruptedException e) {
              <br>                                     break;
                   <br>                         }     
                        <br>               }
    <br>                            }
         <br>        stopThread();
         <br>     }
    <br>

  • Thread scheduling problem in WLS5.1

    We use a Timer Servlet to schedule some back end tasks, however we found
              that from time to time the thread scheduling often get delayed or ahead in a
              outragous magtitude.
              We run the servlet inside WLS, and right after start up, the timer works
              perfect, but after long enough time (more than one day), the timer started
              to behave weird. It could get delayed for as much as hours, and then
              suddenly fired up all delayed tasks in a very short period of time. We then
              try to run a very simple Timer doing only wake up every 10 minutes and print
              one line, that failed too. We are running WLS5.1+sp3 on
              Solaris2.6(Generic_105181-19 sun4u sparc SUNW,Ultra-5_10) with jdk1.2.1_04.
              BTW, we found that it ran well on NT, at least for three days without
              problem.
              Any feedback will be appreciated!
              Qingxiang Ke
              below is the source for the simple timer, and deploy properties for it
              inside weblogic.properties file.
              SimpleTimerServlet.java
              package com.cysive.test;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              public class SimpleTimerServlet extends HttpServlet
              class Sleepy implements Runnable
              public void run()
              while(true)
              try
              long wakeUpTime = 600 * 1000;
              Thread.currentThread().sleep(wakeUpTime);
              System.out.println(new Date().toString() + " SimpleTimer Yawn
              ............ Yawn ............");
              catch(InterruptedException ie){}
              private static boolean timerIsRunning = false;
              public void init()
              if(! timerIsRunning)
              Thread sleepy = new Thread(new Sleepy());
              sleepy.start();
              timerIsRunning = true;
              public void doGet(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              doPost(request, response);
              public void doPost(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              OutputStream os = response.getOutputStream();
              os.write("look at your std out!!!".getBytes());
              os.flush();
              os.close();
              deploy properties in weblogic.properties
              weblogic.httpd.register.simpletimer=com.cysive.test.SimpleTimerServlet
              weblogic.system.startupClass.servletSimpleTimer=weblogic.servlet.utils.Servl
              etStartup
              weblogic.system.startupArgs.servletSimpleTimer=servlet=simpletimer
              

    We use a Timer Servlet to schedule some back end tasks, however we found
              that from time to time the thread scheduling often get delayed or ahead in a
              outragous magtitude.
              We run the servlet inside WLS, and right after start up, the timer works
              perfect, but after long enough time (more than one day), the timer started
              to behave weird. It could get delayed for as much as hours, and then
              suddenly fired up all delayed tasks in a very short period of time. We then
              try to run a very simple Timer doing only wake up every 10 minutes and print
              one line, that failed too. We are running WLS5.1+sp3 on
              Solaris2.6(Generic_105181-19 sun4u sparc SUNW,Ultra-5_10) with jdk1.2.1_04.
              BTW, we found that it ran well on NT, at least for three days without
              problem.
              Any feedback will be appreciated!
              Qingxiang Ke
              below is the source for the simple timer, and deploy properties for it
              inside weblogic.properties file.
              SimpleTimerServlet.java
              package com.cysive.test;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              public class SimpleTimerServlet extends HttpServlet
              class Sleepy implements Runnable
              public void run()
              while(true)
              try
              long wakeUpTime = 600 * 1000;
              Thread.currentThread().sleep(wakeUpTime);
              System.out.println(new Date().toString() + " SimpleTimer Yawn
              ............ Yawn ............");
              catch(InterruptedException ie){}
              private static boolean timerIsRunning = false;
              public void init()
              if(! timerIsRunning)
              Thread sleepy = new Thread(new Sleepy());
              sleepy.start();
              timerIsRunning = true;
              public void doGet(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              doPost(request, response);
              public void doPost(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              OutputStream os = response.getOutputStream();
              os.write("look at your std out!!!".getBytes());
              os.flush();
              os.close();
              deploy properties in weblogic.properties
              weblogic.httpd.register.simpletimer=com.cysive.test.SimpleTimerServlet
              weblogic.system.startupClass.servletSimpleTimer=weblogic.servlet.utils.Servl
              etStartup
              weblogic.system.startupArgs.servletSimpleTimer=servlet=simpletimer
              

  • Thread Pool Problem

    Hi,
    I amhaving problem with a thread pooling my code once allocates a thread to a user then never is able to find that it is idle. the code is some what like this.
    public class foo extends Thread{
    pubblic void setPrimeData(Hashtable data){
    //sets the primary data
    run()
    this.isrunning = true;
    //does something
    this.isrunning= false;
    }

    You cannot restart a Thread. Once it has run, it cannot be reused. If you want to hand new tasks to threads in a pool, device some means by which you can hand a running (started) thread a new Runnable to execute in its run() method.
    Chuck

  • Weblogic 10 jsp compliation thread block problem

    hi
    i am using weblogic 10 and jdk1.5.
    My application is deployed in ear format, with 2 wars, and 20 ejbs.
    The ear works ok with weblogic 8.1.
    In the application , one war passes the request to another war, that's the workflow....
    Now when the request is passed on the second war, a jsp is supposed to open....but the application get stuck there.
    The call is like this in a servlet....
         reqDisp = req.getRequestDispatcher("/newIndex.jsp");
    reqDisp.forward(req, res);
    The new index jsp is not opened....there is no problem with it it comiples ok....i check with weblogic appc...and it is working on weblogic 8.1.
    when i stop the server...the log gives me following exception info.
    "ExecuteThread: '12' for queue: 'default'" daemon prio=6 tid=0x2b8edad0 nid=0xc1
    0 in Object.wait() [0x2da1e000..0x2da1fb64]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x07f94608> (a javelin.client.JobWaiter)
    at java.lang.Object.wait(Object.java:474)
    at javelin.client.JobWaiter.blockUntilFinished(JobWaiter.java:45)
    - locked <0x07f94608> (a javelin.client.JobWaiter)
    at javelin.client.ClientUtilsImpl.build(ClientUtilsImpl.java:838)
    at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:248)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:200)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:164)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
    - locked <0x07ef8220> (a weblogic.servlet.jsp.JavelinxJSPStub)
    at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:391)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:309)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:503)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:245)
    at LCDisplayController.handleProcessing(Unknown Source)
    at DisplayControllerServlet.doPost(Unknown Source)
    at DisplayControllerServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:503)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:245)
    at com.orbitech.workflow.servlet.WFAppListController.openWorkitem(WFAppListController.java:793)
    at com.orbitech.workflow.servlet.WFAppListController.processRequest(WFAppListController.java:102)
    at com.orbitech.workflow.servlet.WFAppController.doProcessRequest(WFAppController.java:97)
    at com.orbitech.workflow.servlet.WFAppController.doGet(WFAppController.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    i think the there is thread blocking and the jsp is not getting compiled or smthing....
    i am unable to understnd the exception....
    any help, suggestion ? thanks in advance.

    We are using jBPM and Hibernate in our application which runs fine on other java application servers. On Weblogic we were getting an error:
    org.hibernate.HibernateException: Errors in named queries: GraphSession...........
    By adding:
    <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    to our weblogic.xml, Weblogic used our Hibernate3 and antl-2.7.6 .jar files which resolved this issue but created multiple CompilationException errors in many .jsp's. (as follows)
    Error 500--Internal Server Error
    weblogic.servlet.jsp.CompilationException: Failed to compile JSP /WEB-INF/jsp/struts/dashboards/portfolio_chart.jsp
    portfolio_chart.jsp:1:1: The validator class: "org.apache.taglibs.standard.tlv.JstlCoreTLV" has failed with the following exception: "java.lang.ClassCastException: weblogic.xml.jaxp.RegistrySAXParserFactory".
    <%@ taglib uri="/jstl-core" prefix="c" %>
    ^---------------------------------------^
    portfolio_chart.jsp:1:1: The validator class: "com.primavera.pvweb.taglib.JSMessageTagLibraryValidator" has failed with the following exception: "java.lang.ClassCastException: weblogic.xml.jaxp.RegistrySAXParserFactory".
    <%@ taglib uri="/jstl-core" prefix="c" %>
    ^---------------------------------------^
         at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:298)
         at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:216)
         at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:165)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
         at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:394)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:309)
    Is this a Weblogic bug ?

  • Thread Concurrency problem

    Hello
    i have an application where i have about 6 threads....I have each of this thread working independently ..i.e each thread has its publis static main method.....they are continuously running..... and they are working correctly.... but the problem is that i have run each thread explicitly....
    But now i want to combine all these threads into one thread so that when i run my java application all these threads will start running.....I tried doing it but the problem is that the first thread itself runs...the other threads do not run...... how do i do this????
    The code of the program where i clubbed the threads is
    public class MainThread
    public static void main(String arg[])
    NewThread n= new NewThread() ;
    System.out.println("in psvm") ;
    class NewThread extends Thread
    String name; // name of thread
    Thread t;
    NewThread()
    System.out.println("in newthread") ;
    SMSSendThread sms=new SMSSendThread() ;
    UsernameThread user=new UsernameThread() ;
    user.start() ;
    SendInbox inbox=new SendInbox() ;
    inbox.start() ;
    DeleteSMS delete=new DeleteSMS() ;
    delete.start();
    My start method of each of these thread contains ie.deleteSMS,SendInbox
    public void start()
    HashSet<Socket> clients = new HashSet<Socket>() ;
    try
    Boolean listening=true ;
    ServerSocket ss=new ServerSocket(2345) ;
    Socket socket=new Socket() ;
    int id=0;
    while(listening)
    System.out.println("Detecting Client please Wait in send thread:=") ;
    socket = ss.accept();
    clients.add(socket);
    System.out.println("clients display:="+clients) ;
    if(clients.contains(socket))
    InetAddress clientIP=socket.getInetAddress() ;
    System.out.println("the ip addrss of the client:="+clientIP) ;
    new ConnectionHandlerdelete(socket).start() ;
    The problem is that only the Username thread exceutes priopely the other two are not running!!!!

    Then why are the other threads not runningIf that is your code you are mistaken about this.
    > the newthread class runs as it is supposed to
    The newthread class constructor runs as it is supposed to , and it starts the other threads. You never call start on it so it never executes its run() method. It doesn't even appear to have a run() method.
    So either this is not your real code or your observations are mistaken.

  • THREAD - CRAZY PROBLEM

    Hi guys, I try to construct a thread and get a crazy problem.
    public class MyThread extends Thread{
      public void run()
        System.out.println("TEST");
      }//End run()
      public static void main(String argv[])
        MyThread app = new MyThread();
       app.start();
      }//End main()
    }And the output are just one loop:
    c:\>java MyThread
    TEST
    c:\>
    Whats wrong??!?!

    class ThreadTest
        public static void main(String[] args)
            MyRunner r1 = new MyRunner();
            MyRunner r2 = new MyRunner();
            Thread t1 = new Thread(r1, "My first thread");
            Thread t2 = new Thread(r2, "My second thread");
            t1.start();
            t2.start();
            try { Thread.sleep(250); } catch (InterruptedException e) { e.printStackTrace(); }
            r1.stop();
            try { Thread.sleep(250); } catch (InterruptedException e) { e.printStackTrace(); }
            r2.stop();
    class MyRunner implements Runnable
        private boolean keepGoing = true;
        public void run()
            int count = 0;
            String name = Thread.currentThread().getName();
            while (keepGoing)
                System.out.println(name + ": " + count++);
        void stop()
            keepGoing = false;
    }

  • Aplication server thread pool problem

    I'm using sun app server 8.
    After some time from starting (and using) the server, it stops responding to clients.
    When I change the max number of threads on server the number of clients it can serve before hanging folows the change. So I guess that some threads are not recycled.
    But, I can't get full thread dump to see what's happening.
    Also I can't get any thread pool monitoring information through asadmin.
    (I can see that EJB's are all removed successfuly)
    Any suggestions.
    Thanks in advance.

    First of all, thank you for helping me.
    The client wasn't making problems, but server did. (I didn't said that I use the app. server on XP.)
    For now I solved the problem by installing the new beta 2004Q4. It works fine now, it also has some thread monitoring in web console...
    I was getting this, when I tried to monitor the thread-pool (it is set on HIGH):
    asadmin> get -m server.thread-pools.thread-pool.thread-pool-1.*
    No matches resulted from the wildcard expression.
    CLI137 Command get failed.
    If it means anything this is what I was getting when I do ctrl-break. (this thread dump stays the same even after server stops responding...)
    Full thread dump Java HotSpot(TM) Client VM (1.4.2_04-b04 mixed mode):
    "Thread-6" prio=5 tid=0x02edad08 nid=0xb40 runnable [331f000..331fd8c]
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:177)
    at org.apache.commons.launcher.StreamConnector.run(StreamConnector.java:
    115)
    "Thread-5" prio=5 tid=0x02ebbb98 nid=0x8ac runnable [32df000..32dfd8c]
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:194)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
    - locked <0x10089900> (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(FilterInputStream.java:90)
    at org.apache.commons.launcher.StreamConnector.run(StreamConnector.java:
    115)
    "Signal Dispatcher" daemon prio=10 tid=0x0093dc18 nid=0x930 waiting on condition
    [0..0]
    "Finalizer" daemon prio=9 tid=0x008a5c20 nid=0xbd0 in Object.wait() [2b5f000..2b
    5fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x10502a00> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
    - locked <0x10502a00> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=10 tid=0x008a47f0 nid=0xb4 in Object.wait() [2b1
    f000..2b1fd8c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x10502a68> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:429)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
    - locked <0x10502a68> (a java.lang.ref.Reference$Lock)
    "main" prio=5 tid=0x000362a0 nid=0xc38 runnable [7f000..7fc3c]
    at java.lang.Win32Process.waitFor(Native Method)
    at org.apache.commons.launcher.LaunchTask.execute(LaunchTask.java:705)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.tools.ant.Target.execute(Target.java:309)
    at org.apache.tools.ant.Target.performTasks(Target.java:336)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
    at org.apache.commons.launcher.Launcher.start(Launcher.java:402)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at LauncherBootstrap.main(LauncherBootstrap.java:185)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.admin.servermgmt.pe.PEInstancesManager.startInstan
    ce(PEInstancesManager.java:115)
    at com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager.startDomain(P
    EDomainsManager.java:126)
    at com.sun.enterprise.cli.commands.StartDomainCommand.runCommand(StartDo
    mainCommand.java:59)
    at com.sun.enterprise.cli.framework.CLIMain.invokeCommand(CLIMain.java:1
    23)
    at com.sun.enterprise.cli.framework.CLIMain.main(CLIMain.java:39)
    "VM Thread" prio=5 tid=0x0093c698 nid=0x9b4 runnable
    "VM Periodic Task Thread" prio=10 tid=0x00940438 nid=0xbd4 waiting on condition
    "Suspend Checker Thread" prio=10 tid=0x0093d2b8 nid=0x2c0 runnable

  • Thread 15 problems in downloading CS6

    Hi - I have tried downloading a copy of the CS6 to my mac book pro.  The download takes a day to download (I've done this three times - yes, I'm aggravated).
    Once it has downloaded, I enter the serial number as directed. The next screen directs me to log into adobe - I do this. Then the next screen tells me that thread number 15 is a problem. It then kicks me back to square one of typing in my serial number all over again. 
    Does anyone have any clues as to what the problem is???
    HELP......

    Hi:  I have a new macbook pro 13.3/2 4ghz/8gb/256gb fla mac os x, 10.9.1
    The first error message I get is:  Adobe application manager quit unexpectedly.
    In looking through the report it says:  crashed thread:  15
    Exception Type EXc_Breakpoint (sigtrap)
    Exception codes: 0x000000000002, 0x000000000000
    Application specific information
    **terminating app due to uncaught exception 'NSInvalidargumentException', reason: '**NSXMLDocumentinitWithXMLString:options:error:: nil argument'
    I tried to print this error code out (around 10-15 pages of code) so I took a screen shot copy. For some reason I can not print it.
    Does this data help any?
    Judy

Maybe you are looking for

  • HT3702 Payment info does not Match bank statement

    Called the bank, typed all the info exCtly as the bank told me...still apple wont let me use it.

  • Can't limit the number of simultaneous sessions per user

    Hi, I am using Cisco ACS 4.0 as a radius server that authenticate users for Internet access. Microsoft ISA 2004 is used as Radius client. When users tries to connect to Internet, the ISA Server forwards requests to Radius server (Cisco ACS) for authe

  • Versions of MD64.

    Dear All, I am using 3 versions of MD64 for my reportings (i.e. 01, 02 & 03) & 00 for MRP. Problem is that when I run MRP it considers all version & creates 4 plan orders on the basis of records of each versions. I want to exclude rest all version fr

  • HT201210 i cant update my ipod

    i keeps reseting but it stays on the usb with the simbull of the itune. its doing my head in

  • Comparing time with date objects

    Hi, I have two time intervals say 0400 and 0800.Now how do i construct a date object using these time 0400 and 0800 ?.I need to carry out few things only if the current time is outside of the above time intervals. Using the below code does not seem t