Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

e voting machine  RSS feed

 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am going to develop a e voting system.
there is a server for each district.
each server has a more than 100 voting machine.
my problem is how to handle threading in the server?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean an application server, then you do not have to worry about multi threading issues.
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not appliucation server.
there is a 100 voting places in district.each of them connect to one data base server.so when going to save simultaniously how to
handle the thread problem.because if we synchronise the save method only one can access one time.
so there are 100 voting places .each of them sending a vote to the server.
hot to solve this problem?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anarkali perera wrote:not appliucation server.
there is a 100 voting places in district.each of them connect to one data base server.so when going to save simultaniously how to
handle the thread problem.because if we synchronise the save method only one can access one time.
so there are 100 voting places .each of them sending a vote to the server.
hot to solve this problem?


What is the interface that you are providing to the voters? Is it a Web interface or a Swing client? Have you heard of Application / Web servers? How are those voting machines in different districts going to connect to the database server?
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it transfer the vote as a soap message.
client interface is swing.
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are the advantage using swing interface than web interface
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it transfer the vote as a soap message.


SOAP servers are easily hosted on typical web servers such as Tomcat. You should study the best practice for web server applications keeping users separate and simultaneously managing multiple requests.

Bill
 
anarkali perera
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is a thread problem also.
there is only one server machine.So all the voting machine requestion authentication from voters details from this one machine.
imagin there are 100 request at given time .so what happen if the authentication method is synchronize.all the other 99 users have to wait.
How to avoid this problem?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would the other 99 threads have to wait? What does the authentication do that would require synchronization?

If synchronization of some kind does need to be done (and remember, there are other ways than making complete methods synchronized), then it's good practice to guard only that section of code that does whatever needs protection. Most often, that is not the complete method.

If you're serious at all about multi-threading in Java, then you need to read one of standard books ("Java Threads" or "Java Concurrency in Practice"). You'll learn far more than you ever could by perusing forums and articles on the web.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anarkali perera wrote:
my problem is how to handle threading in the server?


Then it does not belong to this forum! (CarefullyChooseOneForum)

Moving to Threads forum. (I agree with Ulf though. You need to read those books)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!