Return-Path: X-Original-To: apmail-aurora-commits-archive@minotaur.apache.org Delivered-To: apmail-aurora-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2053617DB4 for ; Tue, 1 Sep 2015 17:24:13 +0000 (UTC) Received: (qmail 67289 invoked by uid 500); 1 Sep 2015 17:24:13 -0000 Delivered-To: apmail-aurora-commits-archive@aurora.apache.org Received: (qmail 67254 invoked by uid 500); 1 Sep 2015 17:24:12 -0000 Mailing-List: contact commits-help@aurora.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aurora.apache.org Delivered-To: mailing list commits@aurora.apache.org Received: (qmail 67245 invoked by uid 99); 1 Sep 2015 17:24:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2015 17:24:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A25E9DFFA2; Tue, 1 Sep 2015 17:24:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zmanji@apache.org To: commits@aurora.apache.org Message-Id: <2a33658083d64553acdcc9173aeed74b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: aurora git commit: Remove unused commons classes. Date: Tue, 1 Sep 2015 17:24:12 +0000 (UTC) Repository: aurora Updated Branches: refs/heads/master f28564782 -> 5a7bd347d Remove unused commons classes. Reviewed at https://reviews.apache.org/r/37988/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/5a7bd347 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/5a7bd347 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/5a7bd347 Branch: refs/heads/master Commit: 5a7bd347d838e16ec52a3d16d2a0b3bdedf15ce9 Parents: f285647 Author: Zameer Manji Authored: Tue Sep 1 10:24:03 2015 -0700 Committer: Zameer Manji Committed: Tue Sep 1 10:24:03 2015 -0700 ---------------------------------------------------------------------- .../aurora/common/base/MoreSuppliers.java | 104 ----------- .../common/testing/easymock/IterableEquals.java | 90 ---------- .../common/thrift/testing/TestThriftTypes.java | 172 ------------------- .../ExceptionHandlingExecutorService.java | 91 ---------- ...ceptionHandlingScheduledExecutorService.java | 118 ------------- .../concurrent/ForwardingExecutorService.java | 101 ----------- .../common/util/concurrent/MoreExecutors.java | 122 ------------- .../common/util/concurrent/TaskConverter.java | 93 ---------- .../aurora/common/base/MoreSuppliersTest.java | 108 ------------ .../testing/easymock/IterableEqualsTest.java | 62 ------- .../ExceptionHandlingExecutorServiceTest.java | 117 ------------- ...ionHandlingScheduledExecutorServiceTest.java | 127 -------------- .../scheduler/http/JettyServerModule.java | 4 +- 13 files changed, 2 insertions(+), 1307 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/base/MoreSuppliers.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/base/MoreSuppliers.java b/commons/src/main/java/org/apache/aurora/common/base/MoreSuppliers.java deleted file mode 100644 index c120d1d..0000000 --- a/commons/src/main/java/org/apache/aurora/common/base/MoreSuppliers.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.base; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; - -import javax.annotation.Nullable; - -import com.google.common.base.Preconditions; -import com.google.common.base.Supplier; - -/** - * Utility methods for working with Suppliers. - * - * @author John Sirois - */ -public final class MoreSuppliers { - - private MoreSuppliers() { - // utility - } - - /** - * Creates a Supplier that uses the no-argument constructor of {@code type} to supply new - * instances. - * - * @param type the type of object this supplier creates - * @param the type of object this supplier creates - * @return a Supplier that created a new obeject of type T on each call to {@link Supplier#get()} - * @throws IllegalArgumentException if the given {@code type} does not have a no-arg constructor - */ - public static Supplier of(final Class type) { - Preconditions.checkNotNull(type); - - try { - final Constructor constructor = getNoArgConstructor(type); - return new Supplier() { - @Override public T get() { - try { - return constructor.newInstance(); - } catch (InstantiationException e) { - throw instantiationFailed(e, type); - } catch (IllegalAccessException e) { - throw instantiationFailed(e, type); - } catch (InvocationTargetException e) { - throw instantiationFailed(e, type); - } - } - }; - } catch (NoSuchMethodException e) { - throw new IllegalArgumentException("No accessible no-arg constructor for " + type, e); - } - } - - private static RuntimeException instantiationFailed(Exception cause, Object type) { - return new RuntimeException("Could not create a new instance of type: " + type, cause); - } - - private static Constructor getNoArgConstructor(Class type) - throws NoSuchMethodException { - - try { - Constructor constructor = type.getConstructor(); - if (!MoreSuppliers.class.getPackage().equals(type.getPackage()) - && !Modifier.isPublic(type.getModifiers())) { - // Handle a public no-args constructor in a non-public class - constructor.setAccessible(true); - } - return constructor; - } catch (NoSuchMethodException e) { - Constructor declaredConstructor = type.getDeclaredConstructor(); - declaredConstructor.setAccessible(true); - return declaredConstructor; - } - } - - /** - * Returns an {@link ExceptionalSupplier} that always supplies {@code item} without error. - * - * @param item The item to supply. - * @param The type of item being supplied. - * @return A supplier that will always supply {@code item}. - */ - public static Supplier ofInstance(@Nullable final T item) { - return new Supplier() { - @Override public T get() { - return item; - } - }; - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/testing/easymock/IterableEquals.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/testing/easymock/IterableEquals.java b/commons/src/main/java/org/apache/aurora/common/testing/easymock/IterableEquals.java deleted file mode 100644 index bcd0a15..0000000 --- a/commons/src/main/java/org/apache/aurora/common/testing/easymock/IterableEquals.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.testing.easymock; - -import java.util.Collection; -import java.util.List; - -import com.google.common.collect.HashMultiset; -import com.google.common.collect.Iterables; -import com.google.common.collect.Multiset; - -import org.easymock.IArgumentMatcher; - -import static org.easymock.EasyMock.reportMatcher; - -/** - * This EasyMock argument matcher tests Iterables for equality irrespective of order. - * - * @param type argument for the Iterables being matched. - */ -public class IterableEquals implements IArgumentMatcher { - private final Multiset elements = HashMultiset.create(); - - /** - * Constructs an IterableEquals object that tests for equality against the specified expected - * Iterable. - * - * @param expected an Iterable containing the elements that are expected, in any order. - */ - public IterableEquals(Iterable expected) { - Iterables.addAll(elements, expected); - } - - @Override - public boolean matches(Object observed) { - if (observed instanceof Iterable) { - Multiset observedElements = HashMultiset.create((Iterable) observed); - return elements.equals(observedElements); - } - return false; - } - - @Override - public void appendTo(StringBuffer buffer) { - buffer.append("eqIterable(").append(elements).append(")"); - } - - /** - * When used in EasyMock expectations, this matches an Iterable having the same elements in any - * order. - * - * @return null, to avoid a compile time error. - */ - public static Iterable eqIterable(Iterable in) { - reportMatcher(new IterableEquals(in)); - return null; - } - - /** - * When used in EasyMock expectations, this matches a List having the same elements in any order. - * - * @return null, to avoid a compile time error. - */ - public static List eqList(Iterable in) { - reportMatcher(new IterableEquals(in)); - return null; - } - - /** - * When used in EasyMock expectations, this matches a Collection having the same elements in any - * order. - * - * @return null, to avoid a compile time error. - */ - public static Collection eqCollection(Iterable in) { - reportMatcher(new IterableEquals(in)); - return null; - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java b/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java deleted file mode 100644 index 1699416..0000000 --- a/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.thrift.testing; - -import java.util.Map; -import java.util.Map.Entry; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Maps; - -import org.apache.thrift.TBase; -import org.apache.thrift.TBaseHelper; -import org.apache.thrift.TException; -import org.apache.thrift.TFieldIdEnum; -import org.apache.thrift.protocol.TField; -import org.apache.thrift.protocol.TProtocol; -import org.apache.thrift.protocol.TStruct; -import org.apache.thrift.protocol.TType; - -/** - * Hand-coded thrift types for use in tests. - * - * @author John Sirois - */ -public class TestThriftTypes { - public static class Field implements TFieldIdEnum { - private static final Map FIELDS_BY_ID = Maps.newHashMap(); - public static Field forId(int id) { - Field field = FIELDS_BY_ID.get((short) id); - Preconditions.checkArgument(field != null, "No Field with id: %s", id); - return field; - } - - public static final Field NAME = new Field((short) 0, "name"); - public static final Field VALUE = new Field((short) 1, "value"); - - private final short fieldId; - private final String fieldName; - - private Field(short fieldId, String fieldName) { - this.fieldId = fieldId; - this.fieldName = fieldName; - FIELDS_BY_ID.put(fieldId, this); - } - - @Override - public short getThriftFieldId() { - return fieldId; - } - - @Override - public String getFieldName() { - return fieldName; - } - } - - public static class Struct implements TBase { - private final Map fields = Maps.newHashMap(); - - public Struct() {} - - public Struct(String name, String value) { - fields.put(Field.NAME, name); - fields.put(Field.VALUE, value); - } - - public String getName() { - Object name = getFieldValue(Field.NAME); - return name == null ? null : (String) name; - } - - public String getValue() { - Object value = getFieldValue(Field.VALUE); - return value == null ? null : (String) value; - } - - @Override - public void read(TProtocol tProtocol) throws TException { - tProtocol.readStructBegin(); - TField field; - while((field = tProtocol.readFieldBegin()).type != TType.STOP) { - fields.put(fieldForId(field.id), tProtocol.readString()); - tProtocol.readFieldEnd(); - } - tProtocol.readStructEnd(); - } - - @Override - public void write(TProtocol tProtocol) throws TException { - tProtocol.writeStructBegin(new TStruct("Field")); - for (Entry entry : fields.entrySet()) { - Field field = entry.getKey(); - tProtocol.writeFieldBegin( - new TField(field.getFieldName(), TType.STRING, field.getThriftFieldId())); - tProtocol.writeString(entry.getValue().toString()); - tProtocol.writeFieldEnd(); - } - tProtocol.writeFieldStop(); - tProtocol.writeStructEnd(); - } - - @Override - public boolean isSet(Field field) { - return fields.containsKey(field); - } - - @Override - public Object getFieldValue(Field field) { - return fields.get(field); - } - - @Override - public void setFieldValue(Field field, Object o) { - fields.put(field, o); - } - - @Override - public TBase deepCopy() { - Struct struct = new Struct(); - struct.fields.putAll(fields); - return struct; - } - - @Override - public int compareTo(Struct other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison; - - lastComparison = Integer.valueOf(fields.size()).compareTo(other.fields.size()); - if (lastComparison != 0) { - return lastComparison; - } - - for (Map.Entry entry : fields.entrySet()) { - Field field = entry.getKey(); - lastComparison = Boolean.TRUE.compareTo(other.isSet(field)); - if (lastComparison != 0) { - return lastComparison; - } - lastComparison = TBaseHelper.compareTo(entry.getValue(), other.getFieldValue(field)); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - @Override - public void clear() { - fields.clear(); - } - - @Override - public Field fieldForId(int fieldId) { - return Field.forId(fieldId); - } - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorService.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorService.java b/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorService.java deleted file mode 100644 index df11d6d..0000000 --- a/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorService.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util.concurrent; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import com.google.common.base.Preconditions; -import com.google.common.base.Supplier; - -/** - * An executor service that delegates to another executor service, invoking an uncaught - * exception handler if any exceptions are thrown in submitted work. - * - * @see MoreExecutors - */ -class ExceptionHandlingExecutorService extends ForwardingExecutorService { - private final Supplier handler; - - ExceptionHandlingExecutorService( - ExecutorService delegate, - Supplier handler) { - - super(delegate); - this.handler = Preconditions.checkNotNull(handler); - } - - @Override - public Future submit(Callable task) { - return super.submit(TaskConverter.alertingCallable(task, handler)); - } - - @Override - public Future submit(Runnable task, T result) { - return super.submit(TaskConverter.alertingRunnable(task, handler), result); - } - - @Override - public Future submit(Runnable task) { - return super.submit(TaskConverter.alertingRunnable(task, handler)); - } - - @Override - public List> invokeAll( - Collection> tasks) throws InterruptedException { - - return super.invokeAll(TaskConverter.alertingCallables(tasks, handler)); - } - - @Override - public List> invokeAll( - Collection> tasks, - long timeout, - TimeUnit unit) throws InterruptedException { - - return super.invokeAll(TaskConverter.alertingCallables(tasks, handler), timeout, unit); - } - - @Override - public T invokeAny( - Collection> tasks) throws InterruptedException, ExecutionException { - - return super.invokeAny(TaskConverter.alertingCallables(tasks, handler)); - } - - @Override - public T invokeAny( - Collection> tasks, - long timeout, - TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { - - return super.invokeAny(TaskConverter.alertingCallables(tasks, handler), timeout, unit); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorService.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorService.java b/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorService.java deleted file mode 100644 index fa0bd7d..0000000 --- a/commons/src/main/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorService.java +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util.concurrent; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import com.google.common.base.Supplier; - -/** - * A scheduled executor service that delegates to another executor service, invoking an uncaught - * exception handler if any exceptions are thrown in submitted work. - * - * @see MoreExecutors - */ -class ExceptionHandlingScheduledExecutorService - extends ForwardingExecutorService - implements ScheduledExecutorService { - private final Supplier handler; - - /** - * Construct a {@link ScheduledExecutorService} with a supplier of - * {@link Thread.UncaughtExceptionHandler} that handles exceptions thrown from submitted work. - */ - ExceptionHandlingScheduledExecutorService( - ScheduledExecutorService delegate, - Supplier handler) { - super(delegate); - this.handler = handler; - } - - @Override - public ScheduledFuture schedule(Runnable runnable, long delay, TimeUnit timeUnit) { - return delegate.schedule(TaskConverter.alertingRunnable(runnable, handler), delay, timeUnit); - } - - @Override - public ScheduledFuture schedule(Callable callable, long delay, TimeUnit timeUnit) { - return delegate.schedule(TaskConverter.alertingCallable(callable, handler), delay, timeUnit); - } - - @Override - public ScheduledFuture scheduleAtFixedRate( - Runnable runnable, long initialDelay, long period, TimeUnit timeUnit) { - return delegate.scheduleAtFixedRate( - TaskConverter.alertingRunnable(runnable, handler), initialDelay, period, timeUnit); - } - - @Override - public ScheduledFuture scheduleWithFixedDelay( - Runnable runnable, long initialDelay, long delay, TimeUnit timeUnit) { - return delegate.scheduleWithFixedDelay( - TaskConverter.alertingRunnable(runnable, handler), initialDelay, delay, timeUnit); - } - - @Override - public Future submit(Callable task) { - return delegate.submit(TaskConverter.alertingCallable(task, handler)); - } - - @Override - public Future submit(Runnable task, T result) { - return delegate.submit(TaskConverter.alertingRunnable(task, handler), result); - } - - @Override - public Future submit(Runnable task) { - return delegate.submit(TaskConverter.alertingRunnable(task, handler)); - } - - @Override - public List> invokeAll(Collection> tasks) - throws InterruptedException { - return delegate.invokeAll(TaskConverter.alertingCallables(tasks, handler)); - } - - @Override - public List> invokeAll( - Collection> tasks, long timeout, TimeUnit unit) - throws InterruptedException { - return delegate.invokeAll(TaskConverter.alertingCallables(tasks, handler), timeout, unit); - } - - @Override - public T invokeAny(Collection> tasks) - throws InterruptedException, ExecutionException { - return delegate.invokeAny(TaskConverter.alertingCallables(tasks, handler)); - } - - @Override - public T invokeAny(Collection> tasks, long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - return delegate.invokeAny(TaskConverter.alertingCallables(tasks, handler), timeout, unit); - } - - @Override - public void execute(Runnable command) { - delegate.execute(TaskConverter.alertingRunnable(command, handler)); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/util/concurrent/ForwardingExecutorService.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/util/concurrent/ForwardingExecutorService.java b/commons/src/main/java/org/apache/aurora/common/util/concurrent/ForwardingExecutorService.java deleted file mode 100644 index b8a0fd9..0000000 --- a/commons/src/main/java/org/apache/aurora/common/util/concurrent/ForwardingExecutorService.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util.concurrent; - -import com.google.common.base.Preconditions; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -/** - * An executor service that forwards all calls to another executor service. Subclasses should - * override one or more methods to modify the behavior of the backing executor service as desired - * per the decorator pattern. - * - * @author John Sirois - */ -public class ForwardingExecutorService implements ExecutorService { - protected final T delegate; - - public ForwardingExecutorService(T delegate) { - Preconditions.checkNotNull(delegate); - this.delegate = delegate; - } - - public void shutdown() { - delegate.shutdown(); - } - - public List shutdownNow() { - return delegate.shutdownNow(); - } - - public boolean isShutdown() { - return delegate.isShutdown(); - } - - public boolean isTerminated() { - return delegate.isTerminated(); - } - - public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { - return delegate.awaitTermination(timeout, unit); - } - - public Future submit(Callable task) { - return delegate.submit(task); - } - - public Future submit(Runnable task, T result) { - return delegate.submit(task, result); - } - - public Future submit(Runnable task) { - return delegate.submit(task); - } - - public List> invokeAll(Collection> tasks) - throws InterruptedException { - - return delegate.invokeAll(tasks); - } - - public List> invokeAll(Collection> tasks, long timeout, - TimeUnit unit) throws InterruptedException { - - return delegate.invokeAll(tasks, timeout, unit); - } - - public T invokeAny(Collection> tasks) - throws InterruptedException, ExecutionException { - - return delegate.invokeAny(tasks); - } - - public T invokeAny(Collection> tasks, long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - - return delegate.invokeAny(tasks, timeout, unit); - } - - public void execute(Runnable command) { - delegate.execute(command); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/util/concurrent/MoreExecutors.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/util/concurrent/MoreExecutors.java b/commons/src/main/java/org/apache/aurora/common/util/concurrent/MoreExecutors.java deleted file mode 100644 index 630b9aa..0000000 --- a/commons/src/main/java/org/apache/aurora/common/util/concurrent/MoreExecutors.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util.concurrent; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ScheduledExecutorService; - -import com.google.common.base.Preconditions; -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; - -/** - * Utility class that provides factory functions to decorate - * {@link java.util.concurrent.ExecutorService}s. - */ -public final class MoreExecutors { - private MoreExecutors() { - // utility - } - - /** - * Returns a {@link ExecutorService} that passes uncaught exceptions to - * {@link java.lang.Thread.UncaughtExceptionHandler}. - *

