You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/12/16 16:00:13 UTC
[43/50] incubator-usergrid git commit: Add missing headers and
formatting only.
Add missing headers and formatting only.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/afe52d47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/afe52d47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/afe52d47
Branch: refs/heads/no-source-in-es
Commit: afe52d47f3c0f549ecf6db2a9fe5c0d0053c8af7
Parents: 7f1d533
Author: Dave Johnson <dm...@apigee.com>
Authored: Wed Dec 10 10:45:58 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Wed Dec 10 10:45:58 2014 -0500
----------------------------------------------------------------------
.../core/task/NamedTaskExecutorImpl.java | 47 +++++++++++++-------
.../core/task/NamedTaskExecutorImplTest.java | 24 +++++++---
2 files changed, 50 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/afe52d47/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImpl.java
index a022c08..9007167 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImpl.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImpl.java
@@ -1,3 +1,21 @@
+/*
+ * 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.usergrid.persistence.core.task;
@@ -9,8 +27,6 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.ForkJoinWorkerThread;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
@@ -60,15 +76,16 @@ public class NamedTaskExecutorImpl implements TaskExecutor {
this.name = name;
this.poolSize = poolSize;
- //The user has chosen to disable asynchronous execution, to create an executor service that will reject all requests
- if(poolSize == 0){
+ // The user has chosen to disable asynchronous execution,
+ // to create an executor service that will reject all requests
+ if ( poolSize == 0 ) {
executorService = MoreExecutors.listeningDecorator( new RejectingExecutorService());
}
//queue executions as normal
else {
- final BlockingQueue<Runnable> queue =
- queueLength > 0 ? new ArrayBlockingQueue<Runnable>( queueLength ) : new SynchronousQueue<Runnable>();
+ final BlockingQueue<Runnable> queue = queueLength > 0
+ ? new ArrayBlockingQueue<Runnable>(queueLength) : new SynchronousQueue<Runnable>();
executorService = MoreExecutors.listeningDecorator( new MaxSizeThreadPool( queue ) );
}
@@ -83,9 +100,7 @@ public class NamedTaskExecutorImpl implements TaskExecutor {
try {
future = executorService.submit( task );
- /**
- * Log our success or failures for debugging purposes
- */
+ // Log our success or failures for debugging purposes
Futures.addCallback( future, new TaskFutureCallBack<V>( task ) );
}
catch ( RejectedExecutionException ree ) {
@@ -210,7 +225,8 @@ public class NamedTaskExecutorImpl implements TaskExecutor {
@Override
- public boolean awaitTermination( final long timeout, final TimeUnit unit ) throws InterruptedException {
+ public boolean awaitTermination( final long timeout, final TimeUnit unit )
+ throws InterruptedException {
return false;
}
@@ -241,22 +257,23 @@ public class NamedTaskExecutorImpl implements TaskExecutor {
@Override
- public <T> List<Future<T>> invokeAll( final Collection<? extends Callable<T>> tasks, final long timeout,
- final TimeUnit unit ) throws InterruptedException {
+ public <T> List<Future<T>> invokeAll( final Collection<? extends Callable<T>> tasks,
+ final long timeout, final TimeUnit unit ) throws InterruptedException {
+
throw new RejectedExecutionException("No Asynchronous tasks allowed");
}
@Override
public <T> T invokeAny( final Collection<? extends Callable<T>> tasks )
- throws InterruptedException, ExecutionException {
+ throws InterruptedException, ExecutionException {
throw new RejectedExecutionException("No Asynchronous tasks allowed");
}
@Override
- public <T> T invokeAny( final Collection<? extends Callable<T>> tasks, final long timeout, final TimeUnit unit )
- throws InterruptedException, ExecutionException, TimeoutException {
+ public <T> T invokeAny( final Collection<? extends Callable<T>> tasks, final long timeout,
+ final TimeUnit unit ) throws InterruptedException, ExecutionException, TimeoutException {
throw new RejectedExecutionException("No Asynchronous tasks allowed");
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/afe52d47/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImplTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImplTest.java
index 65189f1..4f95918 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImplTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/task/NamedTaskExecutorImplTest.java
@@ -1,16 +1,28 @@
+/*
+ * 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.usergrid.persistence.core.task;
-
import java.util.ArrayList;
import java.util.List;
-import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-
import org.junit.Test;
-
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;