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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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.
 
All of the following truths are shameless lies. But what about this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    Bookmark Topic Watch Topic
  • New Topic