Class RaftClassConfigurator
This class wraps the JGroups: ClassConfigurator in a synchronized block to ensure the protocol and headers
are properly registered.
All protocol registrations are performed sequentially in this class's static initializer block, which is guaranteed by
the JVM to execute exactly once in a thread-safe manner. Protocol classes call initialize() in their static
blocks to trigger class loading, ensuring registrations complete before any concurrent operations.
Usage: Each protocol class should include this in their static block:
static {
RaftClassConfigurator.initialize();
}
This forces class loading and registration to occur sequentially, regardless of which protocol class is loaded first
or how many threads are creating JChannels concurrently.
Thread Safety: The JVM guarantees that static initializer blocks execute exactly once per class, with proper synchronization. Even if multiple threads simultaneously trigger class loading, only one thread executes the static block while others wait.
- Since:
- 2.0
- Author:
- José Bolina
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidRegisters the REDIRECT protocol and its header type with JGroups.
-
Method Details
-
initialize
public static void initialize() -
registerRedirect
public void registerRedirect()Registers the REDIRECT protocol and its header type with JGroups.
-