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 static java.util.Objects.requireNonNull;
12 import java.io.Externalizable;
13 import java.io.IOException;
14 import java.io.ObjectInput;
15 import java.io.ObjectOutput;
16 import java.io.Serializable;
17 import org.opendaylight.yangtools.concepts.Identifier;
20 * Message sent to abort slicing.
22 * @author Thomas Pantelis
24 class AbortSlicing implements Serializable {
25 private static final long serialVersionUID = 1L;
27 private final Identifier identifier;
29 AbortSlicing(final Identifier identifier) {
30 this.identifier = requireNonNull(identifier);
33 Identifier getIdentifier() {
38 public String toString() {
39 return "AbortSlicing [identifier=" + identifier + "]";
42 private Object writeReplace() {
43 return new Proxy(this);
46 private static class Proxy implements Externalizable {
47 private static final long serialVersionUID = 1L;
49 private AbortSlicing abortSlicing;
51 // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
52 // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
53 @SuppressWarnings("checkstyle:RedundantModifier")
57 Proxy(final AbortSlicing abortSlicing) {
58 this.abortSlicing = abortSlicing;
62 public void writeExternal(final ObjectOutput out) throws IOException {
63 out.writeObject(abortSlicing.identifier);
67 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
68 abortSlicing = new AbortSlicing((Identifier) in.readObject());
71 private Object readResolve() {