当前位置: 首页>>代码示例>>Java>>正文


Java Collections.newSetFromMap方法代码示例

本文整理汇总了Java中java.util.Collections.newSetFromMap方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.newSetFromMap方法的具体用法?Java Collections.newSetFromMap怎么用?Java Collections.newSetFromMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Collections的用法示例。


在下文中一共展示了Collections.newSetFromMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ConnectionManager

import java.util.Collections; //导入方法依赖的package包/类
ConnectionManager() {
  this.idleScanTimer = new Timer(
      "IPC Server idle connection scanner for port " + getPort(), true);
  this.idleScanThreshold = conf.getInt(
      CommonConfigurationKeysPublic.IPC_CLIENT_IDLETHRESHOLD_KEY,
      CommonConfigurationKeysPublic.IPC_CLIENT_IDLETHRESHOLD_DEFAULT);
  this.idleScanInterval = conf.getInt(
      CommonConfigurationKeys.IPC_CLIENT_CONNECTION_IDLESCANINTERVAL_KEY,
      CommonConfigurationKeys.IPC_CLIENT_CONNECTION_IDLESCANINTERVAL_DEFAULT);
  this.maxIdleTime = 2 * conf.getInt(
      CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
      CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_DEFAULT);
  this.maxIdleToClose = conf.getInt(
      CommonConfigurationKeysPublic.IPC_CLIENT_KILL_MAX_KEY,
      CommonConfigurationKeysPublic.IPC_CLIENT_KILL_MAX_DEFAULT);
  this.maxConnections = conf.getInt(
      CommonConfigurationKeysPublic.IPC_SERVER_MAX_CONNECTIONS_KEY,
      CommonConfigurationKeysPublic.IPC_SERVER_MAX_CONNECTIONS_DEFAULT);
  // create a set with concurrency -and- a thread-safe iterator, add 2
  // for listener and idle closer threads
  this.connections = Collections.newSetFromMap(
      new ConcurrentHashMap<Connection,Boolean>(
          maxQueueSize, 0.75f, readThreads+2));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:25,代码来源:Server.java

示例2: startAbnormalVisualEffect

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Adds the abnormal visual and sends packet for updating them in client.
 * @param aves the abnormal visual effects
 */
public final void startAbnormalVisualEffect(AbnormalVisualEffect... aves)
{
	for (AbnormalVisualEffect ave : aves)
	{
		if (_abnormalVisualEffects == null)
		{
			synchronized (this)
			{
				if (_abnormalVisualEffects == null)
				{
					_abnormalVisualEffects = Collections.newSetFromMap(new ConcurrentHashMap<>());
				}
			}
		}
		_abnormalVisualEffects.add(ave);
	}
	resetCurrentAbnormalVisualEffects();
}
 
开发者ID:rubenswagner,项目名称:L2J-Global,代码行数:23,代码来源:L2Character.java

示例3: getNumberOfAssociations

import java.util.Collections; //导入方法依赖的package包/类
@Override
public long getNumberOfAssociations(SessionFactory sessionFactory, AssociationStorageType type) {
	int asscociationCount = 0;
	Set<IgniteCache<Object, BinaryObject>> processedCaches = Collections.newSetFromMap( new IdentityHashMap<IgniteCache<Object, BinaryObject>, Boolean>() );

	for ( CollectionPersister collectionPersister : ( (SessionFactoryImplementor) sessionFactory ).getCollectionPersisters().values() ) {
		AssociationKeyMetadata associationKeyMetadata = ( (OgmCollectionPersister) collectionPersister ).getAssociationKeyMetadata();
		IgniteCache<Object, BinaryObject> associationCache = getAssociationCache( sessionFactory, associationKeyMetadata );
		if ( !processedCaches.contains( associationCache ) ) {
			asscociationCount += associationCache.size();
			processedCaches.add( associationCache );
		}
	}

	return asscociationCount;
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:17,代码来源:IgniteTestHelper.java

示例4: updateIndex

import java.util.Collections; //导入方法依赖的package包/类
@Override
public boolean updateIndex(Entity entity, Long deviceKey) {
    Collection<Long> devices = null;

    IndexedEntity ie = new IndexedEntity(keyFields, entity);
    if (!ie.hasNonNullKeys()) return false;

    devices = index.get(ie);
    if (devices == null) {
        Map<Long,Boolean> chm = new ConcurrentHashMap<Long,Boolean>();
        devices = Collections.newSetFromMap(chm);
        Collection<Long> r = index.putIfAbsent(ie, devices);
        if (r != null)
            devices = r;
    }
    
    devices.add(deviceKey);
    return true;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:20,代码来源:DeviceMultiIndex.java

示例5: beforeDeleteNodePerson

import java.util.Collections; //导入方法依赖的package包/类
public void beforeDeleteNodePerson(NodeRef personNodeRef)
{
    String userId = (String)nodeService.getProperty(personNodeRef, ContentModel.PROP_USERNAME);
    //MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities" 
    if (! userNamesAreCaseSensitive)
    {
        userId = userId.toLowerCase();
    }
    Set<String> deletedUserIds = (Set<String>)AlfrescoTransactionSupport.getResource(KEY_DELETED_USER_IDS);
    if (deletedUserIds == null)
    {
        deletedUserIds = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); // Java 6
        AlfrescoTransactionSupport.bindResource(KEY_DELETED_USER_IDS, deletedUserIds);
    }
    
    deletedUserIds.add(userId);
    
    AlfrescoTransactionSupport.bindListener(deletePersonTransactionListener);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:FeedCleaner.java

示例6: registerAuthenticatedSession

import java.util.Collections; //导入方法依赖的package包/类
private void registerAuthenticatedSession(WsSession wsSession,
        String httpSessionId) {
    Set<WsSession> wsSessions = authenticatedSessions.get(httpSessionId);
    if (wsSessions == null) {
        wsSessions = Collections.newSetFromMap(
                 new ConcurrentHashMap<WsSession,Boolean>());
         authenticatedSessions.putIfAbsent(httpSessionId, wsSessions);
         wsSessions = authenticatedSessions.get(httpSessionId);
    }
    wsSessions.add(wsSession);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:WsServerContainer.java

示例7: BlockPoolSliceStorage

import java.util.Collections; //导入方法依赖的package包/类
BlockPoolSliceStorage(int namespaceID, String bpID, long cTime,
    String clusterId) {
  super(NodeType.DATA_NODE);
  this.namespaceID = namespaceID;
  this.blockpoolID = bpID;
  this.cTime = cTime;
  this.clusterID = clusterId;
  storagesWithRollingUpgradeMarker = Collections.newSetFromMap(
      new ConcurrentHashMap<String, Boolean>());
  storagesWithoutRollingUpgradeMarker = Collections.newSetFromMap(
      new ConcurrentHashMap<String, Boolean>());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:BlockPoolSliceStorage.java

示例8: CustomObjectInputStream

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Construct a new instance of CustomObjectInputStream with filtering of
 * deserialized classes.
 *
 * @param stream The input stream we will read from
 * @param classLoader The class loader used to instantiate objects
 * @param log The logger to use to report any issues. It may only be null if
 *            the filterMode does not require logging
 * @param allowedClassNamePattern The regular expression to use to filter
 *                                deserialized classes. The fully qualified
 *                                class name must match this pattern for
 *                                deserialization to be allowed if filtering
 *                                is enabled.
 * @param warnOnFailure Should any failures be logged?
 *
 * @exception IOException if an input/output error occurs
 */
public CustomObjectInputStream(InputStream stream, ClassLoader classLoader,
        Log log, Pattern allowedClassNamePattern, boolean warnOnFailure)
        throws IOException {
    super(stream);
    if (log == null && allowedClassNamePattern != null && warnOnFailure) {
        throw new IllegalArgumentException(
                sm.getString("customObjectInputStream.logRequired"));
    }
    this.classLoader = classLoader;
    this.log = log;
    this.allowedClassNamePattern = allowedClassNamePattern;
    if (allowedClassNamePattern == null) {
        this.allowedClassNameFilter = null;
    } else {
        this.allowedClassNameFilter = allowedClassNamePattern.toString();
    }
    this.warnOnFailure = warnOnFailure;

    Set<String> reportedClasses;
    synchronized (reportedClassCache) {
        reportedClasses = reportedClassCache.get(classLoader);
        if (reportedClasses == null) {
            reportedClasses = Collections.newSetFromMap(new ConcurrentHashMap<String,Boolean>());
            reportedClassCache.put(classLoader, reportedClasses);
        }
    }
    this.reportedClasses = reportedClasses;
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:46,代码来源:CustomObjectInputStream.java

示例9: sanitizeMatches

import java.util.Collections; //导入方法依赖的package包/类
private static <T> void sanitizeMatches(Map<T, T> matches) {
	Set<T> matched = Collections.newSetFromMap(new IdentityHashMap<>(matches.size()));
	Set<T> conflictingMatches = Collections.newSetFromMap(new IdentityHashMap<>());

	for (T cls : matches.values()) {
		if (!matched.add(cls)) {
			conflictingMatches.add(cls);
		}
	}

	if (!conflictingMatches.isEmpty()) {
		matches.values().removeAll(conflictingMatches);
	}
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:15,代码来源:Matcher.java

示例10: classPathsChange

import java.util.Collections; //导入方法依赖的package包/类
@Override
public void classPathsChange(AbstractClassPathProvider.ClassPathsChangeEvent event) {
    final Map<String,Set<ClassPath>> snapshot = new HashMap<>();
    for (String cpType : event.getChangedClassPathTypes()) {
        if (classPathTypes.contains(cpType)) {
            final ClassPath[] cps = cpProvider.getProjectClassPaths(cpType);
            final Set<ClassPath> newCps = Collections.newSetFromMap(new IdentityHashMap<>());
            Collections.addAll(newCps, cps);
            snapshot.put(cpType, newCps);
        }
    }
    if (!snapshot.isEmpty()) {
        updateClassPathCache(snapshot);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ProjectHooks.java

示例11: getNumberOfEntities

import java.util.Collections; //导入方法依赖的package包/类
@Override
public long getNumberOfEntities(SessionFactory sessionFactory) {
	int entityCount = 0;
	Set<IgniteCache<?, ?>> processedCaches = Collections.newSetFromMap( new IdentityHashMap<IgniteCache<?, ?>, Boolean>() );
	for ( EntityPersister entityPersister : ( (SessionFactoryImplementor) sessionFactory ).getEntityPersisters().values() ) {
		IgniteCache<?, ?> entityCache = getEntityCache( sessionFactory, ( (OgmEntityPersister) entityPersister ).getEntityKeyMetadata() );
		if ( !processedCaches.contains( entityCache ) ) {
			entityCount += entityCache.size( CachePeekMode.ALL );
			processedCaches.add( entityCache );
		}
	}
	return entityCount;
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:14,代码来源:IgniteTestHelper.java

示例12: getActiveDocuments

import java.util.Collections; //导入方法依赖的package包/类
@Override
public Set<? extends Document> getActiveDocuments() {
    final Set<Document> res = Collections.newSetFromMap(new IdentityHashMap<Document, Boolean>());
    for (JTextComponent jtc : EditorRegistry.componentList()) {
        final Document doc = jtc.getDocument();
        if (doc != null) {
            res.add(doc);
        }
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:NbActiveDocumentProvider.java

示例13: getFinalParameters

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Get the set of parameters marked final.
 *
 * @return final parameter set.
 */
public Set<String> getFinalParameters() {
  Set<String> setFinalParams = Collections.newSetFromMap(
      new ConcurrentHashMap<String, Boolean>());
  setFinalParams.addAll(finalParameters);
  return setFinalParams;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:12,代码来源:Configuration.java

示例14: Groups

import java.util.Collections; //导入方法依赖的package包/类
public Groups(Configuration conf, final Timer timer) {
  impl = 
    ReflectionUtils.newInstance(
        conf.getClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, 
                      ShellBasedUnixGroupsMapping.class, 
                      GroupMappingServiceProvider.class), 
        conf);

  cacheTimeout = 
    conf.getLong(CommonConfigurationKeys.HADOOP_SECURITY_GROUPS_CACHE_SECS, 
        CommonConfigurationKeys.HADOOP_SECURITY_GROUPS_CACHE_SECS_DEFAULT) * 1000;
  negativeCacheTimeout =
    conf.getLong(CommonConfigurationKeys.HADOOP_SECURITY_GROUPS_NEGATIVE_CACHE_SECS,
        CommonConfigurationKeys.HADOOP_SECURITY_GROUPS_NEGATIVE_CACHE_SECS_DEFAULT) * 1000;
  warningDeltaMs =
    conf.getLong(CommonConfigurationKeys.HADOOP_SECURITY_GROUPS_CACHE_WARN_AFTER_MS,
      CommonConfigurationKeys.HADOOP_SECURITY_GROUPS_CACHE_WARN_AFTER_MS_DEFAULT);
  staticUserToGroupsMap = parseStaticMapping(conf);

  this.timer = timer;
  this.cache = CacheBuilder.newBuilder()
    .refreshAfterWrite(cacheTimeout, TimeUnit.MILLISECONDS)
    .ticker(new TimerToTickerAdapter(timer))
    .expireAfterWrite(10 * cacheTimeout, TimeUnit.MILLISECONDS)
    .build(new GroupCacheLoader());

  if(negativeCacheTimeout > 0) {
    Cache<String, Boolean> tempMap = CacheBuilder.newBuilder()
      .expireAfterWrite(negativeCacheTimeout, TimeUnit.MILLISECONDS)
      .ticker(new TimerToTickerAdapter(timer))
      .build();
    negativeCache = Collections.newSetFromMap(tempMap.asMap());
  }

  if(LOG.isDebugEnabled())
    LOG.debug("Group mapping impl=" + impl.getClass().getName() + 
        "; cacheTimeout=" + cacheTimeout + "; warningDeltaMs=" +
        warningDeltaMs);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:Groups.java

示例15: Configuration

import java.util.Collections; //导入方法依赖的package包/类
/** 
 * A new configuration with the same settings cloned from another.
 * 
 * @param other the configuration from which to clone settings.
 */
@SuppressWarnings("unchecked")
public Configuration(Configuration other) {
 this.resources = (ArrayList<Resource>) other.resources.clone();
 synchronized(other) {
   if (other.properties != null) {
     this.properties = (Properties)other.properties.clone();
   }

   if (other.overlay!=null) {
     this.overlay = (Properties)other.overlay.clone();
   }

   this.updatingResource = new ConcurrentHashMap<String, String[]>(
       other.updatingResource);
   this.finalParameters = Collections.newSetFromMap(
       new ConcurrentHashMap<String, Boolean>());
   this.finalParameters.addAll(other.finalParameters);
 }
 
  synchronized(Configuration.class) {
    REGISTRY.put(this, null);
  }
  this.classLoader = other.classLoader;
  this.loadDefaults = other.loadDefaults;
  setQuietMode(other.getQuietMode());
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:32,代码来源:Configuration.java


注:本文中的java.util.Collections.newSetFromMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。