Java Code Examples for java.util.concurrent.CopyOnWriteArrayList
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project hudson-test-harness, under directory /src/test/java/hudson/model/queue/.
Source file: LoadPredictorTest.java

private Computer createMockComputer(int nExecutors) throws Exception { Node n=mock(Node.class); Computer c=mock(Computer.class); when(c.getNode()).thenReturn(n); List executors=new CopyOnWriteArrayList(); for (int i=0; i < nExecutors; i++) { Executor e=mock(Executor.class); when(e.isIdle()).thenReturn(true); when(e.getOwner()).thenReturn(c); executors.add(e); } Field f=Computer.class.getDeclaredField("executors"); f.setAccessible(true); f.set(c,executors); when(c.getExecutors()).thenReturn(executors); return c; }
Example 2
From project social, under directory /component/webui/src/main/java/org/exoplatform/social/webui/space/.
Source file: UISpaceUserSearch.java

/** * search users based on keyword, filter and groupId provided * @param keyword * @param filter * @param groupId * @return user list * @throws Exception */ @SuppressWarnings({"unchecked","deprecation"}) protected List<User> search(String keyword,String filter,String groupId) throws Exception { OrganizationService service=getApplicationComponent(OrganizationService.class); Query q=new Query(); if (keyword != null && keyword.trim().length() != 0) { if (keyword.indexOf("*") < 0) { if (keyword.charAt(0) != '*') keyword="*" + keyword; if (keyword.charAt(keyword.length() - 1) != '*') keyword+="*"; } keyword=keyword.replace('?','_'); if (USER_NAME.equals(filter)) { q.setUserName(keyword); } if (LAST_NAME.equals(filter)) { q.setLastName(keyword); } if (FIRST_NAME.equals(filter)) { q.setFirstName(keyword); } if (EMAIL.equals(filter)) { q.setEmail(keyword); } } List results=new CopyOnWriteArrayList(); results.addAll(service.getUserHandler().findUsers(q).getAll()); MembershipHandler memberShipHandler=service.getMembershipHandler(); if (groupId != null && groupId.trim().length() != 0) { for ( Object user : results) { if (memberShipHandler.findMembershipsByUserAndGroup(((User)user).getUserName(),groupId).size() == 0) { results.remove(user); } } } return results; }
Example 3
From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/view/presenter/.
Source file: MeasurementPresenter.java

private CopyOnWriteArrayList<Measurement> prepareFullView(){ if (fullView != null) return fullView; Stopwatch stopwatch=new Stopwatch().start(); String visibleSensor=sensorManager.getVisibleSensor().getSensorName(); MeasurementStream stream=sessionManager.getMeasurementStream(visibleSensor); Iterable<Measurement> measurements; if (stream == null) { measurements=newArrayList(); } else { measurements=stream.getMeasurements(); } ImmutableListMultimap<Long,Measurement> forAveraging=index(measurements,new Function<Measurement,Long>(){ @Override public Long apply( Measurement measurement){ return measurement.getSecond() / settingsHelper.getAveragingTime(); } } ); Constants.logGraphPerformance("prepareFullView step 1 took " + stopwatch.elapsedMillis()); ArrayList<Long> times=newArrayList(forAveraging.keySet()); sort(times); Constants.logGraphPerformance("prepareFullView step 2 took " + stopwatch.elapsedMillis()); List<Measurement> timeboxedMeasurements=newLinkedList(); for ( Long time : times) { ImmutableList<Measurement> chunk=forAveraging.get(time); timeboxedMeasurements.add(average(chunk)); } Constants.logGraphPerformance("prepareFullView step 3 took " + stopwatch.elapsedMillis()); CopyOnWriteArrayList<Measurement> result=Lists.newCopyOnWriteArrayList(timeboxedMeasurements); Constants.logGraphPerformance("prepareFullView step n took " + stopwatch.elapsedMillis()); fullView=result; return result; }
Example 4
From project android-thaiime, under directory /latinime/src/com/sugree/inputmethod/latin/.
Source file: DictionaryCollection.java

public DictionaryCollection(Dictionary... dictionaries){ if (null == dictionaries) { mDictionaries=new CopyOnWriteArrayList<Dictionary>(); } else { mDictionaries=new CopyOnWriteArrayList<Dictionary>(dictionaries); mDictionaries.removeAll(Collections.singleton(null)); } }
Example 5
From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/latin/.
Source file: DictionaryCollection.java

public DictionaryCollection(Dictionary... dictionaries){ if (null == dictionaries) { mDictionaries=new CopyOnWriteArrayList<Dictionary>(); } else { mDictionaries=new CopyOnWriteArrayList<Dictionary>(dictionaries); mDictionaries.removeAll(Collections.singleton(null)); } }
Example 6
From project AntiCheat, under directory /src/main/java/net/h31ix/anticheat/manage/.
Source file: AnticheatManager.java

public List<String> getLastLogs(){ List<String> log=new CopyOnWriteArrayList<String>(); if (logs.size() < 30) { return logs; } for (int i=logs.size() - 1; i >= 0; i--) { log.add(logs.get(i)); } logs.clear(); return log; }
Example 7
From project archaius, under directory /archaius-core/src/main/java/com/netflix/config/.
Source file: ConcurrentMapConfiguration.java

protected void addPropertyDirect(String key,Object value){ ReentrantLock lock=locks[Math.abs(key.hashCode()) % NUM_LOCKS]; lock.lock(); try { Object previousValue=map.putIfAbsent(key,value); if (previousValue == null) { return; } if (previousValue instanceof List) { ((List)previousValue).add(value); } else { List<Object> list=new CopyOnWriteArrayList<Object>(); list.add(previousValue); list.add(value); map.put(key,list); } } finally { lock.unlock(); } }
Example 8
From project Arecibo, under directory /util/src/main/java/com/ning/arecibo/util/lifecycle/.
Source file: AbstractLifecycle.java

/** * Build a new Lifecycle base. * @param lifecycler The lifecycler to provide the available events and the sequence in which they should be processed. * @param verbose If true, then report each stage at info logging level. */ protected AbstractLifecycle(final Lifecycler lifecycler,boolean verbose){ this.verbose=verbose; this.lifecycler=lifecycler; for ( LifecycleEvent lifecycleEvent : lifecycler.getEvents()) { listeners.put(lifecycleEvent,new CopyOnWriteArrayList<LifecycleListener>()); addListener(lifecycleEvent,lifecycler); } }
Example 9
From project avro, under directory /lang/java/ipc/src/main/java/org/apache/avro/ipc/.
Source file: Responder.java

protected Responder(Protocol local){ this.local=local; this.localHash=new MD5(); localHash.bytes(local.getMD5()); protocols.put(localHash,local); this.rpcMetaPlugins=new CopyOnWriteArrayList<RPCPlugin>(); }
Example 10
public static FileCollection scan(File base){ CopyOnWriteArrayList<FileEntry> entries=new CopyOnWriteArrayList<FileEntry>(); CopyOnWriteArrayList<String> errors=new CopyOnWriteArrayList<String>(); try { ExecutorService threadPool=Executors.newFixedThreadPool(4); constructEntries(base,null,threadPool,entries,errors); threadPool.shutdown(); for (int i=0; !threadPool.awaitTermination(1,TimeUnit.HOURS); i++) { log.warning("" + i + "hours passed by."); if (i > 24) { errors.add("waiting for too long:" + threadPool.shutdownNow()); break; } } } catch ( Exception e) { throw new BeeException(e).addPayload(errors.toArray()); } if (errors.size() > 0) { throw new BeeException("has errors:").addPayload(errors.toArray()); } FileCollection fileCollection=new FileCollection(); FileEntry[] array=entries.toArray(new FileEntry[entries.size()]); Arrays.sort(array); fileCollection.entries=array; return fileCollection; }
Example 11
From project bundlemaker, under directory /main/org.bundlemaker.core/src/org/bundlemaker/core/internal/analysis/.
Source file: AdapterRoot2IArtifact.java

