| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.common; |
| | | |
| | |
| | | */ |
| | | public class ServerState implements Iterable<CSN> |
| | | { |
| | | |
| | | /** Associates a serverId with a CSN. */ |
| | | private final ConcurrentMap<Integer, CSN> serverIdToCSN = new ConcurrentSkipListMap<>(); |
| | | /** |
| | |
| | | */ |
| | | private volatile boolean saved = true; |
| | | |
| | | /** |
| | | * Creates a new empty ServerState. |
| | | */ |
| | | /** Creates a new empty ServerState. */ |
| | | public ServerState() |
| | | { |
| | | super(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Replace the Server State with another ServerState. |
| | | * |
| | | * @param serverState The ServerState. |
| | | * |
| | | * @return a boolean indicating if the update was meaningful. |
| | | */ |
| | | public boolean reload(ServerState serverState) { |
| | | if (serverState == null) { |
| | | return false; |
| | | } |
| | | |
| | | clear(); |
| | | return update(serverState); |
| | | } |
| | | |
| | | /** |
| | | * Return a Set of String usable as a textual representation of |
| | | * a Server state. |
| | | * format : time seqnum id |
| | |
| | | return values; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Encodes this server state to the provided ASN1 writer. |
| | | * |
| | |
| | | return new HashMap<>(serverIdToCSN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Iterator<CSN> iterator() |
| | | { |
| | |
| | | { |
| | | return saved; |
| | | } |
| | | |
| | | } |