Thread stopping

HI, I have a question regarding the use of threads in my program.
I have 4 classes which I have implemented as Runnable. Each class uses it's run method to call methods which carry out queries on a database. I have a thread t which I use to run the methods.
public void run()
        setTotalIncoming();
        getTotalOutbound();
        setTotalLostCalls();
        setTotalCallsSentToVoicemail();
        getOutOfHoursVoicemail();
        setPercentAnswered();
        getTotalPhoneTime();
        getTotalTalkTime();
        setAverageAnswerTime();
        setLostRingingTime();
        setVoicemailRingingTime();
        getOutOfHoursRingingTime();
     }The problem is that periodically (unspecified time periods), my program calls the refresh() method in my program which re-assigns my thread t. Shown here:
public void refresh()
        while(isRunning){
            // wait for thread to finish
        t = new Thread(this);
     t.start();
    }Now, the problem is that, currently, my program could re-assign t, whilst the run() method wasn't finished executing all it's methods. I think this is causing some unexpected behaviour in my code.
I am noticing this in my ConnectionPool class, which I know is sound, as it is a very similar adaptation on code found in a well known book. Basically my program manages to open more connections that the Maximum no. of connections is set to in the ConnectionPool.
Does anyone have any ideas:
1. How I can ensure that all my methods have finished executing, before I allow the refresh() method to re-assign t.
2. If this problem could cause my connection pool to open more connections than i have set the maximum to.
Thanks in advance for your time, I hope someone can help me!

