App running 3000 threads - Problems

Hello everyone,
I am writting an app that created 3000 thread, this app polls information from different sources and each thread is configured to execute a specific job.
The app seems to create the 3000 threads without problems, and it seems to execute well for a random period of time, but afterwards the threads stops working and I don't get any exception message.
I'm currently working on creating some logs, to gather more information about the problem, but I sincerly think that the threads are stopping in which case the logs will not help much.
Is there any conciderations when working wiht a large amount of threads. Is there any link to documentation related to this issue ?
Thanks very much for your help and time.
Regands,
Fabian.

If the mapping between Java threads and operating-system threads is one to one (as done in several JVM implementations, like Sun's JVMs in Windows and Solaris), you can expect problems if your operating system can't handle so many threads in a single process.
If you want to use lots and lots of threads only for breaking a single computing problem, for instance, you can try the FJTask (from the util.concurrent library from Doug Lea - http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html).
You can use some kind of "thread pooling" (use the util.concurrent library from Doug Lea, see link above) if your problem can be handled with "thread pools".
Some problems can be handled with the java.nio package if you want to use Asynchronous I/O - beware, it is not easy to transform a program using Synchronous I/O to a program using Asynchronous I/O.

Similar Messages

  • Multiple Runs of Thread Problem

    hello friends ,
    i have the following code where there are two threads and they will execute simultaneously
    but the error is
    <code>
    import java.util.*;
    import java.lang.*;
    class Demo1.java extends Thread
    public void run()
    for (int i=0;i<10li++)
    System.out.println("Demo 1"+i)
    try
    Thread.sleep(1000);
    catch(InterruptedException e)
    System.out.println("some distrubance " +e);
    class Demo2 extends Thread
    public void run()
    for(int i=0;i<10;i++)
    System.out.println("Demo 2"+i);
    try
    Thread.sleep(1000);
    catch(InterruptedException e)
    System.out.println("some disturbance");
    public class MultipleRuns
    public void main(String args[])
    Demo1 d1=new Demo1();
    Demo2 d2=new Demo2();
    d1.start();
    d2.start();
    </code>
    the error its giveing is while compiling
    [root@server java]# javac MultipleRuns.java
    MultipleRuns.java:4: '{' expected
    class Demo1.java extends Thread
    ^
    MultipleRuns.java:58: '}' expected
    ^
    MultipleRuns.java:55: cannot resolve symbol
    symbol : method start ()
    location: class Demo1
    d1.start();
    ^
    3 errors
    so please guide me where iam going wrong
    with regards
    rama kanth

    i have changed like the following even though i get the errors
    <code>
    import java.util.*;
    import java.lang.*;
    class Demo1.java extends Thread
    public void run()
    for (int i=0;i<10li++)
    System.out.println("Demo 1"+i)
    try
    Thread.sleep(1000);
    catch(InterruptedException e)
    System.out.println("some distrubance " +e);
    class Demo2 extends Thread
    public void run()
    for(int i=0;i<10;i++)
    System.out.println("Demo 2"+i);
    try
    Thread.sleep(1000);
    catch(InterruptedException e)
    System.out.println("some disturbance");
    public class MultipleRuns
    public void main(String args[])
    Demo1 d1=new Demo1();
    Demo2 d2=new Demo2();
    d1.start();
    d2.start();
    </code>
    eroors are
    [root@server java]# javac MultipleRuns.java
    MultipleRuns.java:4: '{' expected
    class Demo1.java extends Thread
    ^
    MultipleRuns.java:58: '}' expected
    ^
    MultipleRuns.java:55: cannot resolve symbol
    symbol : method start ()
    location: class Demo1
    d1.start();
    ^
    3 errors
    so please guide me
    with regards

  • I am having problems with migration assistant (windows pc to Mac 2011) When I get to the 'Quit other applications' box and click continue, nothing happens. There are no other apps running - any ideas, please?

    I am having probems with migration assistant. Trying to transfer data from a windows laptop to iMac 2011. It was working fine when I did the set-up yesterday, but it was going to take hours to transfer some videos so I quit the process with the intention of doing it again at a later stage. However today I find that everytime I get to the 'Quit other applications' box on the Mac and click 'continue', nothing happens. Have checked mission control and confirmed no other apps running. Tried several times with the same result every time. Migration Assistant running on my laptop with the 'Waiting for mac to connect' box displayed. Mac is connected to wi-fi OK as able to use Safari and access internet. Any ideas, please?

    Thanks for your suggestions. Have managed to get Migration Assistant working but now have a new problem, i.e. where does it save the transferred files?!! Searched a few forums and it seems it saves it under your old username, or suchlike. Anyway I tried logging on as a new user using my old user name but there were only a handful of files there, couldn't locate the majority of stuff from my old laptop. Anyway I don't intend to go through any more hoops with MA - will just save the important stuff to an external drive and transfer it that way. Not impressed with MA at all. I thought it was supposed to be a user-friendly tool to simplify the transfer from pc to Mac - not my experience, I'm afraid!

  • Slow WiFi on iOS 8? An app running in the background might be the problem

    I've discovered a problem with Angry Birds Friends on my iPhone 6. When I am connected to my wifi, the app does not load. The log-in status bar gets about 3/4 of the way across but doesn't complete. If I hit the home button to "close" the app and try to do anything else on my iPhone that connects to the internet, they don't connect or the speed is REALLY slow. In fact, when I run a speedtest, my download speeds which are normally at about 23 MBPS drop down to a mere .5 MBPS. If I open the multitask bar and quit the app from there, my download speeds go back to normal. I have also verified the same behavior on my iPad Air. So it seems Angry Birds Friends is having some sort of wifi connectivity issue that impacts the wifi even when I'm not in it. It is possible that other apps might cause similar problems by running some sort of activity in the background that impacts wifi connectivity. I can consistently recreate this behavior with this app and contacted Apple support today to report it. In fact they put me in touch with a senior person and I provided them with the details. I'm waiting to hear back from him after he contacts their engineering team.

    I have exactly the same problem with Angry Birds Friends, I have a two year old iPhone 5 running the latest iOS, the app loads perfectly when on the mobile network but freezes 3/4 of the way through loading on wifi, I have used other people's wifi and experience the same issue. I haven't reported it like you, but it is very weird.

  • Sun Java System Web Server 6.1 SP3 service-j2ee threads problem

    Hi,
    Sorry my english.
    I'm an intermediate Java programmer and a newbie in
    the Sun's web servers world.
    I'm doing an evaluation of an web applicaction
    written in Java Servlets that is
    supposed to have a leaking threads problem. We use
    SunOS 5.9 (... sun4u sparc SUNW,UltraAX-i2) and
    JVM 1.5 Update 4 (the problem is presented too
    in SunOS 5.8 and JVM 1.4.2_04).
    We have seen, thanks to 'prstat' (PROCESS/NLWP) a
    increasing thread's growing in one of the process
    that correspond to our web server instance (I'm sure I'm
    looking the right process). I have checkout the source
    code and it seems like the app doesn't have threads
    problems. I have used the Netbeans Profiler and I see a
    high number of threads called service-j2ee-x that grows
    in congestion moments and never disappear.
    Anybody could help me with suggestions?
    Thank you very much.

    Elvin,
    Thankyou, yes I am unfamiliar with debugging Java apps. I got the web server Java stack trace and I have passed this on to the developer.
    The web server finally closes the socket connection after the total connections queued exceeds 4096.
    There are several hundred entries like this... waiting for monitor entry.. could be a deadlock somewhere?
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "service-j2ee-506" prio=5 tid=0x04b62a08 nid=0x17a waiting for monitor entry [dd74e000..dd74f770]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.verity.search.util.JSDispenser.getConnResource(Unknown Source)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: - waiting to lock <0xe979b2b0> (a com.verity.search.util.JSDispenser)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.verity.search.DocRead.getDoc(Unknown Source)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.verity.search.DocRead.getDoc(Unknown Source)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.verity.search.DocRead.docViewIntern(Unknown Source)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.verity.search.DocRead.docView(Unknown Source)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at au.com.relevance.viewDoc.PdfXmlServlet.performRequest(PdfXmlServlet.java:120)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at au.com.relevance.viewDoc.PdfXmlServlet.doGet(PdfXmlServlet.java:141)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "StandardManager[highlight]" daemon prio=5 tid=0x000f3530 nid=0x1e waiting on condition [e15ff000..e15ffc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.sleep(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.threadSleep(StandardManager.java:800)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.run(StandardManager.java:859)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "WebappLoader[highlight]" daemon prio=5 tid=0x000f3328 nid=0x1d waiting on condition [e16ff000..e16ffc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.sleep(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.loader.WebappLoader.threadSleep(WebappLoader.java:1214)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.loader.WebappLoader.run(WebappLoader.java:1341)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "StandardManager[]" daemon prio=5 tid=0x000f2b08 nid=0x1c waiting on condition [e1b7f000..e1b7fc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.sleep(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.threadSleep(StandardManager.java:800)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.run(StandardManager.java:859)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "WebappLoader[]" daemon prio=5 tid=0x000f2900 nid=0x1b waiting on condition [e1c7f000..e1c7fc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.sleep(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.loader.WebappLoader.threadSleep(WebappLoader.java:1214)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.loader.WebappLoader.run(WebappLoader.java:1341)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "StandardManager[sitesearch]" daemon prio=5 tid=0x000f1cd0 nid=0x1a waiting on condition [e23ff000..e23ffc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.sleep(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.threadSleep(StandardManager.java:800)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.run(StandardManager.java:859)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "WebappLoader[sitesearch]" daemon prio=5 tid=0x000f1ac8 nid=0x19 waiting on condition [e24ff000..e24ffc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.sleep(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.loader.WebappLoader.threadSleep(WebappLoader.java:1214)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.loader.WebappLoader.run(WebappLoader.java:1341)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "StandardManager[search]" daemon prio=5 tid=0x000f0a88 nid=0x18 waiting on condition [e317f000..e317fc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.sleep(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.threadSleep(StandardManager.java:800)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at org.apache.catalina.session.StandardManager.run(StandardManager.java:859)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "Signal Dispatcher" daemon prio=10 tid=0x000ef840 nid=0x12 waiting on condition [0..0]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "Finalizer" daemon prio=8 tid=0x000ef638 nid=0x10 in Object.wait() [fa27f000..fa27fc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Object.wait(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: - waiting on <0xe917fb10> (a java.lang.ref.ReferenceQueue$Lock)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: - locked <0xe917fb10> (a java.lang.ref.ReferenceQueue$Lock)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "Reference Handler" daemon prio=10 tid=0x000ef430 nid=0xf in Object.wait() [fa37f000..fa37fc28]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Object.wait(Native Method)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: - waiting on <0xe917fb78> (a java.lang.ref.Reference$Lock)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.Object.wait(Object.java:429)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: - locked <0xe917fb78> (a java.lang.ref.Reference$Lock)
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "main" prio=5 tid=0x000ee3f0 nid=0x1 runnable [0..ffbff200]
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "VM Thread" prio=5 tid=0x004ee328 nid=0xe runnable
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "VM Periodic Task Thread" prio=10 tid=0x004ee5d0 nid=0x16 waiting on condition
    [15/May/2006:22:01:51] warning ( 3196): CORE3283: stderr: "Suspend Checker Thread" prio=10 tid=0x004ee548 nid=0x11 runnable
    [15/May/2006:22:15:10] failure ( 3196): HTTP3287: connection limit (4096) exceeded, closing socket

  • How do I have two apps running side by side i.e. calculator

    How can i have x2 apps running side by side ie notebook & calculator without going back & forth.
    I have tried several browser type apps but these have not been very succesfull.
    My daughters samsung does this no problem at all.
    Does anyone no why it seems so hard to acheive especially after all the updates ect since launch.
    Probably going to go down samsung route.
    Dave

    7 month old thread, probably by this time OP already has a Note.
    As for the rest of us, we did understand. Kappy answered correctly that it could not be done. Its jus not something iOS is programmed to do.
    We then gave some alternatives. no one suggested it was what the OP wanted to do. Just something that could be done to approximate the requirement.
    If that doesn't work for you, then there's nothing else that can be done.
    Its not a currently supported feature on iOS. You can offer the suggestion to Apple on their feedback page.
    http://www.apple.com/feedback/
    There's nothing wrong with buying a different product that fits your needs more than an iPad.
    Its like tryng to take a Sedan offroad. Was it built to do that?  No. Can it, probably limitedly but the experience is not going to be very pleasant. Buy an Offroad vehicle and you can go offroad just fine. You don't whine because the sedan can't do it. You get something that can.

  • Mac App Store app running programs in /usr/bin or /sbin

    Hello,
    The Mac Developer Program License Agreement says:
    3.3.4          All files necessary for the Application to execute must be in the Application bundle submitted to Apple and must be installed by the Mac App Store.
    This precludes using NSTask to run a program in /usr/bin or /sbin to obtain some output. Seems pretty restrictive since there is a lot of good functionality there and most of it without copyright. There is a fine line between running /sbin/md5 on a file to get a hash, and calling md5() in libssl.dylib, making me wonder what is the purpose of the restriction.
    The question, dumb as it may sound given section 3.3.4 of the agreement, is, should I eliminate all code that runs other programs?
    If the Mac App Store app runs without running other programs, but includes other features by running those programs, does it still violate section 3.3.4?
    Has anyone submitted a program that calls others and, if so, was it accepted?
    Thanks

    CTSdev wrote:
    I've never had a problem with NSTask. In what way is it clunky?
    You have to set it up, launch it, possibly send it data, collect the output, parse it. I have an app circulating around here called EtreCheck that does lots and lots of NSTask. It isn't sandboxed though. The problem is that your NSTask inherits your app sandbox and it may expect to read or write to places that it can't. You can use it, but if there is an alternative in a framework or library, that would be better. I think the biggest problem with NSTask is that they are procedural. You have to start it, run it, wait for it, and then handle the output. You will have to do that in a thread or block.
    I used /sbin/md5 as an example since it has an analog library routine. /usr/bin/cksum is the more direct way to verify file integrity. I would also like to run /usr/bin/compress. Certainly easier than writing & testing LZW or Huffman code.
    I think you could probably run both of those. There may be easier versions around. iOS people can't do any of that so there may be some handy Cocoa libraries that will do just what you need. If you just want to compress data, libz is in the OS and not too terribly difficult to use.
    I will probably just have my app run those programs and describe this in my submission to Apple, If they say no, then I'll code those pieces too.
    I don't think you really have to describe anything other than some of your entitlements. As long as it works on your machine and you aren't calling any private APIs then you should be fine. I was only half-joking before. If you really aren't a fraudster, then you really have nothing to worry about at all.
    I don't know what kind of checks they do for that kind of thing. Pretty much everything I have done so far has some feature that looks like it should be forbidden by the sandbox, but really isn't. I display copyrighted Apple art in ways that aren't normally possible. I launch Terminal. I just released an app that has serious amounts of integration with the Finder. No problems.

  • Cant syncronize! Threads problem

    Hello everybody,
    recently i posted a question(im new to threads) and it was asked immediately but now i have another
    type of problem.
    Please read here the initial post and the answer and please give me any ideas..
    Initial Post
    Hi everybody,i have this thread problem(i'm new to java and h
    ave no idea what exactly to do).
    Well,in my applet i have this action performed method
    that i imagine is in the event dispatch thread.
    This method calls as u see, two other methods of a class named CPU(.
    Note that fetch and execute are observed classes and my applet class
    is the observer.
    The problem is that during the execution of fetch() and execute(),
    inside these methods change some things and so they call notifyObservers(Object arg)
    passing to the applet the argument and so the applet updates some text components.
    But as you can immagine there is no time for the gui to update himself so i see nothing.
    So, my question is which of the methods need to be in a separate thread so to ensure
    visible results(component updating)?
    Perhaps,the update method needs to be invokedLater with SwingUtilities?
    Please give me an example code if possible.
    Here is the actionPerformed code(from the applet class) and the fetch method:
        void executeProgramButton_actionPerformed(ActionEvent e) {      
    int numInstr = this.machine.ram.segmentSize;       
    for (int i = 0; i < numInstr; i = i + 4) {           
    machine.cpu.fetch();           
    machine.cpu.execute();       
    /*The following method is in the CPU class
    fetch method:here the observedPC is the observable value
    that notifies the observer(the main applet)
    that does: pcTextField.setText(arg.toString());*/   
    public void fetchInstructionProgram() {       
    observedPC = Integer.toString(pc);       
    setChanged();       
    notifyObservers(observedPC);       
    instructions++;       
    instruction=readOperation(cache.instructionfetch,pc);       
    pc = pc + 4;    }
    Answer to initial post
    Author: stevejluke
    One way could be to put the content of the action performed method into a new thread, then use invokeLater in your Observers that cause GUI updates:
        void executeProgramButton_actionPerformed(ActionEvent e) {     
    new Thread()       {      
    public void run()        {         
    int numInstr = this.machine.ram.segmentSize;         
    for (int i = 0; i < numInstr; i = i + 4)           {           
    machine.cpu.fetch();           
    machine.cpu.execute();         
    }.start();    }
    // In your Observer    public void update(Observable o, Object arg)    {     
    SwingUtilities.invokeLater(new Runnable() {      
    public void run()        { 
    /* your GUI afecting code
    });[i]
    Or something like that.
    You might need to watch for synchronizing things
    He was right...GUI is responsive but the results...
    Well,let me describe the new problem.
    Here you cant see the method execute().
    The problem is a synchronization problem.
    Actually,what the two methods do is:fetch() updates the value of a long called instruction and execute() takes this value and do some things.Note also that the time the execute method needs to finish is not
    always the same.By that, i mean that it depends on the value of the instruction updated by fetch().
    By putting some System.outs before and after updating i realized that there are delays or sometimes
    i noticed that fetch() executes 2 times before execute() takes control.
    So,i created some synchronized private methods set and get to control access to these resources.
    Better but still not correct...
    What should i look?Where stays the answer?
    How to synchronize these two methods on these resources?
    Thank you in advance,
    Chris

    I think that your fetch and execute has a "Producer-Consumer Relationship"
    in such cases you can make the producer place the produced value in to a queue and consumer take the vlues from the queue
    In the producer thread it sleeps for a while and try again if the Queue is full
    In the Consumer thread it sleeps for a while if the Queue is empty and then try again
    Or you can do as follows
    In the Producer thread it waite() if the Queue is full
    In the Consumer thread it waite() if the queue is empty
    When ever Producer put a value in to the Queue it calls the notify on Consumer and when ever Consumer takes a value from Queue it calls the notify() on Producer
    you can even use notify all
    I think thiere is no built in Queue class in java so you will have to write one here is a example
    public class MyLongQueue{
                long data[];
                int head, tail;
                int size;
               public MyLongQueue(int size){
                    data = new long[size];
                    head = -1;
                    tail = -1;
                    this.size = 0;
                public synchronized boolean isFull(){
                    return (size==data.length);
                public synchronized boolean isEmpty(){
                    return (size==0);
                public synchronized boolean  insert(long l){
                    if (size==data.length) return false; //Queue is full cant add more data
                    tail = (tail + 1) % data.length;
                    data[tail] = l;
                     size++;
                    return true;
               public synchronized long remove(){
                   if (size==0) throw new ArrayIndexOutOfBoundsException();
                   size--;
                   head = (head + 1) % data.length;
                   return data[head];

  • Why is my ipod so slow and laggy? i have lots of space on it, my history is deleted, i dont have multiple apps running! I have an iPod 4th Gen for about 2 years now and I don't know what to do.... Please help

    why is my ipod so slow and laggy? i have lots of space on it, my history is deleted, i dont have multiple apps running! I have an iPod 4th Gen for about 2 years now and I don't know what to do.... Please help

    Periodically double click the home button and close all the apps in the recently used dock. Then power off and then back on the iPod. This frees up memory. The 4G only has 256 MB of memory.
    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          

  • Adobe CC apps running s_____l_____o_____(wait for it)______w.

    Hey gang. I have an iMac running Mavericks OS.
    2010 model running Intel i7 quad core, 16GB RAM with 1TB HHD and 128GB SSD. When opening Ai or Muse, the apps are running freakishly slow. Example; when moving an object I have to wait for the object to catch up to my mouse...  I was running all my adobe apps off the SSD, then tried running them off the HD, no luck.
    I was having this poblem with my old laptop PC and decided to switch to a more powerful Mac. I'm not dogging PC's I use a PC with the same guts at work (and the same apps run smooth). Any body know of any reason these apps are so slow.
    Please Help, I'm desperate (said with extensive over exageration). Thanks
    Cheers

    If you have a problem with payments or downloading or activating programs, this IS the place... otherwise the people in the individual product forums know a lot more about the individual products
    If you don't want to go to those forums that is, of course, your choice
    http://forums.adobe.com/community/download_install_setup/creative_cloud_faq may have a link to help

  • APP RUN  EXECUTION ERROR - F110.

    Dear Sap Experts,
    My User executed program on Run Date: 13/02/2012 and Next Run Date: 14/02/2012. Once he edit proposal done he got this error. My vendor is having open items but not yet cleared when i check job in sm37 status is showing Finished. How can i reschedule this program, At this stage APP Run Deletion is not possible. How can i complete this program through Run or Jobs.
    While Executing the APP the following error is as follows. IF this is possible with job pls tell me how to proceed further in production. 
    Please advise me.
    Parameters have been entered
       Payment proposal could not be carried out
       Payment run has been scheduled 02/12/12 13:53:17
    Job was not released
    Pls help me in this regard.
    Thanks
    Hussain
    Edited by: Csaba Szommer on Feb 12, 2012 4:34 PM

    Hi,
    Payment procedures are derived for the company code from setting in Bank determination in T Code FBZP. Here you need to configure for concerned company code, in your case WIPR for USD currency:
    Ranking order( Mention for the payment method which you are using in the payment run).
    Concerned Bank Accounts.
    Available Amounts.
    Try and do come back if u face any problem
    Regards,
    Rohit

  • F110,  APP run,  payment advice,  Very Urgent

    Hi,
    All
    I have an very urgent problem which needed to be solved immidiatly,  I need to prepare a payment advice form as per the requirement of the client,  The problem is, I unble to test the developed form at APP run,    I want know where or How I can see the preview or print of the payment advice  so that I can test it and send to client immidiatly,  client is asking as very urgent,  as the project is already on LIVE, 
    Kindly help to this,  and very thankful to all
    Thanks & REgards,
    Zeenathunnisa

    HI,
    I have configured the payment advice and assigned the variant to run upon the payment program to print the payment advice. but the log of the payment shows me the "payment medium created in the format"
    Abap/4 processor error: "Call_function_parm_missing"
    I think  am missing some configuration. Can any body provide me how to check the configuratio and what is the necessary configuration to be done for payment advice print and we are not using the check print option.
    "Requirement is when the payment run is done it should print the payment advice also"
    Earleir reply is greatly appreciated and awarded.
    Is it possibel to print payment advice for manual payment also.
    Best Regards
    Rajesh

  • How do I run a thread without its panel.

    I have created a vi in my application that I run as a thread. I run the thread by using an invoke node.
    When I am testing under LabView everything is fine but when I create the executable I have found problems.
    As I am starting the thread with an invoke node, the vi does not show in the application builder unless I add it as a top level vi. When I add it as a top level vi, the panel is shown when I run the application.
    I don't want to show the panel because firstly theres nothing on it anyway and secondly it looks untidy.
    Dave.

    Brian
    I tried that already with no effect. I have attached an example of my problem. This shows a meter on the front panel. A vi running as a thread writes a value to a global every 20ms and this is then read by the front panel and written to the meter.
    Dave.
    Attachments:
    Thread_test.zip ‏18 KB

  • How to run multiple Thread using Scheduler's in 1.5

    Hi,
    I have a scenario, in which I have to run a Thread at every 15 minutes, If the first Thread is not Finished in 15 min then new Thread has to start.
    Currently I implemeted with java 1.5 schedulers, but the problem is if my first Thread is taking more than 15 min, then no new Thread is starting.
    Following is my Code:
    TestAccountingThread accountingThread = new TestAccountingThread();
    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
    scheduler.scheduleAtFixedRate( accountingThread, 0, 60, SECONDS );
    Can any one help on this, This is really urgent.
    Regards,
    Suman

    if my first Thread is taking more than 15 min, then no new Thread is startingIf it takes more than 15 min, manually run a new scheduler with initial-delay=0 and shutdown the current one when the current execution is finished --- and repeat this logic in a conditional loop.
    Could this be what you want?

  • Some events are not dispatched when app runs in background

    My Android app has a TIMER event which fires once every second to connect a TCP socket (class flash.net.Socket) and send a request.
    A packet sniffer confirms that a socket is in fact connecting, request is sent, reply comes back and connection is closed, all happening once per second.
    Clearly, even with the app in the background, the TIMER event is occurring every second, because the timer handler is initating every socket.
    But not every closing connection causes a CLOSE event to dispatch, because my close handler is called less frequently.  Sometimes once in 3 seconds, 8 seconds or even longer.
    The CLOSE dispatches correctly once per second when the app is in the foreground.
    Why are CLOSE events being missed when the app is in the background?  What is the difference between a TIMER event and a CLOSE event, causing one to dispatch correctly but not the other?
    Thanks.

    I've narrowed my problem down by chopping pieces of code until it works, and I think I have it narrowed down to the code that uses FlexGraphing but need to check a bit more...
    It's odd that it works in Flex3 builder though, and there are no errors when I run in as AIR. In fact, the app RUNS, since it is in the task manager, but it won't appear.

Maybe you are looking for

  • Purchase order output type NEU is not get assigned automatically

    Dear All, when i am creting purchase order the output type NEU is not get assigned automatically. I have maintained message condn record for NEU and for specific PO doc type NB. same problame i was facing for the inventory docuemnts but i was resolve

  • How to create configuration of a variant material based on funciton module

    Hello, ABAP experts, I want to create configuration of a variant material based on FM ( MRP3 view, set configurable material and configure the variant ). I use fuction modules:     CUXM_SET_CONFIGURATION     CUCB_CONFIGURATION_TO_DB and subsequently

  • Ipad mini keeps shuting down randomly

    my ipad mini keeps rebooting itself is there a way to fix it? i have try restoring it but that didn't work. its also keeps shutting down after 15 or 20 mins sometimes its freezes on the passcode screen and then it shutsdown with the apple logo showin

  • SAP ISU IDE

    Hi there, I am looking for the configuration notes on setting up IDE from a ISU point of view.  Also the notes on what is new on IDE. If there is anything on this I will appreciate emensly from anyone. thanks

  • Need MDF 1.3

    My CW installation is running Common Services 3.3.0 with MDF 1.25. Going via the GUI in CW to update Common Services (either Software Update or Device Update) from cisco.com returns the message that I am running the latest version. Yet when I downloa