diff options
author | nhauge | 2011-08-17 14:23:59 +0000 |
---|---|---|
committer | nhauge | 2011-08-17 14:23:59 +0000 |
commit | 0e0361e07e0bfb569c39909fab7f6f15dc0c7509 (patch) | |
tree | 5738d919f29eb80712186e55f6b8a4a30b666c38 /common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java | |
parent | 261cc2bbc946cf6df341380ac6995625fc82b04d (diff) | |
download | webtools.dali-0e0361e07e0bfb569c39909fab7f6f15dc0c7509.tar.gz webtools.dali-0e0361e07e0bfb569c39909fab7f6f15dc0c7509.tar.xz webtools.dali-0e0361e07e0bfb569c39909fab7f6f15dc0c7509.zip |
This commit was manufactured by cvs2svn to create tag 'v201108170000'.v201108170000
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java')
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java deleted file mode 100644 index e8e5064614..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * This implementation of the CommandExecutor interface allows the client to - * specify a different Command Executor for each thread. - */ -public class ThreadLocalCommandExecutor implements CommandExecutor { - protected final ThreadLocal<CommandExecutor> threadLocal; - protected final CommandExecutor defaultCommandExecutor; - - /** - * The default command executor simply executes the command directly. - */ - public ThreadLocalCommandExecutor() { - this(CommandExecutor.Default.instance()); - } - - public ThreadLocalCommandExecutor(CommandExecutor defaultCommandExecutor) { - super(); - this.defaultCommandExecutor = defaultCommandExecutor; - this.threadLocal = this.buildThreadLocal(); - } - - protected ThreadLocal<CommandExecutor> buildThreadLocal() { - return new ThreadLocal<CommandExecutor>(); - } - - public void execute(Command command) { - this.getThreadLocalCommandExecutor().execute(command); - } - - protected CommandExecutor getThreadLocalCommandExecutor() { - CommandExecutor ce = this.threadLocal.get(); - return (ce != null) ? ce : this.defaultCommandExecutor; - } - - /** - * Set the current thread's command executor to the specified value. - */ - public void set(CommandExecutor commandExecutor) { - this.threadLocal.set(commandExecutor); - } - - /** - * Return the string representation of the current thread's command - * executor. - */ - @Override - public String toString() { - return this.getThreadLocalCommandExecutor().toString(); - } - -} |