Java threading problem... threads only work on 1 processor

I've got a iterative deepening problem that i have to parallelize. As far as i know i did everything correctly however everything seems to be running on 1 processor instead of 2 processors. As far as i know i am using threads (-Xprof either defines them as thread-1 thread-2 or pool1-thread1,depending on the method used for issueing)
the worker thread is:
public int solutionsT(Board board, int currentDepth) {
        int temp = 0;
        int result = 0;
        if (board.distance() == 0) {
           return 1;
        if (board.distance() > board.bound()) {
            return 0;
        Board[] children = board.makeMoves();
        result = 0;
        for (int i = 0; i < children.length; i++) {
            if (children[i] != null) {
                temp = solutionsT(children, currentDepth + 1);
if(temp != 0){
result += temp;
return result;
public void run() {
int temp =0;
int i = 0;
while(true){
while(bag.size() !=0){
bag.putSolution(solutionsT(bag.get(),1));
try{   
barrier.await();
}catch(Exception e){}
it get's it's input from a bag that is filled before the iteration begins. (once the bag is filled it trips a barrier) this worker thread is a implementation of Runnable
This piece of code is used to make the thread object and to issue it
public SolutionThread(int numberOfThreads) {
   thread = numberOfThreads;
   bag = new bagOfBoards();
   barrier = new CyclicBarrier(thread+1);
   if(thread > 1){
      ExecutorService threadExecutor = Executors.newFixedThreadPool( thread );
      solution = new ThreadTest[thread];
      bag = new bagOfBoards();
      for(int i = 0;i<thread;i++){
         solution[i] = new ThreadTest(bag, lock, barrier, i);
         threadExecutor.execute(solution);
finally this is the code which is used to acces the bag and get a board.
synchronized public Board get() {
            if (size > 0) {
            size--;
            Board result = bag[size];
            return result;
        } else {
         return null;
    }since this method is synchronized and it always returns something (either null or a board) and the worker tests for this. there is no race condition here.
furter more. the main thread is a loop. It fills te bags with an intial state. then it trips the barrier and waits for the workers to do the work. the workers then process the bag until it hits zero and then trip the barrier so that the main thread can do the next iteration (and fill the bag)
p.s. i know the code is a bit messy, but i want to get the threading to work. As of now i relaly don't understand why the threads are just running on 1 processor instead of 2 processors. not only that. the excecution time is nearly the same as that of a sequential equivalent.
p.s.2 the code is parallisable. and it is run on a smp system.
Message was edited by:
jstrike

i'm very sure that the jvm and os support smp. the
problem really should be in the code.I don't see how this can be the case. There's nothing in the Java language that deals with how threads are assigned to processors (at least not as far as I know) so there isn't anything you can do in your code to affect that.
Or did you meant that i have to tell the jvm in the class that
there is support for multiple processorsThat would be the only possibility. I have no idea whether it can be done or not, though.

Similar Messages

  • BATTERY PROBLEMS: Laptop Only Works With Charger

    **My laptop now only works if it is connected to the charger. The second the charger falls out, the laptop shuts off.
    ** I have a white macbook..
    **Any advice??**
    Thanks

    I have a similar problem. Once i disconnect my macbook, with the battery charged, it stays one for awhile then it just shuts down. then i turn it back on and sometimes shuts down in middle of the start up screen =/. its like the random shuts are coming back or something...its really getting annoying.
    recalibrating or resetting the PRAM or whatever isnt gonna do anything

  • I have a G5 Power Mac with dual 1.8 processors. I recently upgraded the software fro 10.4.11 to 10.5.8 in order to get an iPad 2. Now my Adobe Photoshop 7 won't work any longer. All the newer Phtoshop versions only work with Intell processors. Does anyone

    ..know of an older Photoshop version that will work with my processors and system 10.5.8?
    Thanks,
    Don

    I believe I had this issue with PS7 when I first upgraded from OS 9 to OS X 10.2 Jaguar.
    Couldn't get PS 7 to launch at all.
    I ended up having to update all of my Adobe apps to the CS edition to be sure every Adobe app functioned without a hitch.
    I am not sure where you'll find older versions of Adobe software, though.
    You could try and contact Adobe direct to see if they have any older versions on disc left in stock or not.
    Short or that I  really do not know.
    PS CS 4 was the last universal version that works with PPC Macs.
    Pixelmator used to be available for 10.5 Leopard, but it's no longer available for PPC Macs, either.
    http://www.pixelmator.com/
    Could contact them to see if they have the older version still available on disc or as a download.
    This is a pay app, also.
    Another pay app that may work for you is Graphic Converter.
    http://www.lemkesoft.com/
    The other options are the ones already mentioned in the previous reply.
    Other than Pixelmator, the other offerings are quite limited compared to PS.
    Here's the link to Seashore.
    http://seashore.sourceforge.net/The_Seashore_Project/About.html
    A free open source Unix replacement for PS is The Gimp
    http://www.gimp.org/macintosh/
    You need to install X11 in order to use this app.
    If you installed 10.5, you'll need to check your Applications folder to see if X11 was installed by default.
    If not you'll need to go back to your OS X 10.5 install discs and do a custom install and just install X11 from disc.
    This will just add the additional program and extensions and will not erase your installation of OS X 10.5.

  • Thread Problem - (Thread Blocking Problems?)

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

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

  • Scanner problems LIDE60, only works with XSane, but Xsane is buggy!!

    Hello everyone, I'm trying to get my LIDE 60 scanner working properly with Arch.
    Xsane work OK with it, but it doesn't seem to work with anything else (I installed gnome-scan and sane-pygtk from AUR).
    Both these apps do not see it at all.
    I like XSANE, but there is a bug with it: I cannot select the area I want to scan in the preview area.
    When I try to drag/enlarge/move the selection box, it dissapears and goes elsewhere on the window...
    (I would PREFER fixing Xsane, but in the meantime, would like to try other apps)
    Here is my LSUSB output
    [charles@amdx2 ~]$ lsusb
    Bus 002 Device 002: ID 045e:009d Microsoft Corp.
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 004: ID 04a9:10c4 Canon, Inc.
    Bus 001 Device 003: ID 04a9:221c Canon, Inc. CanoScan LiDE 60
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    the output from scanimage -L
    [charles@amdx2 ~]$ scanimage -L
    device `genesys:libusb:001:003' is a Canon LiDE 60 flatbed scanner
    genesys IS enabled in /etc/sane.d/dll.conf
    Here is the output from flegita/gnome-scan
    as you can see it seems to be ignoring the scanner it finds...
    "see line ** (flegita:11223): DEBUG: SANE device genesys:libusb:001:003 failed or ignored"
    Please, please HELP I'm not totally new... just been on Windows for a couple years,
    but i've been installing Linux on and off to try. (so far, Arch seems a keeper. take a while to install
    but it's great!)
    [charles@amdx2 sane.d]$ flegita
    ** (flegita:11223): DEBUG: gnome-scan-init.vala:33: Initializing GNOME Scan 0.7.1 for flegita
    ** Message: gsane-module.c:53: SANE version is 1.0.20
    ** Message: gsane-module.c:53: SANE version is 1.0.20
    (flegita:11223): GLib-GObject-WARNING **: Two different plugins tried to register 'GSaneBackend'.
    (flegita:11223): GLib-GObject-WARNING **: Two different plugins tried to register 'GSaneScanner'.
    (flegita:11223): GLib-GObject-WARNING **: Two different plugins tried to register 'GSFileBackend'.
    (flegita:11223): GLib-GObject-WARNING **: Two different plugins tried to register 'GSFileScanner'.
    (flegita:11223): GLib-GObject-WARNING **: Two different plugins tried to register 'GSFileOptionFilenames'.
    (flegita:11223): GLib-GObject-WARNING **: Two different plugins tried to register 'GSFileFilenamesWidget'.
    /usr/share/themes/Darklooks/gtk-2.0/gtkrc:181: Invalid symbolic color 'tooltip_bg_color'
    /usr/share/themes/Darklooks/gtk-2.0/gtkrc:181: error: invalid identifier `tooltip_bg_color', expected valid identifier
    (flegita:11223): GLib-CRITICAL **: g_utf8_strlen: assertion `p != NULL || max == 0' failed
    (flegita:11223): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed
    ** (flegita:11223): CRITICAL **: gnome_scan_scanner_selector_on_scanner_added: assertion `new_scanner != NULL' failed
    (flegita:11223): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
    (flegita:11223): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed
    ** (flegita:11223): DEBUG: SANE device genesys:libusb:001:003 failed or ignored
    ** (flegita:11223): DEBUG: gnome-scan-dialog.vala:400: job status updated to unconfigured
    ** (flegita:11223): DEBUG: gnome-scan-dialog.vala:400: job status updated to unconfigured

    BTW, this is on a fresh install of Arch done yesterday: Linux groovy9 3.11.4-1-ARCH #1 SMP PREEMPT Sat Oct 5 21:22:51 CEST 2013 x86_64 GNU/Linux
    For a plan B, if there's a straightforward way to custom compile my own kernel, I'd like to try a slightly older one to see if I have better luck.  This same model of scanner is working fine on a 3.5 kernel, for example.
    Last edited by groovy9 (2013-10-09 21:34:22)

  • N96 screen problem. slider only works in normal po...

    hi, is there an easy fix for this problem? the phone seems to show the correct display when in the "normal" postition or when slid open to reveal the media keys but as soon as you open the slider to reveal the numerical keypad the screen kinda freezes and occasionally shows vertical lines.  occasionally when switched on there is a white screen with vertical lines. *#7370# and *#7780# didn't help. it says s'ware is 11.018 and will not upgrade, is there a newer version? please, no replies saying you have the same trouble or telling me to take it to a nokia service center as that is what i'll do if there's no easy fix!! all i want to know is is it a "slider ribbon" etc. thanks

    It could probably be the ribbon as you mentioned, probably for the screen. A hardware issue needs repairing as you already know. Good luck at the care point.

  • Java Session problem while sending mail(using javamail) using Pl/SQL

    Hello ...
    i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
    pls any help.

    props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
    Please format your code when you post the next time, there is a nice 'code' button above the post area.
    Mike

  • Siri only works when "Raise to Speak" option is activated

    Hello:
    I have iOS 7 installed in my iPhone 5 and I have the following problem:
    Siri only works when "Raise to Speak" option is activated. When I change this option and I try to talk with siri I do not receive any answer.
    Please, could someone give me an idea to solve this problem!
    All the best
    jc

    I am having this same problem.  The problem appears to be related to the microphone and must be a softwear issue.  The microphone works with other apps, and works when making and receiving calls.  It also works when I "raise to speak" to Siri, but it does not pick up any sound when I attempt to talk to Siri by holding the home button, or when pressing the microphone button on screen when in the Siri interface.  Is it possible that holding the home button to talk to Siri is somehow not activating the microphone?
    I should also note that I have tried turning the phone off and back on.  I have tried the reset by holding the home button and the sleep/wake button, and I have even restored the phone in iTunes, although I did not set it up as a new iPhone, because I am not interested in losing app data, call history, messeges, etc.

  • JNI calls only work if sent from main thread?!?

    Hi,
    I searched through the forum for a couple of hours now, and found that a lot of developers seem to have problems with JNI and threads. However, I couldn't find a solution to my problem so far...hope you can help!
    We need to send requests to a DDE Server from our Java application. For that reason, we implemented a very small DLL using Delphi, which calls the DDE Server and returns the result as a string. Using JNI, we call this DLL from Java.
    Everything works fine, as long as we call the DDE Server (via JNI and the DLL) from the main thread of the Java application. But everytime we call it from another Java thread, our DDL reports that it can't get a connection to the DDE Server. This is especially awkward if you want to make calls as a reaction to GUI events, since then the call is sent by the Event Dispatch Thread of the Java runtime.
    This does not seem to be a multi-threading problem, since we do never send multiple requests at the same time. It simply depends on the thread, from which the call is sent.
    Any hints are appreciated very much.
    Thanks!
    Thilo

    We are a step further now...thus the problem to be solved changed a little bit.
    The former assumption, that connecting to the DDE server does only work from the main thread was false. It only seemed like that, because we called System.loadLibrary() to in the main thread to load the DLL . In fact, the connection to the DDE server works from any thread - you just have to make sure that System.loadLibrary() is invoked in this same thread.
    This means: if System.loadLibrary() is invoked in the Event Dispatch Thread, we can call the DDE Server from this thread, which is what we primarily wanted to do. So our problem is solved.
    Anyway, I made some more tests to find out, what happens if I start multiple threads, with each of them calling System.loadLibrary(). The result was, that only the first thread is successful. This means: the first thread, which loads the DLL is the only thread that is able to connect to the DDE server. All other threads won't get a connection.
    What could be the reason for that?

  • 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

  • Why java allow start() method only once for a thread

    Hi ,
    Why java allows start method only once for thread . suppose
    Thread t = new Thread();
    t.start();
    say at later stage if again we call t.start() IllegalStateException is thrown , even though isAlive method returns false.
    Hence the question , why start() method is allowed only once.If you need start a thread , we need to create a new instance.

    Really. Why do you think that? Do you have any evidence? It is one of the first things I would think of, personally.Considering that the Thread API doesn't allow you to specify a stack address (only stack size), I think it demonstrates they wanted to remove that capability from their Thread API all together. That missing "capability" makes me believe they want me to believe it's not something I need to worry about when using their API... I think the exact semantics of the Thread class and its methods were driven by how to make it most understandable and usable for their customers. I'm certain this issue was one of many that was given considerable thought during the design and implementation of the JVM and the underlying runtime classes.
    Do I have any evidence? No. But if you can point me at some first-hand information on this, I'd love to read it. Most of what I've found is second or third hand accounts. (and I mean that sincerely, not as a smart-ass remark or rebuke of your comments).
    On the one hand you seem to think the Java API designers are idiots, on the other hand you think that they should be. I can't make it out.I thought my position was that the Java developers were talented enough to implement platform in whatever way their API called for; hence, the designers made a choice about how they wanted their API to be used by their customers. They decided which capabilities they wanted to include or exclude, and created an API that was consistent with their vision for this technology. While I'm certain technical limitations had an effect on the API design, I certainly don't think the API was dictated by the them.
    I think the current design of the Java Thread API was a reflection of their vision to make Threading easier and more accessible to Joe Programmer, not limitations in the implementation. I never said it was wrong or that I could do better... I just said I think they could have done something different if they decided it would have made for a better customer experience. But hey, maybe I'm wrong.

  • I just spent an hour composing a reply in a thread ("Firefox will not work with paypal"), only to see "You don't have permission" at Submit - total loss!

    I was logged in to reply in the thread "Firefox will not work with paypal". I spent the better part of an hour carefully composing that reply, testing cases, providing links, etc... [Hint: Firefox, unlike other browsers, has a problem with scripts from server paypalobjects.com.] Because I had taken so long to compose the reply, it seemed like a good idea to check it via the Preview button, but I got a message that that function was not available. Of course I decided to submit it anyway, but when I hit "Submit" I got a message "You don't have permission ..." - at which point I was (stupidly) on a different page with that message, and everything I had composed was gone!

    It might be too late for this, but it's what I use when this happens. Prepare for deep nerdom:
    * Open the web console below the error page by pressing Ctrl+Shift+k
    * Right-click the blank area and turn on logging of the request and response bodies
    * Resubmit the request by clicking the reload button
    * Click the new URL that appears to open the viewer showing the headers and bodies
    There you may be able to copy out the content of your post from the Request Body. You can use a word processor or text editor to find/replace the + characters back to spaces.

  • Java Multi Thread problem.

    Hi guys . . . i need so much help. i am trying to implement matrix multiplication using threads.
    For some reason when iam multiplying the matrices i have the threads waiting too long.. they wait wait wait.. then do the job and then wait wait wait.
    Here is the code for my thread pool class
    package concurentNaive;
    import java.util.*;
    public class ThreadPool {
         protected Thread threads[] = null;     
         protected EndPool endPool = new EndPool();
         Collection jobs = new ArrayList(5);
         public PriorityQueue<MatrixJob> pq = new PriorityQueue<MatrixJob>();
         public ThreadPool(int size,PriorityQueue qu){
              this.pq = qu;
              threads = new worker[size];
              for (int i=0;i<threads.length;i++){
                   threads[i] = new worker(this);
                   threads.start();
         public synchronized void assign(Runnable r){
              endPool.workerBegin();
              jobs.add(r);
              System.out.println(Thread.currentThread());
              notify();
         * Get a new work
         * @return
         public synchronized Runnable getAssignement(){
              try {
                   while ( !jobs.iterator().hasNext() )
                        wait(1);
                        System.out.print(Thread.currentThread());
                   Runnable r = (Runnable)jobs.iterator().next();
                   jobs.remove(r);
                   return r;
                   } catch (Exception e) {
                        endPool.workerEnd();
                   return null;
         public void complete(){
              endPool.waitBegin();
              endPool.waitDone();
         protected void finalize(){
              endPool.reset();
              for (int i=0;i<threads.length;i++){
                   threads[i].interrupt();
                   endPool.workerBegin();
                   threads[i].destroy();
         * Class for the pool component threads.The thread scans and executes tasks.
         * @author Krack
         class worker extends Thread{
              public boolean busy;
              public ThreadPool owner;
              worker(ThreadPool o){
                   this.owner = o;
              public void run(){
                   Runnable target = null;
                   do {
                        target = owner.getAssignement();
                        if (target!=null) {
                        target.run();
                        owner.endPool.workerEnd();
                        } while (target!=null);
    and here is my thread :
    ublic class TheWorker implements Runnable{
              private int[] answer;
              private MatrixJob myJob;
              private long time1;
              public TheWorker(MatrixJob job){
               this.myJob = job;
               time1 = System.currentTimeMillis();
               public void run()
                    //MatrixJob theJob = this.myJob;
                    answer = new int[myJob.row.length];
                    for (int i=0;i<myJob.row.length;++i){
                         for (int j=0;j<myJob.cols.length;++j){
                              answer=0;
                             for (int k=0;k<myJob.cols[j].length;k++){
                                  answer[i] += myJob.row[i]*myJob.cols[j][k];
                        for(int i=0;i<answer.length;i++){
                             System.out.print(answer[i]+" ");
                        }     System.out.println();
              public int[] getAnswer() {
                   return answer;
    Any help is much appreciated. Thank you much.

    How do you know that they are waiting?

  • Another halting Thread problem

    Hello,
    I want to make a benchmark software using Java, and I want to add capability to stop the test if such setting was selected that the test would take forever. I know that I can do this with using such code like:
    public class MyBenchThread extends Thread {
    boolean toldToStop = false;
    public void run() {
      while (!benchmarkEndConditionHasMet && !toldToStop) {
       // Run heavy benchmark here
    public void haltTest() {
      toldToStop = true;
    }and calling haltTest() from another Thread.
    However, this has two problems:
    1) To have the benchmark at its purest level, I would like
    to avoid extra computation as much as possible. Is there a way to give the same effect of killing the thread without constantly checking a condition variable?
    2) If the benchmark involved some I/O operation (not necessarily over a socket to which you can set a timeout) that takes a while to complete, I would not be able to halt it using the above code or interrupt() function in Thread class. I know that stop() is likely to cause problem... So is there any way to force interrupt execution of the Thread including I/O, do whatever cleanup is needed, and gracefully exit?
    Thanks in advance

    Sorry for late response... Had been away for weekend.
    Well, interrupt() does not seem to work on I/O operation. It only works on a Thread that is actually sleeping or waiting on a monitor. If it was doing some heavy number crunching or I/O, I think it will only set its interrupted status to true, and does not actually suspend its operation. (This is my assumption; correct me if I am wrong)
    Hmm... so I guess there is not really a way to get around this. I was having problem with using a proprietary library that established a CORBA session inside it, and it did not provide any way of halting the operation externally. Unless I Ctrl-C whole VM, the library call just kept on going for about 30 secs till it finally gave up.
    I don't know... Is force trying to stop a problematic thread that dangerous thing in general to do in multiprocess programming, even if you knew what you were doing?

  • JNI & thread problem

    Folks,
    I am using JNI to access WIA (Windows Image Acquisition) functionality under MS Windows XP. WIA consists of a bunch of COM interfaces. I have several native functions in a single dll, with a limited number of static variables stored in the dll between calls. This all works fine as long as long as the calls occur from the same java thread, but not if a new thread is created for some of the calls. I.e., this works:
    final WIACtrl ctrler=new WIACtrl();
    ctrler.initializeWIA();
    ctrler.transferJPGNative("0001\\Root\\IMG_0087","c:\\test.jpg");
    but this does not:
    final WIACtrl ctrler=new WIACtrl();
    ctrler.initializeWIA();
    (new Thread() {
    public void run() {               
    ctrler.transferJPGNative("0001\\Root\\IMG_0087","c:\\test.jpg");
    }).start();
    Here, initializeWIA() and transferJPGNative() are the native methods. What happens in the second case is that transferJPGNative fails in one of the COM methods (not the first COM method it calls). The COM method returns an HRESULT indicating an error (509) which I can't find using any of the usual MS error look-up mechanisms. (Admittedly I am not the world's greatest Windows programmer...)
    Anyway, any suggestions would be much appreciated. I have found some issues regarding JNI and threads in this forum's archives, but none of them seem to apply to quite this situation.

    As a guess this is just a windows threading problem.
    And with COM you have to do things differently (I believe) if there is more than one thread. You might not even be allowed to do it with for that particular API.
    It could also be that you are initializing things more than once. Or you need to initialize twice (two handles.)
    At any rate you could always fix it by making the java code only allow calls for a single thread.

Maybe you are looking for

  • I have Adobe Reader X. I can open a pdf on my Windows PC but the contents will not display.

    I have Adobe Reader X.  I can open a pdf on my Windows PC but the contents of the file will not display.

  • Transfer tables from sql server 2008 to oracle 11g

    Hi , I have to transfer 2-3 tables (5 Lacs records each) from sql server 2008 to oracle Ent. 11g (platform Linux) i have to upload data with some conditions. not allowed to install oracle client on sql server for link server. i can get data in csv fi

  • Disable version control in 9X

    how to disable version control in 9X version in my repository properties i have given exclusive and made it globle...is it possible to dissable version control if anyone knows please share thanks in advance..

  • Need for an infocube

    Hi experts. I am from a Mainframe background and learning SAP. Can anyone please tell me as to why do we need an Infocube, when we have a full fledged Database? Regards, Swaroop.

  • Adobe Products CS, CS2 & CS3

    Can anyone confirm that these products install and work properly. I really want to upgrade but it's not an option if these programs don't work.