Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / shardmanager / SwitchShardBehavior.java
index d797440425eaa39ab38623ad669b95c0b8e83128..be5044270be7077b7b6f7697877208bcdbeade1d 100644 (file)
@@ -5,25 +5,27 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.cluster.datastore.shardmanager;
 
 package org.opendaylight.controller.cluster.datastore.shardmanager;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.raft.RaftState;
 
 final class SwitchShardBehavior {
 import org.opendaylight.controller.cluster.raft.RaftState;
 
 final class SwitchShardBehavior {
-    private final String shardName;
+    private final ShardIdentifier shardId;
     private final RaftState newState;
     private final long term;
 
     private final RaftState newState;
     private final long term;
 
-    SwitchShardBehavior(String shardName, RaftState newState, long term) {
-        this.shardName = Preconditions.checkNotNull(shardName);
-        this.newState = Preconditions.checkNotNull(newState);
+    SwitchShardBehavior(final ShardIdentifier shardId, final RaftState newState, final long term) {
+        this.newState = requireNonNull(newState);
+        this.shardId = shardId;
         this.term = term;
     }
 
         this.term = term;
     }
 
-    String getShardName() {
-        return shardName;
+    @Nullable ShardIdentifier getShardId() {
+        return shardId;
     }
 
     RaftState getNewState() {
     }
 
     RaftState getNewState() {
@@ -36,11 +38,10 @@ final class SwitchShardBehavior {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        final StringBuilder sb = new StringBuilder("SwitchShardBehavior{");
-        sb.append("shardName='").append(shardName).append('\'');
-        sb.append(", newState='").append(newState).append('\'');
-        sb.append(", term=").append(term);
-        sb.append('}');
-        return sb.toString();
+        return "SwitchShardBehavior{"
+                + "shardId='" + shardId + '\''
+                + ", newState='" + newState + '\''
+                + ", term=" + term
+                + '}';
     }
 }
     }
 }