Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The way multithreading goes is that you'll need one thread for each participant. </p> <p>The way you implemented this now means that as soon as one person answers a question, the whole state of your server-side program is advanced to question two. Having one thread (and thus, if you will, one poll-program) for each of the participants will aleviate the problem.</p> <p>To reduce server-load due to unnecessary amounts of threads, use thread-pooling (see <a href="http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html</a>). A thread pool re-uses existing threads once they are not needed any more, thus trying to keep the size of active threads to a minimum. (Creating the threads is the expensive part) If more are needed, the pool grows to a specified maximum, if less are needed it shrinks to a specified minimum.</p> <p>On the other hand, that whole model has a few dangers: What if a person doesn't answer at all? will there be a timeout on the server? Will it wait forever?</p> <p>One option might be to install a software / framework on the mobile devices, that is capable of receiving all the questions and possible answers to a poll and present them one after the other on the screen. As soon as the participant presses "finish" the set of chosen answers is sent back to you. This way your server would not need to hold threads for each participant, just receive one string with all the answers.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload