• Post Reply Bookmark Topic Watch Topic
  • New Topic

multithreading + queues + synchronization ..

 
Gurbhej Singh Dhillon
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Gurbhej Singh Dhillon
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
done
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Gurbhej Singh Dhillon
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!