List of usage examples for org.apache.wicket.util.collections ConcurrentHashSet contains
@Override public boolean contains(final Object o)
From source file:org.efaps.ui.wicket.ConnectionRegistry.java
License:Apache License
/** * @param _sessionID sessionId to be check for invalid * @return true if valid, else false/*from www . ja v a 2 s .c om*/ */ public boolean sessionValid(final String _sessionID) { ConcurrentHashSet<String> invalidated = Session.get().getApplication() .getMetaData(ConnectionRegistry.INVALIDATED); if (invalidated == null) { synchronized (ConnectionRegistry.INVALIDATED) { invalidated = Session.get().getApplication().getMetaData(ConnectionRegistry.INVALIDATED); if (invalidated == null) { invalidated = new ConcurrentHashSet<>(); Session.get().getApplication().setMetaData(ConnectionRegistry.INVALIDATED, invalidated); } } } return !invalidated.contains(_sessionID); }
From source file:org.efaps.ui.wicket.ConnectionRegistry.java
License:Apache License
/** * @param _login login of the user the session is wanted for * @param _sessionId sessionid the connection is wanted for * @return Connection for the user, <code>null</code> if not found *//* w w w .j a va 2 s . c om*/ public IWebSocketConnection getConnection4UserSession(final String _login, final String _sessionId) { IWebSocketConnection ret = null; final ConcurrentMap<String, ConcurrentHashSet<String>> user2session = Session.get().getApplication() .getMetaData(ConnectionRegistry.USER2SESSION); final ConcurrentMap<String, IKey> sessionId2key = Session.get().getApplication() .getMetaData(ConnectionRegistry.SESSION2KEY); final ConcurrentHashSet<String> sessionIds = user2session.get(_login); if (sessionIds.contains(_sessionId)) { final IKey key = sessionId2key.get(_sessionId); if (key != null) { final IWebSocketConnectionRegistry registry = WebSocketSettings.Holder.get(EFapsApplication.get()) .getConnectionRegistry(); ret = registry.getConnection(EFapsApplication.get(), _sessionId, key); } } return ret; }