List of usage examples for org.apache.wicket.util.collections ConcurrentHashSet ConcurrentHashSet
public ConcurrentHashSet()
From source file:com.romeikat.datamessie.core.processing.task.documentProcessing.DocumentsProcessor.java
License:Open Source License
public DocumentsProcessor(final ApplicationContext ctx) { this.ctx = ctx; sessionFactory = ctx.getBean("sessionFactory", SessionFactory.class); processingParallelismFactor = Double .parseDouble(SpringUtil.getPropertyValue(ctx, "documents.processing.parallelism.factor")); statisticsToBeRebuilt = new StatisticsRebuildingSparseTable(); failedDocumentIds = new ConcurrentHashSet<Long>(); }
From source file:org.apache.openmeetings.web.app.Application.java
License:Apache License
public static Client addUserToRoom(long roomId, int pageId) { if (!ROOMS.containsKey(roomId)) { ROOMS.put(roomId, new ConcurrentHashSet<Client>()); }//from w ww. j a va 2 s . co m Client c = new Client(WebSession.get().getId(), pageId, WebSession.getUserId()); c.setUid(UUID.randomUUID().toString()); ROOMS.get(roomId).add(c); return c; }
From source file:org.apache.openmeetings.web.app.ClientManager.java
License:Apache License
/** * This method will return count of users in room _after_ adding * * @param c - client to be added to the room * @return count of users in room _after_ adding *///w ww.ja v a 2 s .c o m public int addToRoom(Client c) { Long roomId = c.getRoom().getId(); log.debug("Adding online room client: {}, room: {}", c.getUid(), roomId); IMap<Long, Set<String>> rooms = rooms(); rooms.lock(roomId); rooms.putIfAbsent(roomId, new ConcurrentHashSet<String>()); Set<String> set = rooms.get(roomId); set.add(c.getUid()); final int count = set.size(); rooms.put(roomId, set); onlineRooms.put(roomId, set); rooms.unlock(roomId); update(c); return count; }
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 w w w. j a v a2 s.c o m*/ */ 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 _sessionID session to marked as invalid *///from ww w . j av a 2 s . co m public void markSessionAsInvalid(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); } } } invalidated.add(_sessionID); ConnectionRegistry.LOG.debug("Marked Session: {} as invalid", _sessionID); }
From source file:org.efaps.ui.wicket.ConnectionRegistry.java
License:Apache License
/** * @param _userName login of the user//w w w .j a va 2s .com * @param _sessionID SessionId assigned */ protected void setUser(final String _userName, final String _sessionID) { ConnectionRegistry.LOG.debug("register user: '{}', session: '{}'", _userName, _sessionID); ConcurrentMap<String, ConcurrentHashSet<String>> user2session = Session.get().getApplication() .getMetaData(ConnectionRegistry.USER2SESSION); if (user2session == null) { synchronized (ConnectionRegistry.USER2SESSION) { user2session = Session.get().getApplication().getMetaData(ConnectionRegistry.USER2SESSION); if (user2session == null) { user2session = Generics.<String, ConcurrentHashSet<String>>newConcurrentHashMap(); Session.get().getApplication().setMetaData(ConnectionRegistry.USER2SESSION, user2session); } } } ConcurrentHashSet<String> sessions = user2session.get(_userName); if (sessions == null) { synchronized (ConnectionRegistry.USER2SESSION) { sessions = user2session.get(_userName); if (sessions == null) { sessions = new ConcurrentHashSet<>(); user2session.put(_userName, sessions); } } } sessions.add(_sessionID); ConnectionRegistry.LOG.debug("Added User '{}' for Session: {}", _userName, _sessionID); registerLogin4History(_userName, _sessionID); }