/** * <p> Creates a new instance of type {@link AdapterModule2IArtifact}. </p> * @param modularizedSystem * @param artifactCache */ public AdapterRoot2IArtifact(IModifiableModularizedSystem modularizedSystem,IArtifactModelConfiguration modelConfiguration,ArtifactCache artifactCache){ super(name(modularizedSystem)); Assert.isNotNull(modelConfiguration); _modularizedSystem=modularizedSystem; _modularizedSystem.addModularizedSystemChangedListener(this); _artifactCache=artifactCache; _artifactModelConfiguration=modelConfiguration; _groupAndModuleContainerDelegate=new GroupAndModuleContainerDelegate(this); _artifactModelChangedListeners=new CopyOnWriteArrayList<IArtifactModelModifiedListener>(); }
Example 12
From project c2dm4j, under directory /src/main/java/org/whispercomm/c2dm4j/async/handler/.
Source file: AsyncHandlersImpl.java

/** * Constructs a new intance. */ public AsyncHandlersImpl(){ responseHandlers=CopyOnWriteArrayListMultimap.create(); throwableHandlers=CopyOnWriteArrayListMultimap.create(); enqueueFilters=new CopyOnWriteArrayList<MessageFilter>(); dequeueFilters=new CopyOnWriteArrayList<MessageFilter>(); }
Example 13
From project chukwa, under directory /src/main/java/org/apache/hadoop/chukwa/datacollection/adaptor/.
Source file: FileAdaptor.java

public FileAdaptorTailer(){ if (conf == null) { ChukwaAgent agent=ChukwaAgent.getAgent(); if (agent != null) { conf=agent.getConfiguration(); if (conf != null) { SAMPLE_PERIOD_MS=conf.getInt("chukwaAgent.adaptor.context.switch.time",DEFAULT_SAMPLE_PERIOD_MS); } } } adaptors=new CopyOnWriteArrayList<FileAdaptor>(); setDaemon(true); start(); }
Example 14
From project cloudhopper-commons-util, under directory /src/main/java/com/cloudhopper/commons/util/windowing/.
Source file: Window.java

/** * Creates a new window with the specified max window size. This constructor enables automatic recurring tasks to be executed (such as expiration of requests). * @param size The maximum number of requests permitted tobe outstanding (unacknowledged) at a given time. Must be > 0. * @param executor The scheduled executor service to executerecurring tasks (such as expiration of requests). * @param monitorInterval The number of milliseconds between executions ofmonitoring tasks. * @param listener A listener to send window events to * @param monitorThreadName The thread name we'll change to when a monitorrun is executed. Null if no name change is required. */ public Window(int size,ScheduledExecutorService executor,long monitorInterval,WindowListener<K,R,P> listener,String monitorThreadName){ if (size <= 0) { throw new IllegalArgumentException("size must be > 0"); } this.maxSize=size; this.futures=new ConcurrentHashMap<K,DefaultWindowFuture<K,R,P>>(size * 2); this.lock=new ReentrantLock(); this.completedCondition=this.lock.newCondition(); this.pendingOffers=new AtomicInteger(0); this.pendingOffersAborted=new AtomicBoolean(false); this.executor=executor; this.monitorInterval=monitorInterval; this.listeners=new CopyOnWriteArrayList<UnwrappedWeakReference<WindowListener<K,R,P>>>(); if (listener != null) { this.listeners.add(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener)); } if (this.executor != null) { this.monitor=new WindowMonitor(this,monitorThreadName); this.monitorHandle=this.executor.scheduleWithFixedDelay(this.monitor,this.monitorInterval,this.monitorInterval,TimeUnit.MILLISECONDS); } else { this.monitor=null; this.monitorHandle=null; } }
Example 15
/** * TODO This could be made to look a lot better. */ public void drawPopular(){ CopyOnWriteArrayList<FileNode> al=new CopyOnWriteArrayList<FileNode>(); noStroke(); textFont(font); textAlign(RIGHT,TOP); fill(fontColor,200); text("Popular Nodes (touches):",width - 120,0); for ( FileNode fn : nodes.values()) { if (fn.qualifies()) { if (al.size() > 0) { int j=0; for (; j < al.size(); j++) { if (fn.compareTo(al.get(j)) <= 0) { continue; } else { break; } } al.add(j,fn); } else { al.add(fn); } } } int i=1; ListIterator<FileNode> it=al.listIterator(); while (it.hasNext()) { FileNode n=it.next(); if (i <= 10) { text(n.name + " (" + n.touches+ ")",width - 100,10 * i++); } else if (i > 10) { break; } } }
Example 16
/** * TODO This could be made to look a lot better. */ public void drawPopular(){ CopyOnWriteArrayList<FileNode> al=new CopyOnWriteArrayList<FileNode>(); noStroke(); textFont(font); textAlign(RIGHT,TOP); fill(fontColor,200); text("Popular Nodes (touches):",width - 120,0); for ( FileNode fn : nodes.values()) { if (fn.qualifies()) { if (al.size() > 0) { int j=0; for (; j < al.size(); j++) { if (fn.compareTo(al.get(j)) <= 0) { continue; } else { break; } } al.add(j,fn); } else { al.add(fn); } } } int i=1; ListIterator<FileNode> it=al.listIterator(); while (it.hasNext()) { FileNode n=it.next(); if (i <= 10) { text(n.name + " (" + n.touches+ ")",width - 100,10 * i++); } else if (i > 10) { break; } } }
Example 17
From project cometd, under directory /cometd-demo/src/main/java/org/webtide/demo/auction/dao/.
Source file: AuctionDao.java

public void saveAuctionBid(Bid bid){ List<Bid> bids=_bids.get(bid.getItemId()); if (bids == null) { bids=new CopyOnWriteArrayList<Bid>(); List<Bid> tmp=_bids.putIfAbsent(bid.getItemId(),bids); bids=tmp == null ? bids : tmp; } bids.add(bid.clone()); }
Example 18
From project commons-j, under directory /src/main/java/nerds/antelax/commons/net/pubsub/.
Source file: ClientMessageHandler.java

void subscribe(final String topic,final PubSubClient.MessageCallback... callbacks){ logger.trace("Subscribing {} callbacks to topic[{}]",callbacks.length,topic); lock.lock(); try { final Collection<PubSubClient.MessageCallback> group; if (subscribers.containsKey(topic)) { group=subscribers.get(topic); logger.trace("Found {} existing subscribers for topic[{}]: ",group.size(),topic); } else { logger.trace("Creating new subscriber group for topic[{}]",topic); group=new CopyOnWriteArrayList<PubSubClient.MessageCallback>(); subscribers.put(topic,group); final Channel channel=activeChannel.get(); if (channel != null) { logger.trace("Writing new subscriber group for topic[{}]",topic); channel.write(new SubscriptionMessage(true,topic)); } } for ( final MessageCallback callback : callbacks) group.add(callback); } finally { lock.unlock(); } }
Example 19
From project components-ness-lifecycle, under directory /src/main/java/com/nesscomputing/lifecycle/.
Source file: AbstractLifecycle.java

/** * Builds a new Lifecycle. * @param lifecycleDriver The lifecycleDriver to provide the available stages and the sequence in which they should be processed. * @param verbose If true, then report each stage at info logging level. */ protected AbstractLifecycle(@Nonnull final LifecycleDriver lifecycleDriver,final boolean verbose){ this.verbose=verbose; this.lifecycleDriver=lifecycleDriver; for ( LifecycleStage lifecycleStage : lifecycleDriver.getStages()) { listeners.put(lifecycleStage,new CopyOnWriteArrayList<LifecycleListener>()); addListener(lifecycleStage,lifecycleDriver); } }
Example 20
/** * Wraps a HookExtension to allow easier use by plugins. */ public static ExtensionListener wrapListener(final Plugin p,final ExtensionListener r){ return new ExtensionListener(){ private PluginLoader l=etc.getLoader(); private long lastCheck=0; public void onSignAdded( int x, int y, int z){ if (etc.getServer().getTime() != lastCheck) { if (l.getPlugin(p.getName()) != p) { CopyOnWriteArrayList<ExtensionListener> taskList=LISTENERS; while (taskList.contains(this)) taskList.remove(this); return; } lastCheck=etc.getServer().getTime(); } if (p.isEnabled()) r.onSignAdded(x,y,z); } } ; }
Example 21
From project Dempsy, under directory /lib-dempsyimpl/src/main/java/com/nokia/dempsy/messagetransport/passthrough/.
Source file: PassthroughTransport.java

@Override public Receiver createInbound() throws MessageTransportException { return new Receiver(){ List<Listener> listeners=new CopyOnWriteArrayList<Listener>(); @Override public void setStatsCollector( StatsCollector statsCollector){ } Sender sender=new Sender(){ @Override public void send( byte[] messageBytes) throws MessageTransportException { for ( Listener listener : listeners) listener.onMessage(messageBytes,failFast); } } ; PassthroughDestination destination=new PassthroughDestination(sender); @Override public void setListener( Listener listener) throws MessageTransportException { listeners.add(listener); } @Override public Destination getDestination() throws MessageTransportException { return destination; } @Override public void stop(){ } } ; }
Example 22
From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.content.core/src/org/springsource/ide/eclipse/commons/content/core/.
Source file: ContentManager.java

public ContentManager(){ itemById=new HashMap<String,ContentItem>(); itemsByKind=new HashMap<String,Set<ContentItem>>(); listeners=new CopyOnWriteArrayList<PropertyChangeListener>(); isDirty=true; }
Example 23
From project edg-examples, under directory /chunchun/src/main/java/com/jboss/datagrid/chunchun/model/.
Source file: User.java

public User(String username,String name,String surname,String password,String whoami,BufferedImage avatar){ this.username=username; this.name=name; this.password=password; this.whoami=whoami; this.posts=new CopyOnWriteArrayList<PostKey>(); this.watchers=new CopyOnWriteArrayList<String>(); this.watching=new CopyOnWriteArrayList<String>(); this.avatar=avatar; }
Example 24
@SuppressWarnings("unchecked") private L1World(){ _allPlayers=new ConcurrentHashMap<String,L1PcInstance>(); _allPets=new ConcurrentHashMap<Integer,L1PetInstance>(); _allSummons=new ConcurrentHashMap<Integer,L1SummonInstance>(); _allObjects=new ConcurrentHashMap<Integer,L1Object>(); _visibleObjects=new ConcurrentHashMap[MAX_MAP_ID + 1]; _allWars=new CopyOnWriteArrayList<L1War>(); _allClans=new ConcurrentHashMap<String,L1Clan>(); for (int i=0; i <= MAX_MAP_ID; i++) { _visibleObjects[i]=new ConcurrentHashMap<Integer,L1Object>(); } }
Example 25
From project floodlight, under directory /src/test/java/net/floodlightcontroller/core/test/.
Source file: MockFloodlightProvider.java

/** */ public MockFloodlightProvider(){ listeners=new ConcurrentHashMap<OFType,ListenerDispatcher<OFType,IOFMessageListener>>(); switches=new ConcurrentHashMap<Long,IOFSwitch>(); switchListeners=new CopyOnWriteArrayList<IOFSwitchListener>(); haListeners=new CopyOnWriteArrayList<IHAListener>(); factory=new BasicFactory(); }
Example 26
From project galaxy, under directory /src/co/paralleluniverse/galaxy/jgroups/.
Source file: ReplicatedTree.java

public void addListener(ReplicatedTreeListener listener){ synchronized (this) { if (listeners == null) listeners=new CopyOnWriteArrayList<ReplicatedTreeListener>(); } if (!listeners.contains(listener)) listeners.add(listener); }
Example 27
From project gatein-naming, under directory /src/main/java/org/gatein/naming/.
Source file: NamingEventCoordinator.java

/** * Add a listener to the coordinator with a given target name and event scope. This information is used when an event is fired to determine whether or not to fire this listener. * @param target The target name to lister * @param scope The event scope * @param namingListener The listener */ synchronized void addListener(final String target,final int scope,final NamingListener namingListener){ final TargetScope targetScope=new TargetScope(target,scope); ListenerHolder holder=holdersByListener.get(namingListener); if (holder == null) { holder=new ListenerHolder(namingListener,targetScope); final Map<NamingListener,ListenerHolder> byListenerCopy=new FastCopyHashMap<NamingListener,ListenerHolder>(holdersByListener); byListenerCopy.put(namingListener,holder); holdersByListener=byListenerCopy; } else { holder.addTarget(targetScope); } List<ListenerHolder> holdersForTarget=holdersByTarget.get(targetScope); if (holdersForTarget == null) { holdersForTarget=new CopyOnWriteArrayList<ListenerHolder>(); final Map<TargetScope,List<ListenerHolder>> byTargetCopy=new FastCopyHashMap<TargetScope,List<ListenerHolder>>(holdersByTarget); byTargetCopy.put(targetScope,holdersForTarget); holdersByTarget=byTargetCopy; } holdersForTarget.add(holder); }
Example 28
From project gecko, under directory /src/main/java/com/taobao/gecko/service/impl/.
Source file: BaseRemotingController.java

public final synchronized void start() throws NotifyRemotingException { if (this.started) { return; } this.started=true; final StringBuffer info=new StringBuffer("????RemotingController...\n"); info.append("????\n").append(this.config.toString()); log.info(info.toString()); if (this.remotingContext == null) { this.remotingContext=new DefaultRemotingContext(this.config,this.config.getWireFormatType().newCommandFactory()); } else { this.remotingContext.dispose(); final ConcurrentHashMap<Class<? extends RequestCommand>,RequestProcessor<? extends RequestCommand>> processorMap=this.remotingContext.processorMap; final CopyOnWriteArrayList<ConnectionLifeCycleListener> connectionLifeCycleListenerList=this.remotingContext.connectionLifeCycleListenerList; this.remotingContext=new DefaultRemotingContext(this.remotingContext.getConfig(),this.config.getWireFormatType().newCommandFactory()); this.remotingContext.processorMap.putAll(processorMap); this.remotingContext.connectionLifeCycleListenerList.addAll(connectionLifeCycleListenerList); } final Configuration conf=this.getConfigurationFromConfig(this.config); this.controller=this.initController(conf); this.controller.setCodecFactory(this.config.getWireFormatType().newCodecFactory()); this.controller.setHandler(new GeckoHandler(this)); this.controller.setSoLinger(this.config.isSoLinger(),this.config.getLinger()); this.controller.setSocketOptions(this.getSocketOptionsFromConfig(this.config)); this.controller.setSelectorPoolSize(this.config.getSelectorPoolSize()); this.scanAllConnectionExecutor=Executors.newSingleThreadScheduledExecutor(new WorkerThreadFactory("notify-remoting-ScanAllConnection")); if (this.config.getScanAllConnectionInterval() > 0) { this.scanAllConnectionExecutor.scheduleAtFixedRate(new ScanAllConnectionRunner(this,this.getScanTasks()),1,this.config.getScanAllConnectionInterval(),TimeUnit.SECONDS); } this.doStart(); this.addShutdownHook(); }
Example 29
From project geronimo-xbean, under directory /xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/.
Source file: DelegatingBundle.java

public DelegatingBundle(Collection<Bundle> bundles){ if (bundles.isEmpty()) { throw new IllegalArgumentException("At least one bundle is required"); } this.bundles=new CopyOnWriteArrayList<Bundle>(bundles); Iterator<Bundle> iterator=bundles.iterator(); this.bundle=iterator.next(); this.bundleContext=new DelegatingBundleContext(this,bundle.getBundleContext()); this.hasDynamicImports=hasDynamicImports(iterator); this.resourceCache=initResourceCache(); this.packageCacheEnabled=initPackageCacheEnabled(); }
Example 30
From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/engine/.
Source file: ChatGroup.java

public ChatGroup(Address address,String name,Collection<Contact> members,ChatGroupManager manager){ mAddress=address; mName=name; mManager=manager; mMembers=new Vector<Contact>(); if (members != null) { mMembers.addAll(members); } mMemberListeners=new CopyOnWriteArrayList<GroupMemberListener>(); }
Example 31
From project greenDAO, under directory /DaoTest/src/de/greenrobot/daotest/async/.
Source file: AbstractAsyncTest.java

@Override protected void setUp(){ super.setUp(); asyncSession=daoSession.startAsyncSession(); asyncSession.setListener(this); completedOperations=new CopyOnWriteArrayList<AsyncOperation>(); }
Example 32
From project grid-goggles, under directory /Dependent Libraries/controlP5/src/controlP5/.
Source file: ControlWindow.java

private void handleMouseWheelMoved(){ if (mouseWheelMoved != 0) { CopyOnWriteArrayList<ControllerInterface> mouselist=new CopyOnWriteArrayList<ControllerInterface>(mouseoverlist); for ( ControllerInterface c : mouselist) { if (c.isVisible()) { if (c instanceof Slider) { ((Slider)c).scrolled(mouseWheelMoved); } else if (c instanceof Knob) { ((Knob)c).scrolled(mouseWheelMoved); } else if (c instanceof Numberbox) { ((Numberbox)c).scrolled(mouseWheelMoved); } else if (c instanceof ListBox) { ((ListBox)c).scrolled(mouseWheelMoved); } else if (c instanceof Textarea) { ((Textarea)c).scrolled(mouseWheelMoved); } break; } } } mouseWheelMoved=0; }
Example 33
public HarleyData(){ mDashboardListeners=new CopyOnWriteArrayList<HarleyDataDashboardListener>(); mDiagnosticsListeners=new CopyOnWriteArrayList<HarleyDataDiagnosticsListener>(); mRawListeners=new CopyOnWriteArrayList<HarleyDataRawListener>(); mHistoricDTC=new CopyOnWriteArrayList<String>(); mCurrentDTC=new CopyOnWriteArrayList<String>(); }
Example 34
From project hazelcast-cluster-monitor, under directory /src/test/java/com/hazelcast/monitor/server/.
Source file: HazelcastServiceImplTest.java

@Test public void testRegisterMapStatisticsEvent() throws Exception { final SessionObject sessionObject=mock(SessionObject.class); HazelcastServiceImpl hazelcastService=new HazelcastServiceImpl(){ @Override public SessionObject getSessionObject(){ return sessionObject; } } ; HazelcastClient hazelcastClient=mock(HazelcastClient.class); ChangeEventGeneratorFactory changeEventGeneratorFactory=mock(ChangeEventGeneratorFactory.class); ConcurrentHashMap<Integer,HazelcastClient> hazelcastClientMap=new ConcurrentHashMap<Integer,HazelcastClient>(); hazelcastClientMap.put(0,hazelcastClient); List<ChangeEventGenerator> eventGenerators=new CopyOnWriteArrayList<ChangeEventGenerator>(); hazelcastService.changeEventGeneratorFactory=changeEventGeneratorFactory; when(sessionObject.getHazelcastClientMap()).thenReturn(hazelcastClientMap); when(sessionObject.getEventGenerators()).thenReturn(eventGenerators); MapStatisticsGenerator mapStatisticsGenerator=mock(MapStatisticsGenerator.class); MapStatistics mapStatistics=mock(MapStatistics.class); when(mapStatisticsGenerator.generateEvent()).thenReturn(mapStatistics); when(changeEventGeneratorFactory.createEventGenerator(ChangeEventType.MAP_STATISTICS,0,"myMap",hazelcastClient)).thenReturn(mapStatisticsGenerator); ChangeEvent changeEvent=hazelcastService.registerEvent(ChangeEventType.MAP_STATISTICS,0,"myMap"); assertEquals(mapStatistics,changeEvent); assertTrue(eventGenerators.contains(mapStatisticsGenerator)); }
Example 35
From project HiTune_1, under directory /chukwa-hitune-dist/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/.
Source file: FileAdaptor.java

public FileAdaptorTailer(){ if (conf == null) { ChukwaAgent agent=ChukwaAgent.getAgent(); if (agent != null) { conf=agent.getConfiguration(); if (conf != null) { SAMPLE_PERIOD_MS=conf.getInt("chukwaAgent.adaptor.context.switch.time",DEFAULT_SAMPLE_PERIOD_MS); } } } adaptors=new CopyOnWriteArrayList<FileAdaptor>(); setDaemon(true); start(); }
Example 36
From project ICS_LatinIME_QHD, under directory /java/src/com/android/inputmethod/latin/.
Source file: DictionaryCollection.java

public DictionaryCollection(Dictionary... dictionaries){ if (null == dictionaries) { mDictionaries=new CopyOnWriteArrayList<Dictionary>(); } else { mDictionaries=new CopyOnWriteArrayList<Dictionary>(dictionaries); mDictionaries.removeAll(Collections.singleton(null)); } }
Example 37
/** * Adds a custom search path for a library * @param libraryName the name of the library to search for * @param path the path to search for the library in */ public static synchronized final void addLibraryPath(String libraryName,File path){ List<String> customPaths=customSearchPaths.get(libraryName); if (customPaths == null) { customPaths=new CopyOnWriteArrayList<String>(); customSearchPaths.put(libraryName,customPaths); } customPaths.add(path.getAbsolutePath()); }
Example 38
From project jboss-jsf-api_spec, under directory /src/main/java/javax/faces/component/.
Source file: UIViewRoot.java

/** * <p class="changed_added_2_0">Install the listener instance referenced by argument <code>listener</code> into the <code>UIViewRoot</code> as a listener for events of type <code>systemEventClass</code>.</p> <p>Note that installed listeners are not maintained as part of the <code>UIViewRoot</code>'s state.</p> * @param systemEvent the <code>Class</code> of event for which<code>listener</code> must be fired. * @param listener the implementation of {@link javax.faces.event.SystemEventListener} whose {@link javax.faces.event.SystemEventListener#processEvent} method mustbe called when events of type <code>systemEventClass</code> are fired. * @throws <code>NullPointerException</code> if <code>systemEventClass</code>or <code>listener</code> are <code>null</code>. * @since 2.0 */ public void subscribeToViewEvent(Class<? extends SystemEvent> systemEvent,SystemEventListener listener){ if (systemEvent == null) { throw new NullPointerException(); } if (listener == null) { throw new NullPointerException(); } if (viewListeners == null) { viewListeners=new HashMap<Class<? extends SystemEvent>,List<SystemEventListener>>(4,1.0f); } List<SystemEventListener> listeners=viewListeners.get(systemEvent); if (listeners == null) { listeners=new CopyOnWriteArrayList<SystemEventListener>(); viewListeners.put(systemEvent,listeners); } listeners.add(listener); }
Example 39
From project JsTestDriver, under directory /JsTestDriver/src/com/google/jstestdriver/server/handlers/.
Source file: BrowserQueryResponseHandler.java

private void addResponseId(String responseId,SlaveBrowser browser){ if (!streamedResponses.containsKey(browser)) { streamedResponses.put(browser,new CopyOnWriteArrayList<String>()); } if (isResponseIdValid(responseId)) { return; } streamedResponses.get(browser).add(responseId); }
Example 40
From project kernel_1, under directory /exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/concurrent/.
Source file: ConcurrentFIFOExoCache.java

public ConcurrentFIFOExoCache(String name,int maxSize,Log log){ this.maxSize=maxSize; this.name=name; this.state=new CacheState<K,V>(this,log); this.liveTimeMillis=-1; this.log=log; this.listeners=new CopyOnWriteArrayList<ListenerContext<K,V>>(); }
Example 41
From project leaves, under directory /libraries/controlP5/src/controlP5/.
Source file: ControlWindow.java

private void handleMouseWheelMoved(){ if (mouseWheelMoved != 0) { CopyOnWriteArrayList<ControllerInterface<?>> mouselist=new CopyOnWriteArrayList<ControllerInterface<?>>(mouseoverlist); for ( ControllerInterface<?> c : mouselist) { if (c.isVisible()) { if (c instanceof Slider) { ((Slider)c).scrolled(mouseWheelMoved); } else if (c instanceof Knob) { ((Knob)c).scrolled(mouseWheelMoved); } else if (c instanceof Numberbox) { ((Numberbox)c).scrolled(mouseWheelMoved); } else if (c instanceof ListBox) { ((ListBox)c).scrolled(mouseWheelMoved); } else if (c instanceof DropdownList) { ((DropdownList)c).scrolled(mouseWheelMoved); } else if (c instanceof Textarea) { ((Textarea)c).scrolled(mouseWheelMoved); } break; } } } mouseWheelMoved=0; }
Example 42
From project legacy-maven-support, under directory /maven-plugin/src/main/java/hudson/maven/.
Source file: Maven3Builder.java

public MavenExecutionListener(Maven3Builder maven3Builder){ this.maven3Builder=maven3Builder; this.proxies=new HashMap<ModuleName,MavenBuildProxy2>(maven3Builder.proxies); for ( Entry<ModuleName,MavenBuildProxy2> e : this.proxies.entrySet()) { e.setValue(maven3Builder.new FilterImpl(e.getValue(),maven3Builder.mavenBuildInformation)); executedMojosPerModule.put(e.getKey(),new CopyOnWriteArrayList<ExecutedMojo>()); } this.reporters.putAll(new HashMap<ModuleName,List<MavenReporter>>(maven3Builder.reporters)); this.eventLogger=new ExecutionEventLogger(new PrintStreamLogger(maven3Builder.listener.getLogger())); }
Example 43
From project log4j-jboss-logmanager, under directory /src/main/java/org/apache/log4j/.
Source file: JBossAppenderHandler.java

/** * Creates a new handler for handling appenders if one does not already exist. * @param logger the logger to attach the handler to and process appenders for */ public static void createAndAttach(final Logger logger){ if (logger.getAttachment(APPENDERS_KEY) == null) { CopyOnWriteArrayList<Appender> list=new CopyOnWriteArrayList<Appender>(); final CopyOnWriteArrayList<Appender> existing=logger.attachIfAbsent(APPENDERS_KEY,list); if (existing != null) { list=existing; } else { final JBossAppenderHandler handler=new JBossAppenderHandler(logger); logger.addHandler(handler); } } }
Example 44
From project mcore, under directory /src/com/massivecraft/mcore4/xlib/bson/.
Source file: BSON.java

@SuppressWarnings("rawtypes") public static void addEncodingHook(Class c,Transformer t){ _encodeHooks=true; List<Transformer> l=_encodingHooks.get(c); if (l == null) { l=new CopyOnWriteArrayList<Transformer>(); _encodingHooks.put(c,l); } l.add(t); }
Example 45
From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android/src/de/tudresden/inf/rn/mobilis/android/xhunt/model/.
Source file: Game.java

/** * Instantiates a new game and set the default values. */ public Game(){ gameName=null; currentRound=-1; mRoutemanagement=new RouteManagement(); gamePlayers=new ConcurrentHashMap<String,XHuntPlayer>(); mTickets=new ConcurrentHashMap<Integer,Ticket>(); mAgentsIconColorPairs=new CopyOnWriteArrayList<Game.IconColorPair>(); mAgentsIconColorPairs.add(new IconColorPair(R.drawable.ic_player_blue_36,Color.BLUE)); mAgentsIconColorPairs.add(new IconColorPair(R.drawable.ic_player_green_36,Color.GREEN)); mAgentsIconColorPairs.add(new IconColorPair(R.drawable.ic_player_orange_36,Color.rgb(220,120,30))); mAgentsIconColorPairs.add(new IconColorPair(R.drawable.ic_player_red_36,Color.RED)); mAgentsIconColorPairs.add(new IconColorPair(R.drawable.ic_player_yellow_36,Color.rgb(255,225,0))); mMrXIconColorPair=new IconColorPair(R.drawable.ic_player_mrx_36,Color.BLACK); showMrX=false; }
Example 46
From project moho, under directory /moho-common/src/main/java/com/voxeo/moho/common/event/.
Source file: EventDispatcher.java

public void addListener(final Class<?> eventClazz,final EventListener<?> listener){ List<Object> list=clazzListeners.get(eventClazz); if (list == null) { list=new CopyOnWriteArrayList<Object>(); final List<Object> existing=clazzListeners.putIfAbsent(eventClazz,list); if (existing != null) { existing.add(listener); } else { list.add(listener); } } else { list.add(listener); } }
Example 47
From project Moneychanger, under directory /src/main/java/com/moneychanger/ui/.
Source file: Load.java

