2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. 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.netconf.server;
10 import java.util.concurrent.atomic.AtomicLong;
11 import javax.inject.Inject;
12 import javax.inject.Singleton;
13 import org.osgi.service.component.annotations.Component;
16 * Default {@link SessionIdProvider}. Counts sessions from the start of the component.
19 @Component(immediate = true, property = "type=default")
20 public final class DefaultSessionIdProvider implements SessionIdProvider {
21 private final AtomicLong sessionCounter = new AtomicLong();
24 public DefaultSessionIdProvider() {
29 public long getNextSessionId() {
30 return sessionCounter.incrementAndGet();
34 public long getCurrentSessionId() {
35 return sessionCounter.get();