Question about multiple servlet comms

all,
Ok here is the setup:
Let�s say I have 3 servlets (A, B, C)
A is started and then responsible for polling a database to check for updates since last poll until it is destroyed on server shutdown
B is an intermediary servlet
C is responsible for pushing data to the client�s that have subscribed
The problem is this:
A is invoked and begins periodically checking a DB for updated data. Upon finding updated data it should forward the data to B. This does some checking and then in turn forwards the updated data to C. C then formats the data and pushes it to the client�s browser where it is displayed as SVG.
I am thinking B->C could simply be resolved through the use of a request dispatcher.
However the problem lies in the communication of A->B.
Since servlet A should frequently (once a sec) poll and check the database contents to see if it has been updated I thought an easy way to do this would be to have the servlet make its check; if nothing has changed redirect the response back to itself. If there has been a change, update servlet B with that change. The problem is how can one send the update to servlet B without halting servlet A�s cycle?
If I open a httpURL connection to B then A will wait for B to pass a response back, but B wants to forward the request, via request dispatcher to C after some processing. Therefore A will hang as no response from B will be written.
If I have A use a request dispatcher to forward the data to B I am unable to redirect the response back to A and thus have it continuously checking.
Unfortunately it is unlikely I can make any changes to the architecture. Any ideas?
Kind regards

Sorry I can't help but I am interested in a similar problem.
Anyone out there?