public void refresh()
while(isRunning){
// wait for thread to finish
t = new Thread(this);
Now, the problem is that, currently, my program could
re-assign t, whilst the run() method wasn't finished
executing all it's methods. Well, you could change the above loop to while (t.isAlive())
some unexpected behaviour in my code.
1. How I can ensure that all my methods have finished
executing, before I allow the refresh() method to
re-assign t.You could use a java.util.concurrent.CountDownLatch so that your loop would wait on a latch (released at the end of the run() method) before re-assigning t. Or even just synchronize on some common object - let me know if you need an example.
2. If this problem could cause my connection pool to
open more connections than i have set the maximum
to.Well, it certainly is bad logic and so may well be the reason that you are opening more connections than you're closing

Similar Messages

  • Is there a better way to stop a Method than Thread.stop()?

    First my basic problem. In one of my programs I am using constraint solver. I call the constraint solver with a set of constraints and it returns a Map with a satisfying assignment. In most cases this works in acceptable time ( less than 1 second). But in some cases it may take hours. Currently I am running the function in a Thread and using Thread.stop(). This look like that:
         public Map<String, Object> getConcreteModel(
                   Collection<Constraint> constraints) {
              WorkingThread t=new WorkingThread(constraints);
              t.setName("WorkingThread");
              t.start();
              try {
                   t.join(Configuration.MAX_TIME);
              } catch (InterruptedException e) {
              if(t.isAlive()){
                   t.stop();
              return t.getSolution();
         }where t.getSolution(); returns null if the Thread was interrupted.
    Unfortunately this sometimes crashes the JVM with:
    # A fatal error has been detected by the Java Runtime Environment:
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006dbeb527, pid=5788, tid=4188
    # JRE version: 6.0_18-b07
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (16.0-b13 mixed mode windows-amd64 )
    # Problematic frame:
    # V  [jvm.dll+0x3fb527]
    # An error report file with more information is saved as:
    # F:\Eigene Dateien\Masterarbeit\workspace\JPF-Listener-Test\hs_err_pid5788.log
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    #Does anyone knows a better way to do it?
    Thank you in advance.
    Note 1: the Constraint solver is a Third Party tool and changing it is unfeasible. (I have tried it already)
    Note 2: Using Thread.stop(Throwable t) only chances the error message.

    In case somebody have the same problem here my code which solves the problem. Note it requires to parameters and the result to be serializable.
    The Class which starts to Process:
    public class Solver{
         public Map<String, Object> getConcreteModel(
                   Collection<Constraint> constraints) {
                   try
                        Process p=Runtime.getRuntime().exec(...); //do not forget the classpath
                        new TimeOut(Configuration.MAX_TIME, p).start();
                        ObjectOutputStream out=new ObjectOutputStream(p.getOutputStream());
                        new ErrReader(p.getErrorStream()).start();//not that std.err fills up the pipe
                        out.writeObject(constraints);
                        out.flush();
                        ObjectInputStream in=new ObjectInputStream(p.getInputStream());
                        return (Map<String, Object>) in.readObject();
                   catch(IOException e)
                        return null;
                   } catch (ClassNotFoundException e) {
                        //should not happen
                        return null;
         // For running in a own process
         static private class TimeOut extends Thread
              private int time;
              private Process p;
              public TimeOut(int time, Process p)
                   this.time=time;
                   this.p=p;
              @Override
              public void run() {
                   synchronized (this) {
                        try {
                             this.wait(time);
                        } catch (InterruptedException e) {
                   p.destroy();
         static class ErrReader extends Thread
             InputStream is;
             ErrReader(InputStream is)
                 this.is = is;
                 this.setDaemon(true);
             public void run()
                 try
                     InputStreamReader isr = new InputStreamReader(is);
                     BufferedReader br = new BufferedReader(isr);
                     String line=null;
                     while ( (line = br.readLine()) != null)
                         System.err.println(line);   
                     } catch (IOException ioe)
                         ioe.printStackTrace(); 
    }And the class which executet the Program
    public class SolverProcess {
          * @param args ignored
         public static void main(String[] args){
              try {
                   ObjectInputStream in =new ObjectInputStream(System.in);
                   SolverProcess p=new SolverProcess();
                   p.constraints=(Collection<Constraint>) in.readObject();
                   p.compute();
                   ObjectOutputStream out=new ObjectOutputStream(System.out);
                   out.writeObject(p.solution);
                   out.flush();
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              //System.err.println("solved");
              System.exit(0);
         private Map<String, Object> solution=null;
         private Collection<Constraint> constraints;
           private void compute()
    }

  • Thread.stop() -- Why is it deprecated ? - What alternatives ?

    Hi,
    I'm creating an XMPP server in Java and I have a problem. I have a thread that run the SAX parser and is constantly blocking to recive data from my socket. Now the problem is that at some point (after the authentication) I need to stop the XML parsing.
    The only way I can do this, I think, is by using the Thread.stop() method, but it is deprecated :(
    I read the FAQ about this deprecation but the alternatives given can't work for me:
    - I can't close the eocket because I need to read another XML document right after on the socket
    - I can't call Thread.interrupt() because the thread is blocking on an IO
    - I can't use a shared variable because the thread is blocked inside the SAX parser that call from time to time a callback. I can't modify the SAX code :(
    Does anyone have an idea how to make my thread stop the parsing ?
    Thanks
    Mildred

    If you've read the "FAQ" on deprecation of stop etc then you already know why stop() is deprecated - it is inherently unsafe as you can't know for sure what your thread was doing when you tried to stop it. Further, what those documents don't tell you is that Thread.stop doesn't break you out of most blocking situations any way - so it wouldn't necessarily help even if it weren't deprecated.
    I don't know the I/O or threading architecture of what you are working with so the following may not be applicable, but hopefully something will help:
    One of the alternatives you didn't mention is setting the SO_TIMEOUT option on the socket so that your thread can periodically check if its actually been cancelled. I don't know if that is possible in this case it depends on how the use of sockets gets exposed by the library.
    Other possibilities for unblocking a thread are to give the thread what it is waiting for - some data on the socket in this case. If you can send something that can be interpreted as "stop looking for more data", or if you check for cancellation before trying to interpret the data at all, then you can unblock the thread by writing to the socket. Whether this is feasible depends on how the real data is written to the socket.
    Final possibility is to create a new thread to do the socket reading. Your parser thread can then read from a BlockingQueue, for example, that is populated with data from the socket thread. You can use interrupt() to cancel the parser thread and just ignore the socket thread - which presumably will unblock when the next real data arrives.

  • All Application threads stopped for 3~5 minutes

    Hi.
    Our Java application experiences sudden 3~5 minutes application threads stops.
    Our Application is run by 1 process and 300~400 threads.
    All threads are stopped suddenly and are run after 3~5 minutes or more.
    I can't analyze any patten but I experience this problem once or twice a day.
    I guess it is caused by application bug, java bug or Solaris bug and so on.
    I have difficulty to solve this problem and I can't find what causes it.
    Please give advice on this problem.
    (*) Our system :
    SunOS Solaris 5.10 Generic_138888-03 sun4u sparc SUNW,Sun-Fire-V890 (32G Mem)
    (*) Java :
    java version "1.5.0_12"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
    Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode)
    (*) Java Options
    -mx2048m -Dcom.sun.management.jmxremote.port=16000
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.snmp.interface=`hostname`
    -Dcom.sun.management.snmp.acl=false -Dcom.sun.management.snmp.port=16500 -Xcheck:jni
    -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCApplicationStoppedTime

    Show your GC logs.

  • Replacement for Thread.stop( ) in JDk 1.4

    Hi all,
    Please suggest an alternate solution to this issue.
    1. Thread problem :
    We cannot use System.exit(0) because control goes out of the calling program also.
    We cannot use destroy() because after the Thread.currentThread().destroy(), the program doesnot know how to handle it and it throws up an exception.
    java.lang.NoSuchMethodError
    at java.lang.Thread.destroy(Unknown Source) // also thread.destroy is deprecated
    The other solution that I explored is the use of interrupt(). However, if I try Thread.currentThread.isAlive() , then it returns me TRUE - meaning , that the thread was not killed or stopped. Because of this, the applet does not exit.
    Remaining options:
    Setting the thread to null. Explore more on how to use set the Thread.currentThread to null?
    Applet {
    init{
    new Thread(){
    public void run(){
    }.start();
    exit(){
    Thread.currentThread().stop();
    the focus here has to be what needs to be done to the Thread.currentThread().stop()?
    In case, we cannot find a solution, can we rewrite the applet without Thread.stop() to do the same? Will it exit then? Can you try it?
    Please reply with your suggestions at the earliest.
    Regards
    Abhijeet

    put some while loop in your run() method as follows
    public void run()
    while(flag)
    //do something
    here flag is a boolean variable. Then to stop the running thread, set flag to false from some other thread.

  • How to stop a thread without the deprecated Thread.stop() method?

    Hi,
    I am writting a server application that launches threads, but the run() implementation of these threads are not written by me (i.e. i have no control over them): they are third-party programs. That's why i could not use the well known Java tutorial way to stop a thread (i.e. with a global variable that indicates the thread state).
    I would like my server to be able to stop these threads at any time, but without using the deprecated Thread.stop() method.
    Any ideas ?
    Thanks in advance,
    Fabien

    Thanks Pandava!
    I was arrived at the same conclusion... As to me, it is a very bad issue, because it means for example that a servlet server can not stop any servlet it launches (especially for preventing infinite loops).
    If i want to be strictly JDK 1.4 compliant, i should not use Thread.stop(). But if i don't use it, i don't have any ideas of how stop a thread that i don't control...

  • About thread stop

    In API, thread.stop() is deprecated.
    If i want to stop a thread, how can i have the same effect like stop()?
    Thanks

    You might also have to call notify() on the thread if it is in a wait() mode.
    - K
    Use a boolean at the top of your run() method:
    boolean bStop = false;
    public void run() {
    if(bStop) return;
    // else do whatever run() is supposed to do
    bStop is a global whish you set depending on
    conditions in your program. If the condition to stop
    the loop becomes true, then you set bStop to true and
    run() will exit.
    Then you can set your reference to the thread to null
    and wait for the GC() to clean up after it. This is
    the recommended way to stop a thread.

  • Is there any alternative to Thread.stop();

    Hi everybody,
    I am facing troubles ,while stopping the Thread. at present i am using 'Thread.destroy()', because Thread.stop() was deprecated.#
    Is there any alternative for Thread.Stop()
    Thanks in advance!
    bye

    boolean myThreadShouldRun;
    public void run()
    while (myThreadShouldRun)
    doSomeThing();
    to stop the thread use: myThreadShouldRun=false; from outside the thread and it will stop the natural way. forcing threads to stop with the stop method was dangerous and therefore this method is deprecated and will maybe not be supported in future releases.

  • JDWP fatal error from thread.stop()

    I get this message
    FATAL ERROR in native method: JDWP "util.c" (Jan 20 2004), line 1209: Unexpected error, error code = 113 (JVMDI_ERROR_INTERNAL)
    from the target VM when I do thread.stop() on the debugger side. The debugger isn't bothered by the fatal error, but the target dies.
    Can anyone offer a clue to what I did wrong?
    Peter

    FATAL ERROR in native method: JDWP "util.c" (Jan 20
    2004), line 1209: Unexpected error, error code = 113
    (JVMDI_ERROR_INTERNAL)
    from the target VM when I do thread.stop() on the
    debugger side. The debugger isn't bothered by the
    fatal error, but the target dies.
    Can anyone offer a clue to what I did wrong?Lets see... "Jan 20 2004" implies that you are using the Tiger (1.5)
    beta release for this experiment.
    According to the JDWP spec:
    http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html
    Error 113 is "An unexpected internal error has occurred"
    More information, please...
    - What platform are you running on, and what version(s) of the VM
    are you using?
    - Which thread in the debugee did you send the stop() to?
    - Can you update this article with sample code and a narrative
    describing what happened when?
    - What throwable did you pass to com.sun.jdi.ThreadReference.stop(ObjectReference throwable)

  • How to avoid thread stops ? ( when try to read sockets inputstream ...)

    Hi ,
    When I try to call :
    Socket sok=new Socket (adres,poort);
    the thread looks to stop...
    How to avoid this ?
    Thx for tip etc !

    Take a look at NIO:
    http://www.google.com/search?num=100&hl=en&c2coff=1&q=non-blocking+java+socket

  • Threads stopped at _libc_read

    Hi All,
    While running of my C++ application under solaris 9 my application get struck.
    When we execute the insert statemnet using the OCIStmtExecute our application thread gets stopped at libcread and hence the entire application is hanged.
    Can any one help for why the thread gets stopped at that point and how can we recover from the same.
    Please find the dbx traces below when the application is hanged.
    Reading -
    Reading ld.so.1
    Reading libsocket.so.1
    Reading libnsl.so.1
    Reading libthread.so.1
    Reading libpthread.so.1
    Reading libintl.so.1
    Reading libgen.so.1
    Reading librt.so.1
    Reading libdl.so.1
    Reading libresolv.so.2
    Reading libosstoed.so
    Reading libccxerces-c1_5_1d.so
    Reading libACEd.so
    Reading libbesmgd.so
    Reading libdbintfd.so
    Reading libcommonlogd.so
    Reading libclientrequestintfd.so
    Reading libinmemorydbd.so
    Reading libarchon-c1_0.so
    Reading libcagent1_0.so
    Reading libclntsh.so.9.0
    Reading libwtc9.so
    Reading libsched.so.1
    Reading libaio.so.1
    Reading libkstat.so.1
    Reading libm.so.1
    Reading libCrun.so.1
    Reading libw.so.1
    Reading libc.so.1
    Reading libmp.so.2
    Reading libmd5.so.1
    Reading libc_psr.so.1
    Reading nss_files.so.1
    Reading nss_nis.so.1
    detected a multithreaded program
    Attached to process 1921 with 45 LWPs
    t@1 (l@1) stopped in _poll at 0xfdb9dfdc
    0xfdb9dfdc: _poll+0x0004: ta 0x8
    Current function is ACE_Reactor::run_event_loop
    38 return r->run_reactor_event_loop (ACE_Reactor::check_reconfiguration);
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx)
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) thread
    current thread ($thread) is t@1
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) threads
    t@1 a l@1 ?() running in _poll()t@2 a l@2 ?() sleep on 0x4553b0 in __lwp_park()
    t@3 a l@3 ?() sleep on 0x4574e8 in __lwp_park()
    t@4 a l@4 ?() sleep on 0x700d68 in __lwp_park()
    t@5 a l@5 ?() running in soaccept()
    t@6 a l@6 create_threaded_task() sleep on 0x49b1a0 in __lwp_park()
    t@7 a l@7 create_threaded_task() sleep on 0x49b1a0 in __lwp_park()
    t@8 a l@8 create_threaded_task() running in soaccept()
    t@9 a l@9 create_threaded_task() sleep on 0xfe334fa0 in __lwp_park()
    t@10 a l@10 create_threaded_task() sleep on 0xfe334fa0 in __lwp_park()
    t@11 a l@11 create_threaded_task() sleep on 0xfe335f88 in __lwp_park()
    t@12 a l@12 create_threaded_task() running in libcnanosleep()
    t@13 a l@13 ?() sleep on 0x4633a0 in __lwp_park()
    t@14 a l@14 ?() running in libcread()
    t@15 a l@15 ?() running in libcread()
    t@16 a l@16 ?() running in libcread()
    t@17 a l@17 ?() running in libcread()
    t@18 a l@18 ?() sleep on 0x457af8 in __lwp_park()
    t@19 a l@19 ?() running in libcread()
    t@20 a l@20 ?() sleep on 0x457af8 in __lwp_park()
    t@21 a l@21 ?() running in libcread()
    t@22 a l@22 ?() running in libcread()
    t@23 a l@23 ?() sleep on 0x457af8 in __lwp_park()
    t@24 a l@24 ?() sleep on 0x457af8 in __lwp_park()
    t@25 a l@25 ?() sleep on 0x457af8 in __lwp_park()
    t@26 a l@26 ?() sleep on 0x457af8 in __lwp_park()
    t@27 a l@27 ?() running in libcread()
    t@28 a l@28 ?() running in libcread()
    t@29 a l@29 ?() running in _poll()
    t@30 a l@30 ?() running in _poll()
    t@31 a l@31 ?() running in _poll()
    t@32 a l@32 ?() running in _poll()
    t@33 a l@33 ?() running in _poll()
    t@34 a l@34 ?() running in _poll()
    t@35 a l@35 ?() running in _poll()
    t@36 a l@36 ?() running in _poll()
    t@37 a l@37 ?() running in _poll()
    t@38 a l@38 ?() running in _poll()
    t@39 a l@39 ?() running in _poll()
    t@40 a l@40 ?() running in _poll()
    t@41 a l@41 ?() running in _poll()
    t@42 a l@42 ?() running in _poll()
    t@43 a l@43 ?() running in _poll()
    t@44 a l@44 ?() running in libcnanosleep()
    t@45 a l@45 create_threaded_task() sleep on 0x4698d0 in __lwp_park()
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx)
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) thread t@4
    Current function is COCIStatement::Execute
    1048 status = OCIStmtExecute(m_Session.get_svc(), m_pstmth, m_Session.get_error(), (ub4) m_Rows, (ub4) 0,
    t@4 (l@4) stopped in __lwp_park at 0xff365994
    0xff365994: __lwp_park+0x0010: ta 0x8
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) sync -info 0x700d68
    0x00700d68 (0x700d68): thread mutex(locked)
    Lock owned by t@28
    Threads blocked by this lock are:
    t@4 (0xfe1f0600) a l@4 ?() sleep on 0x700d68 in __lwp_park()(/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) thread t@28
    Current function is COCIStatement::Execute
    1048 status = OCIStmtExecute(m_Session.get_svc(), m_pstmth, m_Session.get_error(), (ub4) m_Rows, (ub4) 0,
    t@28 (l@28) **stopped in libcread at 0xfdb9f24c**
    0xfdb9f24c: libcread+0x0008: ta 0x8
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) where -l
    current thread: t@28
    [1] libc.so.1:_libc_read(0x23, 0x7bf6f6, 0x810, 0x0, 0x0, 0x0), at 0xfdb9f24c
    [2] libthread.so.1:_ti_read(0x23, 0x7bf6f6, 0x810, 0x0, 0x0, 0x0), at 0xff35d7b4
    [3] libclntsh.so.9.0:snttread(0x23, 0x7bf6f6, 0x810, 0x0, 0x0, 0x0), at 0xfccc8ae8
    [4] libclntsh.so.9.0:nttrd(0x7b63d8, 0x7bf6f6, 0x7b685c, 0x0, 0x0, 0x0), at 0xfccc5a34
    [5] libclntsh.so.9.0:nsprecv(0x0, 0xfd238d68, 0x7a8508, 0x0, 0x84d, 0x0), at 0xfcb4f07c
    [6] libclntsh.so.9.0:nsrdr(0x0, 0x1, 0xfd238d68, 0x7b5f30, 0x1, 0x20), at 0xfcb5387c
    [7] libclntsh.so.9.0:nsdo(0x7a8508, 0xfafe0b27, 0x4b96b8, 0x0, 0xfafe0b27, 0x0), at 0xfcb33dfc
    [8] libclntsh.so.9.0:nioqrc(0x4b96b8, 0x0, 0x0, 0xc27, 0x1, 0x726000), at 0xfcb6bed0
    [9] libclntsh.so.9.0:ttcdrv(0x728ae8, 0x728ae8, 0x0, 0x0, 0x0, 0x0), at 0xfcd06d74
    [10] libclntsh.so.9.0:nioqwa(0x726b98, 0x0, 0xfcd0640c, 0x728704, 0x726b1c, 0x0), at 0xfcb75468
    [11] libclntsh.so.9.0:upirtrc(0x7a7fd0, 0x0, 0x728638, 0x0, 0x0, 0x729b44), at 0xfc966f80
    [12] libclntsh.so.9.0:kpurcsc(0x722874, 0x5e, 0x728638, 0x728704, 0x729b44, 0xfcd0962c), at 0xfca0f5d8
    [13] libclntsh.so.9.0:kpuexecv8(0x72a344, 0x0, 0x728638, 0x0, 0x0, 0xfafe685a), at 0xfc9bf4f4
    [14] libclntsh.so.9.0:kpuexec(0x722874, 0x725fb4, 0x726530, 0x1, 0x0, 0x0), at 0xfc9c18bc
    [15] libclntsh.so.9.0:OCIStmtExecute(0x722874, 0x725fb4, 0x726530, 0x1, 0x0, 0x0), at 0xfc96f434
    =>[16] libdbintfd.so:COCIStatement::Execute(this = 0x853258), line 1048 in "COCIStatement.cpp"
    [17] libdbintfd.so:AcctRDMS_DB::DoWriteCDRDB(this = 0x69b2d0, pReq = 0x928cc0, pResp = 0x92b758), line 1007 in "AcctRDMS_DB.cpp"
    [18] libdbintfd.so:AcctRDMS_DB::commonDBRequest(this = 0x69b2d0, pDbReq = 0x928cc0, pDbResp = 0x92b758), line 87 in "AcctRDMS_DB.cpp"
    [19] libdbintfd.so:CommonDBClientAPI::dbRequest(this = 0x457ac0, dbHandle = 7U, pDbReq = 0x928cc0, pDbResp = 0x92b758), line 297 in "CommonDBClientAPI.cpp"
    [20] -:AcctClientRequest::handleAcctWriteCDR(this = 0x457358, pReq = 0x928cc0, handle = 7U), line 1014 in "AcctClientRequest.cpp"
    [21] -:AcctClientRequest::svc(this = 0x457358), line 1667 in "AcctClientRequest.cpp"
    [22] libACEd.so:ACE_Task_Base::svc_run(0x457358, 0x1, 0x0, 0x0, 0x1c, 0x457358), at 0xfec91070
    [23] libACEd.so:ACE_Thread_Adapter::invoke_i(0x609658, 0x4553e8, 0x609658, 0xfec90fc0, 0x457358, 0x0), at 0xfebb0fb4
    [24] libACEd.so:ACE_Thread_Adapter::invoke(0x609658, 0xfe1f3634, 0x4553e8, 0x609658, 0x0, 0x4d3720), at 0xfebb0ea4
    [25] libACEd.so:ace_thread_adapter(0x609658, 0x0, 0x0, 0x0, 0x0, 0x609658), at 0xfeb42d5c
    (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx)

    I've added extended logging to the console, so there are a few more things to show the errors:
    [ OK ] Mounted /boot.
    [ OK ] Reached target Local File Systems.
    Starting Recreate Volatile Files and Directories...
    Starting Trigger Flushing of Journal to Persistent Storage...
    [ OK ] Started Recreate Volatile Files and Directories.
    Starting Update UTMP about System Reboot/Shutdown...
    [ OK ] Started Update UTMP about System Reboot/Shutdown.
    [ OK ] Started Trigger Flushing of Journal to Persistent Storage.
    [ OK ] Reached target System Initialization.
    Starting Rescue Shell...
    [ OK ] Started Rescue Shell.
    [ OK ] Reached target Rescue Mode.
    [ 2.915824] systemd[255]: Failed at step CHDIR spawning /bin/plymouth: No such file or directory
    [ 2.934292] systemd[257]: Failed at step CHDIR spawning /bin/echo: No such file or directory
    [ 2.952007] systemd[260]: Failed at step CHDIR spawning /sbin/sulogin: No such file or directory
    [ 2.970414] systemd[263]: Failed at step CHDIR spawning /usr/bin/systemctl: No such file or directory
    Remember, this is a fresh installation. Only the base base-devel and vim packages are installed.
    Any ideas?

  • Thread stops GUI redraw

    Hello,
    I' m new to Java and can't solve following problem.
    In a test app I start a socket server with the following instruction:
    void button1_actionPerformed(ActionEvent e) {
    NetServerMultiModified server = new NetServerMultiModified();
    server.main();
    The code of the server-class is:
    public class NetServerMultiModified {
    public ServerSocket server;
    public static void main() {
    NetServerMultiModified nServ = new NetServerMultiModified();
    nServ.runServer();
    private void runServer() {
    boolean keeprunning = true;
    ServerThread newServerThread = null;
    Socket newSocket = null;
    try {
    server = new ServerSocket(7000);
    while (true) {
    System.out.println("Waiting for client connection");
    for(int i = 0; i < 10; i++) {
    newSocket = server.accept(); //at this point app does not come back
    newServerThread = new ServerThread(newSocket,i);
    newServerThread.start();
    catch (EOFException eofException) {
    System.out.println("Client terminated the connection.");
    catch (IOException ioException) {
    System.out.println("Network error: " + ioException.getMessage());
    private class ServerThread extends Thread {
    int num = 0;
    int cthread = 0;
    Socket connection = null;
    String sClientName = null;
    //moved from main class - in and out are now instance variables of each thread
    private ObjectOutputStream out;
    private ObjectInputStream in;
    public ServerThread(Socket socket, int num) {
    connection = socket;
    sClientName = connection.getInetAddress().getHostName();
    System.out.println("connection received from : " + sClientName + ", by thread: " + this.getName());
    this.num = num;
    public void run() {
    boolean flag = false;
    boolean done = false;
    try {
    out = new ObjectOutputStream(connection.getOutputStream());
    in = new ObjectInputStream(connection.getInputStream());
    while (!done) {
    Object input = in.readObject();
    Frame1 frame = new Frame1();
    frame.textArea1.setText("hallo");
    frame.contentPane.repaint();
    frame.textArea1.setText("hallo");
    System.out.println("Received from client: " + sClientName + ", by thread: " + this.getName() + ": " + input.toString());
    out.writeObject(input);
    out.flush();
    closeConnection();
    catch(EOFException eof) {
    System.out.println("Client: " + sClientName + " closed the connection on thread: " + this.getName());
    catch(SocketException se) {
    System.out.println("Client: " + sClientName + " closed the connection on thread: " + this.getName());
    catch (Exception e) {
    e.printStackTrace();
    finally {
    closeConnection();
    } // run
    private void closeConnection() {
    try {
    System.out.println("Cleaning up connection on thread completion...");
    out.close();
    in.close();
    connection.close();
    catch(Exception e) {
    System.out.println("Exception caught during closeConnection() - connection possibly already closed");
    My problem is, that I would like to sent all the messages from the server to a textarea on my app. This does not work! When I debug the program it stops at the comment in the source. What am I doing wrong??
    Can anybody help me?
    Thanks in advance!

    Hi,
    You are trying to write to a swing component from an external thread. All swing components are accessed via the SwingEvent Thread. As you are not accessing the component via this thread the app is locking.
    Replace
    Frame1 frame = new Frame1();
    frame.textArea1.setText("hallo");
    frame.contentPane.repaint();
    frame.textArea1.setText("hallo");with
                  try{
                    SwingUtilities.invokeLater(new Runnable() {
                       public void run() {
                          Frame1 frame = new Frame1();
                          frame.textArea1.setText("hallo");
                          frame.contentPane.repaint();
                          frame.textArea1.setText("hallo");
                  }catch(Exception ex){
                    ex.printStackTrace();
                  }this should now work, get back to me with any other problems and don't forget the Duke Dollars if all goes well.
    regards,
    N35Sy

  • Child thread stopping a parent thread

    I have a java program which has to pick some list of records from table1 and iterate through the list and send a message to an external URL and after getting a response update the same table.
    The issue here is I use HttpUrlconnection and open an InputStream from the connection to read the response message from the external URL.
    This Java program hangs when getting the response from the external URL.(for some reason the external server is busy and does not send a response in time)
    I need to find out some way to get this process out, from waiting for the response from the external URL.
    I have used HttpUrlconnection.disconnect and Thread.interrupt ... both do not "get the process out of wait for response".
    Do any of you have a solution to this issue ?
    Thanks.

    sukumar.sudha wrote:
    Java 1.4 doesnot have setConnectTimeout and setReadTimeout.So I prefer using setSoTimeout.I think it would be easier to start a thread that does the HttpURLConnection stuff and
    when done notifies you (Object.notify()). After you start the thread, you wait(timeout).
    When this wait returns, you can check if the other thread is done or not.
    If yes, all fine. If not, you have your continuation without waiting for completion of the
    HttpURLConnection stuff. The HttpURLConnection will still be attempting to extract the data,
    but should you really care? You achieved the goal of having your main thread move forward.
    Why I think this is better? Simply HttpURLConnection gives you lots of free stuff that you
    would have to implement yourself with sockets.

  • Background java thread stops after running the fx thread

    in my server thread i am accepting a file . so i used Platform.runLater() to display a scene that gets confirmation from user. But when it reach the scene it is not going back to the server thread.
    class server implements Runnable
    public void run()
    while(true)
    // accepts client
    Platform.runLater(new Runnable(){    //  after this fx its not goin to the while
    // display confirmation message
    // writing the file
    }

    Post a bit more code, calling Platform.runLater() will not cause this behaviour. In fact, it should immediately return and continue with the while. You can add print statements if you want to be sure what is happening.
    The only reason I could think of is if the while(true) is already on the FX application thread but that seems unlikely.

  • How to stop a thread at the end of another

    hello
    I want to run two threads. They start at the same time, and I want one of them to end when the first one finishes.
    I have a main class, a GUI. When I click on a button, it processes an action( first thread), and since this action takes some time, I decided to create a second thread that is a GUI that is a dialog box that says that it is being processed...
    So my dialog bow has to disappear when the process ends.
    I've already tried this:
    boolean stop = false;
    Connect connect = new Connect(this);
    connect.start();
    LdapSearch searching = new LdapSearch();
    searching.start();
    while( connect.isAlive() ){
         if( !connect.isAlive() ){
              stop = true;
    if( stop == true ){
                           searching.interrupt();
    }but unfortunately the text written on my dialog box disappears....
    does anyone knows how I can make a thread stop at the end of another properly?
    thanks for your help!!
    Philippe

    sorry the code i tried is:
    boolean stop = false;
    Connect connect = new Connect(this);
    connect.start();
    LdapSearch searching = new LdapSearch();
    searching.start();
    while( stop == false ){
         if( !connect.isAlive() ){
              stop = true;
    if( stop == true ){
         searching.interrupt();
    }

Maybe you are looking for