- * This may be useful because {@link java.util.concurrent.ThreadPoolExecutor} and - * {@link java.util.concurrent.ScheduledThreadPoolExecutor} provide no built-in propagation of - * unchecked exceptions thrown from submitted work. Some users are surprised to find that - * even the default uncaught exception handler is not invoked. - * - * @param executorService delegate - * @param uncaughtExceptionHandler exception handler that will receive exceptions generated - * from executor tasks. - * @return a decorated executor service - */ - public static ExecutorService exceptionHandlingExecutor( - ExecutorService executorService, - Thread.UncaughtExceptionHandler uncaughtExceptionHandler) { - - Preconditions.checkNotNull(uncaughtExceptionHandler); - return new ExceptionHandlingExecutorService( - executorService, Suppliers.ofInstance(uncaughtExceptionHandler)); - } - - /** - * Returns a {@link ExecutorService} that passes uncaught exceptions to - * a handler returned by Thread.currentThread().getDefaultUncaughtExceptionHandler() - * at the time the exception is thrown. - * - * @see MoreExecutors#exceptionHandlingExecutor(java.util.concurrent.ExecutorService, - * Thread.UncaughtExceptionHandler) - * @param executorService delegate - * @return a decorated executor service - */ - public static ExecutorService exceptionHandlingExecutor(ExecutorService executorService) { - return new ExceptionHandlingExecutorService( - executorService, - new Supplier() { - @Override - public Thread.UncaughtExceptionHandler get() { - return Thread.currentThread().getUncaughtExceptionHandler(); - } - }); - } - - /** - * Returns a {@link ScheduledExecutorService} that passes uncaught exceptions to - * {@link java.lang.Thread.UncaughtExceptionHandler}. - *

- * This may be useful because {@link java.util.concurrent.ThreadPoolExecutor} and - * {@link java.util.concurrent.ScheduledThreadPoolExecutor} provide no built-in propagation of - * unchecked exceptions thrown from submitted work. Some users are surprised to find that - * even the default uncaught exception handler is not invoked. - * - * @param executorService delegate - * @param uncaughtExceptionHandler exception handler that will receive exceptions generated - * from executor tasks. - * @return a decorated executor service - */ - public static ScheduledExecutorService exceptionHandlingExecutor( - ScheduledExecutorService executorService, - Thread.UncaughtExceptionHandler uncaughtExceptionHandler) { - - Preconditions.checkNotNull(uncaughtExceptionHandler); - return new ExceptionHandlingScheduledExecutorService( - executorService, - Suppliers.ofInstance(uncaughtExceptionHandler)); - } - - /** - * Returns a {@link ScheduledExecutorService} that passes uncaught exceptions to - * a handler returned by Thread.currentThread().getDefaultUncaughtExceptionHandler() - * at the time the exception is thrown. - * - * @see MoreExecutors#exceptionHandlingExecutor(java.util.concurrent.ScheduledExecutorService, - * Thread.UncaughtExceptionHandler) - * @param executorService delegate - * @return a decorated executor service - */ - public static ScheduledExecutorService exceptionHandlingExecutor( - ScheduledExecutorService executorService) { - - return new ExceptionHandlingScheduledExecutorService( - executorService, - new Supplier() { - @Override - public Thread.UncaughtExceptionHandler get() { - return Thread.currentThread().getUncaughtExceptionHandler(); - } - }); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/main/java/org/apache/aurora/common/util/concurrent/TaskConverter.java ---------------------------------------------------------------------- diff --git a/commons/src/main/java/org/apache/aurora/common/util/concurrent/TaskConverter.java b/commons/src/main/java/org/apache/aurora/common/util/concurrent/TaskConverter.java deleted file mode 100644 index 5971e37..0000000 --- a/commons/src/main/java/org/apache/aurora/common/util/concurrent/TaskConverter.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util.concurrent; - -import java.util.Collection; -import java.util.concurrent.Callable; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import com.google.common.base.Throwables; -import com.google.common.collect.Collections2; - -final class TaskConverter { - private TaskConverter() { - // utility - } - - /** - * Returns a wrapped {@link Runnable} that passes uncaught exceptions thrown from the - * original Runnable to {@link Thread.UncaughtExceptionHandler}. - * - * @param runnable runnable to be wrapped - * @param handler exception handler that will receive exceptions generated in the runnable - * @return wrapped runnable - */ - static Runnable alertingRunnable( - final Runnable runnable, - final Supplier handler) { - - return new Runnable() { - @Override - public void run() { - try { - runnable.run(); - } catch (Throwable t) { - handler.get().uncaughtException(Thread.currentThread(), t); - throw Throwables.propagate(t); - } - } - }; - } - - /** - * Returns a wrapped {@link java.util.concurrent.Callable} that passes uncaught exceptions - * thrown from the original Callable to {@link Thread.UncaughtExceptionHandler}. - * - * @param callable callable to be wrapped - * @param handler exception handler that will receive exceptions generated in the callable - * @return wrapped callable - */ - static Callable alertingCallable( - final Callable callable, - final Supplier handler) { - - return new Callable() { - @Override - public V call() throws Exception { - try { - return callable.call(); - } catch (Throwable t) { - handler.get().uncaughtException(Thread.currentThread(), t); - throw Throwables.propagate(t); - } - } - }; - } - - /* - * Calls #alertingCallable on a collection of callables - */ - static Collection> alertingCallables( - Collection> callables, - final Supplier handler) { - - return Collections2.transform(callables, new Function, Callable>() { - @Override - public Callable apply(Callable callable) { - return alertingCallable(callable, handler); - } - }); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/test/java/org/apache/aurora/common/base/MoreSuppliersTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/base/MoreSuppliersTest.java b/commons/src/test/java/org/apache/aurora/common/base/MoreSuppliersTest.java deleted file mode 100644 index 7c67dee..0000000 --- a/commons/src/test/java/org/apache/aurora/common/base/MoreSuppliersTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.base; - -import com.google.common.base.Preconditions; -import com.google.common.base.Supplier; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; - -/** - * @author John Sirois - */ -public class MoreSuppliersTest { - private static final class PrivateClassPublicConstructor { - public PrivateClassPublicConstructor() { } - } - - private static final class PrivateClassPrivateConstructor { - private PrivateClassPrivateConstructor() { } - } - - public static final class PublicClassPublicConstructor { - public PublicClassPublicConstructor() { } - } - - public static final class PublicClassPrivateConstructor { - private PublicClassPrivateConstructor() { } - } - - @Test - public void testOfVisibilitiesHandled() throws Exception { - testOfForType(PrivateClassPublicConstructor.class); - testOfForType(PrivateClassPrivateConstructor.class); - testOfForType(PublicClassPublicConstructor.class); - testOfForType(PublicClassPrivateConstructor.class); - } - - private void testOfForType(Class type) { - Supplier supplier = MoreSuppliers.of(type); - Object object = supplier.get(); - assertNotNull(object); - assertNotSame(object, supplier.get()); - } - - static class NoNoArgConstructor { - NoNoArgConstructor(String unused) { } - } - - @Test(expected = NullPointerException.class) - public void testNullArgumentRejected() { - MoreSuppliers.of(null); - } - - @Test(expected = IllegalArgumentException.class) - public void testNoNoArgFailsFast() { - MoreSuppliers.of(NoNoArgConstructor.class); - } - - @Test - public void testOfInstance() { - class ValueEquals { - private final String value; - - ValueEquals(String value) { - this.value = Preconditions.checkNotNull(value); - } - - @Override - public boolean equals(Object o) { - return value.equals(((ValueEquals) o).value); - } - - @Override - public int hashCode() { - return value.hashCode(); - } - } - - Supplier nullSupplier = MoreSuppliers.ofInstance(new ValueEquals("jake")); - ValueEquals actual = nullSupplier.get(); - assertEquals(new ValueEquals("jake"), actual); - assertSame(actual, nullSupplier.get()); - } - - @Test - public void testOfInstanceNullable() { - Supplier nullSupplier = MoreSuppliers.ofInstance(null); - assertNull(nullSupplier.get()); - assertNull(nullSupplier.get()); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/test/java/org/apache/aurora/common/testing/easymock/IterableEqualsTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/testing/easymock/IterableEqualsTest.java b/commons/src/test/java/org/apache/aurora/common/testing/easymock/IterableEqualsTest.java deleted file mode 100644 index 0196616..0000000 --- a/commons/src/test/java/org/apache/aurora/common/testing/easymock/IterableEqualsTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.testing.easymock; - -import java.util.Collection; -import java.util.List; - -import com.google.common.collect.ImmutableList; - -import org.junit.Before; -import org.junit.Test; - -import static org.easymock.EasyMock.expect; - -public class IterableEqualsTest extends EasyMockTest { - private static final List TEST = ImmutableList.of(1, 2, 3, 2); - private static final String OK = "ok"; - private Thing thing; - - public interface Thing { - String testIterable(Iterable input); - String testCollection(Collection input); - String testList(List input); - } - - @Before - public void setUp() { - thing = createMock(Thing.class); - } - - @Test - public void testIterableEquals() { - expect(thing.testIterable(IterableEquals.eqIterable(TEST))).andReturn(OK); - control.replay(); - thing.testIterable(ImmutableList.of(3, 2, 2, 1)); - } - - @Test - public void testCollectionEquals() { - expect(thing.testCollection(IterableEquals.eqCollection(TEST))).andReturn(OK); - control.replay(); - thing.testCollection(ImmutableList.of(3, 2, 2, 1)); - } - - @Test - public void testListEquals() { - expect(thing.testList(IterableEquals.eqList(TEST))).andReturn(OK); - control.replay(); - thing.testList(ImmutableList.of(3, 2, 2, 1)); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorServiceTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorServiceTest.java b/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorServiceTest.java deleted file mode 100644 index 722f1cc..0000000 --- a/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingExecutorServiceTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util.concurrent; - -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import com.google.common.util.concurrent.ThreadFactoryBuilder; - -import org.junit.Before; -import org.junit.Test; - -import org.apache.aurora.common.quantity.Amount; -import org.apache.aurora.common.quantity.Time; -import org.apache.aurora.common.testing.easymock.EasyMockTest; - -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -public class ExceptionHandlingExecutorServiceTest extends EasyMockTest { - private static final RuntimeException EXCEPTION = new RuntimeException(); - - private ExecutorService executorService; - private Thread.UncaughtExceptionHandler signallingHandler; - - @Before - public void setUp() throws Exception { - signallingHandler = createMock(Thread.UncaughtExceptionHandler.class); - executorService = MoreExecutors.exceptionHandlingExecutor( - Executors.newCachedThreadPool(new ThreadFactoryBuilder() - .setNameFormat("ExceptionHandlingExecutorServiceTest-%d") - .build()), - signallingHandler); - - ExecutorServiceShutdown executorServiceShutdown = new ExecutorServiceShutdown( - executorService, Amount.of(3L, Time.SECONDS)); - addTearDown(executorServiceShutdown::execute); - } - - @Test - public void testSubmitRunnable() throws Exception { - Runnable runnable = createMock(Runnable.class); - runnable.run(); - - control.replay(); - - executorService.submit(runnable).get(); - } - - @Test - public void testSubmitFailingRunnable() throws Exception { - signallingHandler.uncaughtException(anyObject(Thread.class), eq(EXCEPTION)); - Runnable runnable = createMock(Runnable.class); - runnable.run(); - expectLastCall().andThrow(EXCEPTION); - - control.replay(); - - try { - executorService.submit(runnable).get(); - fail(EXCEPTION.getClass().getSimpleName() + " should be thrown."); - } catch (ExecutionException e) { - assertEquals(EXCEPTION, e.getCause()); - } - } - - @Test - public void testSubmitCallable() throws Exception { - Integer returnValue = 123; - Callable callable = createMock(new Clazz>() {}); - callable.call(); - expectLastCall().andReturn(returnValue); - - control.replay(); - - assertEquals(returnValue, executorService.submit(callable).get()); - } - - @Test - public void testSubmitFailingCallable() throws Exception { - signallingHandler.uncaughtException(anyObject(Thread.class), eq(EXCEPTION)); - Callable callable = createMock(new Clazz>() {}); - expect(callable.call()).andThrow(EXCEPTION); - - control.replay(); - - try { - executorService.submit(callable).get(); - fail(EXCEPTION.getClass().getSimpleName() + " should be thrown."); - } catch (ExecutionException e) { - assertEquals(EXCEPTION, e.getCause()); - } - } - - @Test(expected = NullPointerException.class) - public void testNullHandler() throws Exception { - control.replay(); - MoreExecutors.exceptionHandlingExecutor(executorService, null); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorServiceTest.java ---------------------------------------------------------------------- diff --git a/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorServiceTest.java b/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorServiceTest.java deleted file mode 100644 index 3b2c96b..0000000 --- a/commons/src/test/java/org/apache/aurora/common/util/concurrent/ExceptionHandlingScheduledExecutorServiceTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aurora.common.util.concurrent; - -import java.lang.Exception; -import java.lang.NullPointerException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import org.junit.Before; -import org.junit.Test; - -import org.apache.aurora.common.quantity.Amount; -import org.apache.aurora.common.quantity.Time; -import org.apache.aurora.common.testing.easymock.EasyMockTest; - -import static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -public class ExceptionHandlingScheduledExecutorServiceTest extends EasyMockTest { - private static final RuntimeException EXCEPTION = new RuntimeException(); - - private ScheduledExecutorService executorService; - private Thread.UncaughtExceptionHandler signallingHandler; - - @Before - public void setUp() throws Exception { - signallingHandler = createMock(Thread.UncaughtExceptionHandler.class); - executorService = MoreExecutors.exceptionHandlingExecutor( - Executors.newSingleThreadScheduledExecutor(), signallingHandler); - - ExecutorServiceShutdown executorServiceShutdown = new ExecutorServiceShutdown( - executorService, Amount.of(3L, Time.SECONDS)); - addTearDown(executorServiceShutdown::execute); - } - - @Test - public void testSubmitRunnable() throws Exception { - signallingHandler.uncaughtException(anyObject(Thread.class), eq(EXCEPTION)); - Runnable runnable = createMock(Runnable.class); - runnable.run(); - expectLastCall().andThrow(EXCEPTION); - - control.replay(); - - try { - executorService.submit(runnable).get(); - fail(EXCEPTION.getClass().getSimpleName() + " should be thrown."); - } catch (ExecutionException e) { - assertEquals(EXCEPTION, e.getCause()); - } - } - - @Test - public void testSubmitCallable() throws Exception { - signallingHandler.uncaughtException(anyObject(Thread.class), eq(EXCEPTION)); - Callable callable = createMock(new Clazz>() {}); - expect(callable.call()).andThrow(EXCEPTION); - - control.replay(); - - try { - executorService.submit(callable).get(); - fail(EXCEPTION.getClass().getSimpleName() + " should be thrown."); - } catch (ExecutionException e) { - assertEquals(EXCEPTION, e.getCause()); - } - } - - @Test - public void testScheduleAtFixedRate() throws Exception { - signallingHandler.uncaughtException(anyObject(Thread.class), eq(EXCEPTION)); - Runnable runnable = createMock(Runnable.class); - runnable.run(); - expectLastCall().andThrow(EXCEPTION); - - control.replay(); - - try { - executorService.scheduleAtFixedRate(runnable, 0, 10, TimeUnit.MILLISECONDS).get(); - fail(EXCEPTION.getClass().getSimpleName() + " should be thrown."); - } catch (ExecutionException e) { - assertEquals(EXCEPTION, e.getCause()); - } - } - - @Test - public void testScheduleWithFixedDelay() throws Exception { - signallingHandler.uncaughtException(anyObject(Thread.class), eq(EXCEPTION)); - Runnable runnable = createMock(Runnable.class); - runnable.run(); - expectLastCall().andThrow(EXCEPTION); - - control.replay(); - - try { - executorService.scheduleWithFixedDelay(runnable, 0, 10, TimeUnit.MILLISECONDS).get(); - fail(EXCEPTION.getClass().getSimpleName() + " should be thrown."); - } catch (ExecutionException e) { - assertEquals(EXCEPTION, e.getCause()); - } - } - - @Test(expected = NullPointerException.class) - public void testNullHandler() throws Exception { - control.replay(); - MoreExecutors.exceptionHandlingExecutor(executorService, null); - } -} http://git-wip-us.apache.org/repos/asf/aurora/blob/5a7bd347/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java b/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java index 0a7163b..c503dcc 100644 --- a/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java +++ b/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java @@ -30,6 +30,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.base.Supplier; +import com.google.common.base.Suppliers; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableMap; import com.google.common.net.HostAndPort; @@ -50,7 +51,6 @@ import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; import org.apache.aurora.common.args.Arg; import org.apache.aurora.common.args.CmdLine; -import org.apache.aurora.common.base.MoreSuppliers; import org.apache.aurora.common.net.http.handlers.AbortHandler; import org.apache.aurora.common.net.http.handlers.ContentionPrinter; import org.apache.aurora.common.net.http.handlers.HealthHandler; @@ -141,7 +141,7 @@ public class JettyServerModule extends AbstractModule { bind(QuitCallback.class).in(Singleton.class); bind(new TypeLiteral>() { }) .annotatedWith(Names.named(HealthHandler.HEALTH_CHECKER_KEY)) - .toInstance(MoreSuppliers.ofInstance(true)); + .toInstance(Suppliers.ofInstance(true)); bindConstant().annotatedWith(StringTemplateServlet.CacheTemplates.class).to(true);