Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Threading Policies
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stefan Weber  
View profile  
 More options Nov 12 2009, 3:14 am
From: Stefan Weber <stefan.we...@gmail.com>
Date: Thu, 12 Nov 2009 09:14:46 +0100
Local: Thurs, Nov 12 2009 3:14 am
Subject: Re: Threading Policies

> I didn't implement "concurrent" actors because of two main reasons:
> 1) They break the principles of the actors model itself.
> 2) They could be misused, leading people to use actors in wrong ways.

> That said, I'm not saying to be completely *against* such a use case:
> just let's discuss it and see if there's some better way of doing the
> same thing.

I understand this reasoning and think it makes sense. To be honest, the
suggestion I made to allow concurrent handlers if the @ThreadSafe annotation
is not very clean.

> Another way to offload actors for stateless tasks could be to use an
> external thread pool and schedule those tasks on it: by doing so,
> actors would be used only to represent the messaging abstraction,
> while the actual computation would be executed on another thread
> (launched by the actor who received the related message).
> What do you think?

I think this is a good idea and had it in mind as well. I was a bit
reluctant to do this because it would push some of the concurrency burden
that I could get rid of with Actorom back to the application. But given that
you also suggest to do it this way I will try this.

Actually, I had to ideas how to implement it:

1. The handler class has a concurrent queue as a member and all the handler
method does is push the incoming message into this queue. Then have a number
of worker threads in the handler class that process the queue.

2. In the handler method, create a new Runnable and pass it to the
ExecutorService (very similar to what you do in
OSMessageDispatcher.dispatch).

I prefer solution 2 because it is simpler. The only small doubt I have is
that I have to create a new Runnable for every message. I don't have enough
experience to guess how expensive this will be in practice but I assume it
will be easy to spot in case it really becomes a bottleneck. What do you
think?

Cheers,

Stefan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.