List of usage examples for java.util.concurrent CopyOnWriteArraySet CopyOnWriteArraySet
public CopyOnWriteArraySet()
From source file:ubic.BAMSandAllen.Top50Analyze.java
public Set<String> getTop50Genes(OntClass o) { Set<String> result = new CopyOnWriteArraySet<String>(); NodeIterator nodes = o.listPropertyValues(hasAllenEnrichedGene); for (Object nodeObj : nodes.toList()) { RDFNode node = (RDFNode) nodeObj; Literal l = (Literal) node.as(Literal.class); result.add(l.getString());//www . java 2 s . com } return result; }
From source file:org.eclipse.che.api.builder.internal.SourcesManagerImpl.java
public SourcesManagerImpl(java.io.File directory) { this.directory = directory; tasks = new ConcurrentHashMap<>(); projectKeyHolder = new AtomicReference<>(); executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder() .setNameFormat(getClass().getSimpleName() + "-FileCleaner-%d").setDaemon(true).build()); listeners = new CopyOnWriteArraySet<>(); }
From source file:com.devicehive.eventbus.SubscriberRegistry.java
/** * Unregisters subscriber from registry maps: * - gets all subscriber's subscriptions from {@link SubscriberRegistry#subscriberSubscriptions} * - removes subscriber from each subscription's list in {@link SubscriberRegistry#subscriptions} * - removes entry from {@link SubscriberRegistry#subscriberSubscriptions} * * @param subscriber - subscriber//from w w w . j av a2s.co m */ void unregister(Subscriber subscriber) { CopyOnWriteArraySet<Subscription> subs = subscriberSubscriptions.getOrDefault(subscriber.getId(), new CopyOnWriteArraySet<>()); subs.forEach(s -> { CopyOnWriteArraySet<Subscriber> subscribers = this.subscriptions.get(s); if (subscribers != null) { subscribers.remove(subscriber); } }); }
From source file:com.mmnaseri.dragonfly.runtime.session.impl.AbstractSessionPreparator.java
public AbstractSessionPreparator() { entityDefinitionSources = new CopyOnWriteArraySet<LookupSource>(); extensionDefinitionSources = new CopyOnWriteArraySet<LookupSource>(); entityDefinitionContext = new DefaultEntityDefinitionContext(); extensionManager = new DefaultExtensionManager(); tableMetadataResolverContext = new DefaultTableMetadataResolverContext(MetadataResolveStrategy.UNAMBIGUOUS, Arrays.<TableMetadataInterceptor>asList(extensionManager)); entityDefinitionContext.addInterceptor(extensionManager); parentClassLoader = null;// ww w .j av a2 s. c o m }
From source file:com.espertech.esper.core.EPServiceProviderImpl.java
/** * Constructor - initializes services.//www. j a v a 2 s . com * @param configuration is the engine configuration * @param engineURI is the engine URI or "default" (or null which it assumes as "default") if this is the default provider * @param runtimes map of URI and runtime * @throws ConfigurationException is thrown to indicate a configuraton error */ public EPServiceProviderImpl(Configuration configuration, String engineURI, Map<String, EPServiceProviderSPI> runtimes) throws ConfigurationException { if (configuration == null) { throw new NullPointerException("Unexpected null value received for configuration"); } if (engineURI == null) { throw new NullPointerException("Engine URI should not be null at this stage"); } this.runtimes = runtimes; this.engineURI = engineURI; verifyConfiguration(configuration); serviceListeners = new CopyOnWriteArraySet<EPServiceStateListener>(); configSnapshot = takeSnapshot(configuration); statementListeners = new CopyOnWriteArraySet<EPStatementStateListener>(); doInitialize(); }
From source file:com.devicehive.eventbus.SubscriberRegistry.java
/** * @param subscription - subscription/* w w w . j av a 2 s . c o m*/ * @return - list of subscribers for subscription */ Collection<Subscriber> getSubscribers(Subscription subscription) { Assert.notNull(subscription); return this.subscriptions.getOrDefault(subscription, new CopyOnWriteArraySet<>()); }
From source file:com.espertech.esper.core.service.EPServiceProviderImpl.java
/** * Constructor - initializes services./*from w w w . j av a 2 s . co m*/ * @param configuration is the engine configuration * @param engineURI is the engine URI or "default" (or null which it assumes as "default") if this is the default provider * @param runtimes map of URI and runtime * @throws ConfigurationException is thrown to indicate a configuraton error */ public EPServiceProviderImpl(Configuration configuration, String engineURI, Map<String, EPServiceProviderSPI> runtimes) throws ConfigurationException { if (configuration == null) { throw new NullPointerException("Unexpected null value received for configuration"); } if (engineURI == null) { throw new NullPointerException("Engine URI should not be null at this stage"); } this.runtimes = runtimes; this.engineURI = engineURI; verifyConfiguration(configuration); serviceListeners = new CopyOnWriteArraySet<EPServiceStateListener>(); configSnapshot = takeSnapshot(configuration); statementListeners = new CopyOnWriteArraySet<EPStatementStateListener>(); doInitialize(null); }
From source file:org.rifidi.edge.core.configuration.services.DefaultConfigurationImpl.java
/** * Constructor./*from www . j a v a2s.c o m*/ * * @param context * @param serviceID * @param factoryID * @param attributes * @param sessionDTOs */ public DefaultConfigurationImpl(final String serviceID, final String factoryID, final AttributeList attributes, final NotifierService notifierService, final JMXService jmxService, Set<SessionDTO> sessionDTOs) { this.notifierService = notifierService; this.nameToProperty = new HashMap<String, Property>(); this.nameToOperation = new HashMap<String, Operation>(); this.factoryID = factoryID; this.serviceID = serviceID; this.attributes = (AttributeList) attributes.clone(); this.listeners = new CopyOnWriteArraySet<AttributesChangedListener>(); this.target = new AtomicReference<RifidiService>(null); this.jmxService = jmxService; this.sessionDTOs = new ConcurrentHashMap<SessionDTO, String>(); if (sessionDTOs != null) { for (SessionDTO dto : sessionDTOs) { this.sessionDTOs.put(dto, "-1"); } } }
From source file:org.springframework.security.core.session.SessionRegistryImpl.java
public void registerNewSession(String sessionId, Object principal) { Assert.hasText(sessionId, "SessionId required as per interface contract"); Assert.notNull(principal, "Principal required as per interface contract"); if (getSessionInformation(sessionId) != null) { removeSessionInformation(sessionId); }/*from w ww. java 2 s .c o m*/ if (logger.isDebugEnabled()) { logger.debug("Registering session " + sessionId + ", for principal " + principal); } sessionIds.put(sessionId, new SessionInformation(principal, sessionId, new Date())); Set<String> sessionsUsedByPrincipal = principals.computeIfAbsent(principal, key -> new CopyOnWriteArraySet<>()); sessionsUsedByPrincipal.add(sessionId); if (logger.isTraceEnabled()) { logger.trace("Sessions used by '" + principal + "' : " + sessionsUsedByPrincipal); } }
From source file:com.devicehive.eventbus.SubscriberRegistry.java
Collection<Subscription> getSubscriptions(Subscriber subscriber) { Assert.notNull(subscriber);// w w w .j ava2 s . c o m return this.subscriberSubscriptions.getOrDefault(subscriber.getId(), new CopyOnWriteArraySet<>()); }