How to handle multiple request in the servlet

how to handle multiple request in the servlet...
Example:
java forum...
i'm login in the java forum at this time 1000 members make login in this....how happended in servlet?
if we use thread how to implement in servlet ?

Serlets are already threaded. The application container instantiates the servlet, then uses this instance in a new thread for every use.
This is the reason that you should use (almost) no instance variables in a Servlet, but rather that (almost) everything should be local to the method.

Similar Messages

  • How to handle multiple requests to the same servlet at one time?

    Hi,
    I am new to Servlets. I have doubt regarding ... Handling multiple requests to a servlet at a time.
    If we send a single request to a servlet, as know that group of objects such as servlet, servletContext, servletConfig, request, response and etc are created in the server, And if 1000's of requests are sent to a same servlet at a time, and if server memory capacity is less, then 1000's of objects are created in a server which would be heavy burden to Server. How to handle the application and development in such situation?
    Kind regards,
    veerendra

    Hi veerendra reddy ,
    By default any web server can will have a thread pool to handle client req's.
    In your point also heavy burden to server you are telling that depends on this.
    we can configure this min & max size of this thread pool.
    by default it will be 0-1000 for tomcat server.
    I am not sure in which file this configuration will be.
    But I hope in server.xml or some xml file consists this info.
    If You what you can edit accordingly. to overcome your heavy burden to server.
    Thanks & Regards
    Nagendra

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • How biztalk handle multiple request at a time ?

    can TCP/IP adapter or biztalk handles multiple request at a time ?
    If yes,then how it process multiple request ? 
    Can TCP/IP send ports sends multiple request ?
    Prakash

    Yes.
    It processes multiple requests using THREADS. Each Connect starts off a thread that handles the receipt of the message, submission to BizTalk, wait for the response (matching two-way subscription) and then respond back to the client.
    TCP/IP Send ports handle multiple requests by creating fresh sockets (RPC High-end ports). As an example, in your browser you open multiple tabs and access different sites, each tab results in your browser opening a fresh socket connection for the request.
    Regards.

  • How to handle multiple actions in the webservice ?

    Hi Guys,
    I have multiple operations in the webservcie and under soap action in the receiver soap adapter, i dont know how to handle multiple soap operations.
    can anybody guide me, how to acheive this ?
    Thanks,
    srini

    Hi Srini !
    This weblog shows the general design of a scenario with BPM
    /people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm
    This link:
    http://help.sap.com/saphelp_nw04/helpdata/en/de/766840bf0cbf49e10000000a1550b0/content.htm
    show how to insert a predefined BPM pattern. You could use one of the BpmPatternSerialize.... patterns to see how you BPM should look like...
    Basically it should be:
    1) Receive Step (async/sync, as you need) to trigger the BPM
    2) Send step (sync) for first webservice
    3) Send step (sync) for second webservice
    N) Send step (sync) for N webservice
    N+1) if the whole communication is sync, here you need to use a send step to return back the answer to sender.
    Regards,
    Matias.

  • How to handle multiple exceptions by the same code?

    Hi, all:
    In my situation I want AException and BException handled by the same code, while CException and DException handled by another code. How can I write my try-catch code in a simple way? Of course I can do the following:
    public void TheMainFunction() {
        try {
        } catch (AException e) {
            Handle_AB();
        } catch (BException e) {
            Handle_AB();
        } catch (CException e) {
            Handle_CD();
        } catch (DException e) {
            Handle_CD();
    private void Handle_AB() {
    private void Handle_CD() {
    }But is there a simpler way?
    Thanks in advance.

    If you have one or two places in your code that need multiple exceptions, just do it with multiple catch statements. Unless you are trying to write the most compact Programming 101 homework program, inventing tricks to remove two lines of code is not good use of your time.
    If you have multiple catches all over your code it could be a code smell. You may have too much stuff happening inside one try statement. It becomes hard to know what method call throws one of those exceptions, and you end up handling an exception from some else piece of code than what you intended. E.g. you mention NumberFormatException -- only process one user input inside that try/catch so it is easy to see what error message is given if that particular input is gunk. The next step of processing goes inside its own try/catch.
    In my case, the ArrayIndexOutOfBoundsException and
    NumberFormatException should be handled by the same way.Why?
    I don't think I have ever seen an ArrayIndexOutOfBoundsException that didn't indicate a bug in the code. Instead of an AIOOBE perhaps there should be an if statement somewhere that prevents it, or the algorithm logic should prevent it automatically.

  • How to handle multiple requests from single client??

    hi all
    I wrote a client server program to handle requests from client.I have 2 types of requests, one is to submit comments to the server other is to view comments on the server.I have tested the app and it works fine for either of them(independently) but they don't work both together i.e when i submit a comment and view it,it's stuck and when i close the program it gives SocketException :Connection reset.
    on client side:
    My request is just a string
    on the server side:
    I check the string and give the client what it wants.
    I want to know if there's any other way to send requests other than passing it as a string.
    I can post my code if needed.
    thanks,
    Sree

    Here is my client code,minimized it to the extent possible and it might give some compilation problems since i didn't include all the functions needed but i think you should be able to get an idea if i'm doing something wrong.
    Can give you my server code if needed.
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.Socket;
    import java.net.UnknownHostException;
    import javax.swing.JButton;
    public class Test {
         JButton submit_button;
         JButton view_button;
         Socket client;
          JButton get_submit_button() {
                   if (submit_button == null) {
                        submit_button = new JButton();
                        submit_button.setText("Submit");
                        submit_button.addActionListener(new java.awt.event.ActionListener() {
                             public void actionPerformed(java.awt.event.ActionEvent e) {
                                  send_comments_to_server();
                   return submit_button;
               Socket check_client_connection(){
                   String host = "C001192097";     //server host name
                   if(client == null || client.isClosed()){
                    try {
                         client  = new Socket(host, 4321);
                    }catch (UnknownHostException exception){
                         System.err.println(host + ": unknown host.");
                    catch (IOException exception){
                         System.err.println("I/O error with " + host);
                   return client;
              void send_comments_to_server(){
                    try
                         Socket client = check_client_connection();
                         DataOutputStream output_stream = new DataOutputStream(client.getOutputStream());
                         BufferedReader stream_input = new BufferedReader(new InputStreamReader(client.getInputStream()));
                         String comment_report = "comments";
                         Comments comment = new Comments();
                         User_Data user_data = new User_Data(); //function that returns client details such as host name and stuff
                         String user_info = "User Name: "+user_data.user_name+" "+"Host Name: "+user_data.host_name+" "+"Domain Name: "+ user_data.domain_name;
                         comment.user_info = user_info;
                         comment.summary = comment_report;
                         comment.comments = "passing comments";
                         String report = user_info+" "+comment_report+" ";
                         output_stream.writeBytes(report+"\n");
    //                     output_stream.close();
    //                     stream_input.close();
    //                     client.close();
                    }catch(IOException e){
                         e.printStackTrace();
              void receive_comments_from_server(){
                   String line;
                   StringBuffer comments = new StringBuffer();
                   try
                         Socket client = check_client_connection();
                         DataOutputStream output_stream = new DataOutputStream(client.getOutputStream());
                         BufferedReader stream_input = new BufferedReader(new InputStreamReader(client.getInputStream()));
                         String msg = "view comments";
                         output_stream.writeBytes(msg);
                         System.out.println("waiting for response");
                             while((line = stream_input.readLine()) != null){
                                  comments.append(line);
                              System.out.println("Comments from server "+comments);     
                        } catch (IOException e) {
                             e.printStackTrace();
              JButton get_view_button() {
                   if (view_button == null) {
                        view_button = new JButton();
                        view_button.setText("View Comments");
                        view_button.addActionListener(new java.awt.event.ActionListener() {
                             public void actionPerformed(java.awt.event.ActionEvent e) {
                                  System.out.println("request sent");
                                  receive_comments_from_server();
                   return view_button;
    }thanks
    Sree

  • How to handle multiple datasources in a web application?

    I have a J2EE Web application with Servlets and Java ServerPages. Beside this I have a in-house developed API for certain services built using Hibernate and Spring with POJO's and some EJB.
    There are 8 databases which will be used by the web application. I have heard that multiple datasources with Spring is hard to design around. Considering that I have no choice not to use Spring or Hibernate as the API's are using it.
    Anyone have a good design spesification for how to handle multiple datasources. The datasource(database) will be chosen by the user in the web application.

    Let me get this straight. You have a web application that uses spring framework and hibernate to access the database. You want the user to be able to select the database that he wants to access using spring and hibernate.
    Hopefully you are using the Spring Framework Hibernate DAO. I know you can have more that one spring application context. You can then trying to load a seperate spring application context for each database. Each application context would have it's own configuration files with the connection parameters for each datasource. You could still use JNDi entries in the web.xml for each datasource.
    Then you would need a service locater so that when a user selected a datasource he would get the application context for that datasource which he would use for the rest of his session.
    I think it is doable. It means a long load time. And you'll need to keep the application contexts as small as possible to conserve resources.

  • Does a filter instance handle multiple requests?

    A web container creates a thread to handle each request so that a servlet instance handles multiple requests at the sime time. What about a filter instance? Does a filter instance also handles
    multiple requests? or it handles only one at a time

    Here's a quote from the Servlet spec (2.3):
    After deployment of the web application, and before a request causes the container
    to access a web resource, the container must locate the list of filters that must be
    applied to the web resource as described below. The container must ensure that it
    has instantiated a filter of the appropriate class for each filter in the list, and called its
    init(FilterConfig config) method..............
    Only one instance per filter declaration in the deployment descriptor is
    instantiated per Java virtual machine of the container.
    So, if the servlet engine follows the spec, there should only be one instance.

  • Does af:commandButton submit multiple requests at the same time?

    Hi experts,
    I have a question about af:commandButton behavior.
    I have two commandButtons in a page. They are button1 and button2.
    Button1 takes a few seconds to complete its request process.
    So when I click button1, I can click button2 although button1 request is still being processed.
    I checked how ADF faces handled this situation with servlet filter.
    And I saw that button2 request was always submitted after button1 request was completed.
    Due to this behavior, I would assume that commandButton is designed not to submit multiple requests at the same time and guarantees click order.
    However I couldn't found any documents specifying this feature of commandButton.
    If anyone knows it, could you share?
    I know ADF Faces has busyStateListener to prevent user inputs during request round trip.
    But I'd like to make it sure that I don't need to use busyStateListener if I just want to keep processing order.
    Regards,
    Atsushi

    Hi,
    Does anyone know the document specifying the behavior of af:commandButton in case I click two buttons in a page almost simultaneously?
    Any help will be much appreciated.
    Thanks in advance,
    Atsushi

  • Extra request reaching the servlet

    Hi,
    I have written a servlet which returns me some html code that I display in the browser. The servlet is working fine. My problem is with the HTML code that sends POST request to the servlet.
    When the first POST request is send to the servlet, all the necessary parameters are passed and code works as expected.
    Here is the bug: Sometimes after receiving the first POST request, a secong POST request is somehow send to the servlet. This second POST request is followed by a GET request to the servlet. This GET request doesn't carry all the expected parameters. Due to this my code fails.
    I could not find the reason or the origin of these extra requests. The code is supposed to make only 1 POST request. But somwhow it is making extra requests (1 POST and 1 GET request).
    Can anybody suggest a solution?
    Has anybody come across a similar problem?
    My client side code is similar to the one below:
    <BODY id="MenuBody">
    <FORM method="POST" name="MenuForm" action="/myServlet">
    <input id="submitButton" type="button" style="left:585px; position:absolute" onclick="top.sendRequest();">
    In the sendRequest() function, I submit the form as follows:
    MenuForm.submit();
    Thanks in advance...

    Greetings,
    Hi,
    I have written a servlet which returns me some html
    code that I display in the browser. The servlet is
    working fine. My problem is with the HTML code that
    sends POST request to the servlet. Are you sure the problem is in the client and not in the servlet itself?
    When the first POST request is send to the servlet,
    all the necessary parameters are passed and code works
    as expected.
    Here is the bug: Sometimes after receiving the first"Sometimes" implies intermittency of the problem... sure makes it tough to debug. ':) Are you able to (intentionally) duplicate the error? If so, what conditions are present when you can vs. when you can't? Are you doing all your own testing? Try a "hallway useability test" - "anonymous" third person and see if they can duplicate the problem...
    POST request, a secong POST request is somehow send to
    the servlet. This second POST request is followed by a
    GET request to the servlet. This GET request doesn't
    carry all the expected parameters. Due to this my code
    fails.Are you actually seeing multiple requests being generated in the server logs?
    I could not find the reason or the origin of these
    extra requests. The code is supposed to make only 1
    POST request. But somwhow it is making extra requests
    (1 POST and 1 GET request).
    Can anybody suggest a solution?
    Has anybody come across a similar problem?
    My client side code is similar to the one below:"Similar" but not the same? Sometimes, in trying to "paraphrase" code for presentation a crucial detail is left out... anyway...
    <BODY id="MenuBody">
    <FORM method="POST" name="MenuForm"
    action="/myServlet">
    <input id="submitButton" type="button"
    style="left:585px; position:absolute"
    onclick="top.sendRequest();">Have you tried this with a standard submit button input type? Does the error still persist? If not, then perhaps the error is in your browser's JavaScript handler.
    In the sendRequest() function, I submit the form as
    follows:
    MenuForm.submit();
    Thanks in advance...Regards,
    Tony "Vee Schade" Cook

  • How to select multiple values from the parameters in BI Publisher report

    How to select multiple values from the parameter drop down in BI Publisher, and how to handle this mulitple values from the report sql...

    Hi kishore,
    I have used all the steps as you mentioned in your previous reply....including checking Mulitple Selection Check Box..
    Iam able to get the results when I am selecting one value..
    and also I am able to handle multiple values the in the query by using IN :Parameter, but seems when we select more than one value from the parameter drop down i think the Bi Publisher is sending the values in concatenated form something ilke
    ex: "'ACCOUNT','HR','SALES'" ,and when trying to display the parameters values in the output, its throwing the error as 'missing right paranthesis' ....on the whole do you have any solution which would handle
    1.Single selection.
    2.Multiple selection.
    3.'ALL' Values.
    4.Separating the concatenated string into individual strings and dispaly them on the output of the report..etc..in case of Mulitple selection.
    Ex:
    Concatenated String from BI Publisher:"'ACCOUNT','HR','SALES'"
    Expected Output on the report:ACCOUNT,HR,SALES
    reply to this would be much appreciated....
    thanks,
    manoj

  • How to handle multiple tables data in Entity Beans?

    How to handle multiple tables data in Entity Beans?
    i mean, my bean (non trivial) is responsible for frequent
    insertion in one table and some deletion on another table.
    Can anyone of you...please..?

    Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
    However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
    Cheers,
    Peter.

  • How to handle multiple site to site IPsec vpn on ASA, any best practice to to manage multiple ipsec vpn configrations

    how to handle multiple site to site IPsec vpn on ASA, any best practice to to manage multiple ipsec vpn configurations
    before ver 8.3 and after version 8.3 ...8.4.. 9 versions..

    Hi,
    To my understanding you should be able to attach the same cryptomap to the other "outside" interface or perhaps alternatively create a new crypto map that you attach only to your new "outside" interface.
    Also I think you will probably need to route the remote peer ip of the VPN connection towards the gateway IP address of that new "outside" and also the remote network found behind the VPN connection.
    If you attempt to use VPN Client connection instead of L2L VPN connection with the new "outside" interface then you will run into routing problems as naturally you can have 2 default routes active at the sametime (default route would be required on the new "outside" interface if VPN Client was used since you DONT KNOW where the VPN Clients are connecting to your ASA)
    Hope this helps
    - Jouni

  • How to handle multiple connection or user with l2cap

    hi friends,
    I need your help please a.s.a.p
    how to handle multiple connection with l2cap protocol in j2me
    sorry,
    I'm a new programmer in j2me
    thanks all...

    Please stick with the original thread http://forum.java.sun.com/thread.jspa?threadID=5200413&tstart=0
    Cross-posting is very rude, and JSch has nothing to do with JSSE, directly. It is an SSH2 API. It does (AFAIK) use some parts of JSSE, but those parts are definately not your problem.
    You already have answers in the other thread.

Maybe you are looking for

  • EMS memory problem on Satellite M40X

    Hello. I'am new user sat. m40x-116. I must use EMS and XMS memory in MS-DOS based programs. But now it's not be. I look with MEM command in dos mode, and my programs messeage is "OUT OF MEMORY". I changed windows xp home to xp pro. But it's negative

  • MacBook/iTunes not 'seeing' iPod

    I haven't updated my iPod for a while, certainly not since the last couple of iTunes updates. However, today I opened iTunes, connected my iPod nano and it is not being seen by my MacBook. I've tried closing and reopening iTunes whilst keeping the iP

  • How to find out what camera files are supported in CS4

    Hi guys, I've searched support and this forum and have not been able to find an answer. We are going to be purchasing a new camera in the not too distant future and need to know if CS4 will support the one we eventually purchase or if we will have to

  • Unable to upload file more than 2 MB

    Hi I am trying to uplaod a file to Oracle DB using struts . The file is being stored as a blob datatype . When the file-size is more than 2 MB the file does not get uplaoded . The property mapped to the form attribute returns null . IBelow is part of

  • Set a completed operations alert

    This question was posted in response to the following article: http://help.adobe.com/en_US/photoshopelements/using/WS287f927bd30d4b1f626a494c12e28b3ab58- 7ff1.html