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:co.cask.cdap.data2.transaction.stream.leveldb.LevelDBStreamFileConsumerFactory.java

@Inject
LevelDBStreamFileConsumerFactory(StreamAdmin streamAdmin, StreamConsumerStateStoreFactory stateStoreFactory,
        CConfiguration cConf, LevelDBTableService tableService) {
    super(cConf, streamAdmin, stateStoreFactory);
    this.cConf = cConf;
    this.tableService = tableService;
    this.dbLocks = Maps.newConcurrentMap();
}

From source file:co.cask.cdap.internal.app.runtime.AbstractProgramController.java

protected AbstractProgramController(String programName, RunId runId) {
    this.state = new AtomicReference<>(State.STARTING);
    this.programName = programName;
    this.runId = runId;
    this.listeners = Maps.newConcurrentMap();
    this.caller = new MultiListenerCaller();
}

From source file:com.metamx.druid.client.BrokerServerView.java

public BrokerServerView(QueryToolChestWarehouse warehose, ObjectMapper smileMapper, HttpClient httpClient,
        ServerView baseView, ExecutorService exec) {
    this.warehose = warehose;
    this.smileMapper = smileMapper;
    this.httpClient = httpClient;
    this.baseView = baseView;

    this.clients = Maps.newConcurrentMap();
    this.selectors = Maps.newHashMap();
    this.timelines = Maps.newHashMap();

    baseView.registerSegmentCallback(exec, new ServerView.SegmentCallback() {
        @Override//from  w w  w  .j a v a2 s. com
        public ServerView.CallbackAction segmentAdded(DruidServer server, DataSegment segment) {
            serverAddedSegment(server, segment);
            return ServerView.CallbackAction.CONTINUE;
        }

        @Override
        public ServerView.CallbackAction segmentRemoved(final DruidServer server, DataSegment segment) {
            serverRemovedSegment(server, segment);
            return ServerView.CallbackAction.CONTINUE;
        }
    });

    baseView.registerServerCallback(exec, new ServerView.ServerCallback() {
        @Override
        public ServerView.CallbackAction serverRemoved(DruidServer server) {
            removeServer(server);
            return ServerView.CallbackAction.CONTINUE;
        }
    });
}

From source file:org.sonatype.nexus.capability.internal.DefaultCapabilityFactoryRegistry.java

@Inject
DefaultCapabilityFactoryRegistry(final Map<String, CapabilityFactory> factories,
        final CapabilityDescriptorRegistry capabilityDescriptorRegistry, final BeanLocator beanLocator) {
    this.beanLocator = checkNotNull(beanLocator);
    this.capabilityDescriptorRegistry = checkNotNull(capabilityDescriptorRegistry);
    this.factories = checkNotNull(factories);
    this.dynamicFactories = Maps.newConcurrentMap();
}

From source file:com.voxelplugineering.voxelsniper.service.persistence.MemoryContainer.java

/**
 * Creates a new {@link MemoryContainer}.
 * /*  w  ww .  j  ava  2 s  .co  m*/
 * @param path The path of this container
 */
public MemoryContainer(String path) {
    this.data = Maps.newConcurrentMap();
    if (path.contains(PATH_SEPARATOR)) {
        String[] sp = path.split(PATH_SEPARATOR);
        this.path = sp[0];
        this.data.put(sp[1], new MemoryContainer(path.substring(path.indexOf(PATH_SEPARATOR) + 1)));
    } else {
        this.path = path;
    }
}

From source file:org.obm.provisioning.processing.impl.BatchTrackerImpl.java

@Inject
public BatchTrackerImpl(BatchProcessor processor) {
    this.runningBatches = Maps.newConcurrentMap();

    processor.addBatchProcessingListener(this);
}

From source file:com.github.lburgazzoli.karaf.common.CombinedClassLoader.java

/**
 * c-tor/*from  w  w  w .ja v  a2s . c om*/
 *
 * @param bundleContext the bundle context
 * @param classLoader the delegate class loader
 */
public CombinedClassLoader(BundleContext bundleContext, ClassLoader classLoader) {
    super(classLoader);

    m_bundles = Maps.newConcurrentMap();
    m_classes = Maps.newConcurrentMap();
    m_resources = Maps.newConcurrentMap();
    m_classLoaders = Lists.newArrayList();
    m_class4bundle = Maps.newConcurrentMap();
    m_bundleContext = bundleContext;
}

From source file:com.cloudera.livy.rsc.RSCClient.java

RSCClient(RSCClientFactory factory, RSCConf conf, ContextInfo ctx) throws IOException {
    this.ctx = ctx;
    this.factory = factory;
    this.conf = conf;
    this.jobs = Maps.newConcurrentMap();
    this.protocol = new ClientProtocol();
    this.eventLoopGroup = new NioEventLoopGroup(conf.getInt(RPC_MAX_THREADS), new ThreadFactoryBuilder()
            .setNameFormat("Client-RPC-Handler-" + ctx.getClientId() + "-%d").setDaemon(true).build());

    try {//w ww .jav a  2  s  .  c  o m
        this.driverRpc = Rpc.createClient(conf, eventLoopGroup, ctx.getRemoteAddress(), ctx.getRemotePort(),
                ctx.getClientId(), ctx.getSecret(), protocol).get();
    } catch (Throwable e) {
        ctx.dispose(true);
        throw Throwables.propagate(e);
    }

    driverRpc.addListener(new Rpc.Listener() {
        @Override
        public void rpcClosed(Rpc rpc) {
            if (isAlive) {
                LOG.warn("Client RPC channel closed unexpectedly.");
                isAlive = false;
            }
        }
    });

    isAlive = true;
    LOG.debug("Connected to context {} ({}).", ctx.getClientId(), driverRpc.getChannel());
}

From source file:com.viadeo.kasper.core.resolvers.DomainHelper.java

public DomainHelper() {
    domainClassByComponentClasses = Maps.newConcurrentMap();
}

From source file:org.artifactory.storage.db.binstore.service.FileCacheBinaryProviderImpl.java

public FileCacheBinaryProviderImpl(File rootDataDir, StorageProperties storageProperties) {
    super(getDataFolder(rootDataDir, storageProperties, StorageProperties.Key.binaryProviderCacheDir, "cache"));
    lruCache = Maps.newConcurrentMap();
    totalSize = new AtomicLong(0);
    maxTotalSize = storageProperties.getBinaryProviderCacheMaxSize();
    cacheCleanerSemaphore = new Semaphore(1);
}