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?
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?
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
Joined: Sep 10, 2009
Posts: 237
posted
0
it transfer the vote as a soap message.
client interface is swing.
anarkali perera
Ranch Hand
Joined: Sep 10, 2009
Posts: 237
posted
0
what are the advantage using swing interface than web interface
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
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.
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
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
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.