• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multithread server problems

 
john martinez
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello I have done a server that accepts connections from multiple clients , it is done with sockets , how do I synchorinze methods so that I dont have concurrency issues? , do any of you have code?

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
Welcome to JavaRanch!

Since this isn't about JDBC specifically, I'm moving it to our J2EE forum.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have written your own server maybe this belongs in the threads forum.

Use a synchronized block to make sure only one thread can access a critical resource at a time. You'll have to identify the critical resources - objects, files, devices, etc - and control the access.

Can you clarify - Have you written the server from scratch or is it a J2EE container we would know? What resources do you think you might have to synchronize?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic