Servlet spawning multiple threads causes server to freeze PC

I'm attempting to write a servlet which, upon receipt of a particular GET request, spawns a thread to do various work which can then be queried by a different GET request. A third type of GET request stops a specified thread.
This is working fine, except that I can only seem to have spawned one thread at a time. When I spawn another thread, my entire PC stops responding (even Windows Task Manager becomes so sluggish that I cannot kill the server) , and I have to do a hard reset of my PC. I'm using Sun Java System Application Server. The server logs do not contain any errors. I've tried the NetBeans debugger a bit, and it seems to happen when I call the start() method of the Thread.
This is my first experience with servlets, as well as my first experience with Sun Java System Application Server. I'm also not a Java expert by any means. I'm sure I'm doing something stupid, but I haven't a clue what.
I can post my code if necessary, but does anyone have any idea what could be causing the server to stop responding just because a servlet spawns two threads? Should I post my code?
Sorry if this is a n00b question. Thanks in advance.

I think you may need to spawn it into HTML frame. Each frame will perform
          and download independently.
          Is it what you need ?
          Siros
          "sam ernie" <[email protected]> wrote in message
          news:[email protected]..
          > Hi,
          >
          > In our application, the content of the main page is being
          > retrieved from different databases. All the requests originiate from
          > one JSP to different databases to retrieve the info. As the JSP
          > processes each of the request sequentailly, there is considerable delay
          > before the contents are displayed to the user.
          >
          > What I want to acheive is spawn multiple threads and display the content
          > to the user in fractions as each thread returns. For eaxmple, if the
          > user has subscribed to three news servers.. I want to be able to
          > display the news from first server to the user without waiting to
          > recieve response from the other two servers.
          >
          > What is the best approach to follow for such requirements ?? Any
          > thoughts on this would be highly appreciated.
          >
          > Thanks,
          >
          > Sam
          >
          

