Here is the first status update as an example. Please always include a
link to the commits in question.
I just pushed the following commits:
http://github.com/orfjackal/dimdwarf/compare/2594511...ada9bc9
This includes the infrastructure for registering "services" and
"controllers" using Guice modules. It's not yet fully integrated - the
new code is not being used by the end-to-end tests - so next I'll be
working on updating ServerStarter to use the new module system. There
are also some additional tests which I need to write in
InstallingServicesSpec.
The idea is that each "service" runs in its own thread, where it reads
messages from a message queue and processes them one-by-one in FIFO
order. One of the services is the ControllerHub class, which contains
"controllers". Each controller is connected to 0 or 1 services, and
nobody else has access to that service - all access goes through the
service's controller. The ControllerHub is a special service, in that
anybody can send messages to it (by asking for injection of a @Hub
MessageSender<Object>), and it will delegate processing the message to
every controller (in unspecified order). The controllers should process
everything quickly and without any blocking I/O, because that would
easily block the whole server. Any slow operations should be done in the
services.
Examples of how the service modules look like (in this first version)
are RelayModule and ControllerModule. They need to call some methods in
the ServiceModule class to register a service or controller, and also
provide a ServiceRegistration or ControllerRegistration instance which
will be used to bootstrap the services. The ServiceModule is actually a
PrivateModule
(http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/PrivateModule.html),
so all bindings in the module are by default not seen by other modules,
but ServiceModule will expose the controller and service endpoints so
that the server can use them. Using them by accident from another module
or another thread will not be possible.
--
Esko Luontola
www.orfjackal.net
Everytime someone mentions Actors and Scala I just start to think about
Akka framework (http://akkasource.org/).
Would love to see if it could be of any use in DimDwarf since that
project is amzaingly interesting.
And apologies for being silent for a long time, as a family guy I don't
seem to have as much free time as I would like to. I'll try to come up
with something as soon as possible. Maybe the tiny proof-of-concept game
using DimDwaf or smth else. We'll see!
--
- Agile Poodle
- http://www.jussimononen.info/
- http://www.twitter.com/agilepoodle
I decided not use Scala or Akka actors in Dimdwarf, because I wanted to
minimize the complexity and understand thoroughly what is happening
inside the system (and be able to modify it freely). Also to make the
system as deterministic as possible, I wanted to enforce that actors
process messages in FIFO order - with Scala actors it's possible to
process selectively only some of the messages.
And anyways, it was not much work to create the minimal actor library
which Dimdwarf has. Mostly it's just these classes which do all the work:
net.orfjackal.dimdwarf.actors.ActorStarter
net.orfjackal.dimdwarf.actors.ActorRunner
net.orfjackal.dimdwarf.actors.ActorMessageLoop
net.orfjackal.dimdwarf.mq.MessageQueue
Creating the ActorModule which configures the actors using Guice was
much harder than the code for starting and running the actors.
> And apologies for being silent for a long time, as a family guy I don't
> seem to have as much free time as I would like to. I'll try to come up
> with something as soon as possible. Maybe the tiny proof-of-concept game
> using DimDwaf or smth else. We'll see!
No worries. I'm also occupied by many other things, so it'll take some
time until Dimdwarf is in a shape where it can run applications. Of
course applications for Dimdwarf can be developed before it, by mocking
Dimdwarf's application APIs.
--
Esko Luontola
www.orfjackal.net