Results 1 to 4 of 4
  1. #1
    lcmorley is offline Member
    Join Date
    Jan 2012
    Posts
    2
    Rep Power
    0

    Default Thread hell - Please Help!!

    I am not sure if this is the correct place to post this thread as my problem seems to span the boundaries of many technologies but here goes.

    I am currently running a web app which has a main thread. This has access to the HttpSession object with which I can store and obtain user information
    once they have logged on.

    I also have a second thread running in parallel which is a poller thread. Every second it sends out events to listeners which then react accordingly.

    Basically, what I am trying to do is when a listener to the poller thread receives a polled event, it needs to notify the currently logged in user if there are any new notifications for them.

    My main problem at the moment is that I need to somehow get hold of the information from the HttpSession from the second thread. I am not sure if this is possible though as only the main webapp thread has access to this as far as I know.

    I have tried the TheadLocal method but this obviously will not help as only callers local to the thread can access the information on it.

    I hope I have explained my problem well enough for people to understand. As I said, there is probably no way around this but was just checking to see if anybody has come across the situation before as I am fairly new to thread programming.

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Thread hell - Please Help!!

    How is the polling thread going to inform the user?
    Because in a normal webapp the server cannot prompt the client.

  3. #3
    lcmorley is offline Member
    Join Date
    Jan 2012
    Posts
    2
    Rep Power
    0

    Default Re: Thread hell - Please Help!!

    I am working on a flex application which provides a mechanism to send messages from the Server to the client.

    I have it working with just one user logged into the server at the moment as this does not require access to the session.

    Actually the more I am thinking about it, I think it is more complex than I originally thought.

    Not sure I can get hold of the current session as there is no concept of a current session on the server side, only the client side right.

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Thread hell - Please Help!!

    Exactly.
    The server is quite likely to be working on multiple sessions at one time, so which classes as current?

    I'd have to read up on flex, but I'd lay good odds on it being the browser polling the server, otherwise there'd have to be a permanent link between the two.

Similar Threads

  1. Main Thread not waiting for grand child thread to finish
    By prashanthn in forum Threads and Synchronization
    Replies: 3
    Last Post: 06-07-2011, 09:26 AM
  2. how to reduce the thread sleep time and wake up the thread
    By baktha.thalapathy in forum Threads and Synchronization
    Replies: 2
    Last Post: 06-24-2010, 07:36 PM
  3. Trigger main thread method from secondary thread?
    By DigitalMan in forum Threads and Synchronization
    Replies: 8
    Last Post: 01-26-2010, 02:13 AM
  4. Replies: 0
    Last Post: 01-28-2008, 07:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •