Example usage for com.google.common.collect Maps newConcurrentMap

List of usage examples for com.google.common.collect Maps newConcurrentMap

Introduction

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

Prototype

public static <K, V> ConcurrentMap<K, V> newConcurrentMap() 

Source Link

Document

Returns a general-purpose instance of ConcurrentMap , which supports all optional operations of the ConcurrentMap interface.

Usage

From source file:org.apache.drill.exec.store.sys.local.LocalPStoreProvider.java

public LocalPStoreProvider(DrillConfig config) {
    path = new File(config.getString(ExecConstants.SYS_STORE_PROVIDER_LOCAL_PATH));
    enableWrite = config.getBoolean(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE);
    if (!enableWrite) {
        pstores = Maps.newConcurrentMap();
    }/*w ww. jav a  2  s  . c om*/
}

From source file:nl.knaw.huygens.timbuctoo.storage.file.LoginCollection.java

public LoginCollection(List<Login> logins) {
    userNameIdMap = Maps.newConcurrentMap();
    idLoginMap = Maps.newConcurrentMap();
    userPidIdMap = Maps.newConcurrentMap();
    initialize(logins);
}

From source file:brooklyn.internal.storage.impl.BrooklynStorageImpl.java

public BrooklynStorageImpl(DataGrid datagrid) {
    this.datagrid = datagrid;
    this.refsMap = datagrid.getMap("refs");
    this.listsMap = datagrid.getMap("lists");
    this.refsCache = Maps.newConcurrentMap();
    this.listRefsCache = Maps.newConcurrentMap();
}

From source file:de.felix_klauke.pegasus.client.handler.PacketHandler.java

/**
 * The basic Constructor fot his class. The logger will be assigned to the local var
 * and the map for the Listeners will be created using the google Collections Library.
 *
 * @param logger the Logger to log all important information
 *//* w  w w . j a  v  a 2  s. c  o  m*/
public PacketHandler(Logger logger) {
    this.logger = logger;
    this.listeners = Maps.newConcurrentMap();
}

From source file:org.sonatype.nexus.proxy.storage.AbstractContextualizedRepositoryStorage.java

protected AbstractContextualizedRepositoryStorage() {
    repositoryContextGenerations = Maps.newConcurrentMap();
}

From source file:org.apache.bookkeeper.stream.storage.impl.sc.StorageContainerRegistryImpl.java

public StorageContainerRegistryImpl(StorageContainerFactory factory) {
    this.scFactory = factory;
    this.containers = Maps.newConcurrentMap();
    this.closeLock = new ReentrantReadWriteLock();
}

From source file:com.continuuity.weave.internal.kafka.client.ConnectionPool.java

ConnectionPool(ClientBootstrap bootstrap) {
    this.bootstrap = bootstrap;
    this.channelGroup = new DefaultChannelGroup();
    this.connections = Maps.newConcurrentMap();
}

From source file:com.macrossx.wechat.impl.WechatMenuHelper.java

/**
 * create menu//from  w w  w  .j av a2s. c  om
 * 
 * @param menu
 *            menu to create
 *            {@link https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN}
 * @return true sucess
 */
@Override
public boolean createMenu(List<WechatButton> menu) {
    try {
        Map<String, List<WechatButton>> menus = Maps.newConcurrentMap();
        menus.put("button", menu);
        Optional<WechatAccessToken> token = wechatHelper.getAccessToken();
        if (token.isPresent()) {
            WechatAccessToken accessToken = token.get();
            HttpPost httpPost = new HttpPost();
            httpPost.setEntity(new StringEntity(new Gson().toJson(menus), "utf-8"));
            httpPost.setURI(new URI(
                    MessageFormat.format(WechatConstants.MENU_CREATE_URL, accessToken.getAccess_token())));
            Optional<WechatResponseObj> response = new WechatHttpClient().send(httpPost,
                    WechatResponseObj.class);
            if (response.isPresent()) {
                WechatResponseObj e = response.get();
                log.info(e.toString());
                if (0 == e.getErrcode()) {
                    return true;
                }
            }
        }
    } catch (URISyntaxException e) {
        log.info(e.getMessage());
    }
    return false;
}

From source file:uk.ac.cam.cl.dtg.segue.api.monitors.InMemoryMisuseMonitor.java

/**
 * Creates a misuse monitor that just uses non-persistent storage.
 */// w w  w  .ja  v  a 2s .com
@Inject
public InMemoryMisuseMonitor() {
    nonPersistentDatabase = CacheBuilder.newBuilder()
            .expireAfterAccess(2, TimeUnit.DAYS).<String, Map<String, Map.Entry<Date, Integer>>>build();
    handlerMap = Maps.newConcurrentMap();
}

From source file:com.baidu.rigel.biplatform.ma.report.model.FormatModel.java

/**
 * @return the toolTips/*from w  w  w .  j a  v a 2 s .c om*/
 */
public Map<String, String> getToolTips() {
    if (this.toolTips == null) {
        this.toolTips = Maps.newConcurrentMap();
    }
    return toolTips;
}