Updated Branches: refs/heads/trunk 841ae04f8 -> cc7c549e9
remove unused classes ArrayUtil.java/CreationTimeAwareFuture.java patch by dbrosius reviewed by ayeschenko for CASSANDRA-5474 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/40e7aba6 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/40e7aba6 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/40e7aba6 Branch: refs/heads/trunk Commit: 40e7aba6b2f694017df5fbba90fd44caa0d43fc9 Parents: b4ebbae Author: Dave Brosius <dbros...@apache.org> Authored: Mon Apr 15 22:37:16 2013 -0400 Committer: Dave Brosius <dbros...@apache.org> Committed: Mon Apr 15 22:37:16 2013 -0400 ---------------------------------------------------------------------- .../concurrent/CreationTimeAwareFuture.java | 73 --------------- .../org/apache/cassandra/utils/FBUtilities.java | 27 ------ .../org/apache/cassandra/utils/obs/ArrayUtil.java | 39 -------- 3 files changed, 0 insertions(+), 139 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/40e7aba6/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java b/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java deleted file mode 100644 index d9d8185..0000000 --- a/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.cassandra.concurrent; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -/** - * Decorates {@link FutureTask} - * </p> - * This Future implementation makes the future.get(long timeout, TimeUnit unit) - * wait the amount of time specified in the .get(...) call based on the object creation - * by keeping an internal timestamp of when this object was constructed - * - * @param <V> - */ -public class CreationTimeAwareFuture<V> implements Future<V> -{ - - private final long creationTime = System.currentTimeMillis(); - private final Future<V> future; - - public CreationTimeAwareFuture(Future<V> future) - { - this.future = future; - } - - public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - { - timeout = unit.toMillis(timeout); - long overallTimeout = timeout - (System.currentTimeMillis() - creationTime); - return future.get(overallTimeout, TimeUnit.MILLISECONDS); - } - - public boolean cancel(boolean mayInterruptIfRunning) - { - return future.cancel(mayInterruptIfRunning); - } - - public boolean isCancelled() - { - return future.isCancelled(); - } - - public boolean isDone() - { - return future.isDone(); - } - - public V get() throws InterruptedException, ExecutionException - { - return future.get(); - } - -} http://git-wip-us.apache.org/repos/asf/cassandra/blob/40e7aba6/src/java/org/apache/cassandra/utils/FBUtilities.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java index fd3ad4c..1f7807d 100644 --- a/src/java/org/apache/cassandra/utils/FBUtilities.java +++ b/src/java/org/apache/cassandra/utils/FBUtilities.java @@ -42,7 +42,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.cassandra.cache.IRowCacheProvider; -import org.apache.cassandra.concurrent.CreationTimeAwareFuture; import org.apache.cassandra.exceptions.ConfigurationException; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.db.DecoratedKey; @@ -388,32 +387,6 @@ public class FBUtilities result.get(ms, TimeUnit.MILLISECONDS); } - - /** - * Waits for the futures to complete. - * @param timeout the timeout expressed in <code>TimeUnit</code> units - * @param timeUnit TimeUnit - * @throws TimeoutException if the waiting time exceeds <code>timeout</code> - */ - public static void waitOnFutures(List<CreationTimeAwareFuture<?>> hintFutures, long timeout, TimeUnit timeUnit) throws TimeoutException - { - for (Future<?> future : hintFutures) - { - try - { - future.get(timeout, timeUnit); - } - catch (InterruptedException ex) - { - throw new AssertionError(ex); - } - catch (ExecutionException e) - { - throw new RuntimeException(e); - } - } - } - public static IPartitioner newPartitioner(String partitionerClassName) throws ConfigurationException { if (!partitionerClassName.contains(".")) http://git-wip-us.apache.org/repos/asf/cassandra/blob/40e7aba6/src/java/org/apache/cassandra/utils/obs/ArrayUtil.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/obs/ArrayUtil.java b/src/java/org/apache/cassandra/utils/obs/ArrayUtil.java deleted file mode 100644 index 2af11dc..0000000 --- a/src/java/org/apache/cassandra/utils/obs/ArrayUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.cassandra.utils.obs; - -/** - * Methods for manipulating arrays. - * - * @lucene.internal - */ - -final class ArrayUtil { - public static long[] grow(long[] array, int minSize) { - if (array.length < minSize) { - long[] newArray = new long[Math.max(array.length << 1, minSize)]; - System.arraycopy(array, 0, newArray, 0, array.length); - return newArray; - } else - return array; - } - - public static long[] grow(long[] array) { - return grow(array, 1 + array.length); - } -}