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:mamo.vanillaVotifier.VotifierServer.java

public VotifierServer(@NotNull VanillaVotifier votifier) {
    this.votifier = votifier;
    listeners = new CopyOnWriteArrayList<Listener>();
    listeners.add(new VotifierServerListener(votifier));
}

From source file:Pool.java

private Pool(List<T> stocks) {
    if (stocks == null || stocks.size() == 0) {
        throw new IllegalArgumentException("stocks: " + stocks);
    }/*from   w  w  w .ja v  a  2 s.  c o  m*/
    this.stock = new CopyOnWriteArrayList<T>();
    this.havings = new CopyOnWriteArraySet<T>();
    for (T stockItem : stocks) {
        stock.add(stockItem);
        havings.add(stockItem);
    }
}

From source file:infowall.domain.service.DashboardImporter.java

@Autowired
public DashboardImporter(ConfigRoot configRoot, DashboardRepository dashboardRepository) {

    this.configRoot = configRoot;
    this.dashboardRepository = dashboardRepository;
    this.listeners = new CopyOnWriteArrayList<DashboardImportListener>();
    mapper = new ObjectMapper();
}

From source file:com.web.server.XMLDeploymentScanner.java

public XMLDeploymentScanner(String scanDirectory, String userLibDir) {
    super(scanDirectory);
    this.userLibDir = userLibDir;
    File userLibJars = new File(userLibDir);
    CopyOnWriteArrayList<String> jarList = new CopyOnWriteArrayList();
    getUsersJars(userLibJars, jarList);//from  w w  w .  ja v a  2 s. c  o m
    URLClassLoader loader = (URLClassLoader) ClassLoader.getSystemClassLoader();
    userLibJarLoader = new WebClassLoader(loader.getURLs());
    for (String jarFilePath : jarList) {
        try {
            userLibJarLoader.addURL(new URL("file:/" + jarFilePath.replace("\\", "/")));
        } catch (MalformedURLException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }
    }

    DigesterLoader xmlDigesterLoader = DigesterLoader.newLoader(new FromXmlRulesModule() {

        protected void loadRules() {
            // TODO Auto-generated method stub
            try {
                loadXMLRules(new InputSource(new FileInputStream("./config/datasource-rules.xml")));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    });
    xmlDigester = xmlDigesterLoader.newDigester();
    try {
        ic = new InitialContext();
        ic.createSubcontext("java:");
    } catch (NamingException e1) {
        // TODO Auto-generated catch block
    }

    File[] xmlFiles = new File(scanDirectory).listFiles();

    if (xmlFiles != null && xmlFiles.length > 0) {
        for (File xmlFile : xmlFiles) {
            if (xmlFile.getName().toLowerCase().endsWith("datasource.xml")) {
                installDataSource(xmlFile);
            }
        }
    }

    // TODO Auto-generated constructor stub
}

From source file:org.mqnaas.core.impl.slicing.UnitManagment.java

@Override
public void deactivate() {
    log.info("Removing UnitManagment capability for resource " + resource.getId());
    units = new CopyOnWriteArrayList<UnitResource>();
    log.info("Removed UnitManagment capability for resource " + resource.getId());
}

From source file:org.amplafi.flow.impl.FlowDefinitionsManagerImpl.java

public FlowDefinitionsManagerImpl() {
    flowDefinitions = new ConcurrentHashMap<String, FlowImplementor>();
    flowsFilenames = new CopyOnWriteArrayList<String>();
    factoryFlowPropertyDefinitionProviders = new CopyOnWriteArrayList<FlowPropertyDefinitionProvider>();
    this.addFactoryFlowPropertyDefinitionProvider(FactoryFlowPropertyDefinitionProvider.FLOW_INSTANCE);
    this.addFactoryFlowPropertyDefinitionProvider(FactoryFlowPropertyDefinitionProvider.FLOW_ACTIVITY_INSTANCE);
}

From source file:org.openanzo.combus.realtime.TrackerManager.java

/**
 * Create a new TrackerManager/*from   ww w  .j  a  v  a 2s .  c om*/
 */
public TrackerManager() {
    trackers = new CopyOnWriteArrayList<T>();
    subjectMap = new CopyOnWriteMultiHashMap<Resource, T>();
    propMap = new CopyOnWriteMultiHashMap<URI, T>();
    objMap = new CopyOnWriteMultiHashMap<Value, T>();
    namedGraphMap = new CopyOnWriteMultiHashMap<URI, T>();
    allWildTrackers = new CopyOnWriteArrayList<T>();
}

From source file:com.registryKit.program.programDAO.java

/**
 * The 'getProgramsByAdministratory' function will return a list of programs associated to the program admin
 * logging in.//from   w w w  .  j a  v  a  2s  .c  o  m
 * 
 * @param userId    The id of the program admin.
 * @return
 * @throws Exception 
 */
public List<program> getProgramsByAdminisrator(Integer userId) throws Exception {

    Query query = sessionFactory.getCurrentSession()
            .createQuery("from programAdmin where systemUserId = :systemUserId");
    query.setParameter("systemUserId", userId);

    List<programAdmin> adminProgramList = query.list();
    List<Integer> programIds = null;

    if (!adminProgramList.isEmpty()) {
        programIds = new CopyOnWriteArrayList<Integer>();

        for (programAdmin admin : adminProgramList) {
            programIds.add(admin.getProgramId());
        }
    }

    List<program> programs = null;

    if (!programIds.isEmpty()) {

        Criteria criteria = sessionFactory.getCurrentSession().createCriteria(program.class);
        criteria.add(Restrictions.in("id", programIds));

        programs = criteria.list();

    }

    return programs;

}

From source file:org.codehaus.wadi.group.impl.AbstractDispatcher.java

public AbstractDispatcher(ThreadPool executor) {
    _executor = executor;/*from  w w  w.j a v  a2s.co  m*/

    interceptors = new CopyOnWriteArrayList<EnvelopeInterceptor>();
    inboundEnvelopeDispatcher = new BasicEnvelopeDispatcherManager(this, _executor);
    context = new BasicDispatcherContext();
}

From source file:com.netflix.config.DynamicURLConfigurationTestWithFileURL.java

@Test
public void testFileURLWithPropertiesUpdatedDynamically() throws IOException, InterruptedException {

    File file = File.createTempFile("DynamicURLConfigurationTestWithFileURL",
            "testFileURLWithPropertiesUpdatedDynamically");
    populateFile(file, "test.host=12312,123213", "test.host1=13212");

    AbstractConfiguration.setDefaultListDelimiter(',');
    DynamicURLConfiguration config = new DynamicURLConfiguration(0, 500, false, file.toURI().toString());
    Thread.sleep(1000);//from   ww w.  ja  va 2  s . c  o m
    Assert.assertEquals(13212, config.getInt("test.host1"));
    Thread.sleep(1000);
    populateFile(file, "test.host=12312,123213", "test.host1=13212");
    populateFile(file, "test.host=12312,123213", "test.host1=13212");
    CopyOnWriteArrayList writeList = new CopyOnWriteArrayList();
    writeList.add("12312");
    writeList.add("123213");
    config.setProperty("sample.domain", "google,yahoo");
    Assert.assertEquals(writeList, config.getProperty("test.host"));

}