Do not use protobuf serialization for FindPrimary and it's responses
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / PrimaryNotFound.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
9 package org.opendaylight.controller.cluster.datastore.messages;
10
11 import com.google.common.base.Preconditions;
12
13 public class PrimaryNotFound implements SerializableMessage {
14   public static final Class SERIALIZABLE_CLASS = PrimaryNotFound.class;
15
16     private final String shardName;
17
18     public PrimaryNotFound(String shardName){
19
20         Preconditions.checkNotNull(shardName, "shardName should not be null");
21
22         this.shardName = shardName;
23     }
24
25     @Override
26     public boolean equals(Object o) {
27         if (this == o) return true;
28         if (o == null || getClass() != o.getClass()) return false;
29
30         PrimaryNotFound that = (PrimaryNotFound) o;
31
32         if (shardName != null ? !shardName.equals(that.shardName) : that.shardName != null) return false;
33
34         return true;
35     }
36
37     @Override
38     public int hashCode() {
39         return shardName != null ? shardName.hashCode() : 0;
40     }
41
42   @Override
43   public Object toSerializable() {
44     return this;
45   }
46
47   public static PrimaryNotFound fromSerializable(Object message){
48     return (PrimaryNotFound) message;
49   }
50 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.