/**
* Message sent to a raft actor to shutdown gracefully. If it's the leader it will transfer leadership to a
- * follower. As its last act, the actor self-destructs via a PoisonPill.
+ * follower. As its last act, the actor self-destructs via a PoisonPill. This message should only be used with
+ * Patterns.gracefulStop().
*
* @author Thomas Pantelis
*/
-public class Shutdown implements Serializable {
+public final class Shutdown implements Serializable {
private static final long serialVersionUID = 1L;
+ public static final Shutdown INSTANCE = new Shutdown();
+
+ private Shutdown() {
+ // Hidden on purpose
+ }
+
+ private Object readResolve() {
+ return INSTANCE;
+ }
}