4632N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 4632N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4632N/A * This code is free software; you can redistribute it and/or modify it 4632N/A * under the terms of the GNU General Public License version 2 only, as 4632N/A * published by the Free Software Foundation. Oracle designates this 4632N/A * particular file as subject to the "Classpath" exception as provided 4632N/A * by Oracle in the LICENSE file that accompanied this code. 4632N/A * This code is distributed in the hope that it will be useful, but WITHOUT 4632N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4632N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4632N/A * version 2 for more details (a copy is included in the LICENSE file that 4632N/A * You should have received a copy of the GNU General Public License version 4632N/A * 2 along with this work; if not, write to the Free Software Foundation, 4632N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4632N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4632N/A * or visit www.oracle.com if you need additional information or have any 4632N/A * Factory for {@link Executor}s and {@link ExecutorService}s backed by 4632N/A * Access is controlled through the Dispatch.getInstance() method, because 4632N/A * performed tasks occur on threads owned by libdispatch. These threads are 4632N/A * not owned by any particular AppContext or have any specific context 4632N/A * @since Java for Mac OS X 10.6 Update 2 4632N/A * The priorities of the three default asynchronous queues. 4632N/A * Factory method returns an instnace of Dispatch if supported by the 4632N/A * underlying operating system, and if the caller's security manager 4632N/A * permits "canInvokeInSystemThreadGroup". 4632N/A * @return a factory instance of Dispatch, or null if not available 4632N/A * Creates an {@link Executor} that performs tasks asynchronously. The {@link Executor} 4632N/A * cannot be shutdown, and enqueued {@link Runnable}s cannot be canceled. Passing null 4632N/A * returns the {@link Priority.NORMAL} {@link Executor}. 4632N/A * @param priority - the priority of the returned {@link Executor} 4632N/A * @return an asynchronous {@link Executor} 4632N/A * Creates an {@link ExecutorService} that performs tasks synchronously in FIFO order. 4632N/A * Useful to protect a resource against concurrent modification, in lieu of a lock. 4632N/A * Passing null returns an {@link ExecutorService} with a uniquely labeled queue. 4632N/A * @param label - a label to name the queue, shown in several debugging tools 4632N/A * @return a synchronous {@link ExecutorService} 4632N/A * Returns an {@link Executor} that performs the provided Runnables on the main queue of the process. 4632N/A * Runnables submitted to this {@link Executor} will not run until the AWT is started or another native toolkit is running a CFRunLoop or NSRunLoop on the main thread. 4632N/A * Submitting a Runnable to this {@link Executor} does not wait for the Runnable to complete. 4632N/A * @return an asynchronous {@link Executor} that is backed by the main queue 4632N/A * Returns an {@link Executor} that performs the provided Runnables on the main queue of the process. 4632N/A * Runnables submitted to this {@link Executor} will not run until the AWT is started or another native toolkit is running a CFRunLoop or NSRunLoop on the main thread. 4632N/A * Submitting a Runnable to this {@link Executor} will block until the Runnable has completed. 4632N/A * @return an {@link Executor} that is backed by the main queue