Waiting request threads in 6.0 SP2

we have noticed that in some situations, over time, the number of available request threads will drop, and the number of
current requests will rise!
pretty normal stuff, but once in a while they do not return to the waiting request pool, and the the current request
never seems to go away.
naturally this could be explained by setting up pages which never return. we stayed always from that!
requests that never returned. we also managed to avoid that.
but still over time, some requests never seem to get answered, the request threads never get back to the pool, and
eventually the number of available threads declines, till there are none.
is there a reporting mechanism within iPlanet to help diagnose these situations? perhaps giving stackcrawls of all
current request threads from the kjs at any given time. one option of of course to use -Xrunhprof with the VM to catch
threads in contention under Solaris. but are there other possibilities?
iPlanet seems to have a dearth of internal reporting tools.

You didn't give the specs on the boxes but 300 threads is probably way too
high. Here's a good rule of thumb:
NT/1CPU = 14 free exec threads when idle (use ctrl-break to verify)
NT/2CPU = 28 free exec threads when idle
SolSparc/2CPU = 48 free exec threads when idle (use kill -3 to verify)
SolSparc/4CPU = 96 free exec threads when idle
Note that some exec threads get gobbled by WL itself so after setting the
value you need to figure out how many you actually have available. For
example, if you set it to 15 you may end up with only 10 which means your
expectation is 33% off reality.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"Kirk Everett" <[email protected]> wrote in message
news:[email protected]..
We are getting out-of-memory errors on solaris using 6.0 SP2. We are
seeing the heap size just grow and grow at a steady pace as the
application is stressed tested using load runner. The tests simulate
only about 30-60 users with a fairly light workload. We've run basically
the same tests on NT without the memory problems so I'm wondering if it
has anything to do with our env. We've basically trimed the script to
do just login/logout and the heap grows to over 600MB in about 2 hours.
We've poured over our login/logout code and can't find any places where
we are holding onto memory. Just before the process runs out of memory
we get a log of full gc messages that take about 30 seconds with no
significant change in the heap size. Their are 4 instances running with
a 1GB heap and 300 execute threads each (2 weblogic instances on a
box). Could the heap size/execute thread be causing problems? I think
the heap and execute thread size is a bit excessive given there are only
50 db connections. I'd like to hear anyone's opinion on this problem
and our settings. Thanks.
Kirk

