Code example for CopyOnWriteArrayList

0
	private final int mPort;
 
	private Thread mThread;
	private ExecutorService mThreadPool;
 
	private final List<WindowListener> mListeners = new CopyOnWriteArrayList<ViewServer.WindowListener>();
 
	private final HashMap<View, String> mWindows = new HashMap<View, String>();
	private final ReentrantReadWriteLock mWindowsLock = new ReentrantReadWriteLock();
 
	private View mFocusedWindow;
	private final ReentrantReadWriteLock mFocusLock = new ReentrantReadWriteLock();
 
	private static ViewServer sServer;
 
	/** 
	 * Returns a unique instance of the ViewServer. This method should only be 
	 * called from the main thread of your application. The server will have the 
	 * same lifetime as your process. 
	 *  
	 * If your application does not have the <code>android:debuggable</code>