An event has a type (integer) and an argument (object). Message events have for example type Event.MSG and as argument the message. The type of an event can be determined calling method Event.GetType. The number and types of events used in JavaGroups is fixed and determined in file Event.java. However, in some cases, developers of new protocol layers might find it useful to add new event types. There are two possibilities: either a new event is added to Event.java, modifiying the source code, or the predefined event USER_DEFINED is used. The former solution requires feedback into the main distribution, otherwise a number of incompatible distributions might exist. Also, the same event type numbers might be chosen by different developers, requiring disambiguation when merging those modifications back into the original distribution. The latter allows developers to use their own event types, embedded in the USER_DEFINED event type. The user-specific event would be contained in the argument of the user-defined event. This has the advantage that no source code needs to be changed.
The types currently available for events are listed in table 4.14.3.
Although the events and messages are distinctively different, the term 'message' is used synonymously with 'event' in the following sections, where the flow of events/messages is more important than the difference between them.