public final void addPaths(String paths){ final List<String> pathList=new CopyOnWriteArrayList<String>(); pathList.addAll(Arrays.asList(paths.split(File.pathSeparator))); final Iterator<String> listIterator=pathList.iterator(); String path; while (listIterator.hasNext()) { path=listIterator.next(); if (!path.equalsIgnoreCase(".")) { System.out.println("Load.JavaPaths: Adding path: " + path.toString()); _paths.add(path); } } _javaPathsListModel.fireContentsChanged(); _returnActionToSettings.returnAction(this.toString()); }
Example 48
public static void addEncodingHook(Class c,Transformer t){ _encodeHooks=true; List<Transformer> l=_encodingHooks.get(c); if (l == null) { l=new CopyOnWriteArrayList<Transformer>(); _encodingHooks.put(c,l); } l.add(t); }
Example 49
From project myfaces-extcdi, under directory /core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/startup/.
Source file: CodiStartupBroadcaster.java

private static synchronized void invokeStartupEventBroadcaster(final ClassLoader classLoader){ if (initialized.containsKey(classLoader)) { return; } List<StartupEventBroadcaster> startupEventBroadcasterList=ServiceProvider.loadServices(StartupEventBroadcaster.class,new ServiceProviderContext(){ public ClassLoader getClassLoader(){ return classLoader; } } ); List<Class<? extends StartupEventBroadcaster>> filter=broadcasterFilter.get(classLoader); if (filter == null) { filter=new CopyOnWriteArrayList<Class<? extends StartupEventBroadcaster>>(); broadcasterFilter.put(classLoader,filter); } List<StartupEventBroadcaster> broadcasters=new ArrayList<StartupEventBroadcaster>(); for ( StartupEventBroadcaster startupEventBroadcaster : startupEventBroadcasterList) { if (!filter.contains(startupEventBroadcaster.getClass())) { filter.add(startupEventBroadcaster.getClass()); broadcasters.add(startupEventBroadcaster); } } Collections.sort(broadcasters,new InvocationOrderComparator<StartupEventBroadcaster>()); for ( StartupEventBroadcaster startupEventBroadcaster : broadcasters) { startupEventBroadcaster.broadcastStartup(); } initialized.put(classLoader,Boolean.TRUE); }
Example 50
From project nuxeo-android, under directory /nuxeo-android-connector/src/main/java/org/nuxeo/ecm/automation/client/jaxrs/spi/.
Source file: AsyncAutomationClient.java

public String asyncExec(final Session session,final OperationRequest request,final AsyncCallback<Object> cb){ final String requestKey=CacheKeyHelper.computeRequestKey(request); if (inprogressRequests.addIfAbsent(requestKey)) { Log.i(AsyncAutomationClient.class.getSimpleName(),"Adding task in the pool"); Runnable task=new Runnable(){ public void run(){ Log.i(AsyncAutomationClient.class.getSimpleName(),"Starting task exec"); try { Object result=session.execute(request); cb.onSuccess(requestKey,result); afterRequestSuccess(requestKey,result); } catch ( Throwable t) { cb.onError(requestKey,t); afterRequestFailure(requestKey,t); } finally { inprogressRequests.remove(requestKey); } } } ; async.execute(task); Log.i(AsyncAutomationClient.class.getSimpleName(),"New task added to the pool"); } else { Log.i(AsyncAutomationClient.class.getSimpleName(),"Stacking duplicated request"); CopyOnWriteArrayList<AsyncCallback<Object>> existingQueue=pendingCallBacks.get(requestKey); if (existingQueue == null) { existingQueue=new CopyOnWriteArrayList<AsyncCallback<Object>>(); } pendingCallBacks.putIfAbsent(requestKey,existingQueue); existingQueue.add(cb); } return requestKey; }
Example 51
From project org.openscada.atlantis, under directory /org.openscada.hd.server.storage.hsdb/src/org/openscada/hd/server/storage/hsdb/.
Source file: StorageHistoricalItemService.java

/** * Constructor. * @param backEndManager manager that will be used to handle and distribute back end objects * @param latestReliableTime latest time of known valid information * @param importMode flag indicating whether old data should be deleted or not */ public StorageHistoricalItemService(final BackEndManager<?> backEndManager,final long latestReliableTime,final boolean importMode){ this.backEndManager=backEndManager; final org.openscada.hsdb.configuration.Configuration configuration=backEndManager.getConfiguration(); this.calculationMethods=Conversions.getCalculationMethods(configuration); this.rootStorageChannel=null; this.lockObject=new Object(); this.starting=false; this.started=false; this.openQueries=new CopyOnWriteArrayList<QueryImpl>(); this.latestReliableTime=latestReliableTime; this.importMode=importMode; final Map<String,String> data=configuration.getData(); this.proposedDataAge=Conversions.decodeTimeSpan(data.get(Configuration.PROPOSED_DATA_AGE_KEY_PREFIX + 0)); this.acceptedTimeDelta=Conversions.decodeTimeSpan(data.get(Configuration.ACCEPTED_TIME_DELTA_KEY)); this.expectedDataType=DataType.convertShortStringToDataType(data.get(Configuration.DATA_TYPE_KEY)); this.registration=null; this.adjustDataTimestamp=false; }
Example 52
From project org.openscada.aurora, under directory /org.openscada.utils.toggle/src/org/openscada/utils/toggle/internal/.
Source file: ToggleServiceImpl.java

public void addListener(final int interval,final ToggleCallback bc) throws ToggleError { synchronized (this.addRemoveLock) { if (!this.toggleInfos.containsKey(interval)) { this.toggleInfos.put(interval,new ToggleInfo(interval)); } if (!this.toggleCallbacks.containsKey(interval)) { this.toggleCallbacks.put(interval,new CopyOnWriteArrayList<ToggleCallback>()); } final List<ToggleCallback> handlers=this.toggleCallbacks.get(interval); handlers.add(bc); } }
Example 53
From project org.openscada.orilla, under directory /org.openscada.ui.utils/src/org/openscada/ui/utils/toggle/internal/.
Source file: ToggleServiceImpl.java

public void addListener(final int interval,final ToggleCallback bc) throws ToggleError { final int intervalMs=interval * delay; synchronized (this.addRemoveLock) { if (!this.toggleInfos.containsKey(intervalMs)) { this.toggleInfos.put(intervalMs,new ToggleInfo(intervalMs)); } if (!this.toggleCallbacks.containsKey(intervalMs)) { this.toggleCallbacks.put(intervalMs,new CopyOnWriteArrayList<ToggleCallback>()); } final List<ToggleCallback> handlers=this.toggleCallbacks.get(intervalMs); handlers.add(bc); } }
Example 54
From project packages_apps_Camera_1, under directory /src/com/android/camera/.
Source file: ComboPreferences.java

public ComboPreferences(Context context){ mPrefGlobal=PreferenceManager.getDefaultSharedPreferences(context); mPrefGlobal.registerOnSharedPreferenceChangeListener(this); synchronized (sMap) { sMap.put(context,this); } mListeners=new CopyOnWriteArrayList<OnSharedPreferenceChangeListener>(); }
Example 55
From project packages_apps_Camera_2, under directory /src/com/android/camera/.
Source file: ComboPreferences.java

public ComboPreferences(Context context){ mPrefGlobal=PreferenceManager.getDefaultSharedPreferences(context); mPrefGlobal.registerOnSharedPreferenceChangeListener(this); synchronized (sMap) { sMap.put(context,this); } mListeners=new CopyOnWriteArrayList<OnSharedPreferenceChangeListener>(); }
Example 56
From project PixelController, under directory /src/main/java/com/neophob/sematrix/glue/.
Source file: Collector.java

