This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes multithreading + queues + synchronization .. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "multithreading + queues + synchronization .." Watch "multithreading + queues + synchronization .." New topic
Author

multithreading + queues + synchronization ..

Gurbhej Singh Dhillon
Greenhorn

Joined: Oct 04, 2007
Posts: 10
hi m new to these concepts, bascially my question is that i have to develop a server which listens to client requets, so each client gets its own thread .. currently application funcationality is limited to accessing the same method( bascially clients try to access an RFID antenna to view the current tags it could read) the reader while processing should be disturbed by another request(its Electromagnetics !!) so it means i have to create something like a queue of clients request(client threads) n ensure proper synchronization .. as m not in this field of such java programming, so m really looking forward for your help asap
thanks in advance guys ..
does writing synchronized keyword would solve the purpose do so i dont have to get into queue's ??..
n btw the data transferred are serialized objects between the server connected to the Antenna reader n Web server listening to the client requets(3 tier application)
[ October 04, 2007: Message edited by: Gurbhej Singh Dhillon ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24057
    
  13

Hi "sin nombre",

Welcome to JavaRanch!

First, a bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. Spanish for "without a name" doesn't cut it at the Ranch. You must change your display name here. Thanks!


[Jess in Action][AskingGoodQuestions]
Gurbhej Singh Dhillon
Greenhorn

Joined: Oct 04, 2007
Posts: 10
done
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

I am afraid you have to study a bit of concurrency before diving into the development! Java concurrency tutorial may help.
To give you a head start, you would need one of the Executors to do this for you.
By the way, it sounds like an interesting work. Are you doing this as an assignment or profession?
[ October 04, 2007: Message edited by: Nitesh Kant ]

apigee, a better way to API!
Gurbhej Singh Dhillon
Greenhorn

Joined: Oct 04, 2007
Posts: 10
some1 replied
anyways lemme state it this way(may be n00bish) all i have to do is get clients requets from internet(servlets), as servlets create new thread for each request so it then connects to another backend PC(attached to the reader antenna) thourgh socket programming(exchanged data is object) . now problem is that if more than 1 client requets access to reader to i have to ensure that each request accesses the reader sequentially(reader cannot be disturbed with another request while processing), so it means threads at socketServer side which should be processed as FIFO, performance is not a issue here
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Yeah its like any other server side code and as told before, Executors of jdk 5 will help you.
[ October 04, 2007: Message edited by: Nitesh Kant ]
Gurbhej Singh Dhillon
Greenhorn

Joined: Oct 04, 2007
Posts: 10
could you throw some more light .. there are so many things, synchronized, lock and conidition, thread pool, blocking queues, etc .. which 1 to go for( its an acdemic project, here performance is not an issue, just gotta get this running )
Gurbhej Singh Dhillon
Greenhorn

Joined: Oct 04, 2007
Posts: 10
how about using SingleThreadModel at servlet side so that no two threads would run concurrently n thus i could call the socket server in service() n thus access reader n when it finishes, the other clients request starts to be serivced

_______________________
everyone was a newbie once and got flammed, m no different
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: multithreading + queues + synchronization ..
 
Similar Threads
accept()...Just so I am clear On This
Callback Pattern with different Arguments?
How to use Unreferenced in RMI?
Large messages over JMS?
Basic Object Pooling doubt