Example usage for java.util.concurrent CopyOnWriteArrayList CopyOnWriteArrayList

List of usage examples for java.util.concurrent CopyOnWriteArrayList CopyOnWriteArrayList

Introduction

In this page you can find the example usage for java.util.concurrent CopyOnWriteArrayList CopyOnWriteArrayList.

Prototype

public CopyOnWriteArrayList() 

Source Link

Document

Creates an empty list.

Usage

From source file:org.apache.hama.bsp.GroomServerStatus.java

public GroomServerStatus() {
    // taskReports = new ArrayList<TaskStatus>();
    taskReports = new CopyOnWriteArrayList<TaskStatus>();
}

From source file:com.neophob.sematrix.core.glue.PresetSettings.java

/**
 * //from   www.j ava2 s .  c om
 * @return
 */
public static List<PresetSettings> initializePresetSettings(int nrOfSlots) {
    List<PresetSettings> presets = new CopyOnWriteArrayList<PresetSettings>();
    for (int n = 0; n < nrOfSlots; n++) {
        presets.add(new PresetSettings());
    }

    return presets;
}

From source file:io.fabric8.karaf.core.properties.PlaceholderResolverImpl.java

public PlaceholderResolverImpl() {
    this.functions = new CopyOnWriteArrayList<>();
    this.substitutor = Support.createStrSubstitutor(
            getSystemPropertyOrEnvVar(PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_PREFIX),
            getSystemPropertyOrEnvVar(PLACEHOLDER_SUFFIX, DEFAULT_PLACEHOLDER_SUFFIX), new StrLookup<String>() {
                @Override/*www.  j av a 2  s .c  o m*/
                public String lookup(String value) {
                    return resolve(value);
                }
            });
}

From source file:com.vmware.o11n.plugin.powershell.config.impl.ConfigurationServiceImpl.java

public ConfigurationServiceImpl() {
    listeners = new CopyOnWriteArrayList<ConfigurationChangeListener>();
}

From source file:com.sm.store.BuildRemoteConfig.java

public RemoteConfig build() {
    int port = config.getInt("port", 7210);
    String className = config.getString("className");
    int maxQueue = config.getInt("maxQueue", Runtime.getRuntime().availableProcessors() * 100);
    int maxThread = config.getInt("maxThread", Runtime.getRuntime().availableProcessors());
    int replicaPort = config.getInt("replicaPort", 7310);
    freq = config.getInt("freq", 10);
    boolean useNio = config.getBoolean("useNio", true);
    List<HierarchicalConfiguration> list = (List<HierarchicalConfiguration>) config.configurationsAt(STORE);
    if (list == null || list.size() == 0)
        throw new RuntimeException("list is null or freq ==0 for node " + STORE);
    List<StoreConfig> toReturn = new CopyOnWriteArrayList<StoreConfig>();
    for (HierarchicalConfiguration each : list) {
        toReturn.add(buildStoreConfig(each));
    }/*from  w  ww  .j a v a  2s. co m*/
    RemoteConfig remoteConfig = new RemoteConfig(maxQueue, maxThread, port, className, toReturn, replicaPort,
            freq);
    remoteConfig.setUseNio(useNio);
    return remoteConfig;

}

From source file:org.mortbay.jetty.load.collector.CollectorClient.java

public CollectorClient(List<String> addresses, long scheduleDelayInMillis,
        List<CollectorResultHandler> collectorResultHandlers) {
    this.addresses = addresses;
    this.scheduleDelayInMillis = scheduleDelayInMillis;
    this.httpClients = new CopyOnWriteArrayList<>();
    this.collectorResultHandlers = collectorResultHandlers == null ? Collections.emptyList()
            : collectorResultHandlers;/*  w  w  w. jav  a2  s  .  c om*/
}

From source file:com.github.pires.hazelcast.HazelcastDiscoveryController.java

@Override
public void run(String... args) {
    final String kubeApiHost = getEnvOrDefault("KUBERNETES_RO_SERVICE_HOST", "localhost");
    final String kubeApiPort = getEnvOrDefault("KUBERNETES_RO_SERVICE_PORT", "8080");
    final String kubeUrl = "http://" + kubeApiHost + ":" + kubeApiPort;
    log.info("Asking k8s registry at {}..", kubeUrl);
    final KubernetesClient kube = new KubernetesClient(new KubernetesFactory(kubeUrl));
    final List<Pod> hazelcastPods = new CopyOnWriteArrayList<>();
    kube.getPods().getItems().parallelStream()
            .filter(pod -> pod.getLabels().get(HAZELCAST_LABEL_NAME).equals(HAZELCAST_LABEL_VALUE))
            .forEach(hazelcastPods::add);
    log.info("Found {} pods running Hazelcast.", hazelcastPods.size());
    if (!hazelcastPods.isEmpty()) {
        runHazelcast(hazelcastPods);/*from w  ww .j a va 2 s .c o  m*/
    }
}

From source file:org.wso2.carbon.event.stream.manager.core.internal.stream.EventJunction.java

public EventJunction(StreamDefinition streamDefinition) {
    this.streamDefinition = streamDefinition;
    this.producers = new CopyOnWriteArrayList<EventProducer>();
    this.rawEventConsumers = new CopyOnWriteArrayList<RawEventConsumer>();
    this.siddhiEventConsumers = new CopyOnWriteArrayList<SiddhiEventConsumer>();
    this.wso2Consumers = new CopyOnWriteArrayList<WSO2EventConsumer>();
    populateEventTemplate(streamDefinition);
}

From source file:at.ac.tuwien.big.testsuite.impl.task.UnzipTaskImpl.java

@Override
protected File call() throws Exception {
    final File baseDirectory = createTempDirectory();
    Collection<Exception> exceptions = new CopyOnWriteArrayList<>();
    unzip(zipFile, baseDirectory, true, exceptions);
    return baseDirectory;
}

From source file:com.openteach.diamond.network.waverider.session.DefaultSessionManager.java

public DefaultSessionManager(WaveriderConfig config) {
    this.config = config;
    idleSessionList = new CopyOnWriteArrayList<DefaultSession>();
    sessionMap = new ConcurrentHashMap<Long, DefaultSession>();
}