forked from laforge49/JActor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
97 lines (75 loc) · 4.24 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
The JActor project implements actors in Java that can process 1 Billion messages per second.
JActor 2 supports method calls (without callbacks) for initialization, synchronous
and concurrent requests, as well as static typing, all of which make for a more
natural coding style when developing applications.
Downloads: https://sourceforge.net/projects/jactor/files/
Blog: https://sourceforge.net/p/jactor/blog/
API: http://jactor.sourceforge.net/
VCS: https://github.com/laforge49/JActor/
Slides: http://jactor.sourceforge.net/slides/Actors-in-the-Small-22-feb-2012.pdf
Introduction: https://github.com/laforge49/JActor/wiki/Introduction
Basics: https://github.com/laforge49/JActor/wiki/JActor-Basics
Services
- Factories: https://github.com/laforge49/JActor/wiki/Factories
Issues: https://github.com/laforge49/JActor/issues/
free(code): http://freecode.com/projects/jactor/
Google groups: http://groups.google.com/group/agilewikidevelopers/
Dependent Projects
- Incremental Deserialization https://github.com/laforge49/JID
- File Persistence https://github.com/laforge49/JFile
- Netty Integration https://github.com/kumarshantanu/JANetty
Available on The Central Repository (Maven): http://search.maven.org/#search|ga|1|org.agilewiki
So you just need to add this to your POM file:
<dependency>
<groupId>org.agilewiki.jactor</groupId>
<artifactId>jactor</artifactId>
<version>3.0.0</version>
</dependency>
(Be sure to update the version number appropriately, of course.)
This project is a reimplementation of a portion of the AsyncFP Scala project:
https://github.com/laforge49/Asynchronous-Functional-Programming/wiki
Message passing between actors mostly uses 2-way messages (request / response).
There are several reasons for this:
o With 2-way messaging, sending a request is very similar to a method call with
a callback. Most requests are processed synchronously, which is why JActor is
so much faster than other actor implementations.
o Mailboxes are used mostly when passing messages between threads and are
first-class objects. As first-class objects, mailboxes can be used by more
than one actor. Passing messages between actors with a common mailbox is
always done synchronously and is very fast.
o Flow control is implicit to 2-way messaging. Systems with good flow control
are generally well-behaved when operating with a full load.
Two-way messaging is so much faster than 1-way messaging that it is practical to use
2-way messages when only 1-way messages are needed. There is however one case where
you shouldn't use 2-way messages: when events from non-actor code need to be sent to
an actor. The JAEvent class is used to do this.
Exception Handling
The extensive use of callbacks complicates control flow, which is only made worse
with some callbacks being executed asynchronously. Exception trapping then can be
quite error prone. So exception handling is supported. A default exception handler
is also provided which passes any uncaught exceptions that occurred while processing
a request back to the actor which sent the request, recursively.
Bi-Modal Iterator
Loops with 2-way messages can be problematic, as iterations typically must wait for
the response from the previous iteration. A bi-modal iterator is provided to cover
this. Each iteration takes 5 nanoseconds for synchronous responses and 8 nanoseconds
when a response is asynchronous.
State Machine
State machines are often used with actors and can add considerable clarity to the
code. JActor includes classes for composing and executing state machines that are
compatible with 2-way messages.
Dependency Injection
If an actor receives a request of a type that it does not recognize and that actor
has been assigned a parent actor, then the request is immediately forwarded to the
parent actor.
Message Passing Benchmarks
Shared Mailbox Across Mailboxes Asyncronous Mailboxes
msgs per sec 222,861,399 151,987,233 81,083,272
Test Environment
i7-3770 @ 3.40 GHz
ASUS P8Z77-M Motherboard
16 GB Corsair DDR3 1600 MHz RAM
Vertex 3 SATA III SSD
Contact
email: [email protected]
twitter: @laforge49