8148187: Remove OS X-specific com.apple.concurrent package
Summary: Removed jdk.deploy.osx module (including com.apple.concurrent)
Reviewed-by: alanb, erikj, mchung
--- a/jdk/make/lib/Lib-java.desktop.gmk Tue Mar 08 12:11:07 2016 +0000
+++ b/jdk/make/lib/Lib-java.desktop.gmk Tue Mar 08 11:36:42 2016 -0800
@@ -29,6 +29,7 @@
$(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/java.desktop/*/native \
$(JDK_TOPDIR)/src/*/java.desktop/*/native)))
+include LibosxLibraries.gmk
include PlatformLibraries.gmk
include Awt2dLibraries.gmk
include SoundLibraries.gmk
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include LibCommon.gmk
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
- ################################################################################
-
- LIBOSX_DIRS := $(JDK_TOPDIR)/src/jdk.deploy.osx/macosx/native/libosx
- LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
- -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
- $(LIBJAVA_HEADER_FLAGS) \
- -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
- -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx \
- #
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
- LIBRARY := osx, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBOSX_DIRS), \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(LIBOSX_CFLAGS), \
- DISABLED_WARNINGS_clang := deprecated-declarations, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LIBS := \
- -losxapp \
- -framework Cocoa \
- -framework ApplicationServices \
- -framework JavaNativeFoundation \
- -framework JavaRuntimeSupport \
- -framework SystemConfiguration \
- $(JDKLIB_LIBS), \
- OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
- ))
-
- TARGETS += $(BUILD_LIBOSX)
-
- $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)
-
- $(BUILD_LIBOSX): $(call FindLib, java.base, java)
-
- ################################################################################
-
-endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/lib/LibosxLibraries.gmk Tue Mar 08 11:36:42 2016 -0800
@@ -0,0 +1,67 @@
+#
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ ################################################################################
+
+ LIBOSX_DIRS := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libosx
+ LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
+ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
+ $(LIBJAVA_HEADER_FLAGS) \
+ -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
+ #
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
+ LIBRARY := osx, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBOSX_DIRS), \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(LIBOSX_CFLAGS), \
+ DISABLED_WARNINGS_clang := deprecated-declarations, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LIBS := \
+ -losxapp \
+ -framework Cocoa \
+ -framework ApplicationServices \
+ -framework JavaNativeFoundation \
+ -framework JavaRuntimeSupport \
+ -framework SystemConfiguration \
+ $(JDKLIB_LIBS), \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
+ ))
+
+ TARGETS += $(BUILD_LIBOSX)
+
+ $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)
+
+ $(BUILD_LIBOSX): $(call FindLib, java.base, java)
+
+ ################################################################################
+
+endif
--- a/jdk/make/src/classes/build/tools/module/boot.modules Tue Mar 08 12:11:07 2016 +0000
+++ b/jdk/make/src/classes/build/tools/module/boot.modules Tue Mar 08 11:36:42 2016 -0800
@@ -19,7 +19,6 @@
java.xml.crypto
jdk.charsets
jdk.deploy
-jdk.deploy.osx
jdk.httpserver
jdk.jfr
jdk.jsobject
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/native/libosx/CFileManager.m Tue Mar 08 11:36:42 2016 -0800
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#import "com_apple_eio_FileManager.h"
+
+#import <Cocoa/Cocoa.h>
+#import <JavaNativeFoundation/JavaNativeFoundation.h>
+
+#import "ThreadUtilities.h"
+
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: _setFileTypeAndCreator
+ * Signature: (Ljava/lang/String;II)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileTypeAndCreator
+(JNIEnv *env, jclass clz, jstring javaFilename, jint type, jint creator)
+{
+JNF_COCOA_ENTER(env);
+ NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+ NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt:type], NSFileHFSTypeCode,
+ [NSNumber numberWithInt:creator], NSFileHFSCreatorCode, nil];
+ [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: _setFileType
+ * Signature: (Ljava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileType
+(JNIEnv *env, jclass ckz, jstring javaFilename, jint type)
+{
+JNF_COCOA_ENTER(env);
+ NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+ NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:type] forKey:NSFileHFSTypeCode];
+ [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: _setFileCreator
+ * Signature: (Ljava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileCreator
+(JNIEnv *env, jclass clz, jstring javaFilename, jint creator)
+{
+JNF_COCOA_ENTER(env);
+ NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+ NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:creator] forKey:NSFileHFSCreatorCode];
+ [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: _getFileType
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileType
+(JNIEnv *env, jclass clz, jstring javaFilename)
+{
+ jint type = 0;
+JNF_COCOA_ENTER(env);
+ NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+ NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
+ NSNumber *val = [attributes objectForKey:NSFileHFSTypeCode];
+ type = [val intValue];
+JNF_COCOA_EXIT(env);
+ return type;
+}
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: _getFileCreator
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileCreator
+ (JNIEnv *env, jclass clz, jstring javaFilename)
+{
+ jint creator = 0;
+JNF_COCOA_ENTER(env);
+ NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+ NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
+ NSNumber *val = [attributes objectForKey:NSFileHFSCreatorCode];
+ creator = [val intValue];
+JNF_COCOA_EXIT(env);
+ return creator;
+}
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: _findFolder
+ * Signature: (SIZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager__1findFolder__SIZ
+(JNIEnv *env, jclass clz, jshort domain, jint folderType, jboolean createIfNeeded)
+{
+ jstring filename = nil;
+JNF_COCOA_ENTER(env);
+
+ FSRef foundRef;
+ createIfNeeded = createIfNeeded || (folderType == kTemporaryFolderType) || (folderType == kChewableItemsFolderType);
+ if (FSFindFolder((SInt16)domain, (OSType)folderType, (Boolean)createIfNeeded, &foundRef) == noErr) {
+ char path[PATH_MAX];
+ if (FSRefMakePath(&foundRef, (UInt8 *)path, sizeof(path)) == noErr) {
+ NSString *filenameString = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)];
+ filename = JNFNormalizedJavaStringForPath(env, filenameString);
+ }
+ }
+
+JNF_COCOA_EXIT(env);
+ return filename;
+}
+
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: _openURL
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1openURL
+(JNIEnv *env, jclass clz, jstring urlString)
+{
+JNF_COCOA_ENTER(env);
+
+ NSURL *url = [NSURL URLWithString:JNFNormalizedNSStringForPath(env, urlString)];
+
+ // Radar 3208005: Run this on the main thread; file:// style URLs will hang otherwise.
+ [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+ [[NSWorkspace sharedWorkspace] openURL:url];
+ }];
+
+JNF_COCOA_EXIT(env);
+}
+
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: getNativeResourceFromBundle
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativeResourceFromBundle
+(JNIEnv *env, jclass clz, jstring javaResourceName, jstring javaSubDirName, jstring javaTypeName)
+{
+ jstring filename = NULL;
+JNF_COCOA_ENTER(env);
+
+ NSString *resourceName = JNFNormalizedNSStringForPath(env, javaResourceName);
+ NSString *subDirectory = JNFNormalizedNSStringForPath(env, javaSubDirName);
+ NSString *typeName = JNFNormalizedNSStringForPath(env, javaTypeName);
+
+ NSString *path = [[NSBundle mainBundle] pathForResource:resourceName
+ ofType:typeName
+ inDirectory:subDirectory];
+
+ filename = JNFNormalizedJavaStringForPath(env, path);
+
+JNF_COCOA_EXIT(env);
+ return filename;
+}
+
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: getNativePathToApplicationBundle
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativePathToApplicationBundle
+(JNIEnv *env, jclass clazz)
+{
+ jstring filename = nil;
+JNF_COCOA_ENTER(env);
+
+ NSBundle *mainBundle = [NSBundle mainBundle];
+ filename = JNFNormalizedJavaStringForPath(env, [mainBundle bundlePath]);
+
+JNF_COCOA_EXIT(env);
+ return filename;
+}
+
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: __moveToTrash
+ * Signature: (Ljava/lang/String;)V
+ */
+
+JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1moveToTrash
+(JNIEnv *env, jclass clz, jstring url)
+{
+ __block jboolean returnValue = JNI_FALSE;
+JNF_COCOA_ENTER(env);
+
+ NSString *path = JNFNormalizedNSStringForPath(env, url);
+ [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ NSInteger res = 0;
+ [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation
+ source:[path stringByDeletingLastPathComponent]
+ destination:nil
+ files:[NSArray arrayWithObject:[path lastPathComponent]]
+ tag:&res];
+ returnValue = (res == 0);
+ }];
+
+JNF_COCOA_EXIT(env);
+
+ return returnValue;
+}
+
+/*
+ * Class: com_apple_eio_FileManager
+ * Method: __revealInFinder
+ * Signature: (Ljava/lang/String;)V
+ */
+
+JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1revealInFinder
+(JNIEnv *env, jclass clz, jstring url)
+{
+ __block jboolean returnValue = JNI_FALSE;
+JNF_COCOA_ENTER(env);
+
+ NSString *path = JNFNormalizedNSStringForPath(env, url);
+ [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ returnValue = [[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:@""];
+ }];
+
+JNF_COCOA_EXIT(env);
+
+ return returnValue;
+}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/Dispatch.java Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.apple.concurrent;
-
-import java.util.concurrent.*;
-
-/**
- * Factory for {@link Executor}s and {@link ExecutorService}s backed by
- * libdispatch.
- *
- * Access is controlled through the Dispatch.getInstance() method, because
- * performed tasks occur on threads owned by libdispatch. These threads are
- * not owned by any particular AppContext or have any specific context
- * classloader installed.
- *
- * @since Java for Mac OS X 10.6 Update 2
- */
-public final class Dispatch {
- /**
- * The priorities of the three default asynchronous queues.
- */
- public enum Priority {
- LOW(-2), NORMAL(0), HIGH(2); // values from <dispatch/queue.h>
-
- final int nativePriority;
- Priority(final int nativePriority) { this.nativePriority = nativePriority; }
- };
-
- final static Dispatch instance = new Dispatch();
-
- /**
- * Factory method returns an instnace of Dispatch if supported by the
- * underlying operating system, and if the caller's security manager
- * permits "canInvokeInSystemThreadGroup".
- *
- * @return a factory instance of Dispatch, or null if not available
- */
- public static Dispatch getInstance() {
- checkSecurity();
- if (!LibDispatchNative.nativeIsDispatchSupported()) return null;
-
- return instance;
- }
-
- private static void checkSecurity() {
- final SecurityManager security = System.getSecurityManager();
- if (security != null) security.checkPermission(new RuntimePermission("canInvokeInSystemThreadGroup"));
- }
-
- private Dispatch() { }
-
- /**
- * Creates an {@link Executor} that performs tasks asynchronously. The {@link Executor}
- * cannot be shutdown, and enqueued {@link Runnable}s cannot be canceled. Passing null
- * returns the {@link Priority.NORMAL} {@link Executor}.
- *
- * @param priority - the priority of the returned {@link Executor}
- * @return an asynchronous {@link Executor}
- */
- public Executor getAsyncExecutor(Priority priority) {
- if (priority == null) priority = Priority.NORMAL;
- final long nativeQueue = LibDispatchNative.nativeCreateConcurrentQueue(priority.nativePriority);
- if (nativeQueue == 0L) return null;
- return new LibDispatchConcurrentQueue(nativeQueue);
- }
-
- int queueIndex = 0;
- /**
- * Creates an {@link ExecutorService} that performs tasks synchronously in FIFO order.
- * Useful to protect a resource against concurrent modification, in lieu of a lock.
- * Passing null returns an {@link ExecutorService} with a uniquely labeled queue.
- *
- * @param label - a label to name the queue, shown in several debugging tools
- * @return a synchronous {@link ExecutorService}
- */
- public ExecutorService createSerialExecutor(String label) {
- if (label == null) label = "";
- if (label.length() > 256) label = label.substring(0, 256);
- String queueName = "com.apple.java.concurrent.";
- if ("".equals(label)) {
- synchronized (this) {
- queueName += queueIndex++;
- }
- } else {
- queueName += label;
- }
-
- final long nativeQueue = LibDispatchNative.nativeCreateSerialQueue(queueName);
- if (nativeQueue == 0) return null;
- return new LibDispatchSerialQueue(nativeQueue);
- }
-
- Executor nonBlockingMainQueue = null;
- /**
- * Returns an {@link Executor} that performs the provided Runnables on the main queue of the process.
- * 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.
- *
- * Submitting a Runnable to this {@link Executor} does not wait for the Runnable to complete.
- * @return an asynchronous {@link Executor} that is backed by the main queue
- */
- public synchronized Executor getNonBlockingMainQueueExecutor() {
- if (nonBlockingMainQueue != null) return nonBlockingMainQueue;
- return nonBlockingMainQueue = new LibDispatchMainQueue.ASync();
- }
-
- Executor blockingMainQueue = null;
- /**
- * Returns an {@link Executor} that performs the provided Runnables on the main queue of the process.
- * 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.
- *
- * Submitting a Runnable to this {@link Executor} will block until the Runnable has completed.
- * @return an {@link Executor} that is backed by the main queue
- */
- public synchronized Executor getBlockingMainQueueExecutor() {
- if (blockingMainQueue != null) return blockingMainQueue;
- return blockingMainQueue = new LibDispatchMainQueue.Sync();
- }
-}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchConcurrentQueue.java Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.apple.concurrent;
-
-import java.util.concurrent.Executor;
-
-class LibDispatchConcurrentQueue extends LibDispatchQueue implements Executor {
- LibDispatchConcurrentQueue(final long queuePtr) {
- super(queuePtr);
- }
-
- @Override
- public void execute(final Runnable task) {
- LibDispatchNative.nativeExecuteAsync(ptr, task);
- }
-
- @Override
- protected synchronized void dispose() {
- // should not dispose the default concurrent queues
- }
-}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchMainQueue.java Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.apple.concurrent;
-
-import java.util.concurrent.Executor;
-
-abstract class LibDispatchMainQueue extends LibDispatchQueue implements Executor {
- public LibDispatchMainQueue() {
- super(LibDispatchNative.nativeGetMainQueue());
- }
-
- @Override
- protected synchronized void dispose() {
- // should not dispose the main queue
- }
-
- static class Sync extends LibDispatchMainQueue {
- @Override
- public void execute(final Runnable task) {
- LibDispatchNative.nativeExecuteSync(ptr, task);
- }
- }
-
- static class ASync extends LibDispatchMainQueue {
- @Override
- public void execute(final Runnable task) {
- LibDispatchNative.nativeExecuteAsync(ptr, task);
- }
- }
-}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchNative.java Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.apple.concurrent;
-
-final class LibDispatchNative {
- static {
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Void>() {
- public Void run() {
- System.loadLibrary("osx");
- return null;
- }
- });
- }
-
- static native boolean nativeIsDispatchSupported();
- static native long nativeGetMainQueue();
- static native long nativeCreateConcurrentQueue(int priority);
- static native long nativeCreateSerialQueue(String name);
- static native void nativeReleaseQueue(long nativeQueue);
- static native void nativeExecuteAsync(long nativeQueue, Runnable task);
- static native void nativeExecuteSync(long nativeQueue, Runnable task);
-
- private LibDispatchNative() { }
-}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchQueue.java Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.apple.concurrent;
-
-class LibDispatchQueue extends LibDispatchRetainedResource {
- LibDispatchQueue(final long queuePtr) {
- super(queuePtr);
- }
-}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchRetainedResource.java Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.apple.concurrent;
-
-class LibDispatchRetainedResource {
- protected long ptr;
-
- protected LibDispatchRetainedResource(final long ptr) {
- this.ptr = ptr;
- }
-
- protected synchronized void dispose() {
- if (ptr != 0) LibDispatchNative.nativeReleaseQueue(ptr);
- ptr = 0;
- }
-
- protected void finalize() throws Throwable {
- dispose();
- }
-}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchSerialQueue.java Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.apple.concurrent;
-
-import java.util.List;
-import java.util.concurrent.*;
-
-class LibDispatchSerialQueue extends AbstractExecutorService {
- static final int RUNNING = 0;
- static final int SHUTDOWN = 1;
-// static final int STOP = 2; // not supported by GCD
- static final int TERMINATED = 3;
-
- final Object lock = new Object();
- LibDispatchQueue nativeQueueWrapper;
- volatile int runState;
-
- LibDispatchSerialQueue(final long queuePtr) {
- nativeQueueWrapper = new LibDispatchQueue(queuePtr);
- }
-
- @Override
- public void execute(final Runnable task) {
- if (nativeQueueWrapper == null) return;
- LibDispatchNative.nativeExecuteAsync(nativeQueueWrapper.ptr, task);
- }
-
- @Override
- public boolean isShutdown() {
- return runState != RUNNING;
- }
-
- @Override
- public boolean isTerminated() {
- return runState == TERMINATED;
- }
-
- @Override
- public void shutdown() {
- synchronized (lock) {
- if (runState != RUNNING) return;
-
- runState = SHUTDOWN;
- execute(new Runnable() {
- public void run() {
- synchronized (lock) {
- runState = TERMINATED;
- lock.notifyAll(); // for the benefit of awaitTermination()
- }
- }
- });
- nativeQueueWrapper = null;
- }
- }
-
- @Override
- public List<Runnable> shutdownNow() {
- shutdown();
- return null;
- }
-
- @Override
- public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException {
- if (runState == TERMINATED) return true;
-
- final long millis = unit.toMillis(timeout);
- if (millis <= 0) return false;
-
- synchronized (lock) {
- if (runState == TERMINATED) return true;
- lock.wait(timeout);
- if (runState == TERMINATED) return true;
- }
-
- return false;
- }
-}
--- a/jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/package.html Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<html>
-<head>
-</head>
-<body bgcolor="white">
-Apple-specific implementations of the java.util.concurrent.* API based on libdispatch.
-</body>
-</html>
--- a/jdk/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#import "com_apple_eio_FileManager.h"
-
-#import <Cocoa/Cocoa.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-#import "ThreadUtilities.h"
-
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: _setFileTypeAndCreator
- * Signature: (Ljava/lang/String;II)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileTypeAndCreator
-(JNIEnv *env, jclass clz, jstring javaFilename, jint type, jint creator)
-{
-JNF_COCOA_ENTER(env);
- NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
- NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:type], NSFileHFSTypeCode,
- [NSNumber numberWithInt:creator], NSFileHFSCreatorCode, nil];
- [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: _setFileType
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileType
-(JNIEnv *env, jclass ckz, jstring javaFilename, jint type)
-{
-JNF_COCOA_ENTER(env);
- NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
- NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:type] forKey:NSFileHFSTypeCode];
- [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: _setFileCreator
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileCreator
-(JNIEnv *env, jclass clz, jstring javaFilename, jint creator)
-{
-JNF_COCOA_ENTER(env);
- NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
- NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:creator] forKey:NSFileHFSCreatorCode];
- [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: _getFileType
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileType
-(JNIEnv *env, jclass clz, jstring javaFilename)
-{
- jint type = 0;
-JNF_COCOA_ENTER(env);
- NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
- NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
- NSNumber *val = [attributes objectForKey:NSFileHFSTypeCode];
- type = [val intValue];
-JNF_COCOA_EXIT(env);
- return type;
-}
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: _getFileCreator
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileCreator
- (JNIEnv *env, jclass clz, jstring javaFilename)
-{
- jint creator = 0;
-JNF_COCOA_ENTER(env);
- NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
- NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
- NSNumber *val = [attributes objectForKey:NSFileHFSCreatorCode];
- creator = [val intValue];
-JNF_COCOA_EXIT(env);
- return creator;
-}
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: _findFolder
- * Signature: (SIZ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager__1findFolder__SIZ
-(JNIEnv *env, jclass clz, jshort domain, jint folderType, jboolean createIfNeeded)
-{
- jstring filename = nil;
-JNF_COCOA_ENTER(env);
-
- FSRef foundRef;
- createIfNeeded = createIfNeeded || (folderType == kTemporaryFolderType) || (folderType == kChewableItemsFolderType);
- if (FSFindFolder((SInt16)domain, (OSType)folderType, (Boolean)createIfNeeded, &foundRef) == noErr) {
- char path[PATH_MAX];
- if (FSRefMakePath(&foundRef, (UInt8 *)path, sizeof(path)) == noErr) {
- NSString *filenameString = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)];
- filename = JNFNormalizedJavaStringForPath(env, filenameString);
- }
- }
-
-JNF_COCOA_EXIT(env);
- return filename;
-}
-
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: _openURL
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1openURL
-(JNIEnv *env, jclass clz, jstring urlString)
-{
-JNF_COCOA_ENTER(env);
-
- NSURL *url = [NSURL URLWithString:JNFNormalizedNSStringForPath(env, urlString)];
-
- // Radar 3208005: Run this on the main thread; file:// style URLs will hang otherwise.
- [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
- [[NSWorkspace sharedWorkspace] openURL:url];
- }];
-
-JNF_COCOA_EXIT(env);
-}
-
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: getNativeResourceFromBundle
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativeResourceFromBundle
-(JNIEnv *env, jclass clz, jstring javaResourceName, jstring javaSubDirName, jstring javaTypeName)
-{
- jstring filename = NULL;
-JNF_COCOA_ENTER(env);
-
- NSString *resourceName = JNFNormalizedNSStringForPath(env, javaResourceName);
- NSString *subDirectory = JNFNormalizedNSStringForPath(env, javaSubDirName);
- NSString *typeName = JNFNormalizedNSStringForPath(env, javaTypeName);
-
- NSString *path = [[NSBundle mainBundle] pathForResource:resourceName
- ofType:typeName
- inDirectory:subDirectory];
-
- filename = JNFNormalizedJavaStringForPath(env, path);
-
-JNF_COCOA_EXIT(env);
- return filename;
-}
-
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: getNativePathToApplicationBundle
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativePathToApplicationBundle
-(JNIEnv *env, jclass clazz)
-{
- jstring filename = nil;
-JNF_COCOA_ENTER(env);
-
- NSBundle *mainBundle = [NSBundle mainBundle];
- filename = JNFNormalizedJavaStringForPath(env, [mainBundle bundlePath]);
-
-JNF_COCOA_EXIT(env);
- return filename;
-}
-
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: __moveToTrash
- * Signature: (Ljava/lang/String;)V
- */
-
-JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1moveToTrash
-(JNIEnv *env, jclass clz, jstring url)
-{
- __block jboolean returnValue = JNI_FALSE;
-JNF_COCOA_ENTER(env);
-
- NSString *path = JNFNormalizedNSStringForPath(env, url);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- NSInteger res = 0;
- [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation
- source:[path stringByDeletingLastPathComponent]
- destination:nil
- files:[NSArray arrayWithObject:[path lastPathComponent]]
- tag:&res];
- returnValue = (res == 0);
- }];
-
-JNF_COCOA_EXIT(env);
-
- return returnValue;
-}
-
-/*
- * Class: com_apple_eio_FileManager
- * Method: __revealInFinder
- * Signature: (Ljava/lang/String;)V
- */
-
-JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1revealInFinder
-(JNIEnv *env, jclass clz, jstring url)
-{
- __block jboolean returnValue = JNI_FALSE;
-JNF_COCOA_ENTER(env);
-
- NSString *path = JNFNormalizedNSStringForPath(env, url);
- [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
- returnValue = [[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:@""];
- }];
-
-JNF_COCOA_EXIT(env);
-
- return returnValue;
-}
--- a/jdk/src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m Tue Mar 08 12:11:07 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Must include this before JavaNativeFoundation.h to get jni.h from build
- */
-#include "jni.h"
-#include "jni_util.h"
-
-#import "com_apple_concurrent_LibDispatchNative.h"
-
-#import <dispatch/dispatch.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-/*
- * Declare library specific JNI_Onload entry if static build
- */
-DEF_STATIC_JNI_OnLoad
-
-/*
- * Class: com_apple_concurrent_LibDispatchNative
- * Method: nativeIsDispatchSupported
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeIsDispatchSupported
-(JNIEnv *env, jclass clazz)
-{
- return JNI_TRUE;
-}
-
-
-/*
- * Class: com_apple_concurrent_LibDispatchNative
- * Method: nativeGetMainQueue
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeGetMainQueue
-(JNIEnv *env, jclass clazz)
-{
- dispatch_queue_t queue = dispatch_get_main_queue();
- return ptr_to_jlong(queue);
-}
-
-
-/*
- * Class: com_apple_concurrent_LibDispatchNative
- * Method: nativeCreateConcurrentQueue
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeCreateConcurrentQueue
-(JNIEnv *env, jclass clazz, jint priority)
-{
- dispatch_queue_t queue = dispatch_get_global_queue((long)priority, 0);
- return ptr_to_jlong(queue);
-}
-
-
-/*
- * Class: com_apple_concurrent_LibDispatchNative
- * Method: nativeCreateSerialQueue
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeCreateSerialQueue
-(JNIEnv *env, jclass clazz, jstring name)
-{
- if (name == NULL) return 0L;
-
- jboolean isCopy;
- const char *queue_name = (*env)->GetStringUTFChars(env, name, &isCopy);
- dispatch_queue_t queue = dispatch_queue_create(queue_name, NULL);
- (*env)->ReleaseStringUTFChars(env, name, queue_name);
-
- return ptr_to_jlong(queue);
-}
-
-
-/*
- * Class: com_apple_concurrent_LibDispatchNative
- * Method: nativeReleaseQueue
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeReleaseQueue
-(JNIEnv *env, jclass clazz, jlong nativeQueue)
-{
- if (nativeQueue == 0L) return;
- dispatch_release((dispatch_queue_t)jlong_to_ptr(nativeQueue));
-}
-
-
-static JNF_CLASS_CACHE(jc_Runnable, "java/lang/Runnable");
-static JNF_MEMBER_CACHE(jm_run, jc_Runnable, "run", "()V");
-
-static void perform_dispatch(JNIEnv *env, jlong nativeQueue, jobject runnable, void (*dispatch_fxn)(dispatch_queue_t, dispatch_block_t))
-{
-JNF_COCOA_ENTER(env);
- dispatch_queue_t queue = (dispatch_queue_t)jlong_to_ptr(nativeQueue);
- if (queue == NULL) return; // shouldn't happen
-
- // create a global-ref around the Runnable, so it can be safely passed to the dispatch thread
- JNFJObjectWrapper *wrappedRunnable = [[JNFJObjectWrapper alloc] initWithJObject:runnable withEnv:env];
-
- dispatch_fxn(queue, ^{
- // attach the dispatch thread to the JVM if necessary, and get an env
- JNFThreadContext ctx = JNFThreadDetachOnThreadDeath | JNFThreadSetSystemClassLoaderOnAttach | JNFThreadAttachAsDaemon;
- JNIEnv *blockEnv = JNFObtainEnv(&ctx);
-
- JNF_COCOA_ENTER(blockEnv);
-
- // call the user's runnable
- JNFCallObjectMethod(blockEnv, [wrappedRunnable jObject], jm_run);
-
- // explicitly clear object while we have an env (it's cheaper that way)
- [wrappedRunnable setJObject:NULL withEnv:blockEnv];
-
- JNF_COCOA_EXIT(blockEnv);
-
- // let the env go, but leave the thread attached as a daemon
- JNFReleaseEnv(blockEnv, &ctx);
- });
-
- // release this thread's interest in the Runnable, the block
- // will have retained the it's own interest above
- [wrappedRunnable release];
-
-JNF_COCOA_EXIT(env);
-}
-
-
-/*
- * Class: com_apple_concurrent_LibDispatchNative
- * Method: nativeExecuteAsync
- * Signature: (JLjava/lang/Runnable;)V
- */
-JNIEXPORT void JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeExecuteAsync
-(JNIEnv *env, jclass clazz, jlong nativeQueue, jobject runnable)
-{
- // enqueues and returns
- perform_dispatch(env, nativeQueue, runnable, dispatch_async);
-}
-
-
-/*
- * Class: com_apple_concurrent_LibDispatchNative
- * Method: nativeExecuteSync
- * Signature: (JLjava/lang/Runnable;)V
- */
-JNIEXPORT void JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeExecuteSync
-(JNIEnv *env, jclass clazz, jlong nativeQueue, jobject runnable)
-{
- // blocks until the Runnable completes
- perform_dispatch(env, nativeQueue, runnable, dispatch_sync);
-}