2 * Copyright (c) 2014 Cisco Systems, Inc. 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.remote.rpc.registry.gossip;
10 import com.google.common.base.Preconditions;
11 import com.google.common.base.Verify;
12 import java.io.Serializable;
14 final class BucketImpl<T extends BucketData<T>> implements Bucket<T>, Serializable {
15 private static final long serialVersionUID = 294779770032719196L;
17 // Guaranteed to be non-null.
18 // This is kept a Long for binary compatibility of serialization format.
19 private final Long version;
21 // Guaranteed to be non-null
24 BucketImpl(final Long version, final T data) {
25 this.version = Preconditions.checkNotNull(version);
26 this.data = Preconditions.checkNotNull(data);
30 public long getVersion() {
31 return version.longValue();
40 public String toString() {
41 return "BucketImpl{" + "version=" + version + ", data=" + data + '}';
44 private Object readResolve() {
45 Verify.verifyNotNull(version);
46 Verify.verifyNotNull(data);