diff options
| author | Mario Torre <neugens@limasoftware.net> | 2007-11-23 22:02:15 +0000 |
|---|---|---|
| committer | Mario Torre <neugens@limasoftware.net> | 2007-11-23 22:02:15 +0000 |
| commit | cf5d4d7165840d9445ac4a263912731b98dd875f (patch) | |
| tree | 6c210d269d4b1d434731de72de5d64180aacc72e /gnu/classpath/toolkit/DefaultDaemonThreadFactory.java | |
| parent | 3eae71b2d5a285e973dbd882593a61c25a2598ea (diff) | |
| download | classpath-cf5d4d7165840d9445ac4a263912731b98dd875f.tar.gz | |
2007-11-23 Mario Torre <neugens@limasoftware.net>
* gnu/java/util/prefs/EventDispatcher.java: class removed.
* gnu/classpath/toolkit/DefaultDaemonThreadFactory.java: new file.
* java/util/prefs/AbstractPreferences.java: (fire(PreferenceChangeEvent)):
Use DefaultDaemonThreadFactory and Executors.newSingleThreadExecutor
instead of EventDispatcher. Import statement refactored accordingly.
Also refactored to use 1.5 enhanced for loop and generics.
(fire(NodeChangeEvent, boolean)): likewise.
* gnu/java/util/prefs/GConfBasedPreferences.java (childSpi):
removed startWatchingNode call.
* gnu/java/util/prefs/gconf/GConfNativePeer.java:
(GConfNativePeer): removed use of semaphore.
(gconf_all_nodes): method name shortened, renamed from
gconf_client_all_nodes (removed client_ from method signature) and
declared synchronized.
(gconf_suggest_sync): likewise.
(gconf_get_string): likewise.
(gconf_unescape_key): likewise.
(gconf_set_string): likewise.
(gconf_escape_key): likewise.
(gconf_all_keys): likewise.
(gconf_dir_exists): likewise.
(getKeys): refactored to use new native method name.
(getKey): likewise.
(setString): likewise.
(getChildrenNodes): likewise.
(unset): likewise.
(suggestSync): likewise.
(finalize): likewise.
(nodeExist): likewise.
(gconf_client_add_dir): removed, not needed anymore.
(gconf_client_remove_dir): likewise.
(startWatchingNode): likewise.
(stopWatchingNode): likewise.
* native/jni/conf-peer/GConfNativePeer.c:
All native methods renamed to match changes in GConfNativePeer.java
Now use GConfEngine instead of GConfClient.
Removed gdk_thread_enter/leave locking from all methods.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1add_1dir):
removed.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1dir_1exists):
likewise.
* include/gnu_java_util_prefs_gconf_GConfNativePeer.h: regenerated.
Diffstat (limited to 'gnu/classpath/toolkit/DefaultDaemonThreadFactory.java')
| -rw-r--r-- | gnu/classpath/toolkit/DefaultDaemonThreadFactory.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gnu/classpath/toolkit/DefaultDaemonThreadFactory.java b/gnu/classpath/toolkit/DefaultDaemonThreadFactory.java new file mode 100644 index 000000000..cb56c7641 --- /dev/null +++ b/gnu/classpath/toolkit/DefaultDaemonThreadFactory.java @@ -0,0 +1,59 @@ +/* DefaultDaemonThreadFactory.java -- Factory for Deamon Threads. + + Copyright (C) 2007 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath 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 for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.classpath.toolkit; + +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory;; + +/** + * Create a new thread using all the default settings as returned by + * <code>Executors.defaultThreadFactory()</code> plus calling + * <code>thread.setDaemon(true)</code> on the newly created thread. + * + * @author Mario Torre <neugens@limasoftware.net> + */ +public class DefaultDaemonThreadFactory implements ThreadFactory +{ + public Thread newThread(Runnable r) + { + Thread thread = Executors.defaultThreadFactory().newThread(r); + thread.setDaemon(true); + return thread; + } +} |
