diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ThreadLocalCommandExecutor.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ThreadLocalCommandExecutor.java | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ThreadLocalCommandExecutor.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ThreadLocalCommandExecutor.java deleted file mode 100644 index 7cb49b4e93..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ThreadLocalCommandExecutor.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 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.utility.internal; - -import org.eclipse.jpt.utility.Command; -import org.eclipse.jpt.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.get().execute(command); - } - - protected CommandExecutor get() { - 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.get().toString(); - } - -} |