Example usage for com.google.common.collect MapMaker MapMaker

List of usage examples for com.google.common.collect MapMaker MapMaker

Introduction

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

Prototype

public MapMaker() 

Source Link

Usage

From source file:org.jclouds.tools.ant.taskdefs.compute.ComputeTaskUtils.java

/**
 * /*from w w w.j  av a 2 s.com*/
 * Creates a Map that associates a uri with a live connection to the compute provider. This is
 * done on-demand.
 * 
 * @param projectProvider
 *           allows access to the ant project to retrieve default properties needed for compute
 *           providers.
 */
static Map<URI, ComputeServiceContext> buildComputeMap(final Provider<Project> projectProvider) {
    return new MapMaker().makeComputingMap(new Function<URI, ComputeServiceContext>() {

        @SuppressWarnings("unchecked")
        @Override
        public ComputeServiceContext apply(URI from) {
            Properties props = getPropertiesFromResource("/rest.properties");
            props.putAll(projectProvider.get().getProperties());
            // adding the properties to the factory will allow us to pass
            // alternate endpoints
            String provider = from.getHost();
            Credentials creds = Credentials.parse(from);
            return new ComputeServiceContextFactory(props).createContext(provider, creds.identity,
                    creds.credential, ImmutableSet.of((Module) new AntLoggingModule(projectProvider.get(),
                            ComputeServiceConstants.COMPUTE_LOGGER), new JschSshClientModule()),
                    props);

        }

    });

}

From source file:org.weakref.jmx.MBeanExporter.java

@Inject
public MBeanExporter(MBeanServer server) {
    this.server = server;
    exportedObjects = new MapMaker().weakKeys().weakValues().makeMap();
}

From source file:org.springframework.ide.eclipse.boot.dash.model.BootProjectDashElementFactory.java

public BootProjectDashElementFactory(LocalBootDashModel model, IScopedPropertyStore<IProject> projectProperties,
        LaunchConfDashElementFactory launchConfElementFactory) {
    this.cache = new MapMaker().concurrencyLevel(1) //single thread only so don't waste space for 'connurrencyLevel' support
            .makeMap();//  ww  w .j  a  va2 s.com
    this.model = model;
    this.launchConfElementFactory = launchConfElementFactory;
    this.projectProperties = projectProperties;
}

From source file:com.aipo.container.gadgets.render.AipoRpcServiceLookup.java

@Inject
public AipoRpcServiceLookup(AipoServiceFetcher fetcher,
        @Named("org.apache.shindig.serviceExpirationDurationMinutes") Long duration) {
    containerServices = new MapMaker().expiration(duration * 60, TimeUnit.SECONDS).makeMap();
    this.fetcher = fetcher;
}

From source file:org.gradle.model.internal.PersistentModelObjectRegistry.java

public PersistentModelObjectRegistry(File outputFile) {
    store = new BTreePersistentIndexedCache<Object, FlattenedObject>(outputFile,
            new DefaultSerializer<Object>(), new DefaultSerializer<FlattenedObject>());
    idToInstance = new MapMaker().weakValues().makeMap();
    instanceToId = new MapMaker().weakKeys().makeMap();
}

From source file:com.tantaman.eats.aop.pub.nutrients.impl.concurrent.ReScheduleExecutionNutrient.java

public ReScheduleExecutionNutrient(ReScheduleExecution pAnnotation) {
    mAnnotation = pAnnotation;/*from   w  ww  . j  av a  2s.  com*/
    mFutures = new MapMaker().weakKeys().makeMap();
    mRunnableCreator = new RunnableCreator();

    ScheduledExecutorService exec = null;
    try {
        exec = pAnnotation.executorProvider().newInstance().getExecutorForMethod(pAnnotation);
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    mExecutor = exec;
}

From source file:org.apache.isis.core.wrapper.proxy.ProxyCreator.java

public ProxyCreator() {
    this(new MapMaker().weakKeys().concurrencyLevel(10).<Class, ProxyFactory>makeMap());
}

From source file:uk.q3c.krail.core.services.ServicesMonitor.java

@Inject
public ServicesMonitor() {
    this.services = new MapMaker().weakKeys().makeMap();
}

From source file:org.springframework.ide.eclipse.boot.dash.model.LaunchConfDashElementFactory.java

public LaunchConfDashElementFactory(LocalBootDashModel bootDashModel, ILaunchManager lm) {
    this.cache = new MapMaker().concurrencyLevel(1) //single thread only so don't waste space for 'connurrencyLevel' support
            .makeMap();//from w  w  w.  j  ava2  s  .  c  o  m
    this.model = bootDashModel;
    this.launchManager = lm;
    lm.addLaunchConfigurationListener(listener = new ILaunchConfigurationListener() {

        @Override
        public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
            deleted(configuration);
        }

        @Override
        public void launchConfigurationChanged(ILaunchConfiguration configuration) {
        }

        @Override
        public void launchConfigurationAdded(ILaunchConfiguration configuration) {
        }
    });
}

From source file:net.t7seven7t.viewit.ConfigElements.java

public ConfigElements(Plugin plugin) {
    this.elementsMap = new MapMaker().makeMap();
    this.plugin = plugin;
    loadFromConfiguration(plugin.getConfig());
    Bukkit.getPluginManager().registerEvents(this, plugin);
    Bukkit.getOnlinePlayers().forEach(this::addAllToPlayer);
}