/** * Instantiates a new collector. */ private Collector(){ allVisuals=new CopyOnWriteArrayList<Visual>(); this.nrOfScreens=0; ioMapping=new CopyOnWriteArrayList<OutputMapping>(); initialized=false; selectedPresent=0; present=new CopyOnWriteArrayList<PresentSettings>(); for (int n=0; n < NR_OF_PRESENT_SLOTS; n++) { present.add(new PresentSettings()); } pixelControllerShufflerSelect=new PixelControllerShufflerSelect(); pixelControllerShufflerSelect.initAll(); }
Example 57
From project platform_packages_apps_camera, under directory /src/com/android/camera/.
Source file: ComboPreferences.java

public ComboPreferences(Context context){ mPrefGlobal=PreferenceManager.getDefaultSharedPreferences(context); mPrefGlobal.registerOnSharedPreferenceChangeListener(this); synchronized (sMap) { sMap.put(context,this); } mListeners=new CopyOnWriteArrayList<OnSharedPreferenceChangeListener>(); }
Example 58
From project platform_packages_apps_im, under directory /src/com/android/im/engine/.
Source file: ChatGroup.java

public ChatGroup(Address address,String name,Collection<Contact> members,ChatGroupManager manager){ mAddress=address; mName=name; mManager=manager; mMembers=new Vector<Contact>(); if (members != null) { mMembers.addAll(members); } mMemberListeners=new CopyOnWriteArrayList<GroupMemberListener>(); }
Example 59
From project pomodoro4nb, under directory /src/org/matveev/pomodoro4nb/data/.
Source file: Properties.java

public Properties(){ holder=new LinkedHashMap<Property<?>,Object>(); elements=new CopyOnWriteArrayList<Properties>(); listeners=new CopyOnWriteArrayList<PropertyListener>(); setProperty(Id,UUID.randomUUID()); setProperty(ClassType,getClass().getName()); setProperty(SerializeKey,getClass().getSimpleName()); }
Example 60
From project pos_1, under directory /jetty/contrib/cometd/bayeux/src/main/java/org/mortbay/cometd/.
Source file: AbstractBayeux.java

void clientOnBrowser(String browserId,String clientId){ List<String> clients=_browser2client.get(browserId); if (clients == null) { List<String> new_clients=new CopyOnWriteArrayList<String>(); clients=_browser2client.putIfAbsent(browserId,new_clients); if (clients == null) clients=new_clients; } clients.add(clientId); }
Example 61
From project project_bpm, under directory /Processing/libraries/controlP5/src/controlP5/.
Source file: ControlWindow.java

@SuppressWarnings("unchecked") private void handleMouseWheelMoved(){ if (mouseWheelMoved != 0) { CopyOnWriteArrayList<ControllerInterface<?>> mouselist=new CopyOnWriteArrayList<ControllerInterface<?>>(mouseoverlist); for ( ControllerInterface<?> c : mouselist) { if (c.isVisible()) { if (c instanceof Controller) { ((Controller)c).onScroll(mouseWheelMoved); } if (c instanceof ControllerGroup) { ((ControllerGroup)c).onScroll(mouseWheelMoved); } if (c instanceof Slider) { ((Slider)c).scrolled(mouseWheelMoved); } else if (c instanceof Knob) { ((Knob)c).scrolled(mouseWheelMoved); } else if (c instanceof Numberbox) { ((Numberbox)c).scrolled(mouseWheelMoved); } else if (c instanceof ListBox) { ((ListBox)c).scrolled(mouseWheelMoved); } else if (c instanceof DropdownList) { ((DropdownList)c).scrolled(mouseWheelMoved); } else if (c instanceof Textarea) { ((Textarea)c).scrolled(mouseWheelMoved); } break; } } } mouseWheelMoved=0; }
Example 62
From project QuickSnap, under directory /Camera/src/com/lightbox/android/camera/.
Source file: ComboPreferences.java

public ComboPreferences(Context context){ mPrefGlobal=PreferenceManager.getDefaultSharedPreferences(context); mPrefGlobal.registerOnSharedPreferenceChangeListener(this); synchronized (sMap) { sMap.put(context,this); } mListeners=new CopyOnWriteArrayList<OnSharedPreferenceChangeListener>(); }
Example 63
From project RegexTagForMusic, under directory /src/org/essembeh/rtfm/ui/model/.
Source file: JobModel.java

public JobModel(List<IMusicFile> files,boolean onlyKeepErrorFiles){ data=new CopyOnWriteArrayList<JobModel.FileWithStatus>(); this.onlyKeepErrorFiles=onlyKeepErrorFiles; for ( IMusicFile iMusicFile : files) { data.add(new FileWithStatus(iMusicFile)); } }
Example 64
From project riak-java-client, under directory /src/main/java/com/basho/riak/client/http/.
Source file: RiakObject.java

private void safeSetLinks(final List<RiakLink> links){ if (links == null) { this.links=new CopyOnWriteArrayList<RiakLink>(); } else { this.links=new CopyOnWriteArrayList<RiakLink>(deepCopy(links)); } }
Example 65
From project RoyalCommands, under directory /src/org/royaldev/royalcommands/runners/.
Source file: WarnWatcher.java

@Override public void run(){ if (plugin.warnExpireTime < 1) return; OfflinePlayer[] players=plugin.getServer().getOfflinePlayers(); for ( OfflinePlayer p : players) { PConfManager pcm=new PConfManager(p); if (!pcm.exists()) continue; if (pcm.get("warns") == null) continue; CopyOnWriteArrayList<String> cowal=new CopyOnWriteArrayList<String>(); List<String> warns=pcm.getStringList("warns"); if (warns == null) return; cowal.addAll(warns); for ( String s : cowal) { String[] reason=s.split("\\u00b5"); if (reason.length < 2) continue; long timeSet; try { timeSet=Long.valueOf(reason[1]); } catch ( NumberFormatException e) { continue; } long currentTime=new Date().getTime(); long timeExpires=timeSet + (plugin.warnExpireTime * 1000); if (timeExpires <= currentTime) cowal.remove(s); } pcm.setStringList(cowal,"warns"); } }
Example 66
From project scooter, under directory /source/src/com/scooterframework/admin/.
Source file: EventsManager.java

/** * Register a listener for a specific event type. * @param eventType The event type * @param listener The event listener to be registered. */ public void registerListener(String eventType,Listener listener){ List<Listener> listeners=listenersMap.get(eventType); if (listeners == null) { listeners=new CopyOnWriteArrayList<Listener>(); List<Listener> oldListeners=listenersMap.putIfAbsent(eventType,listeners); if (oldListeners != null) { listeners=oldListeners; } } if (!listeners.contains(listener)) listeners.add(listener); }
Example 67
From project shiro, under directory /core/src/main/java/org/apache/shiro/subject/support/.
Source file: DelegatingSubject.java

private void pushIdentity(PrincipalCollection principals) throws NullPointerException { if (CollectionUtils.isEmpty(principals)) { String msg="Specified Subject principals cannot be null or empty for 'run as' functionality."; throw new NullPointerException(msg); } List<PrincipalCollection> stack=getRunAsPrincipalsStack(); if (stack == null) { stack=new CopyOnWriteArrayList<PrincipalCollection>(); } stack.add(0,principals); Session session=getSession(); session.setAttribute(RUN_AS_PRINCIPALS_SESSION_KEY,stack); }
Example 68
From project speedsircapi, under directory /src/com/speed/irc/connection/.
Source file: ServerMessageParser.java