Similar Messages

  • Questions about Java Servlets and JSP

    Hi,
    I'm a confident Java Programmer (and really enjoy using this language) but am very new to Java servlets and Java Server Pages.
    I have previously worked with Perl on my web projects (simple 'league' style voting pages). I read in my 'Core Java' book that I should no longer use perl or even cgi.
    I need to know more about Java servlets and Java Server Pages so I can make the switch to a 'real' programming language.
    I have a few questions:
    How should I start to learn JS and JSP?
    How applicable will the java knowlegdge I have already be?
    Are JSP common on the world wide web?
    What tools do I need to start? (I currently develop in JBuilder and have Java 1.4.1 Standard Edition)
    Is it likey my web host (and others) will support JSP?
    Thank-you very much for helping a novice get started,
    Regards,
    Paul

    Hi, Steve ...has to be frustrating! But do not despair.
    Let's suppose the servlet it's named MyServlet on package org.servlets
    WEB-INF should look:
    WEB-INF
    classes
    org
    servlets
    MyServlet.class
    web.xml
    web.xml file should have this two declarations:
    <web-app>
      <servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>org.servlets.MyServlet</servlet-class>
      </servlet>
      <!-- other servlets -->
      <servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/MyServlet</url-pattern>
      </servlet-mapping>
      <!-- other servlets mappings -->
    </web-app>Now, once the container starts (Tomcat?), you should be able to see that servlet in:
    http://localhost:8080/[my-context/]MyServletAnd what my-context is? The web application context. This string should be empty if your're deploying to the root context, otherwise should the context name. In Tomcat, deploying to root context defaults to using webapps/ROOT.
    Sorry for my English, but I felt the need to answer your request. I hope it helps despite my writing.

  • Newbie question about loading servlets on tomcat

    I have what is probably a very basic question about loading simple servlets on to tomcat to test its installation. I have followed instructions from numerous tutorials to the letter but still I can't get it to work.
    I have installed tomcat on win2k in c:\tomcat. I set up the jdk, environment vars (JAVA_HOME, CATALINA_HOME, TOMCAT_HOME) which all point at the correct dirs. I can compile a servlet without errors. I can also place a test jsp and html file into the root directory and they both work fine.
    However, now I am trying a test servlet and no matter what I do it gives me a 404. I have a servlet class file called "HelloServlet.class" which I placed into the %install_dir%\webapps\ROOT\WEB-INF\classes directory. I try to reference it using this url:
    http://localhost/servlet/HelloServlet
    Tomcat is configured to use port 80 and has been restarted after adding the servlet class file. Does anyone have a clue why this is not working for me?
    Many thanks
    Marc

    You have to add in the web.xml file that it is in the WEB-INF dir, the information about your servlet. An example:
    <web-app>
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>
    </web-app>

  • I bought a Canon 8400F scanner- question about multiple photos being scanne

    Hi,
    I have a question about about scanning photos. It was posted that if you scan something with multiple photos, it will separate the pictures.
    If I put 6 pictures on the scanner, will it automatically scan them and separate them, or is there something in the software where I select it to separate each picture.
    Thank you

    I'm not at my Mac right now but it should be real obvious in the CanoScan software. Open it up and play around. It will jump out at you.
    You don't tell it to select "each" picture. You merely tell it that there are multiple pictures and it then does everything automatically.

  • Question about multiple application modules.

    Hello,
    Suppose I have 2 database schema’s. For both schemas I have 1 application module. All view objects are in the same project.
    For each application module I have an application definition.
    Is it possible to link between these two applications? Because sometimes these database schema’s link to each other and you would like to jump from one application directly to the other.
    For example you have orders locates in 1 DB schema and customers in another DB schema.
    You would want to jump from the order directly to the customer details in the second schema.
    Is this possible? Or do I need to make nested application modules etc?
    I can find very little info about this; the JHS def guide does not offer much information about multiple application modules etc.
    -Anton

    Anton,
    Yes, you can jump aroundd as you like.
    You just can't use view links between VO's based on different db schema tables.
    Nesting AM's doesn't help there, the DB connection of the top-level AM will be used.
    Why don't you create synomyms for the tables in the other schema?
    Steven Davelaar,
    JHeadstart Team.

  • Question about Threads/Servlets

    Let's say I have a servlet that opens a socket connection to a server application. On the server end, I would have to make a thread for each connection. But what about the Servlet? do I have to deal with Threads on the servlet side or does the servlet engine takes care of that?

    Unless your servlet implements the SingleThreadModel interface, the servlet container shoud take care of running each request to your servlet in a separate thread.
    Andy Nguyen

  • Some questions about Java servlets

    I am having some problems with my Java servlets. Here they are below.
    #1 I have a login jsp page. When user logs in, the MySQL database is queried. If a match, redirect to appropriate page. The problem is I can't seem to remain in the login page if there is no match, I get a blank screen. If there is no match, how can I redirect it back to the login screen? For example, my login screen is login.jsp. Here is my code below.
    while(rs.next())
    if(rs != null)
    String name = rs.getString("USERNAME");
    Cookie getUser = new Cookie("User", name);
    response.addCookie(getUser);
    String sql2 = "INSERT INTO answers (USERNAME) VALUES( '" + name +"')";
    ResultSet rs2 = stmt.executeQuery(sql2);
    response.sendRedirect("profile410.jsp");
    out.println("<p>inside if structure");
    #2 After I go to the first screen after login, I am filling out a questionaire, and everytime I click on a submit button a different servlet comes into play, called InsertRecords.java. Everytime I go from one jsp to another, information gets stored into a database, InsertRecords.java is controlling this. I use the below code.
    String delete = request.getParameter("delete");
    String question = request.getParameter("question");
    String value = request.getParameter("R");
    if (delete.equals("no") && !value.equals(""))
    String sql = "INSERT INTO answers (" + question + ") VALUES (" + value + ")";
    int numRows = stmt.executeUpdate(sql);
    out.println("Record has been inserted");
    String nextPage = request.getParameter("nextPage");
    Cookie[] cookies = request.getCookies();
    if (cookies != null)
    for (int i = 0; i < cookies.length; i++)
    String name = cookies.getName();
    String valuecook = cookies.getValue();
    Cookie getUser = new Cookie(name, valuecook);
    response.addCookie(getUser);
    response.sendRedirect(nextPage);
    the table is answer and the fields are ID, username, and q1, q2 q3, up to q11. the idea is upon login, the username gets stored into the answer table, the field username. I want the values stored in the same row everytime user jumps from one page to another based on his username. Goes to first jsp, q1 gets inserted, next jsp, q2 gets inserted, etc. But they all get inserted diagonally on different rows, not the same one, that is the problem. How can I fix this?
    #2 Based on the above code, say there is 11 jsp pages, remember, this is an online questionaire. When user logs in, he starts at the first jsp page, or question. When for example when the browser gets cut off at question6, when he logs back in, I want him to start at question4, if cut of at question 11, start again upon login at question 8. The reason, so he won't have to start from the beginning. Each question is on seperate jsp's. The way I see this happening is creating a session upon login and keeping that session. And grab 4th question when he logs back in, but I am not sure about how to go about it.
    Can someone help me please?

    Q1:
    Use the update command and not insert.
    Q2:
    Won't work. The user may log back in after the session has expired or from a different location. On log in look for a record for that user and what questions have been answered so far.

  • Question about multiple audio tracks

    Hello,
    I see that imovie has only 2 audio tracks available when creating a movie. I need more than two since I will be working with a voiceover track, a soundtrack and at least one background/environment track all at one time. I won't be able to use the sound recorded with the video so that "track" is not an option.
    My question is; Am I out of luck here and need to spend the 1K for studio pro to add more multiple audio tracks?
    Also, I tried working with garageband but since all of my audio tracks import in at a minimum of 40 beats per minute, the voiceovers are all sped up and sound chipmunky.
    Thanks for any help!

    Well I didn't mean to irritate you...LOL And yes, I realize that this is the iM 6 forum but the gist of my question was related to multiple audio tracks in iM and thought I would ask about it in the forum pertaining to the latest release.
    I had already posted a question in the GB forum regarding the bpm problem and found no answers so I was pretty much about to shelve that idea and forgo the whole garageband thing; this without knowing about the new "swap" features. I just updated to iM 6 yesterday.
    As far as the "on-tape" raw audios: I was working on my movie in iM4. I wanted to add more audio bits but I don't have a proper mic for my G5 so I recorded the audio bits on dv8 tape through my camcorder. I imported the video (the image was the inside of my lens cap!), extracted the audio, took those audio files and imported them into GarageBand. That's when I noticed the bpm problem.
    I'm sorry about the lack of info I originally gave but like I said, I had pretty much gave up on the idea of using GarageBand. I'm pretty new at this and I'm trying to decide what I need in terms of software to get what I want out of my movie. I'd be willing to pay for FCxp but still looking into whether I need to do just that or whether I can get by by using imovie and now it looks like GarageBand too.
    ah, thanks for that
    what irritates me, Prince wrote:
    The audio tracks were voiceovers that came from my
    dv8tape, imported into imovie4.
    ... ehm, but this is the iM 6(six) section, as said,
    iM 6 allows now "swapping" files with GB3... (I'm way
    back in the 90ies.... see my specs... )
    so, video is in some iM, and he wants to use the
    actual "on-tape" raw audios...
    I thnik we need a little more detail...

  • OT: question about multiple root directories

    ok, so on this website i just transferred to a new host, i
    password
    protected a directory, and for many people (possibly
    everyone) it is
    asking for the login info twice or three times before it lets
    you in. i
    contacted the host tech support, who gave me an explanation
    that i don't
    think makes sense. or maybe it does, but i don't think
    applies to my
    problem. and even if it does, they didn't offer any advice on
    how to
    solve the problem, just what might be causing it. bad tech
    support.
    anyway, i had a different idea about what the might be. there
    are two
    root directories on the server: public_html and www. they
    both have the
    same files, and therefore my protected directory is protected
    in both
    places. to me, that seems like it could be why it's asking
    for login
    info more than once.
    so, i want to find out if this is the case by deleting the
    one i'm not
    uploading to. so basically, my question is, if i have chosen
    public_html
    as the directory that i upload to, is it safe to delete the
    www
    directory? or is there a reason that i need two root
    directories and,
    essentially, two copies of my site on the server?
    i realize these are probably questions best suited for my
    host, but i'm
    unimpressed with their tech support so far (though i like
    everything
    else about them), and i'm confident that someone here will be
    able to
    answer this question for me.
    thanks!

    ok, well that's good to know! thanks.
    also, i changed my mind about the tech support response.
    here's what he
    said:
    Typically when you are seeing multiple login prompts like
    what you
    describe it has to do with content/site linking.
    Here is a rather wordy explanation:
    When entering a password-protected web site for the first
    time, you
    will occasionally notice that you are asked for your
    password twice.
    This may happen immediately after you entered the password
    the first
    time, or it may happen when you click on the first link
    after
    authenticating the first time.
    This happens for a very simple, but nonetheless confusing,
    reason,
    again having to do with the way that the browser caches the
    login
    information.
    Login information is stored on the browser based on the
    authentication realm, specified by the AuthName directive,
    and by
    the server name. In this way, the browser can distinguish
    between
    the Private authentication realm on one site and on another.
    So, if
    you go to a site using one name for the server, and internal
    links
    on the server refer to that server by a different name, the
    browser
    has no way to know that they are in fact the same server.
    For example, if you were to visit the URL
    http://example.com/private/,
    which required authentication, your
    browser would remember the supplied username and password,
    associated with the hostname example.com. If, by virtue of
    an
    internal redirect, or fully-qualified HTML links in pages,
    you are
    then sent to the URL
    http://www.example.com/private/,
    even though
    this is really exactly the same URL, the browser does not
    know this
    for sure, and is forced to request the authentication
    information
    again, since example.com and www.example.com
    <
    http://www.example.com> are
    not exactly the same hostname. Your
    browser has no particular way to know that these are the
    same web site.
    at first i thought that didn't make any sense because i've
    been using
    the same url every time. but after paying closer attention
    during the
    login process, i see that he's right. i've been typing in the
    url with
    the www, but once you get logged in, there is no www. so i
    tried typing
    it in without the www, and i got right in with the first
    attempt.
    so, i suppose my question now is, can i make it so that
    typing in the
    url with the www, lets you in on the first login attempt? or
    should i
    just tell everyone to leave out the www?
    thanks for the help!
    Alan wrote:
    >
    >> there are two
    >> root directories on the server: public_html and www
    >>
    >
    > Usually, only one of them is a real folder. The other is
    a symbolic link, a
    > shortcut to the other.
    >
    > Don't delete either of them. You might delete the real
    folder instead of the
    > symbolic link. And- in most hosting setups, you wont
    have permissions to
    > delete the folder anyway. Changing the
    ownership/permissions of those
    > folders prevents panicked help ticket calls.
    >
    > You didn't say what the host says is the reason people
    are asked for
    > passwords several times. What did they say?
    >
    > and- is the first page that opens in the password
    section a framed page?
    > Or- does it draw images and other files from deeper
    nested directories? Such
    > an images folder?
    >
    >

  • Another question about multiple copies

    I've seen several others posting questions lately about making multiple copies, but my question is just slightly different. I'll be making an iDVD project for our 5th Grade Recognition at school. Obviously, I'll be making it on my Mac at home. However, once it's finished and I have my final DVD, I'm going to need to make over 50 copies.
    Last year, when I did the presentation as a Powerpoint show, it was easy enough to use multiple (Windows) computers at school to duplicate. There are 4 computers that I used to just rotate CD's in and out of to make copies.
    Will I be able to use a Windows machine to make copies of an iDVD disk? I know that the computers can burn DVD's, so that's not an issue. I can't remember exactly which programs the computer have. I believe that one is Sonic something. The one that I used for CD's was IRecordNow (or something like that).
    Is there any "protection" placed on the iDVD disk that will prevent me from placing the iDVD into the drive and choosing "copy" in whatever program that I use?

    Is there any "protection" placed on the iDVD disk that will prevent me from placing the iDVD into the drive and choosing "copy" in whatever program that I use?
    No. Only DVDs made in a production house have copy protection applied.
    (31727)

  • Question about multiple Script declarations

    I'm reading Flash Builder 4 and Flex 4 Bible.
    On page 121 it states:
    "Any particular <fx:Script> element can contain nested ActionScript or use the source property to link to an external Actionscript file, but it cannot do both at the same time. You can, however, have as many <Script> declarations in a single MXML file as you need>"
    My questions are about the last sentence.
    1)  They specifically used <fx:Script> and <Script>. Are these two different entities?
    2)  I've never seen examples of using multiple <fx:Script> declarations in a project. How would this work?
    3)  Are they promoting bad practices by making this claim?
    Thank you
    Kristin

    Although multiple script tags are allowed, I'd guess that they're not commonly used.
    Gordon Smith
    Adobe Flex SDK Team

  • Question about multiple ipods on one computer

    I set up my own ipod nano on my computer and I have been using it without problems for some time. Now someone else in my family got the same ipod nano. I do not know how to set up this new ipod. Do i use the same software already on my computer? Do i just register this new ipod? Please help. Thank you

    Hello!
    Let me explain this in detail for you:
    The Do Not Disconnect screen
    It is normal for your iPod to say this message to you when you connect it to your computer.
    When you need to disconnect it from your computer, you'll first need to eject it.
    There are a few ways to eject your iPod; through iTunes, the Safely Remove Hardware program, and "My Computer".
    Through iTunes
    Ejecting your iPod via iTunes depends on what setting your iPod is on for.
    Connect your iPod. Go into Edit> preferences> iPod. See what setting your iPod is on; "automatic" or "manual".
    Automatic
    If you aren't restoring, or updating your iPod, iTunes should automatically eject your iPod from iTunes. If it doesn't, then right-click the name of your iPod in iTunes, and make sure that the "enable for disk use" is un-checked.
    Manual
    If you need to eject your iPod from iTunes if the setting is "manual", click the little arrow that's next to the name of your iPod in the left source list in iTunes.
    Through the "Safely Remove Hardware" program
    Look at the bottom-right corner of your screen, and there's the system tray icons there. If the "Safely Remove Hardware" icon is there, click on it, select your iPod, and click "stop".
    Through "My Computer"
    Go to "My Computer".
    Find your iPod's listing there (it's typically "E:" or "F:").
    Right-click it, click on "eject".
    For additional information about ejecting your iPod, check this Apple Support articles about it.
    Safely disconnecting your iPod
    About the "Do Not Disconnect" and "OK to Disconnect" screens on iPod
    Any more questions? I'll be glad to try to help you again.
    ~~Kylene

  • Question about multiple LTS

    Hi,
    I am currently working with the rpd and a general doubt pops up... in the physical layer I have dimensions related, like for example Person, related to another dimension City and for example Age (with Foreign Key join):
    City -< Person
    Age -< Person
    So in order to have a true star schema in the BMM, I need to create a single logical table with these three physical tables, right? The question is how.
    I can add the physical tables as 3 logical table sources, or have one single logical table source, mapped to these three physical tables.
    What is the difference, if any? Can someone explain, please? I always use the first choice (multiple logical table sources, each of them mapped to one physical table), but is it better to have just one single logical table source?
    Thanks in advanced :)

    I'm not surprised that it works fine, but there is a chance that it can lead to some problems. Let me explain.
    You now have three LTS in your Logical dimension table Person.
    Person
    Age
    City
    When you create a report with columns from City and the Fact table, the BI Server will need to set up a join path between Fact and City table. There is no other option then via the physical Person table. So the BI Server decides for you to create a join between fact and person and person and city.
    When the City is joined to other tables in the physical layer then the BI Server might create another join path between Fact and City, because it thinks it is more efficient. This can lead to inccorect results.
    When you add the three physical tables to one LTS, you explicitly tell the BI Server, to create a join path from Fact to City table via the Person table.

  • Question about multiple listeners and vip addresses in rac.

    We have a 2 node rac cluster running 10.2.0.3 on rhel4 on the itanium platform. We have a need where we want to connect the 2 hosts up to another network temporarily by configuring an additional network interface on each server so that we can test some connections from a different network.
    My question is can you configure multiple listeners on the same server in which the newly added listener can be configured to service requets on the new network interface?
    Because it's rac would you need to configure an additional vip address? I am not sure that you can have multiple vip's on a server?
    Has anyone configured rac in such a way, any help is appreciated.

    can you configure multiple listeners on the same server in which the newly added listener can be configured to service requets on the new network interface?Yes, you can but you should not be doing this. Listener is a node specific resource and one listener can server multiple services. You actually can create multiple services within the database for different set of users and all can be registered to the same listener.
    Because it's rac would you need to configure an additional vip address? What do you mean by additional IP?
    You have installed 10g RAC where you have already configured virtual IPs. Why do you want to have additional one? node1 - static ip1, vip1, pvtip1
    node2 - static ip2 vip2, pvtip2
    total 6
    I am not sure that you can have multiple vip's on a server?Nothing to do with the server, they are based on public IP. Yes you can create multiples vip's based on same public IP. This is possible, But you do not need to do this in RAC environment.

  • Question about multiple recovery partitions

    Hello,
    My question is: what is the default partition for toshiba z930 ultrabooks.
    According to Windows 8 disk management, there are 6 partitions on my drive. From what I understand, the 6Gb is for hibernation (my computer's RAM is 6Gb), and the 101.38Gb is the main partition, and the 10.60Gb is for Toshiba recovery. I heard that the 450Mb partition is meant for Windows repair tools. But why are there two of such partitions?
    Recently I did a reset using the built-in windows 8 function. Not sure if this caused the "duplicate" 450Mb partition.
    What is the default partitioning scheme for toshiba z930 ultrabooks? My purpose of asking is partly out of curiosity but mainly because I am afraid of creating more of these 450Mb partitions if I should do a reset in future. Logically, a reset should not cause the duplicate partition but why are there two seemingly identical partitions? (I did not check the partition scheme when I first bought the computer, so I am not sure if I caused the duplicate. )
    Thanks very much in advance for taking the time to help me. I've attached a screenshot of the partitions.
    http://oi57.tinypic.com/2rw6zia.jpg

    I don't have a Toshiba machine here, but I know something about Windows 8 and about UEFI/GPT partitioning. I can tell you what four of the six partitions are for.
    Starting from the left side, the first partition contains the recovery environment (starts with the Choose-an-option menu); the second (System) partition contains the boot files; the C partition has Windows of course; and the 10.6 GB one is the recovery partition, which contains the image of the whole drive (including itself).
    I don't know what Toshiba uses the other two partitions (450 MB and 6 GB) for. Perhaps somebody here will explain those to us.
    Peculiar that Toshiba does not have the 128 MB Microsoft Reserved Partition. I thought everybody must have that one.
       Configure UEFI/GPT-Based Hard Drive Partitions
    PS A Reset preserves the partitioning and the hibernation image is the file C:\hiberfil.sys.
    -Jerry

Maybe you are looking for

  • Wireless connection issues

    I have read extensively on this problem and it seems others have the same issue, however I will fully document the problem I have here and will also be sending this to apple as a bug report. I have a Macbook Pro (3.1) running leopard 10.5.4 however t

  • Why won't Adobe Business Catalyst log in when i am trying to publish my website in Muse

    it just sits here and never logs in-normally it takes less than a second.

  • Organizing videos by year then event in folders?

    I organize my photos in Aperture in folders by year then event..2011, 2012, etc. How can I do this in Final Cut....do I create a new library for each year? After a few years of video at almost every event I just have a string of events on the left co

  • HELP -Re-Installing Creative Suite cs4

    Is their another fourm I should post this to lmk - I couldn't find a creative suite fourm? I did a re-format of my hard drive and went to install Creative suite cs4 gets to disk 2 out of the 5 and will not accept the others it keeps asking for disk 2

  • Hiding all parameters sended to report by using an URL

    hello, I am using OAS10G release 1 that contain a report server. I want to know if it's possible to hide all argument that appear when I call my report from an url. for example , my url : http://myserver/rwservlet/un=test\pwd@hostring&p1=1&p2='01-02-