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:nl.knaw.huygens.security.server.service.LoginService.java

public LoginService() {
    log.debug("LoginService created");
    loginRequestsByRelayState = Maps.newConcurrentMap();
    nextPurge = DateTime.now().plusMinutes(1);
}

From source file:org.darkware.netpipe.PipeService.java

public PipeService(final InetAddress addr, final int port) {
    super();/*  w  ww . j  a va2 s .  co  m*/

    this.connections = Maps.newConcurrentMap();
    this.active = new AtomicBoolean(true);

    try {
        this.server = ServerSocketChannel.open();
        this.server.bind(new InetSocketAddress(addr, port));
    } catch (IOException e) {
        throw new IllegalArgumentException("Could not start a pipe service.", e);
    }
}

From source file:net.myrrix.web.DoSFilter.java

public DoSFilter() {
    numRecentAccesses = Maps.newConcurrentMap();
    bannedIPAddresses = Sets.newSetFromMap(Maps.<String, Boolean>newConcurrentMap());
}

From source file:com.netflix.ice.basic.BasicThroughputMetricService.java

public BasicThroughputMetricService(String metricName, String metricUnitName, String factoredCostCurrencySign,
        double factoredCostMultiply, String filePrefix) {
    this.metricName = metricName;
    this.metricUnitName = metricUnitName;
    this.factoredCostCurrencySign = factoredCostCurrencySign;
    this.factoredCostMultiply = factoredCostMultiply;
    this.filePrefix = filePrefix;
    fileCache = Maps.newConcurrentMap();
}

From source file:org.apache.provisionr.core.templates.PoolTemplateInstaller.java

public PoolTemplateInstaller(BundleContext bundleContext) {
    this.bundleContext = checkNotNull(bundleContext, "bundleContext is null");
    this.templates = Maps.newConcurrentMap();
}

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

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

From source file:com.censoredsoftware.infractions.bukkit.legacy.data.file.FileDataManager.java

@Override
public void init() {
    // Check if init has happened already...
    if (didInit)/* w w w.java 2  s.  c om*/
        throw new RuntimeException("Data tried to initialize more than once.");

    // Preserve the load order.
    List<Class> fileOrder = Lists.newArrayList();

    // Create YAML files.
    yamlFiles = Maps.newConcurrentMap();
    for (DataType dataType : DataType.values()) {
        InfractionsFile file = InfractionsFileFactory.create(dataType, SAVE_PATH);
        if (file == null)
            continue;
        InfractionsPlugin.getInst().getLogger().info("Marked \"" + dataType.name() + "\" for data import.");
        yamlFiles.put(dataType.getDataClass(), file);
        fileOrder.add(dataType.getDataClass());
    }

    // Load YAML files.
    for (Class clazz : fileOrder) {
        InfractionsFile file = yamlFiles.get(clazz);
        try {
            file.loadDataFromFile();
        } catch (Exception ex) {
            InfractionsPlugin.getInst().getLogger()
                    .severe("Failure to import data from \"" + file.getName() + "\" file.");
            continue;
        }
        InfractionsPlugin.getInst().getLogger()
                .info("Data import from \"" + file.getName() + "\" file complete.");
    }

    // Let the plugin know that this has finished.
    didInit = true;
}

From source file:co.cask.cdap.metrics.process.PersistedMessageCallback.java

/**
 * Constructs a {@link PersistedMessageCallback} which delegates to the given callback for actual action while
 * persisting offsets information in to the given meta table when number of messages has been processed based
 * on the persistThreshold./*from w w w  .  ja  v  a 2 s  .co m*/
 */
public PersistedMessageCallback(KafkaConsumer.MessageCallback delegate, KafkaConsumerMetaTable metaTable,
        int persistThreshold) {
    this.delegate = delegate;
    this.metaTable = metaTable;
    this.persistThreshold = persistThreshold;
    this.offsets = Maps.newConcurrentMap();
    this.messageCount = new AtomicInteger();
}

From source file:org.axonframework.ext.chronicle.store.ChronicleEventStore.java

/**
 * c-tor// ww w  . j  av  a  2s . co m
 *
 * @param basePath   the Chronicle base path
 * @param serializer the DomainEventStream serializer
 */
public ChronicleEventStore(String basePath, final Serializer serializer) {
    m_basePath = basePath;
    m_serializer = serializer;
    m_domainEventStore = Maps.newConcurrentMap();

    LOGGER.debug("BasePath for ChronicleEventStore is {}", m_basePath);
}

From source file:org.ros.android.android_acm_serial.AcmDeviceActivity.java

protected AcmDeviceActivity(String notificationTicker, String notificationTitle) {
    super(notificationTicker, notificationTitle);
    log.info("<New> - Enter - v0.1");
    acmDevices = Maps.newConcurrentMap();
    usbDevicePermissionReceiver = new UsbDevicePermissionReceiver(new UsbDevicePermissionCallback() {
        @Override//from  w  ww. ja  v  a 2 s  . c o m
        public void onPermissionGranted(UsbDevice usbDevice) {
            log.info("New ACM device. Permission Granted");
            newAcmDevice(usbDevice);
        }

        @Override
        public void onPermissionDenied() {
            log.info("New ACM device. Permission Denied");
            AcmDeviceActivity.this.onPermissionDenied();
        }
    });
    usbDeviceDetachedReceiver = new UsbDeviceDetachedReceiver(acmDevices);
    log.info("<New> - Exit");
}