Example usage for com.google.common.collect Sets newIdentityHashSet

List of usage examples for com.google.common.collect Sets newIdentityHashSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets newIdentityHashSet.

Prototype

public static <E> Set<E> newIdentityHashSet() 

Source Link

Document

Creates an empty Set that uses identity to determine equality.

Usage

From source file:co.cask.cdap.logging.pipeline.LogProcessorPipelineContext.java

public LogProcessorPipelineContext(CConfiguration cConf, String name, final LoggerContext context) {
    this.name = name;
    this.loggerContext = context;
    this.effectiveLoggerCache = CacheBuilder.newBuilder()
            .maximumSize(cConf.getInt(Constants.Logging.PIPELINE_LOGGER_CACHE_SIZE))
            .expireAfterAccess(cConf.getInt(Constants.Logging.PIPELINE_LOGGER_CACHE_EXPIRATION_MS),
                    TimeUnit.MILLISECONDS)
            .build(new CacheLoader<String, Logger>() {
                @Override/*from   w  ww  . j a  va 2  s  .  com*/
                public Logger load(String loggerName) throws Exception {
                    return Loggers.getEffectiveLogger(context, loggerName);
                }
            });

    // Grab all the appender instances in the context
    Set<Appender<ILoggingEvent>> appenders = Sets.newIdentityHashSet();
    for (Logger logger : context.getLoggerList()) {
        Iterators.addAll(appenders, logger.iteratorForAppenders());
    }
    this.appenders = appenders;
}

From source file:com.google.inject.servlet.AbstractServletPipeline.java

void destroy() {
    Set<HttpServlet> destroyedSoFar = Sets.newIdentityHashSet();
    for (ServletDefinition servletDefinition : servletDefinitions()) {
        servletDefinition.destroy(destroyedSoFar);
    }//ww w.  j ava  2 s  .  c om
}

From source file:com.spectralogic.ds3client.helpers.JobImpl.java

public JobImpl(final Ds3Client client, final MasterObjectList masterObjectList,
        final int objectTransferAttempts, final EventRunner eventRunner) {
    this.client = client;
    this.masterObjectList = masterObjectList;
    this.objectTransferAttempts = objectTransferAttempts;
    this.eventRunner = eventRunner;
    this.failureEventListeners = Sets.newIdentityHashSet();
    this.waitingForChunksListeners = Sets.newIdentityHashSet();
    this.checksumListeners = Sets.newIdentityHashSet();
    this.jobPartTracker = makeJobPartTracker(getChunks(masterObjectList), eventRunner);
}

From source file:com.google.inject.servlet.AbstractFilterPipeline.java

public synchronized void initPipeline(ServletContext servletContext) throws ServletException {

    //double-checked lock, prevents duplicate initialization
    if (initialized)
        return;/*from  w  ww . j ava 2  s.c o m*/

    // Used to prevent duplicate initialization.
    Set<Filter> initializedSoFar = Sets.newIdentityHashSet();

    for (FilterDefinition filterDefinition : filterDefinitions()) {
        filterDefinition.init(servletContext, injector, initializedSoFar);
    }

    //next, initialize servlets...
    servletPipeline.init(servletContext, injector);

    //everything was ok...
    initialized = true;
}

From source file:at.ac.univie.isc.asio.insight.VndError.java

/**
 * Create an ordered list of the causal chain of errors leading up to the given top level error.
 *
 * @param top top most exception in chain
 * @return full causal chain of exceptions
 *//*  w w  w . j ava 2 s . c o m*/
private static List<ErrorChainElement> collectCausalChain(final Throwable top) {
    final Set<Throwable> seen = Sets.newIdentityHashSet();
    final ImmutableList.Builder<ErrorChainElement> chain = ImmutableList.builder();
    Throwable current = top;
    while (current != null) {
        if (!seen.add(current)) {
            final ErrorChainElement element = ErrorChainElement.from(circularPlaceholder(current));
            chain.add(element);
            break; // circular reference in chain
        }
        final ErrorChainElement element = ErrorChainElement.from(current);
        chain.add(element);
        current = current.getCause();
    }
    return chain.build();
}

From source file:com.google.inject.servlet.ManagedServletPipeline.java

public void init(ServletContext servletContext, Injector injector) throws ServletException {
    Set<HttpServlet> initializedSoFar = Sets.newIdentityHashSet();

    for (ServletDefinition servletDefinition : servletDefinitions) {
        servletDefinition.init(servletContext, injector, initializedSoFar);
    }/*from w  ww.  j  a  va 2  s  . c  om*/
}

From source file:compile.module.AbstractScope.java

public void addDependency(final Statement statement, final Binding binding) {
    // invalidate previously calculated dependency groups
    groups = null;/*w  ww. java 2 s  .c o m*/

    assert body.contains(statement) || (statement instanceof TypeDef
            && typeDefs.containsValue(statement)) : "source statement not from this scope";

    assert binding.getScope() == this : "target binding not from this scope";

    Set<Binding> targets = dependencies.get(statement);

    if (targets == null) {
        targets = Sets.newIdentityHashSet();
        dependencies.put(statement, targets);
    }

    targets.add(binding);
}

From source file:compile.type.visit.TypeVarSubstitutor.java

/**
 *
 *///from   w w w.j a  va  2s . co  m
public TypeVarSubstitutor(final Type type, final SubstMap substMap, final boolean canCopyParams) {
    this.type = type;
    this.substMap = substMap;
    this.canCopyParams = canCopyParams;
    this.xferParams = Sets.newIdentityHashSet();
    this.paramRefs = new IdentityHashMap<TypeParam, List<TypeRef>>();
}

From source file:com.google.inject.servlet.DynamicServletPipeline.java

@Override
public void destroy() {
    Set<HttpServlet> destroyedSoFar = Sets.newIdentityHashSet();
    for (ServletDefinition servletDefinition : servletDefinitions()) {
        servletDefinition.destroy(destroyedSoFar);
    }/*ww w  .j  ava2s .c o  m*/
}

From source file:org.apache.jackrabbit.oak.plugins.index.lucene.IndexAugmentorFactory.java

public IndexAugmentorFactory() {
    indexFieldProviders = Sets.newIdentityHashSet();
    fulltextQueryTermsProviders = Sets.newIdentityHashSet();

    resetState();
}