Cheers
--
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.
But after the external input has ceased the actors can still send
messages between them.
Sending a PoisonPill to all the actors at that moment could imply a
few dead letters.
Ex:
Actor web is: "A" and "B".
External input has finished.
A PoisonPill is sent to both actors "A" and "B".
But "A" is still active processing external (or internal) messages.
As "A" is still running it could send a message to "B" but, as "B" has
already received a PoisonPill, it will never process that message.
Am I right ?
Maybe a compromise solution would be just wait a few millis before
sending the PoisonPill allowing the system to "cool down".
I guess a few seconds should be enough.
Not an accurate solution but maybe the best that can be achieved with
the current Akka API avoiding monsters like my previous code.
Cheers
I don't think that would help much.
How can an actor know that its work is really done?
I mean, the only way an actor could be sure it is not going to receive
more incoming messages from its peers is knowing if its peers (all of
them) are idle or stopped.
Did I miss anything?
Cheers
"everything's done":
When all the actors are idle (I think it is equivalent to all
dispatcher threads are idle and its queue is empty)
It seems however that I'm the only one with that requirement.
Cheers
√ictor, It seems you were concerned by performance using an
AtomicInteger.
}
}
}
--
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.
--
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.
Not really sure, that's what I'm asking :-D
I didn't really unterstand "Introduces a hotspot for cache-traffic, so
would be very costly"
I thought the problem was with the AtomicInteger because of the use of
locks.
That's the reason I asked if a solution using "fire & forget" actors
would be better.
By the way, I'd use a TypedActor implementation cause, as you have
noticed, I'm rubbish with the untyped ones.
--
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.
--
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.
Is this really different from using a Counter actor in the
Dispatcher ?
Anyway, I hadn't think about distributing the actors on several
machines.
Using the same actor counter on their dispatchers should solve that
problem.
>Because it doesn't use shared mutable state concurrency control.Sorry, I don't understand that. I'm too inexpert.
At the moment my model is almost completely unaware of Akka.
>By modeling the protocol and the flow of messages within the
>same abstraction your domain code your code becomes much easier to reason
>about and easier to evolve.
It is only present in the model in:
- Loader code, at start up, where the entities are created from the DB
- Factory Methods in Repositories
I hadn't considered that maybe in the future several machines would be
>> Anyway, I hadn't think about distributing the actors on several machines.
needed.
I was thinking only on a Local System,
I was thinking that the dispatcher of the model actors is hidden
inside the dispatcher
If several dispatchers (even on different machines) share the same
>> Using the same actor counter on their dispatchers should solve that problem.
counter actor
then the problem of waiting for actors to be idle when they are
distributed on
several machines is solved.
--
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.
>So I was assuming you were using Actors quite a bit?I am, many of the model entities are actors but, as they are typed
actors, the code in the model is almost unaware of Akka.
I think that's one of the big advantages of using typed actors, they
are pretty transparent.
You could remove akka from my project and the model wouldn't need to
change.
Well, unless the model was single-threaded or other magic akka-style
was added, it should need to change to control the "shared mutable
state".
Cheers
--
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.
>TypedActors are intended to be a bridge-layer between non-actor code and????????????
>Actors, not to be used exclusively.
Not all my entities are actors:
-a Ship is an actor but,
-Hull, Gun, Engine, etc... aren't
Is that related with your comment???
Oh yes, I forgot to state that.
>unless you're using only void-returning methods or
>Future-returning methods on your typed actors you're wasting threads.
I only use fire&forget methods.
But the main reason was to avoid deadlocks.
Have "wasting threads" a special meaning in concurrency jargon?
But now the "extra" is only present after the shutdown has been
>I see not difference in your proposed solution as your initial proposed
>solution, you've even introduced allocation overhead for all actions, an
>extra level of indirection which will impact cache performance and still
>retained the cache-hotspot which is the counter
required.
In the initial solution the "extra" was present all the time, from
start to shutdown.
If the system is running for a couple of days
and it requires a few additional seconds for a proper shutdown
then it is no big deal.
>Sorry for sounding critical
If the critic is sound I really appreciate it :)
Cheers
--
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.
>TypedActors are intended to be a bridge-layer between non-actor code andI know it is not properly said but in some way I see actors like EJBs.
>Actors, not to be used exclusively.
They are coarse-grained.
I don't know how to express that, I see it like a metaphor.
It doesn't matter because of these lines:
>long running tasks that started prior
>to your shutdown won't be visible to your shutdown
originalService.shutdown();
originalService.awaitTermination(timeout, unit);
>You also might have all sorts of races happening in that code
>I'm just too tired and on holiday right now :-)I don't see any flaw. (Yet)
I cannot wait for the holidays to end to get your next critic ;)
On Sat, Apr 7, 2012 at 1:51 AM, Pepe <ppr...@googlemail.com> wrote:>TypedActors are intended to be a bridge-layer between non-actor code andI know it is not properly said but in some way I see actors like EJBs.
>Actors, not to be used exclusively.
They are coarse-grained.
I don't know how to express that, I see it like a metaphor.
It doesn't matter because of these lines:
>long running tasks that started prior
>to your shutdown won't be visible to your shutdown
originalService.shutdown();
- "Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down." - http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html#shutdown()
originalService.awaitTermination(timeout, unit);Blocking is evil :-)
>You also might have all sorts of races happening in that code
>I'm just too tired and on holiday right now :-)I don't see any flaw. (Yet)
How about now? :-)I cannot wait for the holidays to end to get your next critic ;)
}
}
> Problem is that you're trying to build it in on the dispatch-level insteadAs I see it, this concern doesn't belong to the domain layer, it
> of in the domain level,
belongs to the infrastructure layer.
I don't want to pollute the domain model with alien concepts.
If I had implemented it with a counter actor it'd also work OOTB in a
> if you had implemented as I suggested with a WorkManager it'd work OOTB in
> a distributed setting.
distribute setting.
But, as I don't need distributed systems (yet) I chose the
AtomicInteger easier path.
In an infinite simulation it is very difficult to get the concept of
work done (is it meaningful?).
Besides, the actors are (can be) highly interconnected. At any moment:
- a player can receive an invitation, a war declaration, a purchase,
etc. from almost any other player,
- a flying ship can receive a shot from another ship or base
Then, I don't know how to construct the WorkManager.
*One way could be using request-reply style methods to control easily
the "end" of a partial work.
But I don't want to use request-reply methods because I don't want to
worry about deadlocks.
*Another way could involve having a more strict control of all the
messages. But how can that be achieved?
In order to create an actor there is an interface (ex:Player) and an
implementing class (ex:PlayerImpl) with the actual business code.
Should a special WatchedActor class be used and make all the *Impl
inherit it?
Should a special WatchedActor class be constructed as a wrapper for
the domain classes?
Cheers