You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/08/01 09:27:13 UTC
[28/50] [abbrv] ignite git commit: Removed unused methods from
IgniteThreadPoolExecutor.
Removed unused methods from IgniteThreadPoolExecutor.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2574bebd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2574bebd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2574bebd
Branch: refs/heads/ignite-5757
Commit: 2574bebde0fc5591bc09e2241f1352e1f0e9cbca
Parents: 5704e39
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 27 13:21:14 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 27 13:21:14 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/IgnitionEx.java | 3 +-
.../internal/processors/igfs/IgfsImpl.java | 2 +-
.../ignite/thread/IgniteThreadPoolExecutor.java | 144 +------------------
.../loadtests/colocation/GridTestMain.java | 45 ------
.../marshaller/GridMarshallerResourceBean.java | 5 +-
.../GridThreadPoolExecutorServiceSelfTest.java | 7 +-
6 files changed, 10 insertions(+), 196 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2574bebd/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index d219333..1139ec6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1776,8 +1776,7 @@ public class IgnitionEx {
cfg.getIgfsThreadPoolSize(),
DFLT_THREAD_KEEP_ALIVE_TIME,
new LinkedBlockingQueue<Runnable>(),
- new IgfsThreadFactory(cfg.getIgniteInstanceName(), "igfs"),
- null /* Abort policy will be used. */);
+ new IgfsThreadFactory(cfg.getIgniteInstanceName(), "igfs"));
igfsExecSvc.allowCoreThreadTimeOut(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2574bebd/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 7eb61d1..5808e7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -247,7 +247,7 @@ public final class IgfsImpl implements IgfsEx {
}
dualPool = secondaryFs != null ? new IgniteThreadPoolExecutor(4, Integer.MAX_VALUE, 5000L,
- new SynchronousQueue<Runnable>(), new IgfsThreadFactory(cfg.getName()), null) : null;
+ new SynchronousQueue<Runnable>(), new IgfsThreadFactory(cfg.getName())) : null;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/2574bebd/modules/core/src/main/java/org/apache/ignite/thread/IgniteThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThreadPoolExecutor.java b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThreadPoolExecutor.java
index 8002aaa..639ef94 100644
--- a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThreadPoolExecutor.java
+++ b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThreadPoolExecutor.java
@@ -19,150 +19,14 @@ package org.apache.ignite.thread;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import org.jetbrains.annotations.Nullable;
/**
* An {@link ExecutorService} that executes submitted tasks using pooled grid threads.
*/
public class IgniteThreadPoolExecutor extends ThreadPoolExecutor {
- /** Default core pool size (value is {@code 100}). */
- public static final int DFLT_CORE_POOL_SIZE = 100;
-
- /**
- * Creates a new service with default initial parameters.
- * Default values are:
- * <table class="doctable">
- * <tr>
- * <th>Name</th>
- * <th>Default Value</th>
- * </tr>
- * <tr>
- * <td>Core Pool Size</td>
- * <td>{@code 100} (see {@link #DFLT_CORE_POOL_SIZE}).</td>
- * </tr>
- * <tr>
- * <td>Maximum Pool Size</td>
- * <td>None, is it is not used for unbounded queues.</td>
- * </tr>
- * <tr>
- * <td>Keep alive time</td>
- * <td>No limit (see {@link Long#MAX_VALUE}).</td>
- * </tr>
- * <tr>
- * <td>Blocking Queue (see {@link BlockingQueue}).</td>
- * <td>Unbounded linked blocking queue (see {@link LinkedBlockingDeque}).</td>
- * </tr>
- * </table>
- */
- public IgniteThreadPoolExecutor() {
- this(
- DFLT_CORE_POOL_SIZE,
- DFLT_CORE_POOL_SIZE,
- 0,
- new LinkedBlockingDeque<Runnable>(),
- new IgniteThreadFactory(null),
- null
- );
- }
-
- /**
- * Creates a new service with the given initial parameters.
- *
- * @param corePoolSize The number of threads to keep in the pool, even if they are idle.
- * @param maxPoolSize The maximum number of threads to allow in the pool.
- * @param keepAliveTime When the number of threads is greater than the core, this is the maximum time
- * that excess idle threads will wait for new tasks before terminating.
- * @param workQueue The queue to use for holding tasks before they are executed. This queue will hold only
- * runnable tasks submitted by the {@link #execute(Runnable)} method.
- */
- public IgniteThreadPoolExecutor(
- int corePoolSize,
- int maxPoolSize,
- long keepAliveTime,
- BlockingQueue<Runnable> workQueue) {
- this(
- corePoolSize,
- maxPoolSize,
- keepAliveTime,
- workQueue,
- new IgniteThreadFactory(null),
- null
- );
- }
-
- /**
- * Creates a new service with the given initial parameters.
- *
- * @param corePoolSize The number of threads to keep in the pool, even if they are idle.
- * @param maxPoolSize The maximum number of threads to allow in the pool.
- * @param keepAliveTime When the number of threads is greater than the core, this is the maximum time
- * that excess idle threads will wait for new tasks before terminating.
- * @param workQ The queue to use for holding tasks before they are executed. This queue will hold only the
- * runnable tasks submitted by the {@link #execute(Runnable)} method.
- * @param hnd Optional handler to use when execution is blocked because the thread bounds and queue
- * capacities are reached. If {@code null} then {@code AbortPolicy}
- * handler is used by default.
- */
- public IgniteThreadPoolExecutor(
- int corePoolSize,
- int maxPoolSize,
- long keepAliveTime,
- BlockingQueue<Runnable> workQ,
- RejectedExecutionHandler hnd) {
- this(
- corePoolSize,
- maxPoolSize,
- keepAliveTime,
- workQ,
- new IgniteThreadFactory(null),
- hnd
- );
- }
-
- /**
- * Creates a new service with default initial parameters.
- * Default values are:
- * <table class="doctable">
- * <tr>
- * <th>Name</th>
- * <th>Default Value</th>
- * </tr>
- * <tr>
- * <td>Core Pool Size</td>
- * <td>{@code 100} (see {@link #DFLT_CORE_POOL_SIZE}).</td>
- * </tr>
- * <tr>
- * <td>Maximum Pool Size</td>
- * <td>None, is it is not used for unbounded queues.</td>
- * </tr>
- * <tr>
- * <td>Keep alive time</td>
- * <td>No limit (see {@link Long#MAX_VALUE}).</td>
- * </tr>
- * <tr>
- * <td>Blocking Queue (see {@link BlockingQueue}).</td>
- * <td>Unbounded linked blocking queue (see {@link LinkedBlockingDeque}).</td>
- * </tr>
- * </table>
- *
- * @param igniteInstanceName Name of the grid.
- */
- public IgniteThreadPoolExecutor(String igniteInstanceName) {
- this(
- DFLT_CORE_POOL_SIZE,
- DFLT_CORE_POOL_SIZE,
- 0,
- new LinkedBlockingDeque<Runnable>(),
- new IgniteThreadFactory(igniteInstanceName),
- null
- );
- }
-
/**
* Creates a new service with the given initial parameters.
*
@@ -202,17 +66,13 @@ public class IgniteThreadPoolExecutor extends ThreadPoolExecutor {
* @param workQ The queue to use for holding tasks before they are executed. This queue will hold only the
* runnable tasks submitted by the {@link #execute(Runnable)} method.
* @param threadFactory Thread factory.
- * @param hnd Optional handler to use when execution is blocked because the thread bounds and queue
- * capacities are reached. If {@code null} then {@code AbortPolicy}
- * handler is used by default.
*/
public IgniteThreadPoolExecutor(
int corePoolSize,
int maxPoolSize,
long keepAliveTime,
BlockingQueue<Runnable> workQ,
- ThreadFactory threadFactory,
- @Nullable RejectedExecutionHandler hnd) {
+ ThreadFactory threadFactory) {
super(
corePoolSize,
maxPoolSize,
@@ -220,7 +80,7 @@ public class IgniteThreadPoolExecutor extends ThreadPoolExecutor {
TimeUnit.MILLISECONDS,
workQ,
threadFactory,
- hnd == null ? new AbortPolicy() : hnd
+ new AbortPolicy()
);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/2574bebd/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
index bf34545..aa0764e 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestMain.java
@@ -119,51 +119,6 @@ public class GridTestMain {
}
/**
- *
- */
- private static void localPoolRun() {
- X.println("Local thread pool run...");
-
- ExecutorService exe = new IgniteThreadPoolExecutor(400, 400, 0, new ArrayBlockingQueue<Runnable>(400) {
- @Override public boolean offer(Runnable runnable) {
- try {
- put(runnable);
- }
- catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- return true;
- }
- });
-
- long start = System.currentTimeMillis();
-
- final IgniteCache<GridTestKey, Long> cache = G.ignite().cache("partitioned");
-
- // Collocate computations and data.
- for (long i = 0; i < GridTestConstants.ENTRY_COUNT; i++) {
- final long key = i;
-
- exe.submit(new Runnable() {
- @Override public void run() {
- Long val = cache.localPeek(new GridTestKey(key), CachePeekMode.ONHEAP);
-
- if (val == null || val != key)
- throw new RuntimeException("Invalid value found [key=" + key + ", val=" + val + ']');
- }
- });
-
- if (i % 10000 == 0)
- X.println("Executed jobs: " + i);
- }
-
- long end = System.currentTimeMillis();
-
- X.println("Executed " + GridTestConstants.ENTRY_COUNT + " computations in " + (end - start) + "ms.");
- }
-
- /**
* Load cache from data store. Also take a look at
* {@link GridTestCacheStore#loadAll} method.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/2574bebd/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
index a0bdf7e..0887879 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
@@ -21,7 +21,7 @@ import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.util.Collection;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.Executors;
import javax.management.MBeanServer;
import org.apache.ignite.GridTestJobContext;
import org.apache.ignite.GridTestTaskSession;
@@ -74,7 +74,7 @@ class GridMarshallerResourceBean implements Serializable {
marshaller = new JdkMarshaller();
mbeanSrv = ManagementFactory.getPlatformMBeanServer();
ses = new GridTestTaskSession();
- execSvc = new IgniteThreadPoolExecutor(1, 1, 0, new LinkedBlockingQueue<Runnable>());
+ execSvc = Executors.newSingleThreadExecutor();
appCtx = new GenericApplicationContext();
jobCtx = new GridTestJobContext();
balancer = new LoadBalancer();
@@ -98,6 +98,7 @@ class GridMarshallerResourceBean implements Serializable {
private static class LoadBalancer extends GridLoadBalancerAdapter {
/** */
public LoadBalancer() {
+ // No-op.
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/2574bebd/modules/core/src/test/java/org/apache/ignite/thread/GridThreadPoolExecutorServiceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/thread/GridThreadPoolExecutorServiceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/thread/GridThreadPoolExecutorServiceSelfTest.java
index bad42b0..3948f6a 100644
--- a/modules/core/src/test/java/org/apache/ignite/thread/GridThreadPoolExecutorServiceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/thread/GridThreadPoolExecutorServiceSelfTest.java
@@ -85,7 +85,7 @@ public class GridThreadPoolExecutorServiceSelfTest extends GridCommonAbstractTes
* @throws ExecutionException If failed.
*/
public void testGridThreadPoolExecutor() throws Exception {
- IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor(1, 1, 0, new LinkedBlockingQueue<Runnable>());
+ IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor("", "", 1, 1, 0, new LinkedBlockingQueue<Runnable>());
exec.submit(new InterruptingRunnable()).get();
@@ -101,7 +101,7 @@ public class GridThreadPoolExecutorServiceSelfTest extends GridCommonAbstractTes
* @throws ExecutionException If failed.
*/
public void testGridThreadPoolExecutorRejection() throws Exception {
- IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor(1, 1, 0, new LinkedBlockingQueue<Runnable>());
+ IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor("", "", 1, 1, 0, new LinkedBlockingQueue<Runnable>());
for (int i = 0; i < 10; i++)
exec.submit(new TestRunnable());
@@ -141,8 +141,7 @@ public class GridThreadPoolExecutorServiceSelfTest extends GridCommonAbstractTes
}
});
}
- },
- null
+ }
);
assert exec.prestartAllCoreThreads() == THREAD_CNT;