Bookmark Topic Watch Topic
  • New Topic

Worker Threads and Work Queue

 
Saniya Ansari
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi.. i'm working on a corba based project and i need to have a worker thread which picks up some work(sql statements) from a queue. So i implemented a work queue class using Linked List, a worker thread etc.. did a simple test ..worked fine.. The problem is that I need to know the contents of the LinkedList bcoz i need to check during the program if a certain object is currently in the work queue or not.. so a hashmap would be helpful since i can have the objectId for example as the key and the sql statemnt associated with it as the mapping.. but then i cant do the addLast and removeFirst() operations which are very helpful. In hashmap i need to pass a particular object refrence when i say remove(key) which makes the program more complicated.. so what can i do .. any suggestions.. would really apppreciate some quick advice.. i was thinking of two solutions.
1. a data structure for the objects i put in a linked list meaning an object which contains two attributes objectID and the sql stmt
OR
2. a linked list with another linked list.. but i dont know how that works. .havent used linked lists much..
So any threads and java.util expert out there.. PLEASE REPLY SOOOONNN...
thanks..
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question in multiple forums. A response is here. Thanks.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!