Shimi
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Yes. Either:
java.util.concurrent.ThreadPoolExecutor.AbortPolicy
or
java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
or
java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy
Read more here:
http://java.sun.com/javase/6/docs/api/index.html?java/util/concurrent/RejectedExecutionHandler.html
> To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
>
>
--
Jonas Bonér
work: http://jayway.com
code: http://akkasource.com
blog: http://jonasboner.com
twitter: @jboner
class MyActor extends Actor { self.dispatcher = Dispatchers.newExecutorEventBasedThreadPoolDispatcher(name) dispatcher .withNewThreadPoolWithBoundedBlockingQueue(100) .setCorePoolSize(16) .setMaxPoolSize(128) .setKeepAliveTimeInMillis(60000) .setRejectionPolicy(new CallerRunsPolicy) .buildThreadPool ... }
When defining a BlockingQueue in the fluent API. See the doc snippet I sent.
--
Jonas Bonér
http://jayway.com
http://akkasource.com
twitter: jboner
On 28 Jun 2010 17:34, "Shimi" <shi...@gmail.com> wrote:
Where do you define the mailbox limit?
Shimi
On Jun 28, 5:45 pm, Jonas Bonér <jo...@jonasboner.com> wrote:
> Added it to the docs herehttp://doc.akkasource.org/dispatchers:
>
> You can also set the rejection policy that should be used, e.g. what should
> be done if the dis...
> You cane read more about these policieshttp://java.sun.com/javase/6/docs/api/index.html?java/util/concurrent...</here>
>
> Here is an example:
>
> class MyActor extends Actor {
> self.dispatcher = Dispatchers.newExecu...
> On 28 June 2010 16:38, Jonas Bonér <jo...@jonasboner.com> wrote:> On 28 June 2010 16:00, Shimi <sh...
> http://java.sun.com/javase/6/docs/api/index.html?java/util/concurrent...
>
>
>
>
>
> >> Shimi
>
> >> On Jun 28, 4:52 pm, Shimi <shim...@gmail.com> wrote:
> >>> In my case it...
> > Jonas Bonér
>
> > work: http://jayway.com
> > code: http://akkasource.com
> > blog: http://...
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To...
Yes. There is effectively two queues. One is the mailbox on the
ActorRef and one is the used by the dispatcher. The latter one can be
used for throttling and is highly configurable. Would you need to
override the mailbox queue as well? You can't set a rejection policy
for that one, you would have to implement such a thing yourself.
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
>
>
--
Jonas Bonér
work: http://jayway.com
code: http://akkasource.com
blog: http://jonasboner.com
twitter: @jboner
I see your point. You do limit the # of messages if you use one
dispatcher per Actor, but not if it is shared.
Currently the mailbox is defined as:
protected[akka] val _mailbox: Deque[MessageInvocation] = new
ConcurrentLinkedDeque[MessageInvocation]
You'd like to be able to plug in other mailbox impls?
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
E.g. a http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166xdocs/jsr166x/LinkedBlockingDeque.html
// if mailboxSize is negative then use unbounded, if positive create a
BlockingDeque with the size
def actorOf[T <: Actor: Manifest](mailboxSize = -1): ActorRef =
new LocalActorRef(manifest[T].erasure.asInstanceOf[Class[_ <:
Actor]], mailboxSize)
val actor = actorOf[MyActor](mailboxSize = 100)
Or should we do as we do with the new STM stuff? E.g. accept an
implicit ActorRefConfig that can do more?
def actorOf[T <: Actor: Manifest](implicit config: ActorRefConfig =
DefaultActorRefConfig()): ActorRef =
new LocalActorRef(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]], config)
Thoughts?
Should we solve it by adding this?
// if mailboxSize is negative then use unbounded, if positive create a
BlockingDeque with the size
def actorOf[T <: Actor: Manifest](mailboxSize = -1): ActorRef =
new LocalActorRef(manifest[T].erasure.asInstanceOf[Class[_ <:
Actor]], mailboxSize)
val actor = actorOf[MyActor](mailboxSize = 100)
Or should we do as we do with the new STM stuff? E.g. accept an
implicit ActorRefConfig that can do more?
def actorOf[T <: Actor: Manifest](implicit config: ActorRefConfig =
DefaultActorRefConfig()): ActorRef =
new LocalActorRef(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]], config)
In this case (and many other) I do not want to make mailbox a 'var' to
change in 'init' since then it can be changed at any point in time. It
should be a 'val' so only at ActorRef creation.
So I think we need both for sure.
But what else could be put into the ActorRefConfig? Just one config
element does not pull its weight.
Right. We can put all these there.
The number of concurrent actors is limited by max thread pool size (if blocking queue else min thread pool size).
I have added configuring mailbox to the backlog.
Don't get what the problem with the fluent API is. I use it without problems.
--
Jonas Bonér
http://jayway.com
http://akkasource.com
twitter: jboner
On 29 Jun 2010 15:26, "Shimi" <shi...@gmail.com> wrote:
> I see your point. You do limit the # of messages if you use one
> dispatcher per Actor, but not if...
It seems to me that you don't limit the # of messages but the number
of Actors. If I understood right, if you set:
dispatcher
.withNewThreadPoolWithBoundedBlockingQueue(1)
.setCorePoolSize(16)
.setRejectionPolicy(new ThreadPoolExecutor.DiscardPolicy)
.setMaxPoolSize(128)
.setKeepAliveTimeInMillis(60000)
.buildThreadPool
You will be able to use only one Actor with this dispatcher but the #
of messages to that Actor will be unlimited.
> Currently the mailbox is defined as:
> protected[akka] val _mailbox: Deque[MessageInvocation] =...
It will be nice to plugin a different Queue. In my case it can be a
LinkedBlockingDeque with limit and ThreadPoolExecutor.DiscardPolicy.
By the way the Dispatcher fluent API does not work. It should be
newExecutorBasedEventDrivenDispatcher and not
newExecutorEventBasedThreadPoolDispatcher.
Any way it throws IllegalStateException(
"Is not in the process of building a thread pool, start building
one by invoking one of the 'newThreadPool*' methods")
Shimi
On Jun 28, 11:31 pm, Jonas Bonér <jo...@jonasboner.com> wrote:
> On 28 June 2010 19:21, Shimi <shim...@gmail.com> wrote:
>
>
>
>
>
> > I still do not understand. Y...
I see there is a typo in the docs. Wrong name in fluent API. But apart from that?
--
Jonas Bonér
http://jayway.com
http://akkasource.com
twitter: jboner
On 29 Jun 2010 16:30, "Jonas Bonér" <jo...@jonasboner.com> wrote:
The number of concurrent actors is limited by max thread pool size (if blocking queue else min thread pool size).
I have added configuring mailbox to the backlog.
Don't get what the problem with the fluent API is. I use it without problems.
--
Jonas Bonér
http://jayway.com
http://akkasource.com
twitter: jboner
>
> On 29 Jun 2010 15:26, "Shimi" <shi...@gmail.com> wrote:
>
> > I see your point. You do limit the # of messages if you use one
> dispatcher per Actor, but not if...
>
> It seems to me that you don't limit the # of messages but the number
> of Actors. If I understo...
>
> protected[akka] val _mailbox: Deque[MessageInvocation] =...
>
> > Currently the mailbox is defined as:
>
> It will be nice to plugin a different Queue. In my case it can be a
> LinkedBlockingDeque with ...
> I have added configuring mailbox to the backlog.Since you know the code much better then me :)
Do you think there is some kind of workaround I can use in the mean
time until this feature will be implemented? Only something that will
limit the number of messages in the queue.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
Since it is a val it is hard.
--
Jonas Bonér
http://jayway.com
http://akkasource.com
twitter: jboner
On 30 Jun 2010 19:02, "Shimi" <shi...@gmail.com> wrote:
Thanks.
I was hoping there is a clean way to do it with akka API.
On Jun 30, 6:01 pm, Jonas Bonér <jo...@jonasboner.com> wrote:
> Track progress here:https://www.assembla.com/spaces/akka/tickets/298-configure-actor-mail...
>
> On 30 June 2010 16:56, Jonas Bonér <jo...@jonasboner.com> wrote:
>
>
>
>
>
>
>
> > On 29 June 2010 19:01, Shimi <shim...@gmail.com> wrote:
>
> >> > I have added conf...
> >> akka-user+...@googlegroups.com<akka-user%2Bunsubscribe@googlegroups .com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/akka-user?hl=en...
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To...