code: public boolean addSession(String key, Session newSession) {
  
          SessionEntry newEntry = createSessionEntry(key, newSession);
          SessionEntry oldEntry = null;
  
          sessionsLockWrite.lock();
          try {
              oldEntry = this.sessions.putIfAbsent(key, newEntry);
          } finally {
              sessionsLockWrite.unlock();
          }
  
          /* check how successful we were with adding */
          if (oldEntry == null) {
              log.debugf("A WebSocket session [%s] of [%s] has been added. The endpoint has now [%d] sessions", key,
                      endpoint, this.sessions.size());
              newEntry.added();
          } else {
              /* a feed already had a session open, cannot open more than one */
              try {
                  log.errorClosingDuplicateWsSession(key, endpoint);
                  newSession.close(new CloseReason(CloseReason.CloseCodes.VIOLATED_POLICY,
                          "Cannot have multiple WebSocket sessions open, the new one will be closed"));
              } catch (Exception e) {
                  log.errorCannotCloseDuplicateWsSession(key, endpoint, e);
              }
          }
  
          return oldEntry == null;
      }
docs: Stores the given {@code newSession} under the given {@code key}.
  <p>
  If there is already a session associated with the given {@code key}, the given {@code newSession} is closed;
  it is not added or associated with the given key and an error will be logged. The original session remains
  associated with the {@code key}.
  <p>
  When adding a session, that new session's websocket session listeners will be told via
  {@link WsSessionListener#sessionAdded()}.
  
  @param key the key (feedId or sessionId) that will be associated with the new session
  @param newSession the new session to add
  @return {@code true} if the session was added; {@code false} otherwise.