List of usage examples for java.util.concurrent CopyOnWriteArrayList add
public boolean add(E e)
From source file:io.github.minecraftgui.models.network.UserConnection.java
public void addOnGuiCloseListener(OnGuiListener plugin, OnGuiListener.OnGuiClose onGuiClose) { CopyOnWriteArrayList<OnGuiListener.OnGuiClose> onGuiCloses = onGuiCloseListeners.get(plugin); if (onGuiCloses == null) { onGuiCloses = new CopyOnWriteArrayList<>(); onGuiCloseListeners.put(plugin, onGuiCloses); }/*w w w . j a va2 s .c om*/ onGuiCloses.add(onGuiClose); }
From source file:com.l2jfree.gameserver.model.entity.events.TvT.java
private static boolean startEventOk() { if (_joining || !_teleport || _started) return false; if (Config.TVT_EVEN_TEAMS.equals("NO") || Config.TVT_EVEN_TEAMS.equals("BALANCE")) { if (_teamPlayersCount.contains(0)) return false; } else if (Config.TVT_EVEN_TEAMS.equals("SHUFFLE")) { CopyOnWriteArrayList<L2Player> playersShuffleTemp = new CopyOnWriteArrayList<L2Player>(); int loopCount = 0; loopCount = _playersShuffle.size(); for (int i = 0; i < loopCount; i++) { if (_playersShuffle != null) playersShuffleTemp.add(_playersShuffle.get(i)); }//from w ww . j a va 2 s .c o m _playersShuffle = playersShuffleTemp; playersShuffleTemp.clear(); // if (_playersShuffle.size() < (_teams.size()*2)){ // return false; // } } return true; }
From source file:com.adobe.acs.commons.httpcache.engine.impl.HttpCacheEngineImpl.java
/** * Binds cache config. Cache config could come and go at run time. * * @param cacheConfig/*from www. j ava2s . c o m*/ * @param configs */ protected void bindHttpCacheConfig(final HttpCacheConfig cacheConfig, final Map<String, Object> configs) { // Validate cache config object if (!cacheConfig.isValid()) { log.info("Http cache config rejected as the request uri is absent."); return; } // Check if the same object is already there in the map. if (cacheConfigs.contains(cacheConfig)) { log.trace("Http cache config object already exists in the cacheConfigs map and hence ignored."); return; } // Sort cacheConfigs by order final CopyOnWriteArrayList<HttpCacheConfig> tmp = new CopyOnWriteArrayList<HttpCacheConfig>( this.cacheConfigs); tmp.add(cacheConfig); Collections.sort(tmp, new HttpCacheConfigComparator()); this.cacheConfigs = tmp; this.cacheConfigConfigs.put(cacheConfig, configs); log.debug("Total number of cache configs added: {}", cacheConfigs.size()); }
From source file:com.app.server.JarDeployer.java
/** * This method obtains the jar file in the deploy directory. * @param dir/*from w w w .j av a2 s .c o m*/ * @param jarList */ public void getUsersJars(File dir, CopyOnWriteArrayList jarList) { if (dir.isDirectory()) { File[] children = dir.listFiles(); for (int i = 0; i < children.length; i++) { log.info(children[i]); getUsersJars(children[i], jarList); if (children[i].isFile() && children[i].getName().endsWith(".jar")) jarList.add(children[i].getAbsolutePath()); } } }
From source file:org.wso2.carbon.bpel.core.ode.integration.store.ProcessStoreImpl.java
public void onBPELPackageReload(Integer tenantId, String duName, List<ProcessConfigurationImpl> pConfs) { CopyOnWriteArrayList<QName> pids = new CopyOnWriteArrayList<QName>(); for (ProcessConf pConf : pConfs) { pids.add(pConf.getProcessId()); }//w w w . j a v a 2 s. c o m updateProcessAndDUMaps(tenantId, duName, pids, true); Collections.sort(pConfs, BY_DEPLOYEDDATE); for (ProcessConfigurationImpl processConfiguration : pConfs) { try { if (log.isDebugEnabled()) { log.debug("Firing state change event --" + processConfiguration.getState() + "-- for process conf " + processConfiguration.getPackage() + "located at " + processConfiguration.getAbsolutePathForBpelArchive()); } fireStateChange(processConfiguration.getProcessId(), processConfiguration.getState(), duName); } catch (Exception e) { log.error("Error while firing state change event for process " + processConfiguration.getProcessId() + " in deployment unit " + duName + "."); } } }
From source file:com.web.server.JarDeployer.java
/** * This method obtains the jar file in the deploy directory. * @param dir/*from w ww.jav a2s.c o m*/ * @param jarList */ public void getUsersJars(File dir, CopyOnWriteArrayList jarList) { if (dir.isDirectory()) { File[] children = dir.listFiles(); for (int i = 0; i < children.length; i++) { System.out.println(children[i]); getUsersJars(children[i], jarList); if (children[i].isFile() && children[i].getName().endsWith(".jar")) jarList.add(children[i].getAbsolutePath()); } } }
From source file:org.wso2.carbon.bpel.core.ode.integration.store.ProcessStoreImpl.java
public void onBPELPackageDeployment(Integer tenantId, final String duName, final String duLocation, final List<ProcessConfigurationImpl> processConfs) { boolean status = exec(new Callable<Boolean>() { @Override//from www . j av a2s. c o m public Boolean call(ConfStoreConnection conn) { DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName); if (duDao != null) { /* This is for clustering scenario. update/deployment */ return true; } duDao = conn.createDeploymentUnit(duName); duDao.setDeploymentUnitDir(duLocation); for (ProcessConf pConf : processConfs) { try { ProcessConfDAO processConfDao = duDao.createProcess(pConf.getProcessId(), pConf.getType(), pConf.getVersion()); processConfDao.setState(pConf.getState()); for (Map.Entry<QName, Node> prop : pConf.getProcessProperties().entrySet()) { processConfDao.setProperty(prop.getKey(), DOMUtils.domToString(prop.getValue())); } conn.setVersion(pConf.getVersion()); } catch (Exception e) { String errmsg = "Error persisting deployment record for " + pConf.getProcessId() + "; process will not be available after restart!"; log.error(errmsg, e); return false; } } return true; } }); if (status) { CopyOnWriteArrayList<QName> pids = new CopyOnWriteArrayList<QName>(); for (ProcessConf pConf : processConfs) { pids.add(pConf.getProcessId()); } updateProcessAndDUMaps(tenantId, duName, pids, true); for (ProcessConfigurationImpl processConf : processConfs) { fireEvent( new ProcessStoreEvent(ProcessStoreEvent.Type.DEPLOYED, processConf.getProcessId(), duName)); fireStateChange(processConf.getProcessId(), processConf.getState(), duName); } } }
From source file:Ternary.java
public void shiftLeft(int num) { CopyOnWriteArrayList<Trit> newTrits = new CopyOnWriteArrayList<Trit>(); for (int i = 0; i < num; i++) newTrits.add(Trit.NEUTRAL); newTrits.addAll(trits);/*from w w w.j av a2 s . c o m*/ trits = newTrits; }
From source file:com.app.server.JarDeployer.java
/** * This method obtains the class name for each of the executor services * @param jarFile/*from w w w .j a v a 2 s . c o m*/ * @param classList * @throws FileSystemException */ public void getChildren(FileObject jarFile, CopyOnWriteArrayList classList) throws FileSystemException { if (jarFile.getType() == FileType.FILE) return; FileObject[] children = jarFile.getChildren(); //log.info( "Children of " + jarFile.getName().getURI() ); if (children == null) return; for (int i = 0; i < children.length; i++) { //log.info(children[i].+" "+ children[i].getName().getBaseName() ); if (children[i].getType() == FileType.FILE && children[i].getName().getBaseName().endsWith(".class")) classList.add(children[i].toString().substring(children[i].toString().indexOf('!') + 2)); getChildren(children[i], classList); children[i].close(); //fsManager.closeFileSystem(children[i].getFileSystem()); } }
From source file:com.web.server.JarDeployer.java
/** * This method obtains the class name for each of the executor services * @param jarFile//from w ww.ja v a 2 s. co m * @param classList * @throws FileSystemException */ public void getChildren(FileObject jarFile, CopyOnWriteArrayList classList) throws FileSystemException { if (jarFile.getType() == FileType.FILE) return; FileObject[] children = jarFile.getChildren(); //System.out.println( "Children of " + jarFile.getName().getURI() ); if (children == null) return; for (int i = 0; i < children.length; i++) { //System.out.println(children[i].+" "+ children[i].getName().getBaseName() ); if (children[i].getType() == FileType.FILE && children[i].getName().getBaseName().endsWith(".class")) classList.add(children[i].toString().substring(children[i].toString().indexOf('!') + 2)); getChildren(children[i], classList); children[i].close(); //fsManager.closeFileSystem(children[i].getFileSystem()); } }