Thread.start() without run() invoke

We got interesting problem during migration one old application from java 1.4.2_08 to the java 1.5.0_06. The principal code of application is:
public class objServ extends Thread {
  public void run() {
     while (!End) {
           clientSocket = ServSocket.accept();
           client = new objClient(this, clientSocket);
           logger.sendInfo("client created. "+client.getName());
           client.start();
           logger.sendInfo("client start done. "+client.getName());
  public static void main(String args[]) {
      pkvserv serv = new objServ(hostName, port);
      serv.start();
public class objClient extends Thread {
   // client method run()
  public void run() {
     printlog("Thread run started. "+this..getName());
}The application listen port and generate the client thread for each connection.
After 10 days of using this application and generating and successful processing and termination of near 340000 client threads we got a situation when client thread was created, method start() was invoked, but the client method run() was never invoke.
Does anybody have any idea why this situation can happen? We have memory monitoring on that application and it�s was not a memory problem.

So you're claiming there's a bug in the VM. I doubt it (at least not one of the nature you're claiming). I'd suspect your code didn't execute start(), or that if it did, run() did execute and you're making a faulty conclusion that it didn't.

Similar Messages

  • Firefox won't start, but possible to troubleshoot as compatibility. how can I fix this without running compatibility?

    2014 April 29, Firefox works fine but April 30 it won't start, the possible to work is running compatibility (troubleshoot). Is there any solution for this without running compatibility or without formatting computer? And works during 2014 April 29.
    I've already uninstall anti virus
    I try also restore and repair windows
    I've also uninstall and reinstall firefox.
    still doesn't work :(

    If you had an update of Firefox, the firewall may be the problem.<BR><BR>
    This problem occurs when your Internet security program was set to trust the
    previous version of Firefox, but no longer recognizes your updated version as
    trusted. Now how to fix the problem: To allow Firefox to connect to the Internet
    again:<BR><BR>
    * Make sure your Internet security software is up-to-date (i.e. you are running the latest version)<BR><BR>
    * Remove Firefox from your program's list of trusted or recognized programs, then add it back. For detailed instructions, see Configure firewalls so that Firefox can access the Internet.

  • When my thread starts running, at that time keylistener is not working.

    when my thread starts running, at that time keylistener is not working.
    plz reply me.

    //FrameShow.java
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import java.awt.Dimension;
    import java.awt.geom.Dimension2D;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.util.logging.Level;
    import java.awt.event.*;
    import java.util.*;
    public class FrameShow extends JFrame implements ActionListener,KeyListener
         boolean paused=false;
         JButton stop;
         JButton start;
         JButton exit;
         public IncludePanel CenterPanel;
         public FrameShow()
    CenterPanel= new IncludePanel();
              Functions fn=new Functions();
              int height=fn.getScreenHeight();
              int width=fn.getScreenWidth();
              setTitle("Game Assignment--Santanu Tripathy--MCA");
              setSize(width,height);
              setResizable(false);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              show();
              initComponents();
              DefaultColorSet();
              this.addKeyListener(this);
         this.setFocusable(true);
         public void initComponents()
              Container contentpane=getContentPane();
              //Creating Panel For Different Side
              JPanel EastPanel= new JPanel();
              JPanel WestPanel= new JPanel();
              JPanel NorthPanel= new JPanel();
              JPanel SouthPanel= new JPanel();
              //CenterPanel = new IncludePanel();
              //IncludePanel CenterPanel= new IncludePanel();
              EastPanel.setPreferredSize(new Dimension(100,10));
              WestPanel.setPreferredSize(new Dimension(100,10));
              NorthPanel.setPreferredSize(new Dimension(10,100));
              SouthPanel.setPreferredSize(new Dimension(10,100));
              //CenterPanel.setPreferredSize(new Dimension(200,200));
              //Adding Color to the Panels
              NorthPanel.setBackground(Color.green);
              SouthPanel.setBackground(Color.orange);
              CenterPanel.setBackground(Color.black);
              //Creating Border For Different Side
              Border EastBr = javax.swing.BorderFactory.createEtchedBorder(Color.cyan, Color.red);
              Border WestBr = javax.swing.BorderFactory.createEtchedBorder(Color.cyan, Color.red);
              Border NorthBr = javax.swing.BorderFactory.createEtchedBorder(Color.cyan, Color.red);
              Border SouthBr = javax.swing.BorderFactory.createEtchedBorder(Color.cyan, Color.red);
              Border CenterBr = javax.swing.BorderFactory.createEtchedBorder(Color.cyan, Color.red);
              //Creating Components For East Panel
              JLabel left= new JLabel("LEFT");
              JLabel right= new JLabel("RIGHT");
              JLabel rotate= new JLabel("ROTATE");
              left.setForeground(Color.blue);
              right.setForeground(Color.blue);
              rotate.setForeground(Color.blue);
              //Creating Components For West Panel
              ButtonGroup group = new ButtonGroup();
              JRadioButton rb1 = new JRadioButton("Pink",false);
              JRadioButton rb2 = new JRadioButton("Cyan",false);
              JRadioButton rb3 = new JRadioButton("Orange",false);
              JRadioButton _default = new JRadioButton("Black",true);
              rb1.setForeground(Color.pink);
              rb2.setForeground(Color.cyan);
              rb3.setForeground(Color.orange);
              _default.setForeground(Color.black);
              //Creating Components For North Panel
              JLabel name= new JLabel("Santanu Tripathy");
              name.setForeground(Color.blue);
              name.setFont(new Font("Serif",Font.BOLD,30));
              //Creating Components For South Panel
              start = new JButton();
              stop = new JButton();
              exit = new JButton();
              start.setToolTipText("Click this button to start the game");
              start.setFont(new java.awt.Font("Trebuchet MS", 0, 12));
              start.setText("START");
              start.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEmptyBorder(3, 5, 3, 5), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
              start.setMaximumSize(new java.awt.Dimension(90, 35));
              start.setMinimumSize(new java.awt.Dimension(90, 35));
              start.setPreferredSize(new java.awt.Dimension(95, 35));
              if(paused)
                   stop.setToolTipText("Click this button to pause the game");
              else
                   stop.setToolTipText("Click this button to resume the game");
              stop.setFont(new java.awt.Font("Trebuchet MS", 0, 12));
              stop.setText("PAUSE");
              stop.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEmptyBorder(3, 5, 3, 5), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
              stop.setMaximumSize(new java.awt.Dimension(90, 35));
              stop.setMinimumSize(new java.awt.Dimension(90, 35));
              stop.setPreferredSize(new java.awt.Dimension(95, 35));
              exit.setToolTipText("Click this button to exit from the game");
              exit.setFont(new java.awt.Font("Trebuchet MS", 0, 12));
              exit.setText("EXIT");
              exit.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEmptyBorder(3, 5, 3, 5), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
              exit.setMaximumSize(new java.awt.Dimension(90, 35));
              exit.setMinimumSize(new java.awt.Dimension(90, 35));
              exit.setPreferredSize(new java.awt.Dimension(95, 35));
              //Adding some extra things to the Panels
              group.add(rb1);
              group.add(rb2);
              group.add(rb3);
              group.add(_default);
              //Adding Component into the Panels
              EastPanel.add(left);
              EastPanel.add(right);
              EastPanel.add(rotate);
              WestPanel.add(rb1);
              WestPanel.add(rb2);
              WestPanel.add(rb3);
              WestPanel.add(_default);
              NorthPanel.add(name);
              SouthPanel.add(start);
              SouthPanel.add(stop);
              SouthPanel.add(exit);
              //Adding Border Into the Panels
              EastPanel.setBorder(EastBr);
              WestPanel.setBorder(WestBr);
              NorthPanel.setBorder(NorthBr);
              SouthPanel.setBorder(SouthBr);
              CenterPanel.setBorder(CenterBr);
              //Adding Panels into the Container
              EastPanel.setLayout(new GridLayout(0,1));
              contentpane.add(EastPanel,BorderLayout.EAST);
              WestPanel.setLayout(new GridLayout(0,1));
              contentpane.add(WestPanel,BorderLayout.WEST);
              contentpane.add(NorthPanel,BorderLayout.NORTH);
              contentpane.add(SouthPanel,BorderLayout.SOUTH);
              contentpane.add(CenterPanel,BorderLayout.CENTER);
              //Adding Action Listeners
              rb1.addActionListener(this);
              rb2.addActionListener(this);
              rb3.addActionListener(this);
              _default.addActionListener(this);
              exit.addActionListener(this);
              start.addActionListener(this);
    try
              start.addActionListener(
    new ActionListener() {
    public void actionPerformed( ActionEvent e )
                        start.setEnabled(false);
    CenterPanel.drawCircle();
    catch(Exception e)
    {System.out.println("Exception is attached with sart button exp = "+e);}
    try
              stop.addActionListener(
    new ActionListener() {
    public void actionPerformed( ActionEvent e )
                        paused=!paused;
                        if(paused)
                             start.setToolTipText("Click this button to resume the game");
                             stop.setText("RESUME");
                        else
                             start.setToolTipText("Click this button to pause the game");
                             stop.setText("PAUSE");
    CenterPanel.pause();
    catch(Exception e)
    {System.out.println("Exception is attached with sart button exp = "+e);}
         public void DefaultColorSet()
              getContentPane().setBackground(Color.white);
         public void actionPerformed(ActionEvent AE)
              String str=(String)AE.getActionCommand();
              if(str.equalsIgnoreCase("pink"))
                   CenterPanel.setBackground(Color.pink);
              if(str.equalsIgnoreCase("cyan"))
                   CenterPanel.setBackground(Color.cyan);
              if(str.equalsIgnoreCase("orange"))
                   CenterPanel.setBackground(Color.orange);
              if(str.equalsIgnoreCase("black"))
                   CenterPanel.setBackground(Color.black);
              if(str.equalsIgnoreCase("exit"))
                   System.exit(0);
         public void keyTyped(KeyEvent kevt)
    //repaint();
    public void keyPressed(KeyEvent e)
              System.out.println("here key pressed");
              //CenterPanel.dec();
         public void keyReleased(KeyEvent ke) {}
    }//End of FrameShow.ja
    //IncludePanel.java
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.Graphics.*;
    import java.awt.Dimension;
    import java.awt.geom.Dimension2D;
    import java.util.*;
    import java.util.logging.Level;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    public class IncludePanel extends JPanel implements Runnable
    int x=0,y=0;
    int color_1=0;
    int color_2=1;
    int start=0;
    Thread th;
    Image red,blue,green,yellow;
    java.util.List image;
    static boolean PAUSE=false;
         public IncludePanel()
         red= Toolkit.getDefaultToolkit().getImage("red.png");
         blue= Toolkit.getDefaultToolkit().getImage("blue.png");
         green= Toolkit.getDefaultToolkit().getImage("green.png");
         yellow= Toolkit.getDefaultToolkit().getImage("yellow.png");
    public void paintComponent(Graphics g)
              super.paintComponent(g);
              draw(g);
    public void dec()
         System.out.println("in dec method");
         x=x+30;
    public void draw(Graphics g)
              g.setColor(Color.red);
              int xx=0,yy=0;
              for (int row=0;row<=12;row++)
                   g.drawLine(xx,yy,180,yy);
                   yy=yy+30;
              xx=0;
              yy=0;
              for (int col=0;col<=6;col++)
                   g.drawLine(xx,yy,xx,360);
                   xx=xx+30;
              if(color_1==0)
                   g.drawImage(red, x, y, this);
              else if(color_1==1)
                   g.drawImage(blue,x, y, this);
              else if(color_1==2)
                   g.drawImage(green,x,y, this);
              else if(color_1==3)
                   g.drawImage(yellow,x,y, this);
    x=x+30;
              if(color_2==0)
                   g.drawImage(red, x, y, this);
              else if(color_2==1)
                   g.drawImage(blue,x,y, this);
              else if(color_2==2)
                   g.drawImage(green,x,y, this);
              else if(color_2==3)
                   g.drawImage(yellow,x,y, this);
    x=0;
    public void drawCircle( )
         th=new Thread(this);
         th.start();
         public void pause()
              if(PAUSE)
                   th.resume();
                   PAUSE=false;
                   return;
              if(!PAUSE)
              PAUSE=true;
         public synchronized void run()
              Random rand = new Random();
              Thread ani=Thread.currentThread();
              while(ani==th)
                   if(PAUSE)
                        th.suspend();
                   if(y==330)
                        color_1 = Math.abs(rand.nextInt())%4;
                        color_2 = Math.abs(rand.nextInt())%4;
                        if(color_1==color_2)
                             color_2=(color_2+1)%4;
                        y=0;
                   else
                        y=y+30;
                   repaint();
                   try
                        Thread.sleep(700);
                   catch(Exception e)
         }//End of run
    i sent two entire program

  • Thread start, run question

    public class Test {
         public Test(){
              boolean a=false;
              Thread t = new Thread() {
                public void run() {
                     //code a
        if(a){
             //comment 1: here I need to execute the code a and code b concurrently
             t.start();
        }else{
             //comment 2:here I don't want a concurrent process and code b starts only after completion of code a
             t.run();
         //code b     
         public static void main(String args[]){
              new Test();
          * I know that if the 'code a' is in a method() then its ok that we can call that
          * method instead of t.run(); . But this application already developed like this.
    }My question is : Is the above implementation on right way to satify comment1 and comment2 ?

    It works the same way that anonymous subclasses of Classes work. The only difference is that you need to implement every method of that interface (which is only one in the case of Runnable).
    So if
    Thread t = new Thread() {
      //some methods
    };is a shortcut for
    //outside your method, but inside your (outer) class:
    class MyAnonymousThread extends Thread{
      //some methods
    //inside your method:
    Thread t = new MyAnonymousThread();then
    Runnable r = new Runnable() {
      //some methods
    };is a shortcut for
    //outside your method, but inside your (outer) class:
    class MyAnonymousRunnable implements Runnable {
      //some methods
    //inside your method:
    Runnable r = new MyAnonymousRunnable();(note that those are not completely the same, since you can access final local variables of your method inside a anyonymous inner class among )

  • When I download itunes, it says that Ipod Service failed to start. I checked the services under task manager and when I try to start it, it says access denied. How to I get access and for the ipod service to start and run?

    Please help. My ipod classic could not be recognised by itunes when I connect my ipod to PC. Previously it has been recognised before I updated. This was a while ago now and so I removed all apple files and re installed the latest itunes but am having the same problem.
    When I download itunes, it says that Ipod Service failed to start. I checked the services under task manager and when I try to start it, it says access denied. How to I get access and for the ipod service to start and run?

    Some anti-virus programs (e.g., McAfee) have this rule that can be invoked under the "maximum protection" settings: PREVENT PROGRAMS REGISTERING AS A SERVICE. If that rule is set to BLOCK, then any attempt to install or upgrade iTunes will fail with an "iPod service failed to start" message.
    If you are getting this problem with iTunes, check to see if your anti-virus has this setting and unset it, at least for as long as the iTunes install requires. Exactly how to find the rule and turn it on and off will vary, depending upon your anti-malware software. However, if your anti-virus or anti-malware software produces a log of its activities, examining the log may help you find the problem.
    For example, here's the log entry for McAfee:
    9/23/2009 3:18:45 PM Blocked by Access Protection rule NT AUTHORITY\SYSTEM C:\WINDOWS\system32\services.exe \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\iPod Service Common Maximum Protection:Prevent programs registering as a service Action blocked : Create
    Note that the log says "Common Maximum Protection: Prevent programs registering as a service". The "Common Maximum Protection" is the location of the rule, "Prevent programs registering as a service" is the rule. I used that information to track down the location in the McAfee VirusScan Console where I could turn the rule off.
    After I made the change, iTunes installed without complaint.

  • Thread won't run a second time

    Using JDK 1.4.1 on a Windows 2000 box
    After a thread is created, started and completes, it is not possible to start the same thread object a second time.
    I'm not sure what's going on here. It seems that a thread pool implementation could never work if what I've found is true. This seems unlikely, but my test program is very simple. If you run it you will notice that run() is called after the first start(), but not after the second. The isAlive() state returns false as expected after the join(), so it appears the thread has finished executing. I've tried sleeping in various ways waiting for the thread to start the second time, but it never starts.
    public class ThreadTest
        private static class MyThread extends Thread
            final public void run()
                System.out.println( "run() called" );
        private static void testThreadRestart()
            for ( int i = 0; i < 10; i++ )
                System.out.println( i );
                try
                    MyThread thread = new MyThread();
                    System.out.println( "start() called 1" );
                    thread.start();
                    thread.join();
                    System.out.println( "thread.isAlive() = " + thread.isAlive());
                    //Thread.sleep( 60000 );
                    System.out.println( "start() called 2" );
                    thread.start();
                    thread.join();
                    System.out.println( "thread.isAlive() = " + thread.isAlive());
                    // Try a sleep loop to wait for the thread to start.
                    for ( int j = 0; j < 1000; j++ )
                        Thread.sleep( 1 );
                    //Thread.sleep( 60000 );
                catch ( InterruptedException e )
                    // do nothing
        public static void main( String[] args )
            testThreadRestart();
    }

    I found the following information in "Concurrent Programming in Java" 2nd Edition, by Doug Lea.
    "Threads are not restartable, even after they terminate. Invoking start more than once results in an InvalidThreadStateException."
    The first part seems to be true, but the second part is only true if the thread is still alive. Once the thread completes, calling start() a second time results in no exception and no action.
    I did not find any such information in Sun's documentation.
    Apparently a thread pool implementation relies on threads that never "finish". That is the thread object never exits the run() method, but employs a mechanism by which it accepts new tasks, executes them. When the task completes, the thread's run() method loops and waits for a new task. run() is never exited.

  • Snmp commands dont work once the thread starts

    I am using multi-threading. Once my thread starts executing (using the CmtScheduleThreadPoolFunction), I am not able to run simple get and set snmp function, basically they never return. Any suggestions?
    Thank you all in advance.

    Hi qsa301,
    Does your function call work without multithreading?
    Is the function documented to be able to be called by multiple threads?
    Here are some KnowledgeBases about CVI and multithreading:
    Executing LabWindows/CVI Internet Library Functions from Multiple Threads
    http://digital.ni.com/public.nsf/websearch/88AC3C540ACFE65186257021005D2084?OpenDocument
    Multithreading in LabWindows/CVI
    http://zone.ni.com/devzone/cda/tut/p/id/3663
    General Information on Multithreading for C Programmers
    http://digital.ni.com/public.nsf/websearch/6ECCBAA87476EB22862568950071CCD6?OpenDocument
    Sending Parameters to a Thread Callback Function in LabWindows/CVI
    http://digital.ni.com/public.nsf/websearch/A50A89929B77EE06862571BF0015F42F?OpenDocument
    LabWindows/CVI and Thread Pools
    http://digital.ni.com/public.nsf/websearch/F968F9F8B100393786256D25005EAF8A?OpenDocument
    Gavin Fox
    Systems Software
    National Instruments

  • How many threads can be running at the same time

    Hi!!
    Dows anyone knows how many Threads can be running at the same time in the JVM.
    I'm making a multi thread client-server app and I would like to know how much simultneous connections the JVM support. I'm using one Thread per connection.

    Hi, thanks to all for your answers.
    I think that I made the wrong question, as you said: "that means the number of threads currently created".
    I'm worry about this because my application is already online (It's a mail server -SMTP and POP3 server using ORACLE for the users database- ) and some other user post in the "multi-tread forum" that almost any JVM can only have 700 threads created at the same time, and I've never heard or read anything about this.
    what you mean with the stack space (memory??)
    I'm using the JavaWebServer 2.0 and a servlet to start the main Thread.
    Again Thanks to all for the answers but I think that the schapel answer is the one that solve my doubt...

  • Sender File Adapter always "Polling interval started" without complete

    Hi,
    I have problem with sender file adapter suddenlty the status from Communication Channel Log monitoring always with polling started without completed.
    4/25/11 11:40:33 AM   Polling interval started. Length: 10.0 seconds
    4/25/11 11:40:23 AM   Polling interval started. Length: 10.0 seconds
    4/25/11 11:40:13 AM   Polling interval started. Length: 10.0 seconds
    4/25/11 11:40:03 AM   Polling interval started. Length: 10.0 seconds
    Normal :
    4/25/11 11:41:50 AM   Polling interval started. Length: 10.0 seconds
    4/25/11 11:41:50 AM   Processing finished successfully
    4/25/11 11:41:50 AM   Processing started
    4/25/11 11:41:40 AM   Polling interval started. Length: 10.0 seconds
    4/25/11 11:41:40 AM   Processing finished successfully
    4/25/11 11:41:40 AM   Processing started
    I have tried to stop and start the channel but still no luck. This problem only happen for this particular communication channel others channel is working fine.
    Please advise other solution before i need to restart the java engine since this in the production environment. The problem is some of the process was delayed because this issue. CC was delayed to pickup the file.
    Thank You in advance.
    FL

    Hi Abhistek,
    Thank you for your correction. It was typo.
    Which assumption is correct ?
    1. All 3 instance running together in the same time ?  or
    2. Either 1 of the instance running once time manage by clustering setting.
    Example :
    15:01:00   ---> A
    15:02:00  -
    > A
    15:03:00  -
    > B
    15:04:00   -
    > B
    Currently :
    15:01:00   -
    > A    
    15:01:00   -
    > B (lock)
    15:02:00  -
    > A
    15:02:00  -
    > B (lock)
    It seems all 3 instance lose control from clustering ?
    Regards
    FL

  • Stream-in images from client to server,without running the transmit code

    Hello all,
    Im using JMF for my current project.Right now,I am trying to only recieve images from the client without the client transmitting it.That is I dont want the transmit code to run on the client.
    I should just be able to stream in the images from client to server, without running the transmit code on client.
    Can this be done?
    Thanks in advance

    suppigs wrote:
    Can I know more about this?Sure.
    <Side A>
    You'd just need to write an application that doesn't have a GUI (so, a console-based application) that listens on some pre-determined port for a message to start broadcasting. Maybe you'd send it the IP/PORT number to start broadcasting on. Once it receives that message, it'd start broadcasting the web cam to the IP/PORT number until it received a message to stop. Once it stops, it'll just go back to waiting for the next "start" signal.
    <Side B>
    On the other side, you'd write an application that sends the start messages, receives/displays the videos, and then sends the stop signal. This will have a GUI, and be your "control program" so to speak.
    Then, once of have both of those programs working...if you're using Linux, you're done. If you're using Windows, you'd need to modify the <Side A> program so that it can run as a Windows service.
    There are a lot of ways to do this, you can google it or look at the following link:
    [http://twit88.com/blog/2007/09/19/open-source-software-to-start-up-java-as-windows-serviceunix-daemon/]

  • Why are the threads start and terminate randomly?

    Hi there,
    I got the program below. I am wondering why are the threads start and terminate randomly? Everytime, I run the program, it produces different results.
    I know that these four threads have got same normal priority (should be 5), and under windows there is something called timeslice. Then these four threads rotate using this timeslice. How do we know what exactly the timeslice is in seconds? If the timeslice is fix, then why the results are ramdom?
    Thanks in advance!
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package mythreadone;
    * @author Administrator
    public class MyThreadOne implements Runnable {
    String tName;
    Thread t;
    MyThreadOne(String threadName) {
    tName = threadName;
    t = new Thread(this, tName);
    t.start();
    public void run() {
    try {
    System.out.println("Thread: " + tName);
    Thread.sleep(2000);
    } catch (InterruptedException e) {
    System.out.println("Exception: Thread "
    + tName + " interrupted");
    System.out.println("Terminating thread: " + tName);
    public static void main(String args[]) {
    // Why are the threads start and terminate randomly?
    new MyThreadOne("1");
    new MyThreadOne("2");
    new MyThreadOne("3");
    new MyThreadOne("4");
    try {
    Thread.sleep(10000);
    // Thread.sleep(2000);
    } catch (InterruptedException e) {
    System.out.println(
    "Exception: Thread main interrupted.");
    System.out.println(
    "Terminating thread: main thread.");
    1. Firstly, I set in the main function:
    Thread.sleep(10000);
    and I run the program it gives:
    Thread: 1
    Thread: 4
    Thread: 2
    Thread: 3
    Terminating thread: 1
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    Run it again, it gives:
    Thread: 2
    Thread: 4
    Thread: 3
    Thread: 1
    Terminating thread: 2
    Terminating thread: 1
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    And my question was why it outputs like this? It suppose to be:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 1
    Terminating thread: 2
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    Why these four threads start and finish randomly each time I run the program? I use Windows, suppose there is a timeslice (i.e. 1 second), these threads have the same priority. Then the threads should start and finish in turn one by one. Am I right?
    2. My second question is:
    When I change the codes in the 'main' function into:
    Thread.sleep(10000); -> Thread.sleep(2000);
    it gives me the results like:
    Thread: 1
    Thread: 4
    Thread: 3
    Thread: 2
    Terminating thread: main thread.
    Terminating thread: 1
    Terminating thread: 4
    Terminating thread: 3
    Terminating thread: 2
    BUILD SUCCESSFUL (total time: 2 seconds)
    Run it again:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 3
    Terminating thread: main thread.
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    I tried several times. The main thread always terminates before or after the first child thread finished.
    My question is why it doesn't output something like:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: main thread.
    Terminating thread: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    or
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: 1
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 2 seconds)

    user13476736 wrote:
    Yes, my machine has multi-core. Then you mean that if I got a one core machine the result should always be:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 1
    Terminating thread: 2
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    ???No.
    >
    How to explain my second quesiton then? Why the main thread always terminates before some of the child threads end? Thanks a lot.

  • NOT STARTING WITHOUT SUPPLY

    I have hp compaq610 running on windows8!
    1)my laptop is not starting without a/c supply.
    2)battery showing 30% full "plugged in,not charging"
    3) and if i remove adapter wire after starting starting,laptop is going off!!
    plzz someone help i tried uninstalling driver but didnt worked

    How was it solved?

  • Maverick starting to run slow

    I've got a iMac with 8gb installed, a core 3.1GHz i7 processor.
    There are 2 areas where the system is running ridiculously slow, when I start any app. The computer doesn't respond at all for 30 seconds+.
    I've just timed the startup of Lexar's Image Rescue 4 program. From clicking it's icon in the dock it took 50 seconds before the icon started bouncing, 56 seconds for the app's flash window to appear and 1 minute for the main window to appear.
    The other speed issue I have is open and save dialogs. Click Documents, for example, the gear wheel spins for nearly a minute before the folder's contents is displayed.
    Once the programs have started they run fine, no problem. Once Documents contents have been displayed everything runs smoothly (unless you click to a lower level folder in which case that will be slow).
    I can't guarantee it, but I think this all started with the last system upgrade, to 10.9.1 which I installed on 17 December.
    Anyone else getting this problem?
    Jack

    If you don't already have a current backup, back up all data before doing anything else. This procedure is a diagnostic  test. It changes nothing, for better or worse, and therefore will not, in itself, solve your problem. The backup is necessary on principle, not because of anything suggested in this comment. There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The procedure will help identify which such modifications you've installed, as well as some other aspects of the configuration that may be pertinent.
    Don’t be alarmed by the seeming complexity of these instructions — they’re easy to carry out. Here's a brief summary: You copy a line of text from this web page into a window in another application. You wait about a minute. Then you paste some other text, which will have been copied automatically, back into a reply on this page. The sequence is copy; paste; paste again. That's all there is to it. Details follow.
    You may have started the computer in "safe" mode. Preferably, these steps should be taken while booted in “normal” mode. If the system is now running in safe mode and is bootable in normal mode, reboot as usual. If it only boots in safe mode, proceed anyway.
    Below are instructions to enter a UNIX shell command. It does nothing but produce human-readable output. However, you need to think carefully before running any program at the behest of a stranger on a public message board. If you question the safety of the procedure suggested here — which you should — search this site for other discussions in which it’s been followed without any report of ill effects. If you can't satisfy yourself that these instructions are safe, don't follow them.
    The command will line-wrap or scroll in your browser, but it's really a single long line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it.
    If you have more than one user, and the affected user is not an administrator, then please run the command twice: once while logged in as the affected user, and once as an administrator. The results may be different. The administrator is the user that is created automatically on a new computer when you start it for the first time. If you can't log in as an administrator, just run the command as the affected user. Most personal Macs have only one user, and in that case this paragraph doesn’t apply.
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign ($) or a percent sign (%). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Triple-click anywhere in the line of text below on this page to select it:
    clear; PB=/usr/libexec/PlistBuddy; PR () { [[ "$o" ]] && o=$(sed 's/^/   /' <<< "$o") && printf '\n%s:\n\n%s\n' "$1" "$o"; }; PC () { o=$(grep [^[:blank:]] "$2"); PR "$1"; }; PF () { o=$($PB -c Print "$2" | awk -F'= ' \/$3'/{print $2}'); PR "$1"; }; PN () { [[ $o -eq 0 ]] || printf "\n%s: %s\n" "$1" $o; }; a=$(id | grep -w '80(admin)'); [[ "$a" ]] && sudo true && r=1 || r=; { [[ "$a" ]] || echo $'No admin access\n'; [[ "$a" && ! "$r" ]] && echo $'No root access\n'; system_profiler SPSoftwareDataType | sed '8!d;s/^ *//'; o=$(system_profiler SPDiagnosticsDataType | sed '5,6!d'); fgrep -q P <<< "$o" && o=; PR "POST"; o=$(($(vm_stat | awk '/Pageo/{sub("\\.",""); print $2}')/256)); o=$((o>=1024?o:0));  PN "Pageouts (MiB)"; s=( $(sar -u 1 10 | sed '$!d') ); [[ ${s[4]} -lt 90 ]] && o=$( printf 'User %s%%\t\tSystem %s%%' ${s[1]} ${s[3]} ) || o=; PR "Total CPU usage"; [[ "$o" ]] && o=$(ps acrx -o comm,ruid,%cpu | sed '2!d'); PR "Max %CPU by process (name, UID, %)"; o=$(kextstat -kl | grep -v com\\.apple | cut -c53- | cut -d\< -f1); PR "Loaded extrinsic kernel extensions"; o=$(launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)|\.[0-9]+$/{print $3}'); PR "Loaded extrinsic user agents"; o=$(launchctl getenv DYLD_INSERT_LIBRARIES); PR "Inserted libraries"; PC "cron configuration" /e*/cron*; o=$(crontab -l | grep [^[:blank:]]); PR "User cron tasks"; PC "Global launchd configuration" /e*/lau*; PC "Per-user launchd configuration" ~/.lau*; PF "Global login items" /L*/P*/loginw* Path; PF "Per-user login items" L*/P*/*loginit* Name; PF "Safari extensions" L*/Saf*/*/E*.plist Bundle | sed 's/\..*$//;s/-[1-9]$//'; o=$(find ~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \) | wc -l); PN "Restricted user files"; cd; o=$(find -L /S*/L*/E* {,/}L*/{A*d,Compon,Ex,In,Keyb,Mail/Bu,P*P,Qu,Scripti,Servi,Spo}* -type d -name Contents -prune | while read d; do ID=$($PB -c 'Print :CFBundleIdentifier' "$d/Info.plist") || ID=; ID=${ID:-No bundle ID}; egrep -qv "^com\.apple\.[^x]|Accusys|ArcMSR|ATTO|HDPro|HighPoint|driver\.stex|hp-fax|JMicron|microsoft\.MDI|print|SoftRAID" <<< $ID && printf '%s\n\t(%s)\n' "${d%/Contents}" "$ID"; done); PR "Extrinsic loadable bundles"; o=$(find /u*/{,*/}lib -type f -exec sh -c 'file -b "$1" | grep -qw shared && ! codesign -v "$1"' {} {} \; -print); PR "Unsigned shared libraries"; o=$(system_profiler SPFontsDataType | egrep "Valid: N|Duplicate: Y" | wc -l); PN "Font problems"; for d in {,/}L*/{La,Priv,Sta}*; do o=$(ls -A "$d"); PR "$d"; done; [ "$r" ] && { o=$(sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix\.cron)|org\.(amav|apac|calendarse|cups|dove|isc|ntp|post[fg]|x)/{print $3}'); PR "Loaded extrinsic daemons"; o=$(sudo defaults read com.apple.loginwindow LoginHook); PR "Login hook"; o=$(sudo crontab -l | grep [^[:blank:]]); PR "Root cron tasks"; }; o=$(syslog -k Sender kernel -k Message CReq 'GPU |hfs: Ru|I/O e|find tok|n Cause: -|NVDA\(|pagin|timed? ?o' | tail -n25 | awk '/:/{$4=""; print}'); PR "Log check"; } 2> /dev/null | pbcopy; exit
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting. The line you pasted will disappear.
    If you're logged in as an administrator, you'll be prompted for your login password. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. If you make three failed attempts to enter your password, the command will run anyway, but it will produce less information. In most cases, the difference is not important.
    The command may take up to a few minutes to run, depending on how many files you have and the speed of the computer. Wait for the line "[Process completed]" to appear.
    You can then quit Terminal. The output of the command will have been copied to the Clipboard automatically. All you have to do is paste into a reply to this message by pressing command-V again.
    Please note:
    ☞ This procedure is all copy-and-paste — type only your login password when prompted. When typing it, you won't see what you're typing. Make sure caps lock is off.
    ☞ Remember to post the output. It's already in the Clipboard when you see "[Process completed]" in the Terminal window.
    ☞ If any personal information, such as your name or email address, appears in the output, anonymize it before posting. Usually that won't be necessary.

  • Hi, Accidentally somebody screw up Photoshop CS4 and InDesign CS4 Master edition on a MAC computer in the school. The install discs did not start to run therefore I can't  reinstall the 2 missing programs. I want to install the softwares, therefore I down

    Hi, Accidentally somebody screw up Photoshop CS4 and InDesign CS4 Master edition on a MAC computer in the school. The install discs did not start to run therefore I can't  reinstall the 2 missing programs. I want to install the softwares, therefore I download those from here.  The downloaded program refuse to accept the serial number which was given to the school when they purchased the Master Collection CS4 MLP A00. Thank you for your help, in advance.

    Hi Jeff,
    Thank you. I am a little bit busy at work, sorry for the delayed reply. I tried to solve the problem, but it still exists. The 3rd of the Adobe disk is damaged someway. I tried to run on my mac at home and it has a failure. So I think we have no other choice that to download the full pack of master collection. I had a discussion with the IT expert and he figured out that company does not exist any more from where they purchased the Adobe Master Collection for Mac and PC. So If you would be kind to help me, what kind of information ID or any kind of document would be needed to identify the purchaser institute (us). I don't think any of us has an account at the Adobe. I will try to figur out. I desperately need to replace Photoshop and InDesign as without them it's really harsh to teach the kids fot the graphic design.
    Sincerely yours.
    Peter

  • Thread start (and end?) times?

    Is it possible to see when a thread was started? I have looked at various pieces of doc on JPDA, Java API, etc. and cannot see any references to this. Of course I could track it myslef when threads are created, but I was wondering if the JVM does that for me?

    It would be handy in diaglostic situations to possibly see how long a thread has been running, especially if one that whouldn't be running long happens to now be doing so.

Maybe you are looking for