2 * Copyright (c) 2017 Inocybe Technologies and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.messaging;
10 import com.google.common.base.Preconditions;
11 import java.io.Externalizable;
12 import java.io.IOException;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
15 import java.io.Serializable;
16 import org.opendaylight.yangtools.concepts.Identifier;
19 * Message sent to abort slicing.
21 * @author Thomas Pantelis
23 class AbortSlicing implements Serializable {
24 private static final long serialVersionUID = 1L;
26 private final Identifier identifier;
28 AbortSlicing(final Identifier identifier) {
29 this.identifier = Preconditions.checkNotNull(identifier);
32 Identifier getIdentifier() {
37 public String toString() {
38 return "AbortSlicing [identifier=" + identifier + "]";
41 private Object writeReplace() {
42 return new Proxy(this);
45 private static class Proxy implements Externalizable {
46 private static final long serialVersionUID = 1L;
48 private AbortSlicing abortSlicing;
50 // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
51 // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
52 @SuppressWarnings("checkstyle:RedundantModifier")
56 Proxy(AbortSlicing abortSlicing) {
57 this.abortSlicing = abortSlicing;
61 public void writeExternal(ObjectOutput out) throws IOException {
62 out.writeObject(abortSlicing.identifier);
66 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
67 abortSlicing = new AbortSlicing((Identifier) in.readObject());
70 private Object readResolve() {