use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Close in project bgpcep by opendaylight.
the class ServerSessionManager method takeNodeState.
final synchronized TopologyNodeState takeNodeState(final InetAddress address, final TopologySessionListener sessionListener, final boolean retrieveNode) {
final NodeId id = createNodeId(address);
if (isClosed.get()) {
LOG.error("Server Session Manager is closed. Unable to create topology node {} with listener {}", id, sessionListener);
return null;
}
LOG.debug("Node {} requested by listener {}", id, sessionListener);
TopologyNodeState ret = state.get(id);
if (ret == null) {
ret = new TopologyNodeState(dependencies.getDataBroker(), topology, id, DEFAULT_HOLD_STATE_NANOS);
LOG.debug("Created topology node {} for id {} at {}", ret, id, ret.getNodeId());
state.put(id, ret);
}
// if another listener requests the same session, close it
final TopologySessionListener existingSessionListener = nodes.get(id);
if (existingSessionListener != null && !sessionListener.equals(existingSessionListener)) {
LOG.error("New session listener {} is in conflict with existing session listener {} on node {}," + " closing the existing one.", existingSessionListener, sessionListener, id);
existingSessionListener.close();
}
ret.taken(retrieveNode);
nodes.put(id, sessionListener);
LOG.debug("Node {} bound to listener {}", id, sessionListener);
return ret;
}
Aggregations