Similar Messages

  • Spawning multiple threads ?

    Hi,
              In our application, the content of the main page is being
              retrieved from different databases. All the requests originiate from
              one JSP to different databases to retrieve the info. As the JSP
              processes each of the request sequentailly, there is considerable delay
              before the contents are displayed to the user.
              What I want to acheive is spawn multiple threads and display the content
              to the user in fractions as each thread returns. For eaxmple, if the
              user has subscribed to three news servers.. I want to be able to
              display the news from first server to the user without waiting to
              recieve response from the other two servers.
              What is the best approach to follow for such requirements ?? Any
              thoughts on this would be highly appreciated.
              Thanks,
              Sam
              

    I think you may need to spawn it into HTML frame. Each frame will perform
              and download independently.
              Is it what you need ?
              Siros
              "sam ernie" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              > In our application, the content of the main page is being
              > retrieved from different databases. All the requests originiate from
              > one JSP to different databases to retrieve the info. As the JSP
              > processes each of the request sequentailly, there is considerable delay
              > before the contents are displayed to the user.
              >
              > What I want to acheive is spawn multiple threads and display the content
              > to the user in fractions as each thread returns. For eaxmple, if the
              > user has subscribed to three news servers.. I want to be able to
              > display the news from first server to the user without waiting to
              > recieve response from the other two servers.
              >
              > What is the best approach to follow for such requirements ?? Any
              > thoughts on this would be highly appreciated.
              >
              > Thanks,
              >
              > Sam
              >
              

  • BrdMgr 3.9 fails to load, causes server to freeze

    Am beginning to troubleshoot a problem with a NetWare server (6.5 sp8) running BrdMgr 3.9 that stopped working awhile back. In fact, the server is still running fine but with BorderManager not loaded for the time being. BrdMgr. was only being used as a Proxy server. When the problem began late last year, everytime there was an attempt to load BrdMgr., the server would freeze up and a hard reset was required. So I am wondering whether we need to just re-create the cache volumes and delete the DNS cache - perhaps there is some corruption there that is causing the server to tank. Or, re-install a BrdMgr support pack? Any ideas? Thanks.
    I will likely have more info once I visit the site later today.

    djhess,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • Opening SQL Server Management Studio causes server to freeze - mouse stops working

     I have a virtual server running Windows Server 2012 with SQL Server 2012 on it.  Recently I went to open SSMS and it caused the entire server to freeze.  I can't click on anything- nothing in SSMS, on my desktop, my taskbar, or anywhere else. 
    All I can do is close the remote desktop window, log in as a different user and restart the server to get it to unfreeze.  I found that I can use keyboard arrows for basic navigation within SSMS and the Enter key to Connect to the database but that's
    it.  I've tried uninstalling and reinstalling the software with no luck.  Event Viewer doesn't log any errors.
    We use this server for GIS data so ESRI's ArcSDE programs are also running on the machine- they are acting buggy for some users but not others.  I don't know if this is related.  We've also been having issues with the backups from vRanger which
    have caused random server crashes.  Our Server/Network Admin has temporarily disabled backups.  I'm afraid the instability has messed something up at a deeper level but I don't know where to start looking.  Any advice would be appreciated.
    Christina

    The GIS people have wanted to have all their software running directly on the server, including SSMS, based on recommendations from their ESRI consultant.  I will ask again why this is necessary.
    No matter what the consultant says, you can always connect to the server from another machine. (Unless the instance is configured to not accept remote connections.)
    While waiting for the server admin to increase the memory of the VM, you can connect to the server with SQLCMD from the command line and issue these commands:
    EXEC sp_configure 'max server memory', 2000
    RECONFIGURE
    go
    This restricts how much memory SQL Server can consume, and you should now be able to run SSMS on the server. The performance of SQL Server may suffer, though.
    When you get more memory, run the commands above again, but with 6000 instead of 2000.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Servlet with Multiple Threads spawned automatically

    Hi,
    I have a problem involving threads in servlet as follows:
    Scenario: I am working on developing a web application using Tomcat and Netbeans IDE. I have a servlet which gets values from the session object and then constructs a server-side object and invoke a method on the same. This method on the server-side object executes an INSERT query in the mysql database.
    Problem Description: The INSERT query is invoked twice => the method on the server-side object is invoked twice, and 2 records with different keys are created in the database table.
    Observation: When I used the debugger in the IDE, I discovered that there are 2 different threads that are getting spawned (which I did not design/code for) and these threads call the insert query on the table twice.
    I am not sure why this is happening. Can someone please throw some light on this?
    Thank you in advance.

    The servlet has a number of multiple if-else blocks. In the last if-else block of the servlet code, I am getting some attributes from the session object, creating the server class object and setting the attributes of the object.
    The 2-thread problem is occurring only when the the last block is reached. The 1st thread creates the server class and the 2nd thread executes the rest of the lines in the servlet and completes the INSERT query. This is followed by the 1st thread to insert a new record again.

  • Spawning multiple threads inside a Servlet

    Hi All,
    We have a situtation where we need to crawl various sites/databases for information to perform a search. As we all know, the most efficient way is to multithread the application. Since J2EE discourages custom Multithreading, we had to search for alternatives to accomplish this task.
    We came across few interesting solutions using JMS/MDB. Other than using these is there a simpler way to accomplish this. Any help is appreciated...
    Thanks,
    Srini

    oc4j/orion is the fastest servlet engine on the planet. Those
    guys in Sweden don't let you mess around with the number of
    servlet instances available. The message here is that you do not
    have to resort to any tricks that other servlet engines use to
    make sure your servlet will be available to be served up...it
    will.
    The only thing that slows it down are lack of memory or lack of
    resources (the database isn't replying fast enough). You can
    solve these problems by clustering your servers on several
    machines.
    regards,
    the elephantwalker
    www.elephantwalker.com

  • Posting Threads causing server problems too?

    I don't feel sorry for apple at all releasing everything in 24 hours, but I think threads are probably not helping either, but then again I think different server's for web vs. itunes.

    Good grief, if they're using the same servers for these boards as they are for their iTunes hosting, they have bigger problems than some ticked off customers.

  • Calling System.exit() from multiple threads

    Hi,
    Why would calling System.exit() from multiple threads cause all the threads to block?
    Laith

    Thanks for your replies.
    I made further tests and the problem is actually not as I described it first.
    I'm using a shutdown hook that would stop all running threads if the program is stopped externally (using ctl-c for example) (I'm not using Thread.stop(), but setting a boolean value to false that would make the thread exit a while() loop in run()) .
    One of the running threads would call System.exit(-1) just before it would exit run().
    This thread is getting blocked if it is stopped by the shutdown hook.
    I know that this is a bad coding practice, bout would still appreciate an explanation to the reason why the thread is actually blocked by System.exit().
    Laith

  • Where can we tell OC4J to load multiple threads of a servlet?

    I configured a web site on OC4J that uses a servlet. Everything is working fine.
    Now, I want to start, lets say, 50 instances of this servlet when the web site
    is started by OC4J. How can I do this? Which configuration files should
    I play with? Please note that my servlet is single-threaded and that I want
    all threads running in the same JVM.
    I want to do something similar than this parameter in JServ:
    singleThreadModelServlet.initialCapacity=100
    Thanks

    oc4j/orion is the fastest servlet engine on the planet. Those
    guys in Sweden don't let you mess around with the number of
    servlet instances available. The message here is that you do not
    have to resort to any tricks that other servlet engines use to
    make sure your servlet will be available to be served up...it
    will.
    The only thing that slows it down are lack of memory or lack of
    resources (the database isn't replying fast enough). You can
    solve these problems by clustering your servers on several
    machines.
    regards,
    the elephantwalker
    www.elephantwalker.com

  • Need to spawn multiple Automator app threads

    I have an AppleScript that runs on a folder action when files are dropped in.
    Each item triggers the same Automator app that FTPs the file.
    Problem arises when the files come in faster than the Automator app finishes each FTP job, so some are skipped. If i could have the AppleScript somehow spawn multiple Automator app threads, this would be solved.
    How would you go about solving it (sorry, can't slow down the incoming files)?
      Mac OS X (10.4.7)  

    anyone?

  • Multiple Threads Using System.out.println...

    i have a client server app and each client that connects to the server has its own thread.
    i am running the server on a pc using windows xp and to run it i just use a bat file which uses cmd.exe and my output using System.out.println prints out in the cmd.exe.
    each of my threads is using System.out.println to send debug info and outs quite often.
    after the screen fills a scroll bar appears at the right and you can scroll back to see past output.
    my app is all running ok but when i had a ton of output coming in all at once i tried to scroll back to see the older output and realized that if i click down on the scroll bar and fight the new input it freezes my server app. then when i release it it continues lol.
    it made me wonder if output from multiple threads when there are many all at once (say 20 or 30 threads all outputing at the exact same time) could cause a slow down or effect the performance of the server?
    i use a debug variable so i can just turn this output 100 % off except for critical errors so there would be no output but i am just curious as to whether or not it may be causing problems when its on.

    That's not a performance issue, I guess System.out.println() simply gets blocked by the console while you're scrolling and thus your app stalls, until you stop doing that.
    Maybe you should look into logging.

  • Servlets handle multiple, concurrent requests

    Hi, folks. Could someone give me a basic idea of how Servlets handle multiple, concurrent requests which are sent from user's web browser, or possibly, point me some useful web links, tutorials. Let me take a example to make sure that i have explained the question clearly: let's say there is a website that does air ticket booking service. Suppose there is a spare seat exists for a particular flight. There are two users logon to the website and they are both looking for this particular seat. So, once these user's HTML form requests are sent to server, how do i implement my servlet to handle these requests properly, in another words, make sure this seat is only allowed booked by a single user. thanks in advance.

    This acturally raises me a another question which i
    still have some uncertainties. In another assignment i
    did last semester, that was we had multiple users
    using our database and accessing, retirving and
    updating database by using jdbc. And what i did was
    let every user call a particular method within a
    javabean for setting up database connection, then goes
    for the specific that needs to be dealt with. So, what
    i am wondering now is that can i possibly having a
    different approach, like setting up only a single
    connection(ie. a public Connection objec) which being
    exist all the time so that all request can get
    connection by calling this object's relevant method.
    Hope i explained it clearly.
    If I understand you correctly, then you would have to make the methods of this Connecting Object synchronized so that there was only ever one connection to the database at any one time.
    If a database is transactional, that means it has attempted to deal with the problem of multiple connections and statements being executed at the same time on the same data. If you have one single Connecting Object then you don't have to worry about transactions, but you do need to make sure that there aren't multiple threads running, each trying to use your Connecting Object.
    The synchronized keyword makes sure only one thread can use the synchronized method at any one time.

  • Servlets and multiple JDBC connections...

    Hi Guru's
    I want to perform multiple JDBC queries simultaneously from my servlet. Let's say I have a connection pool containing JDBC connections. Now what I want to do is to use each of this connections simultaneously to perform queries in parallel.
    What is the best way to do this??? create multiple threads, one for each query, and then collate results when all threads are finished???
    Has anyone does this before or know of any links or samples which I can look at??
    your help much appreciated...
    Many Thanks

    Thanks but further questions....
    But take care:
    multithreading might only work parallel if there are
    multiple processors - otherwise the thread fragments
    will be processed one after the other until they are
    finished.I agree. My server has multiple processors hence multi-threading.
    Why do you need to perform the queries
    simultaneously?
    wouldn't it work too when you perform the queries one
    after the other?To speed up performance. Sequential processing is too slow at the moment.
    Hope you don't try doing so inside one single
    database...yes inside a single databse.
    Do you have any links to sample example etc..??? Importantly are you aware of any issues when one does this type of multi-threading from servlet. i.e does it clash with servlet's threading model etc...
    I am aware of how servlets multithread requests and am quite familiar with them. Just wanted some examples on multithreading JDBC connections from servlets and how I can wait for all threads to finish before collecting results....also wanted to make sure that there are no other issues....
    further help will be much appreciated.....

  • Can Java Spawn multiple processes?

    I see that Directory proxy server is spawning multiple processes. Is this really possible? How should one shut down this process? kill -15 did not kill child process
    Operation System is Solaris 10.
    -bash-3.00$ ptree 27450
    27450 /usr/jdk/instances/jdk1.6.0/bin/java -Xss128k -Xmx1400M -Xms1400M -XX:NewSize=1
    27789 /usr/jdk/instances/jdk1.6.0/bin/java -Xss128k -Xmx1400M -Xms1400M -XX:NewSize=1
    27790 /usr/jdk/instances/jdk1.6.0/bin/java -Xss128k -Xmx1400M -Xms1400M -XX:NewSize=1
    Thanks!

    Because on linux threads are implemented as standard processes but on other
    platform like windows and solaris they are not processes.

  • Jdbc and multiple thread

    hi, i have an application that creates multiple thread..each thread (querythread) is accessing a webservice(querydb) that retrieves data from different databases. This webservice supposed to create a jdbc connection each time it is invoke by the querythread. The problem is i get an error that a particular table does not exist in the server..This is cause by the confusion in my program..
    The table is access in the wrong server..e.g.(cdsisis.TblHoldings does not exist) this is because thread is confuse and using a different connection..when i tried to use the querydb webservice directly per database it is ok. but when i try to make multiple thread to invoke querydb accessing different database it has this error: cdsisis.TblHoldings does not exist
    cdsisis is a database server..and tblHoldings is a table in another database named silms. i think the thread tends to share resources.
    should it be that thread supposed to be independent with each other? how come this is happening?

    hi, i have an application that creates multiple
    thread..each thread (querythread) is accessing a
    webservice(querydb) that retrieves data from
    different databases. This webservice supposed to
    create a jdbc connection each time it is invoke by
    the querythread. The problem is i get an error that a
    particular table does not exist in the server..This
    is cause by the confusion in my program..
    The table is access in the wrong
    server..e.g.(cdsisis.TblHoldings does not exist) this
    is because thread is confuse and using a different
    connection..when i tried to use the querydb
    webservice directly per database it is ok. but when i
    try to make multiple thread to invoke querydb
    accessing different database it has this error:
    cdsisis.TblHoldings does not exist
    cdsisis is a database server..and tblHoldings is a
    table in another database named silms. i think the
    thread tends to share resources.
    should it be that thread supposed to be independent
    with each other? how come this is happening?I think you should lock your thread while trying to make request or making your connection. When you lock your thread, the currently used variable can not be accessed by another thread. Actually I know you are creating different treads and create different instances of connection. But some how some methods are not thread safe, it means they are static or use static variables. So they change from another thread, while you are trying to access it.
    If lock does not work try this,
    synchronized(this){
    //do your stuff
    }

Maybe you are looking for