| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
JGroups - A Framework for Group Communication in Java |
| 5 |
======================================================== |
| 6 |
|
| 7 |
March 3, 1998 |
| 8 |
|
| 9 |
Bela Ban |
| 10 |
4114 Upson Hall |
| 11 |
Cornell University |
| 12 |
Ithaca, NY 14853 |
| 13 |
[email protected] |
| 14 |
[email protected] |
| 15 |
|
| 16 |
|
| 17 |
JGroups is a Java library for reliable group communication. It |
| 18 |
consists of 3 parts: (1) a socket-like API for application |
| 19 |
development, (2) a protocol stack, which implements reliable |
| 20 |
communication, and (3) a set of building blocks, which give the |
| 21 |
developer high-level abstractions (e.g. ReplicatedHashMap, an |
| 22 |
implementation of java.util.Map. |
| 23 |
|
| 24 |
The API (a channel) looks like a socket: there are methods for joining |
| 25 |
and leaving groups, sending and receiving messages, |
| 26 |
getting the shared group state, and registering for notifications when |
| 27 |
a member joins, or an existing member leaves or crashes. |
| 28 |
|
| 29 |
The protocol stack is a list of protocols, through which each |
| 30 |
message passes. Each protocol implements an up() and down() |
| 31 |
method, and may modify, reorder, encrypt, fragment/unfragment, drop, |
| 32 |
or pass a message up/down. The protocol stack is created |
| 33 |
according to a specification given when a channel is created. New |
| 34 |
protocols can be plugged into the stack easily. |
| 35 |
|
| 36 |
Building blocks hide the channel and provide a higher abstraction. |
| 37 |
Example: ReplicatedHashMap implements java.util.Mapand implements |
| 38 |
all methods that change the map (clear(), put(), remove()). |
| 39 |
Those methods are invoked on all hashmap instances in the same group |
| 40 |
simultaneously, so that all hashmaps have the same state. |
| 41 |
A new hashmap uses a state transfer protocol to initially obtain |
| 42 |
the shared group state from an existing member. This allows for |
| 43 |
replication of data structures across processes. |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
Group communication is important in the following situations: |
| 48 |
|
| 49 |
- A service has to be replicated for availability. As long as at |
| 50 |
least one of the servers remains operational, the service itself |
| 51 |
remains operational |
| 52 |
|
| 53 |
- Service requests have to be balanced between a set of servers |
| 54 |
|
| 55 |
- A large number of objects have to be managed as one entity (e.g. a |
| 56 |
management domain) |
| 57 |
|
| 58 |
- Notification service / push technology: receivers subscribe to a |
| 59 |
channel, senders send data to the channels, channels distribute |
| 60 |
data to all receivers subscribed to the channel. |
| 61 |
Used for example for video distribution, videoconferencing |
| 62 |
|
| 63 |
|
| 64 |
JGroups deliberately models a rather low-level message-oriented |
| 65 |
middleware (MOM) model. The reason is that we don't want to impose a |
| 66 |
one-size-fits-all model on the programmer, who usually will want to |
| 67 |
extend the model in various (previously unconceived) ways anyway. |
| 68 |
|
| 69 |
Providing low level Java classes allows the programmer to |
| 70 |
extend/replace classes at will, as the granularity of the system is |
| 71 |
finer. |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|