Class RaftClassConfigurator

java.lang.Object
org.jgroups.raft.util.RaftClassConfigurator

@ThreadSafe public final class RaftClassConfigurator extends Object
Centralized registration of all RAFT protocol types with JGroups ClassConfigurator.

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:
  • ClassConfigurator
  • Method Details

    • initialize

      public static void initialize()
    • registerRedirect

      public void registerRedirect()
      Registers the REDIRECT protocol and its header type with JGroups.