public ServerMessageParser(final Server server){ this.server=server; generators=new CopyOnWriteArrayList<EventGenerator>(); generators.add(this); generators.add(new JoinGenerator()); generators.add(new KickGenerator()); generators.add(new ModeGenerator()); generators.add(new NoticeGenerator()); generators.add(new PartGenerator()); generators.add(new PrivmsgGenerator()); reader=new ServerMessageReader(server); execServ=Executors.newSingleThreadScheduledExecutor(); new Thread(reader,"Server message reader").start(); future=execServ.scheduleWithFixedDelay(this,0,50,TimeUnit.MILLISECONDS); }
Example 69
From project spring-js, under directory /src/test/java/org/springframework/context/support/.
Source file: DefaultLifecycleProcessorTests.java

@Test public void singleSmartLifecycleAutoStartup() throws Exception { CopyOnWriteArrayList<Lifecycle> startedBeans=new CopyOnWriteArrayList<Lifecycle>(); TestSmartLifecycleBean bean=TestSmartLifecycleBean.forStartupTests(1,startedBeans); bean.setAutoStartup(true); StaticApplicationContext context=new StaticApplicationContext(); context.getBeanFactory().registerSingleton("bean",bean); assertFalse(bean.isRunning()); context.refresh(); assertTrue(bean.isRunning()); context.stop(); assertFalse(bean.isRunning()); assertEquals(1,startedBeans.size()); }
Example 70
From project starflow, under directory /src/main/java/com/googlecode/starflow/engine/xml/.
Source file: NodeUtil.java

/** * ??????????????????---??????????? */ @SuppressWarnings("rawtypes") public static List<FreeActElement> getActFreeActs(Element actEl){ List<FreeActElement> events=new CopyOnWriteArrayList<FreeActElement>(); List list=actEl.selectNodes(StarFlowNames.ACT_FREE_ACT); Iterator iter=list.iterator(); while (iter.hasNext()) { Element el=(Element)iter.next(); FreeActElement e=new FreeActElement(); e.setId(el.attributeValue(StarFlowNames.ACT_FREE_ACT_ID)); e.setName(el.attributeValue(StarFlowNames.ACT_FREE_ACT_NAME)); e.setType(el.attributeValue(StarFlowNames.ACT_FREE_ACT_TYPE)); events.add(e); } return events; }
Example 71
From project streams, under directory /stream-mining/src/main/java/stream/quantiles/.
Source file: GKQuantiles.java

public void setEpsilon(Double epsilon){ super.epsilon=epsilon; this.minimum=Double.MAX_VALUE; this.maximum=Double.MIN_VALUE; Double mergingSteps=Math.floor(1.0 / (2.0 * super.epsilon)); this.stepsUntilMerge=mergingSteps.intValue(); this.summary=new CopyOnWriteArrayList<Tuple>(); this.count=0; this.initialPhase=true; }
Example 72
From project Stroke5Keyboard-android, under directory /src/com/linkomnia/android/Stroke5/.
Source file: WordProcessor.java

@SuppressWarnings({"rawtypes","unchecked"}) public CopyOnWriteArrayList<String> getChinesePhraseDictLinkedHashMap(String key){ if (this.chinesePhraseDict.containsKey(key)) { return this.chinesePhraseDict.get(key); } else { return null; } }
Example 73
From project Tanks_1, under directory /src/org/apache/mina/core/filterchain/.
Source file: DefaultIoFilterChainBuilder.java

/** * Creates a new copy of the specified {@link DefaultIoFilterChainBuilder}. */ public DefaultIoFilterChainBuilder(DefaultIoFilterChainBuilder filterChain){ if (filterChain == null) { throw new IllegalArgumentException("filterChain"); } entries=new CopyOnWriteArrayList<Entry>(filterChain.entries); }
Example 74
From project tb-diamond_1, under directory /diamond-client/src/main/java/com/taobao/diamond/client/impl/.
Source file: DefaultSubscriberListener.java

public void receiveConfigInfo(final ConfigureInfomation configureInfomation){ String dataId=configureInfomation.getDataId(); String group=configureInfomation.getGroup(); if (null == dataId) { log.error("?????????DataID"); } else { String key=makeKey(dataId,group); Map<String,CopyOnWriteArrayList<ManagerListener>> map=allListeners.get(key); if (null == map) { log.warn("??????MessageListener"); } else if (map.size() == 0) { log.warn("??????MessageListener"); allListeners.remove(key); } else { for ( List<ManagerListener> listeners : map.values()) { for ( ManagerListener listener : listeners) { callListener(configureInfomation,listener); } } } } }
Example 75
From project ubuntu-packaging-floodlight, under directory /src/test/java/net/floodlightcontroller/core/test/.
Source file: MockFloodlightProvider.java

/** */ public MockFloodlightProvider(){ listeners=new ConcurrentHashMap<OFType,List<IOFMessageListener>>(); switches=new ConcurrentHashMap<Long,IOFSwitch>(); switchListeners=new CopyOnWriteArrayList<IOFSwitchListener>(); haListeners=new CopyOnWriteArrayList<IHAListener>(); factory=new BasicFactory(); }
Example 76
From project undertow, under directory /servlet/src/main/java/io/undertow/servlet/core/.
Source file: ApplicationListeners.java

public ApplicationListeners(final List<ManagedListener> allListeners,final ServletContext servletContext){ this.servletContext=servletContext; servletContextListeners=new CopyOnWriteArrayList<ManagedListener>(); servletContextAttributeListeners=new CopyOnWriteArrayList<ManagedListener>(); servletRequestListeners=new CopyOnWriteArrayList<ManagedListener>(); servletRequestAttributeListeners=new CopyOnWriteArrayList<ManagedListener>(); httpSessionListeners=new CopyOnWriteArrayList<ManagedListener>(); httpSessionAttributeListeners=new CopyOnWriteArrayList<ManagedListener>(); this.allListeners=new CopyOnWriteArrayList<ManagedListener>(); for ( final ManagedListener listener : allListeners) { addListener(listener); } }
Example 77
From project XenMaster, under directory /src/main/java/org/xenmaster/api/util/.
Source file: CachingFacility.java

private CachingFacility(boolean distributed){ this.mode=Mode.LAZY; this.cache=buildCache(distributed); this.loadedEntityClasses=new CopyOnWriteArrayList<>(); registerCacheUpdater(); }
Example 78
From project xmemcached, under directory /src/main/java/net/rubyeye/xmemcached/impl/.
Source file: MemcachedConnector.java

private void addStandbySession(Session session,InetSocketAddress mainNodeAddress){ InetSocketAddress remoteSocketAddress=session.getRemoteSocketAddress(); log.warn("Add a standby session: " + SystemUtils.getRawAddress(remoteSocketAddress) + ":"+ remoteSocketAddress.getPort()+ " for "+ SystemUtils.getRawAddress(mainNodeAddress)+ ":"+ mainNodeAddress.getPort()); List<Session> sessions=this.standbySessionMap.get(mainNodeAddress); if (sessions == null) { sessions=new CopyOnWriteArrayList<Session>(); List<Session> oldSessions=this.standbySessionMap.putIfAbsent(mainNodeAddress,sessions); if (null != oldSessions) { sessions=oldSessions; } } sessions.add(session); }