Fix followerDistributedDataStore tear down
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / FindPrimary.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.datastore.messages;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.io.Serializable;
13
14 /**
15  * The FindPrimary message is used to locate the primary of any given shard.
16  */
17 public class FindPrimary implements Serializable {
18     private static final long serialVersionUID = 1L;
19
20     private final String shardName;
21     private final boolean waitUntilReady;
22
23     public FindPrimary(final String shardName, final boolean waitUntilReady) {
24         this.shardName = requireNonNull(shardName, "shardName should not be null");
25         this.waitUntilReady = waitUntilReady;
26     }
27
28     public String getShardName() {
29         return shardName;
30     }
31
32     public boolean isWaitUntilReady() {
33         return waitUntilReady;
34     }
35
36     @Override
37     public String toString() {
38         return getClass().getName() + " [shardName=" + shardName
39                 + ", waitUntilReady=" + waitUntilReady + "]";
40     }
41 }