Similar Messages

  • Media Recovery Waiting for thread 1 sequence (in transit)

    I have rebuilt our standby database using an rman duplicate since it was missing many archive logs.
    Following the duplicate, the standby is now almost in sync with the primary. Logs are shipping across but are not being applied in a timely manner. How long should it take for an archive log from the primary to be applied to the standby?
    I need to know this so that a proper script can be set up to check the primary and standby. At the moment they are never exactly in sync - always one sequence number behind the primary.
    Why is the standby is not applying in a timely manner?
    From the alert log:
    Media Recovery Waiting for thread 1 sequence 11278 (in transit)
    The log seems to be "in transit" for a long time
    PRIMARY:
    SQL> select max (sequence#) current_seq from v$log;
    CURRENT_SEQ
    11278
    SB:
    SQL> select MAX (SEQUENCE#), APPLIED FROM V$ARCHIVED_LOG where APPLIED ='YES' GROUP BY APPLIED;
    MAX(SEQUENCE#) APP
    11277 YES
    ALERT LOG:
    RFS[2]: Archived Log: '/backup/prod/log_1_11277_704816194.dbf'
    Primary database is in MAXIMUM PERFORMANCE mode
    Mon Nov 1 15:22:01 2010
    Media Recovery Log /backup/prod/log_1_11272_704816194.dbf
    Mon Nov 1 15:26:49 2010
    Media Recovery Log /backup/prod/log_1_11273_704816194.dbf
    Mon Nov 1 15:29:54 2010
    Media Recovery Log /backup/prod/log_1_11274_704816194.dbf
    Mon Nov 1 15:34:18 2010
    Media Recovery Log /backup/prod/log_1_11275_704816194.dbf
    Mon Nov 1 15:36:42 2010
    Media Recovery Log /backup/prod/log_1_11276_704816194.dbf
    Mon Nov 1 15:39:43 2010
    Media Recovery Log /backup/prod/log_1_11277_704816194.dbf
    Mon Nov 1 15:42:34 2010
    Media Recovery Waiting for thread 1 sequence 11278 (in transit)
    I should add that I understand that for the Primary and Standby to be out by one log is not cause for concern (they are applying). Its just that I wanted to script a check that would compare them both, and and the moment they are never equal - when I understand that they should be and that the logs should be applied almost immediately.
    Edited by: Dan A on Nov 1, 2010 4:36 PM

    How long should it take for an archive log from the primary to be applied to the standby?depends on network speed also.
    make sure the archives are shipped to standby location.
    PRIMARY:
    SQL> select max (sequence#) current_seq from v$log;
    CURRENT_SEQ
    11278(this is log not archivelog ) ..... :)SB:
    SQL> select MAX (SEQUENCE#), APPLIED FROM V$ARCHIVED_LOG where APPLIED ='YES' GROUP BY APPLIED;
    MAX(SEQUENCE#) APP
    11277 YES
    Hi check is MRP started or not?
    primary database you need not check current sequence, check last generated sequence..not current sequence.
    current sequence is redo log which has been not yet archived
    I think everything is perfect here.. no issues.
    Hope you understood, let me know if not clear , thanks.

  • AMP Feature request thread

    I've just started trying to use the AMP for some home entertainment and I must say it has been a challenge to enjoy this product in its current form. Perhaps I dont have a grasp on what the expressed functions of the player are, and what advantages can it offer me over the myriad of other players and services.
    I can find nowhere else to leave feedback and suggestions or have dialog with adobe developers so I thought, like in many other Adobe product forums, to begin a feature request thread in hopes that if enough users add feedback we may eventually have an improved product. In the same regard users can enlighten others as to what functions they find useful already. Its not meant to be a gripe list but a chance to voice constructive ideas and share experience with the product.
    Preamble complete, I will have first go:
    1) The system options seem very limited to me, for instance I can not find an option to view or change in what directory\folder the video files are downloaded or cached to.
    2) A minimized view or skin would add benefit for me. It seems now the only options are full screen and a small window housed inside the AMP program window. With any other media player I have used one can play a file in a resizable window without all the other program buttons and menus eating up your screen space.
    3) Video controls options during playback, like chroma level, brightness/contrast, gamma. This is standard on other players.
    4) I get annoyed when I am watching a video and I pause and go to the home or favorites tab, AMP automatically disconnects the video I was playing, and the I must search the catalogue to find it, restart it, and re-watch the commercials if any to re-cue it to the last viewing spot.
    5) I dont really appreciate the default favorites or new episodes listed. That is not needed.
    6) There are no right click menus? Odd. At the least I would like to be able to right click a video file to pull up information on it. In fact, I would like any method of looking at files information. This goes hand in hand with the general lack of user options throughout the program.
    7) Last one for now, but a big one. Why in the world would AMP not support more video formats? I, like most computing people, horde all kinds of different media files in my various libraries. If AMP cant play them it has a big disadvantage to all of the other ubiquitous media players out there.
    Thats it for starters. Hopefully I will start get more familiar with the program and then find more benefits. Please, add to this thread if you have any thoughts on the AMP.

    1.  Ability to skip forward (fast forward) through a video or rewind video.
    2.  Point AMP to a set of folders containing personal videos I want to watch in AMP.  Right now, if I have a series of videos that form one full course, I have to eliminate the previous course videos so they do not get mixed in with the new course videos.
    3.  Ability to go back to where I was in the video when the Internet goes down (or flickers) rather than play from beginning.
    4.  By the way, why are the TV shows going away?  This was the No. 1 reason we installed AMP on our multimedia computer!
    That is all for now.
    Thanks,
    edsager

  • Update of jlabel does not happen when i wait for thread to finish (join())

    gurus please help.
    I have a main application which in actionevent calls a thread, that thread calls parent method to update ths status in jlabel, but when i use thread.join() to wait for process to complete, the jlabel does not get updated, please tell me how can i update the jlabel, i have to wait for thread to finish and during run i need to update the jlabel.
    thanks

    hi camickr and gurus:
    here is the code:
    notice after pressing the Process button, the label is being updated but its not working. I called the processnow() method directly and also by thread, but in thread I have to wait until it finishes using join() but still does not work, please help. Thanks
    package label;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.text.*;
    import javax.swing.border.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    public class thePanel extends JDialog {
      private DefaultTableModel tableModel = null;
      private JTable theTable = new JTable();
      private JScrollPane scrollPane = new JScrollPane();
    JPanel tPanel = new JPanel();
      private Border mainBorder;
      private BorderLayout borderLayout1 = new BorderLayout();
      private BorderLayout borderLayout2 = new BorderLayout();
      private BorderLayout borderLayout3 = new BorderLayout();
      private BorderLayout borderLayout4 = new BorderLayout();
      private JPanel statusPanel = new JPanel();
      private JPanel buttonPanel = new JPanel();
      private JPanel lowerPanel = new JPanel();
      private JLabel statusBar = new JLabel();
      private JButton processButton = new JButton("Process");
      public JButton closeButton = new JButton("Close");
      boolean image = true;
      theProcess processThread;
      Vector tableData = new Vector();
      ImageIcon Image = new ImageIcon("image.gif");
      ImageIcon oImage= new ImageIcon("oimage.gif");
      boolean errorOcurred=false;
      String statusMessage;
      public thePanel() {
        try {
         jbInit();
        } catch(Exception e) {
          e.printStackTrace();
      private void jbInit() throws Exception {
        tPanel.setPreferredSize(new Dimension(800,424));
        mainBorder = new TitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)," ");
        statusPanel.setBorder(BorderFactory.createEtchedBorder());
        tPanel.setBorder(mainBorder);
        tPanel.setLayout(borderLayout1);
        scrollPane.getViewport().add(theTable, null);
        tPanel.add(scrollPane,  BorderLayout.CENTER);
        // status
        statusPanel.setLayout(borderLayout2);
        statusPanel.setBorder(BorderFactory.createEmptyBorder());
        statusBar.setAlignmentX((float) 0.5);
        statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
        statusBar.setMaximumSize(new Dimension(600, 21));
        statusBar.setMinimumSize(new Dimension(600, 21));
        statusBar.setPreferredSize(new Dimension(600, 21));
        statusPanel.add(statusBar, BorderLayout.SOUTH);
        // buttons
        processButton.setPreferredSize(new Dimension(70,25));
        processButton.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            process_actionPerformed(e);
        closeButton.setPreferredSize(new Dimension(70,25));
        buttonPanel.setLayout(borderLayout3);
        buttonPanel.setBorder(BorderFactory.createRaisedBevelBorder());
        buttonPanel.add(processButton,BorderLayout.WEST);
        buttonPanel.add(new JPanel());
        buttonPanel.add(closeButton,BorderLayout.EAST);
        // lower panel
        lowerPanel.setLayout(borderLayout4);
        lowerPanel.setBorder(BorderFactory.createEmptyBorder());
        lowerPanel.add(statusPanel, BorderLayout.WEST);
        lowerPanel.add(buttonPanel, BorderLayout.EAST);
        tPanel.add(lowerPanel, BorderLayout.SOUTH);
        theTable.setAutoCreateColumnsFromModel(true);
        theTable.setColumnSelectionAllowed(false);
        theTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        theTable.getTableHeader().setReorderingAllowed(false);
    getContentPane().add(tPanel);pack();
        getinfo();
    show();
      private void prepairTable(){
        tableModel = new DefaultTableModel(){
                          public boolean isCellEditable(int row, int col)
                            { return false; }};
        tableModel.addColumn("text 1");
        tableModel.addColumn("text 2");
        tableModel.addColumn("text 3");
        tableModel.addColumn("text 4");
        tableModel.addColumn("text 5");
        theTable.setModel(tableModel);
      } // end method (prepairTable)
      public void refreshTable() {
        prepairTable();
      public void getinfo() {
        try {
            refreshTable();
            tableModel.addRow(new Object[]{"3465465555","0123456789",new Date(1135022905196L),"0100000","errror message","sssssss"});
            tableModel.addRow(new Object[]{"8949344562","0324354549",new Date(1134511763683L),"0166600","errror mes666e","ddddddd"});
    setStatusMessage("ready to process, select record and click Process button to process record");
          errorOcurred = false;
        } catch (Exception ex) {
          errorOcurred = true;
          ex.printStackTrace();
        } // End try
      private void process_actionPerformed(ActionEvent e) {
        try {
          if(theTable.getSelectedRows().length > 0) {
    //        processThread = null;
    //        processThread = new theProcess(this);
    //        processThread.start();
    processnow();
            System.out.println("........finished now.........");
          } else {
        } catch (Exception ex) {
          ex.printStackTrace();
      public void processnow() {
        try {
          int[] selectedRows = null;
          int totalSelected = 0;
          setStatusMessage("processing " + totalSelected + " selected records...");Thread.sleep(1500);
          selectedRows = theTable.getSelectedRows();
          totalSelected = selectedRows.length;
          for(int i = 0; i < totalSelected ; i++){
            setStatusMessage("processing " + (i+1) + " of " + totalSelected + " selected records...");
            System.out.println(".......................row: "+selectedRows);
    Thread.sleep(2500);
    System.out.println("........fins...........");
    errorOcurred = false;
    } catch (Exception ex) {
    errorOcurred = true;
    ex.printStackTrace();
    } // End try
    public void setStatusMessage(String message) {
    statusMessage=message;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    if(image)
    statusBar.setIcon(Image);
    else
    statusBar.setIcon(oImage);
    statusBar.setText(statusMessage);
    statusBar.update(statusBar.getGraphics());
    public static void main(String[] args){
    new thePanel();
    } // class
    package label;
    import java.lang.Runnable;
    public class theProcess implements Runnable {
    private thePanel parent;
    public theProcess(thePanel xparent){
    parent = xparent;
    } // end constructor
    public void start() {
    try {
    Thread thisThread = new Thread(this);
    thisThread.start();
    thisThread.join();
    } catch(Exception ex) {
    ex.printStackTrace();
    } // end method (start)
    public void run(){
    try {
    parent.processnow();
    } catch (Exception ex){
    ex.printStackTrace();
    } // end try
    } // end method (run)
    } // end class

  • How could increase the number of waiting request queue?

    how could increase the number of waiting request queue?
    thanks,

    I assume you're asking because you're getting connection refused exceptions? Set the AcceptBacklog parameter in the config.xml/via the console. Here's a description of the parameter:
    http://e-docs.bea.com/wls/docs81/config_xml/Server.html#AcceptBacklog

  • Out of "Request thread waiting" in KJS iAS SP4

    We are developing a J2EE aplication in iPlanet Application Server SP4. When we load the main page (Servlet), that composes a HTML page with 3 frames, the KJS of iAS takes 2 threads to process the request of the upper frame (call to a HttpServlet) and left frame (another call to a HttpServlet). After a time we can see the upper and left frame (we've got the HTML code that has been generated by the servlets) , but the browser hasn't finished to load the images of these frames. These images are on a iPlanet Web Server 4.1 SP 7. Some time later the web server time out expires and stop our browser and the images are no loaded.
    The third frame is never loaded (the request never go to the iAS as we see on the web server log).
    We expected that the 2 threads that are processing our request wil be freeded after processing the request, but that doesn't happen. The threads are blocked and doesn't return to de thread pool althougth the request are totally processes.
    We have the same application deployed on a iAS SP2 and we have never get these problem.
    Could anyone help me.
    Thank you.

    It seems that some dead lock has occured.
    Can you please send the kjs logs for sp4 and if possible can you also send the servlet code which is giving errors. With that I can proceed.
    Thanks,
    Rakesh.

  • Servlet waiting for threads to end

    Hi !
    To make our web app more efficient, we wanted to delegate some work to threads. But it seems that the servlet engine (or something else) is waiting for all spawned threads to end before sending the response back to the browser. So, if a servlet finishes execution but the threads it spawned are still working, I do not get the next page in the browser. I only do when all threads are done. So my question is : is this a normal behavior of the servlet engine ? If so, why ? If not, what could I have done wrong, what should I look out for when using threads inside servlets ?
    Thanks,
    Martin

    Yup I agree with the other guys.
    I am building a servlet that has 2 threads running continuously (looping), and they do not bother the requests/responses at all. But in your case if I understand correctly, you spawn threads from the request. You must have some kind of interaction between them.
    Are you sure you are spawning the code in a separate thread??. I use something like this:
    class Mythread extends Thread
    public void run()
    // code here
    THread threadobject = new Mythread();
    threadobject.start(); //( DO NOT CALL THE run() method, but the start() method.)
    Are your threads sleeping (to not hog up all CPU power???). Are your threads higher priority then the normal?.
    See ya,
    Andre

  • Reuse a waiting/blocked thread

    Using the API in java.util.concurrency, there are operations such as BlockingQueue.take() or Condition.await() that makes the current thread to be blocked (waiting) on the operation to complete. I am working on a problem in which, in such situation, it is very costly to leave the thread as such holding all the resources already allocated for it. I would like to use the same thread to run/execute another task. And, when the condition or take can continue their work, then the resources are allocated back to the thread (including the local state) such that the thread can continue the execution from the blocked/waiting point. So, my question is that is there any way to release the thread when it is blocked on some concurrent operation such that it can be used for other executions?
    On a related ground, is there any way I can replace the Thread class implementation in Java/JVM?
    My current impression is that since some parts of the implementations are native so we need to tweak the C++ code, is that correct?
    Thanks in advance.

    i think you are missing the point of what i'm saying. i'm saying you don't need to change how threads work, you need to change your style of programming. having multiple tasks run on the same physical thread is as easy to do in java as it is in erlang (as Peter Lawrey described). what you need to do is use the erlang style of programming, where a thread does not block waiting for something to happen, but is instead giving a task when there is work today. i.e. you need to write your tasks so that they are essentially non-blocking. you can do this just fine in java without mucking w/ the jvm.
    for instance, say you have a standard model with 3 queues, 3 producers, and 3 consumers, where there is 1 producer and 1 consumer per queue, and the consumer is a dedicated thread. in this scenario, if a queue is empty, that thread is idle/useless. instead, you can change your model around so that instead of each producer putting "data" on the queue, they instantiate a "handler/consumer" (instance of Runnable) with a reference to the data to be handled. this handler is then tossed into a thread pool with 3 threads. in this scenario, your 3 threads are now "general purpose" and can work on whichever queue(s) happen to currently have data. (in essence, you are collapsing your 3 queues into 1 queue and making the queue data "smarter"). this is exactly what erlang is doing under the hood.
    Edited by: jtahlborn on Jul 28, 2011 11:34 AM

  • Waiting for Thread to finish execution

    I have a program which uses a thread to copy files. While they are copying, a ProgressMonitor comes up displaying the current file being copied. After this has completed, my main program needs to be notified and go on with it's own code. Either I get the 'I'm done waiting!' message instantly, or not at all, instead of getting it after the thread completes. How do I do this?
    This is what I currently have
    // CLASS 1 //
    //...other code is here
    myMethod()
    ProgressMonitorDemo pmd = new ProgressMonitorDemo();
    while (!pmd.isDone())
    { wait(); }
    System.out.println( "I'm done waiting!" );
    }//Class 2 //
    import java.awt.*;
    import java.awt.event.*;
    import java.io.File;
    import javax.swing.*;
    public class ProgressMonitorDemo extends JPanel
      public final static int ONE_SECOND = 1000;
      private ProgressMonitor progressMonitor;
      private Timer timer;
      private LongTask task;
      public ProgressMonitorDemo()
        task = new LongTask();
        timer = new Timer( ONE_SECOND, new TimerListener() );
        progressMonitor = new ProgressMonitor( this, "Running a Long Task", "", 0, task.getLengthOfTask() );
        progressMonitor.setProgress( 0 );
        progressMonitor.setMillisToDecideToPopup( 2 * ONE_SECOND );
        task.go( );
        timer.start();
      public boolean isDone()
        return task.isDone();
       * The actionPerformed method in this class
       * is called each time the Timer "goes off".
      class TimerListener implements ActionListener
        public void actionPerformed( ActionEvent evt )
          progressMonitor.setProgress( task.getCurrent() );
          String s = task.getMessage();
          if( s != null )
            progressMonitor.setNote( s );
          if( progressMonitor.isCanceled() || task.isDone() )
            progressMonitor.close();
            task.stop();
            Toolkit.getDefaultToolkit().beep();
            timer.stop();
    }// CLASS 3 //
    import javax.swing.*;
    import java.io.*;
    import java.awt.dnd.DnDConstants;
    public class LongTask
      private int lengthOfTask;
      private int current = 0;
      private boolean done = false;
      private boolean canceled = false;
      private String statMessage;
      public LongTask()
        //Compute length of task...
        //In a real program, this would figure out
        //the number of bytes to read or whatever.
        lengthOfTask = 400;
       * Called from ProgressBarDemo to start the task.
      public void go( )
        final SwingWorker worker = new SwingWorker()
          public Object construct()
            current = 0;
            done = false;
            canceled = false;
            statMessage = null;
            return new CopyMove();
        worker.start();
       * Called from ProgressBarDemo to find out how much work needs
       * to be done.
      public int getLengthOfTask()
        return lengthOfTask;
       * Called from ProgressBarDemo to find out how much has been done.
      public int getCurrent()
        return current;
      public void stop()
        canceled = true;
        statMessage = null;
       * Called from ProgressBarDemo to find out if the task has completed.
      public boolean isDone()
        return done;
       * Returns the most recent status message, or null
       * if there is no current status message.
      public String getMessage()
        return statMessage;
       * The actual long running task.  This runs in a SwingWorker thread.
      class CopyMove
        private String currOldLoc, currNewLoc, type;
        CopyMove()
          while( current < lengthOfTask )
            try
              Thread.sleep( 1000 );
              current += Math.random() * 100; //make some progress
              if( current > lengthOfTask )
                current = lengthOfTask;
              statMessage = "Completed " + current + " out of " + lengthOfTask + ".";
            catch( Exception e )
              System.out.println( "<ERROR>: Long Task " + e.toString() );
    }

    I tried this but it froze...
    public void myMethod()
    ProgressMonitorDemo pmd = new ProgressMonitorDemo( );
    synchronized( pmd )
       try
         pmd.wait();  
       catch(Exception e){}
    System.out.println( "I'm done waiting!" );
    }Class 2
    class CopyMove
      private String currOldLoc, currNewLoc, type;
      CopyMove()
        while( current < lengthOfTask )
          try
            Thread.sleep( 1000 );
            current += Math.random() * 100; //make some progress
            if( current > lengthOfTask )
              current = lengthOfTask;
            statMessage = "Completed " + current + " out of " + lengthOfTask + ".";
          catch( Exception e )
            System.out.println( "<ERROR>: Long Task " + e.toString() );
        synchronized(this)
          notifyAll();

  • Waiting all threads in a fixed thread pool

    Hello, may I know how can I wait for all the threads in a fixed thread pool to be completed, without calling shutdownNow?
    Executor pool = Executors.newFixedThreadPool(nThreads);
    for(int i = 0; i < 10000;  i++)
        pool.execute(new StockHistoryRunnable(code));
    // blah blah blah
    // I would like to wait for all the 10000 task to be completed. There is a method named
    // awaitTermination. However, in order to use the method, I have to first call shutdownNow.
    // I do not want to do so, because I need to re-use the pool later.
    //

    You could retrieve all the "Future" instances returned by calling "submit" on your Executor and then have a Thread sequentially wait for the completion of all these individual tasks by using "get". Of course, this will require some synchronization if it is possible that new tasks get queued while you are already waiting for the original ones to be completed. But this way you can easily find out when all tasks have completed.

  • Problems with notify/wait on threads

    I have a few Player threads connected to some game server.
    The first player to connect ("Player1") starts a timer to 10 seconds. During this time all other connected players can't do anything. When the 10 seconds are up the game starts.
    My idea is that if the current thread is Player1 then it sleeps for 10 seconds and then calls notifyAll() to wake up all other player threads. Other player threads will wait() until they are notified by Player1. Problem is I can get Player1 to sleep and wake up but my notifyAll() calls don't wake the other players up.
    My basic server connection code:
    // a for loop to create players and add them to a vector ("players"). Run player threads as soon as they connect
    players.add( new Player( server.accept(), maze, this, i + 1);
    players.get(i).start();The run() for Players:
    public void run()
      synchronized( this)
        if( Thread.currentThread().getName.compareTo( "Player1") == 0)
          sleep( 10 * 1000);
          // game_started is a condition var, init to false
          game_started = true;
          notifyAll();
        else
          while( !game_started)
            try
              wait();
            catch( Exception e) {}
    }Somehow my others threads keep waiting even thought the notify signal has been sent. They just keep waiting.
    Any suggestions on what I'm doing wrong?

    Well the problem is that you seem a bit confused over the way wait and notify/notifyAll work.
    Wait (and notify) work with thread against an object monitor. What this means is that you need a common object shared among the threads that they are calling wait/notify on.
    Note that the Javadoc says this about wait
    wait() - Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.And about notifyAll
    notifyAll() - Wakes up all threads that are waiting on this object's monitor.So the problem is you have these threads waiting and notifying themselves. Which isn't what you want. See this section of [_the concurrency (threading) tutorial_|http://java.sun.com/docs/books/tutorial/essential/concurrency/guardmeth.html] for more on how to use wait/notify/notifyAll.

  • Waiting unknown threads to be completed.

    Hi all,
    Here is my issue:
    TaskRunner runner = TaskRunner.getInstance();
    for(Task task : tasks) {
            runner.run(task);
    System.out.println("Done!");Each task may (probably will) create one or more sub-threads... How can I ensure that, by the time I print "Done!", that every task has been completely executed?
    Is there any way to wait for unknown threads to finish before continuing? By unknown, I mean I know absolutely nothing about them (no name, no group...).
    EDIT - I must add I can't touch TaskRunner's code...
    Thank you all in advance!
    Best regards,
    Guilherme
    Edited by: guilherme.tramontina on Aug 16, 2009 8:28 AM
    Edited by: guilherme.tramontina on Aug 16, 2009 8:43 AM

    All,
    ExecutorService didn't work for this specific issue.
    So I solved my problem by doing the following:
    Moved the "for" statement into a new Thread class. Please note the "super()" call... This new Thread is created into a new ThreadGroup.
    public class TaskRunnerThread extends Thread {
         private List<Task> tasks;
         public TaskRunnerThread(List<Task> tasks) {
              super(new ThreadGroup("TRThreadGroup", "TRThread");
              this.tasks = tasks;
         public void run() {
              TaskRunner runner = TaskRunner.getInstance();
              for (Task task : tasks) {
                   runner.run(task);
    }And then...
    TaskRunnerThread trThread = new TaskRunnerTask(tasks);
    trThread.start();
    groupJoin(tsThread.getThreadGroup());
    System.out.println("Done!");Here is the "groupJoin" method:
    private void join(ThreadGroup t) {
         synchronized (t) {
              while (t.activeCount() > 0) {
                   try {
                        t.wait();
                   } catch (InterruptedException e) {
                        e.printStackTrace();
    }It worked like a charm!
    Thanks for your help!
    Best regards,
    Guilherme

  • About a Special Effects Request Thread

    Do we have any threads for requests on special effects? If not, I believe that would be a great idea.
    Some of you may disagree but that's your perception.
    It will allow Novices like me to get the feel of things are done when adding our effects.
    What do you all think?

    There you all go again. You are misconcieving what just said. Perception is perception that is all there is too it. I wrote and I am pretty clear about what I ask.
    Again LaRhonde, No. I am busy and that's it I am busy. I have a son and a fiancee, which means is I can't finish up.
    I just got recently sidetracked having to put my 4 year old son into school which is a pain in the rear.
    In my community it is a task to put him into school due to the way the Governor runs Louisiana.
    Also, again and I don't really care how many years of experience you have or anyone for that matter. Good for you.
    Then you said. "there you go right there "referring to me not finishing up as to repoint out that you are correct about your judgement.
    Again you are not a psychic. You don't know what I am doing every minute of the day. Also, for the record, I am still doing the tutorials. Just right now other stuff came up.
    Secondly, I am new here and I don't like the hospitality that is going on. If any of you are professional as you claim to be, you should be helping me out in a  professional manner.
    Mylenium and Andrew Yoole cleared a little bit about helping me and we dropped it.
    Let me put this in very lamen terms for you all to understand. I made a request idea for the rest of the community, "not me."
    The next time you all see my screen name while I make a request, or a request that is similar to my other posts and you all have the craving to make a judgment reply to my posts. Don't reply to my posts. If you all are going to be helpful next time please be helpful but do so without judging my posts I make, otherwise I DON'T want to hear it!

  • Multiple request threads

    Hi
    We have an application which has a controller servlet. On any action the request is submitted to the controller, the controller meanwhile instantiates a helper class to do the necessary action and on completion forwards it to the result JSP page.
    On certain instances we have observed the following:
    On click of Submit button a request is given to controller and the processing begins....On completion a JSP page is displayed with different charts. There are instances when there are some huge Database calculations taking place and at that point we get a "Page cannot be displayed" error message. This happens at around 1.5 to 2 minutes. We have a Netscape web server and a Weblogic 5.1 App server and a Oracle 8i database. In the weblogic access logs I see that there have been two calls to the controller and we get a java.util.ConcurrentModificationException.....This is happening in the production environment...Also we tried to put System.outs and we saw that it things were being printed twice.....However, in QA this does not happen whereby we have a similiar environment, however queries run a bit faster due to less load on db server.
    Please help me if you can.
    Regards
    Amit Wadkar

    Servlet does not have fields...My problem is that on a single request, two threads are spawned in production environment. However this is not how it works on Dev and QA environment.
    Access logs
    QA
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:26:55 -0400] "GET /ceo/pfm/jsp/CTIntermediate.jsp HTTP/1.0" 200 1169
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:26:56 -0400] "GET /ceo/fw/css/1.jsp HTTP/1.0" 200 4577
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:37 -0400] "POST /ceo/PFMController HTTP/1.0" 200 880
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:39 -0400] "GET /ceo/pfm/jsp/PFMHeader.jsp HTTP/1.0" 200 1928
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/pfm/jsp/PFMComponentRates.jsp HTTP/1.0" 200 7965
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/pfm/jsp/PFMReliabilityGrowth.jsp HTTP/1.0" 200 0
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/pfm/jsp/PFMTopField.jsp HTTP/1.0" 200 6026
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/pfm/jsp/PFMTimeSeries.jsp HTTP/1.0" 200 0
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/pwc/js/ChartComponent.js HTTP/1.0" 404 1313
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/pfm/jsp/PFMFooter.jsp HTTP/1.0" 200 1657
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/pfm/js/FRC.css HTTP/1.0" 200 2550
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:40 -0400] "GET /ceo/fw/css/1.jsp HTTP/1.0" 200 4577
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:41 -0400] "GET /ceo/PWCChartServlet?graph=LEGEND_TABLE_CHART_2&time=1121275659778 HTTP/1.0" 200 1362
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:42 -0400] "GET /ceo/PWCChartServlet?chartId=RelGrowthChart&time=1121275659888 HTTP/1.0" 200 2477
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:43 -0400] "GET /ceo/PWCChartServlet?chartId=Component&time=1121275659888 HTTP/1.0" 200 3769
    129.202.39.102 - ngpt8qs [13/Jul/2005:13:27:43 -0400] "GET /ceo/PWCChartServlet?chartId=TimeSeries&time=1121275659888 HTTP/1.0" 200 4452
    Prod
    129.202.18.86 - amfg13t [30/Jun/2005:14:17:48 -0400] "GET /wls-ewcp/ceo/pfm/jsp/CTIntermediate.jsp" 200 1169 "-" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322)"
    129.202.18.86 - amfg13t [30/Jun/2005:14:22:20 -0400] "GET /wls-ewcp/ceo/fw/css/1.jsp" 200 4577 "http://wsp04.ae.ge.com/wls-ewcp/ceo/PFMController" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322)"
    129.202.18.86 - amfg13t [30/Jun/2005:14:22:20 -0400] "POST /wls-ewcp/ceo/PFMController" 200 1219 "http://wsp04.ae.ge.com/wls-ewcp/ceo/pfm/jsp/CTIntermediate.jsp" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322)"
    129.202.18.86 - amfg13t [30/Jun/2005:14:22:20 -0400] "POST /wls-ewcp/ceo/PFMController" 200 880 "http://wsp04.ae.ge.com/wls-ewcp/ceo/pfm/jsp/CTIntermediate.jsp" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322)"
    129.202.18.86 - amfg13t [30/Jun/2005:15:01:59 -0400] "GET /wls-ewcp/ceo/pfm/jsp/CTIntermediate.jsp" 200 1143 "-" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322)"
    129.202.18.86 - amfg13t [30/Jun/2005:15:01:59 -0400] "GET /fw/css/1.jsp HTTP/1.1" 404 - "http://wsp04.ae.ge.com/wls-ewcp/ceo/pfm/jsp/CTIntermediate.jsp" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322)"
    129.202.18.86 - amfg13t [30/Jun/2005:15:01:59 -0400] "GET /htmglobal/masthead.html HTTP/1.1" 404 - "http://wsp04.ae.ge.com/PFMController" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322)"
    129.202.18.86 - amfg13t [30/Jun/2005:15:01:59 -0400] "POST /PFMController HTTP/1.1" 404 - "http://wsp04.ae.ge.com/wls-ewcp/ceo/pfm/jsp/CTIntermediate.jsp" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461; .NET CLR 1.1.4322
    Below is the code......
    package pfm.framework.controller;
    import java.io.IOException;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpSession;
    import pfm.framework.bean.Page;
    import pfm.framework.controller.Command;
    import pfm.framework.bean.PageBean;
    import pfm.framework.util.FrameworkException;
    import pfm.framework.util.XMLParser;
    import framework.util.RequestWrapper;
    import framework.util.HTTPRequestWrapper;
    import pfm.util.PFMConfigProvider;
    public class Controller extends HttpServlet
         public Controller()
              super();
         public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws ServletException, IOException
              // call doPost
              doPost(httpservletrequest, httpservletresponse);
         public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) throws ServletException, IOException
              try
                   processRequest(httpservletrequest, httpservletresponse);
                   return;
              catch (ServletException se)
                   throw se;
              catch (Exception exception)
                   exception.printStackTrace();
                   String errMsg[] =new String[]{"Error has occurred . Please close your browser and try again"};
                   httpservletrequest.setAttribute("err_msg", errMsg);
                   try
                        pfm.util.PFMLogger.getInstance().logError("pfm", "1", httpservletrequest.getRemoteUser(), "Exception :"+exception.getMessage());
                        RequestDispatcher dispatcher = httpservletrequest.getRequestDispatcher("/pfm/jsp/ErrorHandler.jsp?errorNum=0");
                        dispatcher.forward(httpservletrequest,httpservletresponse);
                   catch(Exception exception1)
                        //buffer could have been cleared, so throw it again which will be
                        //handled by the default error handler
                        throw new ServletException(exception1);
          * This method will initialize the Contoller servlet.
          * @param servletconfig javax.servlet.ServletConfig
         public void init(ServletConfig servletconfig) throws ServletException
              super.init(servletconfig);
              // create PageBean in application scope ****************
              try
                   //Create the Pagebean
                   //Set into application scope
                   //Create the Pagebean
                   ServletContext sc = getServletContext();
                   String strConfigProvider = null;
                   String strUploadxmlpath = null;
                   String strXmlpath = null;
                   String strXmlParser = null;
                   String pwcRoot = null;
                   String configFileName = null;
                   String absoluteXMLPath = null;
                   strConfigProvider = PFMConfigProvider.getInstance().getRegion();
                   // get init parameters
                   configFileName = servletconfig.getInitParameter(Constants.CONFIGXML);
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),"servletStartup","  configFileName:"+configFileName);
                   strXmlpath = servletconfig.getInitParameter(Constants.XMLPATH);
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),"servletStartup","  strXmlpath:"+strXmlpath);
                   strUploadxmlpath = strConfigProvider+".xmlpath";
                   pwcRoot = (String)sc.getInitParameter(strUploadxmlpath);
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),"servletStartup","  pwcRoot:"+pwcRoot);
                   strXmlParser = pwcRoot+strXmlpath+configFileName;
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),"servletStartup","  strXmlParser:"+strXmlParser);
                   absoluteXMLPath = pwcRoot+strXmlpath;
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),"servletStartup","  absoluteXMLPath:"+absoluteXMLPath);
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),"servletStartup","  strXmlParser:"+strXmlParser);
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),"servletStartup","  absoluteXMLPath:"+absoluteXMLPath);
                   PageBean pageBean = XMLParser.parse("file:///" + strXmlParser,absoluteXMLPath);
                   //PageBean pageBean = XMLParser.parse(strXmlParser,absoluteXMLPath);
                   //Set into application scope
                   sc.setAttribute("PageBean",pageBean);//Store into application scope
                   sc.setAttribute(Constants.ABSOLUTEXMLPATH,absoluteXMLPath);//Store into XML PATH into application
              catch(FrameworkException e)
                   //Exception handling here
                   pfm.util.PFMLogger.getInstance().logError("pfm", "1", "servletStartup", "Framework Exception in init :"+e.getMessage());
                   //this.destroy();
                   throw e;
              catch(Exception e1)
                   //Exception handling here
                   pfm.util.PFMLogger.getInstance().logError("pfm", "1", "servletStartup", "Exception in init :"+e1.getMessage());
                   //this.destroy();
                   throw new ServletException(e1);
              // Handle all the Servlet initialization here. Add code below.
         * Method will process the request for specified page
         * @param req HttpServletRequest
         * @param res HttpServletResponse
         * @exception Exception - IOException
         * @exception Exception - Exception
         private void processRequest(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
              throws ServletException, IOException, Exception
              try
                   String commandName = null;
                   String pageId = null;
                   String next = null;
                   pageId = httpservletrequest.getParameter("PageID");
                   ServletContext sc = getServletContext();
                   String helperClass = null;
                   PageBean pageBean = null;
                   pageBean = (PageBean)sc.getAttribute("PageBean");
                   HttpSession session = httpservletrequest.getSession();
                   Page page = null;
                   if (pageBean!=null)
                        page = pageBean.getPage(pageId);
                        helperClass = page.getPageHelper();
                        if (session!=null)
                             //session.setAttribute("PageBean",pageBean); // Can be removed *//////
                             session.setAttribute("PageId",pageId);
                             session.setAttribute("Page",page);
                   // get command factory
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),httpservletrequest.getRemoteUser(),"  helperClass:"+helperClass);
                   CommandFactory factory = new CommandFactory();
                   Command command = factory.getInstance(helperClass);
                   RequestWrapper httpRequestWrapper = new HTTPRequestWrapper(httpservletrequest,httpservletresponse);
                   String targetPage = null;
                   targetPage = command.execute(httpRequestWrapper);
                   pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),httpservletrequest.getRemoteUser(),"  targetPage:"+targetPage);
                   // dispatch to target page
                   if (!targetPage.equals("DOWNLOAD"))
                        dispatch(httpservletrequest, httpservletresponse, targetPage);
                   else
                        pfm.util.PFMLogger.getInstance().logInfo("pfm",this.getClass().getName(),httpservletrequest.getRemoteUser(),"  This is downLoad, canot dispatch");
              catch (Exception e)
                   // log here
                   pfm.util.PFMLogger.getInstance().logError("pfm", "1", httpservletrequest.getRemoteUser(), "Exception in process request :"+e.getMessage());
                   throw e;
         * Method will dispatch the control to the specified page
         * @param req HttpServletRequest
         * @param res HttpServletResponse
         * @param page String
         * @exception Exception - ServletException
         * @exception Exception - IOException
         private void dispatch(HttpServletRequest req, HttpServletResponse res, String page)
              throws ServletException, IOException, Exception
              ServletContext context = getServletContext();
              RequestDispatcher dispatcher = null;
              try
                   dispatcher = context.getRequestDispatcher(page);
                   dispatcher.include(req, res);
              catch (Exception e)
                   throw e;
    }Thanks again
    Amit Wadkar

  • Viewing Threads In WinXP Pro SP2

    Hi all,
    I installed Oracle 9iR2 (9.2.0.1.0) WinXP Professional SP2 and tried to use Administrative Assistant to view the background processes/threads. It seems that either there is a bug somewhere or I missed some steps. The dialog box always displayed nothing - no thread.
    Here is what I've done. In Admin Assistant, I right clicked Computers->database->instance_name. I first used 'connect database'. A list of users and roles then displayed. I then chose 'Process Information' under the same menu. But the dialog box was empty. I've double verified that my database was started (i could select table in sqlplus).
    Why there was no thread displayed? Did i miss some steps?
    Thx for any input.

    Alternate solution to your problem.
    You can make use of v$bgprocess and v$process dynamic views.
    Use following query
    select a.name,b.spid from v$bgprocess a,v$process b where a.paddr=b.addr;
    Hope so this will solve your req.
    Nikhil

Maybe you are looking for