I'm working on a turn-based game server. The server needs to support:
1. Initializing a new game.
2. Allowing two players to register to play that game.
3. Once the players have registered the game begins:
3a. Player1 submits his move and the server updates both Player1 and Player2
with the results of the move. The calculation of the result of the move
will be somewhat intensive so I think it makes sense to do this in a
non-WorkerThread.
The server needs to support a number of concurrently running games.
If having the filter submit the job to another ThreadPool is legal, I will
go with that model.
My next problem will be sending the results back to Player2 after Player1
submits his move. Can you suggest a good way of holding onto the output
stream for both players? Can I hold a reference to the SelectableChannel
for each player when they register? How does that relate to the Context's
reference count?
Thanks for all of your help,
Bill
Jeanfrancois Arcand-2 wrote:
>
> Salut,
>
> bsimonssays wrote:
>> I'm making a lot of progress with Grizzly. At this point my server has a
>> custom protocol parser and echoes back the request that has been parsed.
>
> Great!!
>
>>
>> What I'm curious about now is what the best practice is for the threading
>> model of processing a request. Do you typically do the business logic in
>> the same Worker Thread that has called the filter?
>
> It really based on your application/protocol. For GlassFish v3, we are
> using the WorkerThread for processing the http requests, but in Sailfin
> we are using another set of thread to process the SIP protocol requests.
>
>
> Or is it common to have
>> a thread pool that the filter submits jobs to?
>
> I would think it is really based on your application. Can you share what
> you are working on?
>
> A+
>
> -- Jeanfrancois
>
>
>
>>
>> Thanks,
>> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>
--
View this message in context: http://www.nabble.com/Threading-model-tp19673177p19676608.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.