2 * Copyright (c) 2016 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
9 package org.opendaylight.protocol.bgp.rib.spi;
11 import com.google.common.collect.ImmutableMap;
15 * Internal session state.
19 * The session object is created by the negotiator in OpenConfirm state. While in this state, the session object
20 * is half-alive, e.g. the timers are running, but the session is not completely up, e.g. it has not been
21 * announced to the listener. If the session is torn down in this state, we do not inform the listener.
23 OPEN_CONFIRM((short) 0),
25 * The session has been completely established.
29 * The session has been closed. It will not be resurrected.
33 private static final Map<Short, State> VALUE_MAP;
36 final ImmutableMap.Builder<Short, State> b = ImmutableMap.builder();
37 for (final State enumItem : State.values()) {
38 b.put(enumItem.getValue(), enumItem);
40 VALUE_MAP = b.build();
43 private final short value;
45 State(final short value) {
49 public static State forValue(final short value) {
50 return VALUE_MAP.get(value);
53 public short getValue() {