Merge "BUG-2218: Keep existing link augmentations during discovery process"
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / registry / gossip / BucketImpl.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 package org.opendaylight.controller.remote.rpc.registry.gossip;
9
10 import java.io.Serializable;
11
12 public class BucketImpl<T extends Copier<T>> implements Bucket<T>, Serializable {
13     private static final long serialVersionUID = 1L;
14
15     private Long version = System.currentTimeMillis();
16
17     private T data;
18
19     @Override
20     public Long getVersion() {
21         return version;
22     }
23
24     @Override
25     public T getData() {
26         if (this.data == null)
27             return null;
28
29         return data.copy();
30     }
31
32     public void setData(T data){
33         this.version = System.currentTimeMillis()+1;
34         this.data = data;
35     }
36
37     @Override
38     public String toString() {
39         return "BucketImpl{" +
40                 "version=" + version +
41                 ", data=" + data +
42                 '}';
43     }
44 }