Results 1 to 2 of 2
  1. #1
    pnbalaji is offline Member
    Join Date
    Jun 2010
    Location
    Dodgeville, WI
    Posts
    9
    Rep Power
    0

    Default Reading MQ using threads

    Hi,

    Currently we are developing an application to calculate tax & freight using taxware and we are using MQ to pass the message between our AIX and mainframe servers. Though the application is working, we found that the response time is very low. The current existing application is taking around 2 secs to calculate the tax & freight, but our new application is taking more than 6 seconds.

    So, we want to use the multi-threading logic. Once we receive the response from mainframe (for tax & freight) via MQ, only one java application is reading that queue and process the message. Now, we would like to use more than one threads in the application to process multiple requests simultaneously.

    We changed our code to use thread logic, but we are having a problem. The threads seems to be working "fast", so we observed that sometimes two threads read the same message and I would like to avoid this case. Can some one help me?

    The threads should read the MQ sequentially, but once the message is read, the remaining process needs to be processed parallelly. We tried the "synchronized" block around the MQ read code, but it doesn't seem to work.

    Can some one help me how to achieve this?

    Thanks in advance,
    Balaji.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,762
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by pnbalaji View Post
    The threads should read the MQ sequentially, but once the message is read, the remaining process needs to be processed parallelly. We tried the "synchronized" block around the MQ read code, but it doesn't seem to work.
    If reading from that MQ is a critical operation it should be done in a synchronized block so that only one thread can read from it.

    kind regards,

    Jos

Similar Threads

  1. GUI and Threads
    By rp181 in forum Threads and Synchronization
    Replies: 1
    Last Post: 10-10-2009, 09:39 PM
  2. Threads reading a file and writing
    By akronjava in forum Threads and Synchronization
    Replies: 6
    Last Post: 09-07-2009, 03:52 PM
  3. Replies: 5
    Last Post: 08-21-2009, 12:03 PM
  4. Threads!
    By rameshraj in forum Advanced Java
    Replies: 1
    Last Post: 05-04-2008, 05:11 PM
  5. Threads
    By one198 in forum Threads and Synchronization
    Replies: 1
    Last Post: 11-20-2007, 07:15 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
  •