• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using Thread.interrupt() method , to finish mq.get(..) call, before stated time interval.

 
Ranch Hand
Posts: 133
Hibernate Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am trying to alter a piece of code which works with IBM MQ .

While invoking the get(...) method on the mq, we can provide wait interval , i.e. for how much time the thread will wait for a message to arrive in the queue.

When this time interval is too long , we want to stop this perticular thread , from waiting on mq.get(..) method (in some user initiated stoppage)

(There is some other logic that comes after the mq.get(), and we just intend to interrupt the thread to end waiting on mq.get() call)

One of the probable solutions would be invoking Thread.interrupt(); on the thread which has been waiting for mq.get(..) to completed.

What I am trying to understand here is , if this is a proper approach and can this be achieved in a better way?

Your help would be very much helpful on this one.

Thank you,
Rohit
 
rohit chavan
Ranch Hand
Posts: 133
Hibernate Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found a better way to do this.
Used repeating time intervals, for breaking the total WAIT time.
And it did the trick.
 
reply
    Bookmark Topic Watch Topic
  • New Topic