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

Worker Threads and Work Queue

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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