• Post Reply Bookmark Topic Watch Topic
  • New Topic

implementing Java request Queues  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys,

I have a web program that takes requests from user input and sends it to the database. I need to monitor the changes with data on the database, before I send another request.

Do does anyone know how to implement Java Queues? I've never used queues before.

I need to have a simple Java queue with to a) send a request. b) monitor db change c) send second request. The queue needs to have multiple requests.

I would will appreciate any guidance and insight you have, because I'm stuck.

Thanks in Advance.
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really an advanced question. Moving to the intermediate forum...
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Java 1.5 we have the java.util.concurrent package which has some elegant Queue classes suitable for use in a multi-threaded environment such as a web application. (I was just reading about them in the 3rd edition of _Java Threads_ by Oaks and Wong.)

I strongly suggest that you do NOT queue up the web application request objects - instead, extract the request data to some sort of holder class.
Consider completing the initial response with some sort of "working" message rather than waiting for the database operation to complete.

Request objects and Threads must be managed by the servlet container, you do NOT want the whole app to grind to a halt if there is some sort of holdup on the database end.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!