Results 1 to 2 of 2
  1. #1
    d3n1s is offline Member
    Join Date
    Apr 2011
    Rep Power

    Default Using pipedinputstream to REQUEST data from another thread

    Hello all

    I am developping a server that will act as a database server to fetch info from a database and send it back to clients. I have made it multithreaded and ran into a wall. I know of piped streams and how you can pass the output stream to a thread and the input stream to the other and have the input stream read whatever is passed to it from the output stream. The way my server works is i have one thread that interacts with the db and has a get connection method which returns a connection. I also have a socket listener class that gets queries from clients and executes them. What i would like to do is have the listener thread REQUEST a connection from the DB thread using piped streams. Normally data is being pushed to the input stream via the output stream, as opposed to the input stream requesting data from the output stream.

    I don't have code example since i have not implemented this part yet (my server only displays the query and returns an acknowledgement to the clients so far). Is what i'm trying to do possible?



  2. #2
    d3n1s is offline Member
    Join Date
    Apr 2011
    Rep Power


    Side question : Does an output stream behave like a server socket where it will WAIT for the data to be sent/fetched before continuing execution? If it does, i could probably just make my Db thread constantly supply connections and the listener thread could fetch them as needed...

    Am i making sense?

Similar Threads

  1. Request help for retrieving data from Access
    By tunali2 in forum New To Java
    Replies: 6
    Last Post: 04-04-2011, 07:59 AM
  2. Thread at wait() state , shared data (volatile? confused ;/ )
    By doomsword2001 in forum Threads and Synchronization
    Replies: 5
    Last Post: 02-09-2011, 04:11 AM
  3. Problem with PipedInputStream
    By divakarnvs in forum Threads and Synchronization
    Replies: 11
    Last Post: 09-11-2010, 07:15 PM
  4. data from the main/GUI thread to another runnin thread...
    By cornercuttin in forum Threads and Synchronization
    Replies: 2
    Last Post: 04-23-2008, 10:30 PM

Posting Permissions

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