You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2014/12/05 09:45:03 UTC
[36/38] incubator-ignite git commit: # Renaming
# Renaming
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5068cc6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5068cc6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5068cc6e
Branch: refs/heads/master
Commit: 5068cc6e54fd000bc7e67496f2213a1ee806c549
Parents: f106170
Author: sboikov <sb...@gridgain.com>
Authored: Fri Dec 5 11:35:58 2014 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Dec 5 11:35:58 2014 +0300
----------------------------------------------------------------------
.../src/test/resources/spring-server-node.xml | 4 +-
.../test/resources/spring-server-ssl-node.xml | 4 +-
.../sender/store/fs/GridDrSenderHubFsStore.java | 2 +-
.../org/gridgain/grid/kernal/GridGainEx.java | 14 +-
.../discovery/GridDiscoveryManager.java | 8 +-
.../cache/GridCacheEvictionManager.java | 4 +-
.../GridCachePartitionExchangeManager.java | 2 +-
.../processors/cache/GridCacheTtlManager.java | 2 +-
.../cache/GridCacheWriteBehindStore.java | 2 +-
.../preloader/GridDhtPartitionDemandPool.java | 2 +-
.../preloader/GridDhtPartitionSupplyPool.java | 2 +-
.../processors/clock/GridClockServer.java | 2 +-
.../clock/GridClockSyncProcessor.java | 2 +-
.../continuous/GridContinuousProcessor.java | 4 +-
.../dataload/GridDataLoaderProcessor.java | 2 +-
.../processors/ggfs/GridGgfsDataManager.java | 2 +-
.../ggfs/GridGgfsFragmentizerManager.java | 4 +-
.../kernal/processors/ggfs/GridGgfsServer.java | 4 +-
.../processors/ggfs/GridGgfsServerManager.java | 2 +-
.../service/GridServiceProcessor.java | 2 +-
.../processors/streamer/IgniteStreamerImpl.java | 2 +-
.../timeout/GridTimeoutProcessor.java | 4 +-
.../tcp/GridTcpCommunicationSpi.java | 4 +-
.../thread/GridStripedThreadPoolExecutor.java | 216 -----------------
.../org/gridgain/grid/thread/GridThread.java | 100 --------
.../gridgain/grid/thread/GridThreadFactory.java | 53 ----
.../grid/thread/GridThreadPoolExecutor.java | 242 -------------------
.../thread/IgniteStripedThreadPoolExecutor.java | 216 +++++++++++++++++
.../org/gridgain/grid/thread/IgniteThread.java | 100 ++++++++
.../grid/thread/IgniteThreadFactory.java | 53 ++++
.../grid/thread/IgniteThreadPoolExecutor.java | 242 +++++++++++++++++++
.../GridIpcSharedMemoryServerEndpoint.java | 2 +-
.../util/nio/GridNioBackPressureControl.java | 8 +-
.../gridgain/grid/util/nio/GridNioServer.java | 12 +-
.../src/test/config/job-loadtest/client.xml | 6 +-
.../src/test/config/job-loadtest/server.xml | 2 +-
modules/core/src/test/config/jobs-load-base.xml | 4 +-
.../core/src/test/config/load/dsi-load-base.xml | 4 +-
.../src/test/config/load/merge-sort-base.xml | 6 +-
.../test/config/load/mongo-multinode-foster.xml | 2 +-
.../core/src/test/config/spring-multicache.xml | 6 +-
.../GridCachePreloadLifecycleAbstractTest.java | 6 +-
.../marshaller/GridMarshallerResourceBean.java | 2 +-
.../GridThreadPoolExecutorServiceSelfTest.java | 10 +-
.../gridgain/grid/thread/GridThreadTest.java | 10 +-
.../cache/GridCacheSingleNodeLoadTest.java | 4 +-
.../loadtests/colocation/GridTestMain.java | 2 +-
.../loadtests/colocation/spring-colocation.xml | 4 +-
...ridSingleSplitsNewNodesAbstractLoadTest.java | 2 +-
.../testframework/junits/GridTestResources.java | 2 +-
.../processors/email/GridEmailProcessor.java | 4 +-
.../hadoop/shuffle/GridHadoopShuffleJob.java | 2 +-
.../taskexecutor/GridHadoopExecutorService.java | 2 +-
.../GridHadoopExternalCommunication.java | 6 +-
.../main/scala/org/gridgain/visor/visor.scala | 6 +-
55 files changed, 708 insertions(+), 708 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/clients/src/test/resources/spring-server-node.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-server-node.xml b/modules/clients/src/test/resources/spring-server-node.xml
index de7db25..2fb48ae 100644
--- a/modules/clients/src/test/resources/spring-server-node.xml
+++ b/modules/clients/src/test/resources/spring-server-node.xml
@@ -319,7 +319,7 @@
possible started nodes count in one VM.
-->
<property name="executorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg value="SERVER"/>
<constructor-arg type="int" value="15"/>
<constructor-arg type="int" value="15"/>
@@ -335,7 +335,7 @@
<property name="executorServiceShutdown" value="true"/>
<property name="systemExecutorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg value="SYS-SERVER"/>
<constructor-arg type="int" value="15"/>
<constructor-arg type="int" value="15"/>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/clients/src/test/resources/spring-server-ssl-node.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-server-ssl-node.xml b/modules/clients/src/test/resources/spring-server-ssl-node.xml
index 3d50ace..af9421c 100644
--- a/modules/clients/src/test/resources/spring-server-ssl-node.xml
+++ b/modules/clients/src/test/resources/spring-server-ssl-node.xml
@@ -286,7 +286,7 @@
possible started nodes count in one VM.
-->
<property name="executorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg value="SERVER"/>
<constructor-arg type="int" value="15"/>
<constructor-arg type="int" value="15"/>
@@ -302,7 +302,7 @@
<property name="executorServiceShutdown" value="true"/>
<property name="systemExecutorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg value="SYS-SERVER"/>
<constructor-arg type="int" value="15"/>
<constructor-arg type="int" value="15"/>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/dr/hub/sender/store/fs/GridDrSenderHubFsStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/dr/hub/sender/store/fs/GridDrSenderHubFsStore.java b/modules/core/src/main/java/org/gridgain/grid/dr/hub/sender/store/fs/GridDrSenderHubFsStore.java
index 5571bde..38ee4ad 100644
--- a/modules/core/src/main/java/org/gridgain/grid/dr/hub/sender/store/fs/GridDrSenderHubFsStore.java
+++ b/modules/core/src/main/java/org/gridgain/grid/dr/hub/sender/store/fs/GridDrSenderHubFsStore.java
@@ -364,7 +364,7 @@ public class GridDrSenderHubFsStore implements GridDrSenderHubStore, LifecycleAw
checkPntWorker = new CheckPointWorker(gridName, log, checkPoints);
- new GridThread(checkPntWorker).start();
+ new IgniteThread(checkPntWorker).start();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java b/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
index 703840b..0515da4 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java
@@ -1484,7 +1484,7 @@ public class GridGainEx {
if (execSvc == null) {
isAutoExecSvc = true;
- execSvc = new GridThreadPoolExecutor(
+ execSvc = new IgniteThreadPoolExecutor(
"pub-" + cfg.getGridName(),
DFLT_PUBLIC_CORE_THREAD_CNT,
DFLT_PUBLIC_MAX_THREAD_CNT,
@@ -1500,7 +1500,7 @@ public class GridGainEx {
// Note that since we use 'LinkedBlockingQueue', number of
// maximum threads has no effect.
- sysExecSvc = new GridThreadPoolExecutor(
+ sysExecSvc = new IgniteThreadPoolExecutor(
"sys-" + cfg.getGridName(),
DFLT_SYSTEM_CORE_THREAD_CNT,
DFLT_SYSTEM_MAX_THREAD_CNT,
@@ -1518,7 +1518,7 @@ public class GridGainEx {
// maximum threads has no effect.
// Note, that we do not pre-start threads here as management pool may
// not be needed.
- mgmtExecSvc = new GridThreadPoolExecutor(
+ mgmtExecSvc = new IgniteThreadPoolExecutor(
"mgmt-" + cfg.getGridName(),
DFLT_MGMT_THREAD_CNT,
DFLT_MGMT_THREAD_CNT,
@@ -1533,7 +1533,7 @@ public class GridGainEx {
// maximum threads has no effect.
// Note, that we do not pre-start threads here as class loading pool may
// not be needed.
- p2pExecSvc = new GridThreadPoolExecutor(
+ p2pExecSvc = new IgniteThreadPoolExecutor(
"p2p-" + cfg.getGridName(),
DFLT_P2P_THREAD_CNT,
DFLT_P2P_THREAD_CNT,
@@ -1547,7 +1547,7 @@ public class GridGainEx {
int procCnt = Runtime.getRuntime().availableProcessors();
// Note that we do not pre-start threads here as ggfs pool may not be needed.
- ggfsExecSvc = new GridThreadPoolExecutor(
+ ggfsExecSvc = new IgniteThreadPoolExecutor(
"ggfs-" + cfg.getGridName(),
procCnt,
procCnt,
@@ -1564,7 +1564,7 @@ public class GridGainEx {
else if (restExecSvc == null && clientCfg != null) {
isAutoRestSvc = true;
- restExecSvc = new GridThreadPoolExecutor(
+ restExecSvc = new IgniteThreadPoolExecutor(
"rest-" + cfg.getGridName(),
DFLT_REST_CORE_THREAD_CNT,
DFLT_REST_MAX_THREAD_CNT,
@@ -1575,7 +1575,7 @@ public class GridGainEx {
clientCfg.setRestExecutorService(restExecSvc);
}
- utilityCacheExecSvc = new GridThreadPoolExecutor(
+ utilityCacheExecSvc = new IgniteThreadPoolExecutor(
"utility-" + cfg.getGridName(),
DFLT_SYSTEM_CORE_THREAD_CNT,
DFLT_SYSTEM_MAX_THREAD_CNT,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java
index 106308f..74ae650 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/managers/discovery/GridDiscoveryManager.java
@@ -102,7 +102,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<GridDiscoverySpi> {
private SegmentCheckWorker segChkWrk;
/** Network segment check thread. */
- private GridThread segChkThread;
+ private IgniteThread segChkThread;
/** Last logged topology. */
private final AtomicLong lastLoggedTop = new AtomicLong();
@@ -228,7 +228,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<GridDiscoverySpi> {
checkSegmentOnStart();
}
- new GridThread(metricsUpdater).start();
+ new IgniteThread(metricsUpdater).start();
getSpi().setMetricsProvider(createMetricsProvider());
@@ -378,7 +378,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<GridDiscoverySpi> {
if (hasRslvrs && segChkFreq > 0) {
segChkWrk = new SegmentCheckWorker();
- segChkThread = new GridThread(segChkWrk);
+ segChkThread = new IgniteThread(segChkWrk);
segChkThread.start();
}
@@ -395,7 +395,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<GridDiscoverySpi> {
}
// Start discovery worker.
- new GridThread(discoWrk).start();
+ new IgniteThread(discoWrk).start();
if (log.isDebugEnabled())
log.debug(startInfo());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionManager.java
index 1a56e5d..b44bccf 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionManager.java
@@ -101,7 +101,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
private BackupWorker backupWorker;
/** Backup entries worker thread. */
- private GridThread backupWorkerThread;
+ private IgniteThread backupWorkerThread;
/** Busy lock. */
private final GridBusyLock busyLock = new GridBusyLock();
@@ -245,7 +245,7 @@ public class GridCacheEvictionManager<K, V> extends GridCacheManagerAdapter<K, V
backupWorker.addEvent(new IgniteDiscoveryEvent(cctx.localNode(), "Dummy event.",
EVT_NODE_JOINED, cctx.localNode()));
- backupWorkerThread = new GridThread(backupWorker);
+ backupWorkerThread = new IgniteThread(backupWorker);
backupWorkerThread.start();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java
index 5187960..e56ca45 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCachePartitionExchangeManager.java
@@ -200,7 +200,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
GridDhtPartitionsExchangeFuture<K, V> fut = exchangeFuture(exchId, discoEvt);
- new GridThread(cctx.gridName(), "exchange-worker", exchWorker).start();
+ new IgniteThread(cctx.gridName(), "exchange-worker", exchWorker).start();
onDiscoveryEvent(cctx.localNodeId(), fut);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java
index e7d8524..827665c 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTtlManager.java
@@ -44,7 +44,7 @@ public class GridCacheTtlManager<K, V> extends GridCacheManagerAdapter<K, V> {
/** {@inheritDoc} */
@Override protected void onKernalStart0() throws GridException {
if (cleanupWorker != null)
- new GridThread(cleanupWorker).start();
+ new IgniteThread(cleanupWorker).start();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java
index 5896389..a8b2ffc 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheWriteBehindStore.java
@@ -274,7 +274,7 @@ public class GridCacheWriteBehindStore<K, V> implements GridCacheStore<K, V>, Li
for (int i = 0; i < flushThreads.length; i++) {
flushThreads[i] = new Flusher(gridName, "flusher-" + i, log);
- new GridThread(flushThreads[i]).start();
+ new IgniteThread(flushThreads[i]).start();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
index 7e72404..6c2e31f 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
@@ -134,7 +134,7 @@ public class GridDhtPartitionDemandPool<K, V> {
void start() {
if (poolSize > 0) {
for (DemandWorker w : dmdWorkers)
- new GridThread(cctx.gridName(), "preloader-demand-worker", w).start();
+ new IgniteThread(cctx.gridName(), "preloader-demand-worker", w).start();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
index 6aac752..bbba8b2 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyPool.java
@@ -93,7 +93,7 @@ class GridDhtPartitionSupplyPool<K, V> {
*/
void start() {
for (SupplyWorker w : workers)
- new GridThread(cctx.gridName(), "preloader-supply-worker", w).start();
+ new IgniteThread(cctx.gridName(), "preloader-supply-worker", w).start();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockServer.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockServer.java
index cb5028e..5d17e7f 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockServer.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockServer.java
@@ -90,7 +90,7 @@ public class GridClockServer {
public void afterStart() {
readWorker = new ReadWorker();
- GridThread th = new GridThread(readWorker);
+ IgniteThread th = new IgniteThread(readWorker);
th.setPriority(Thread.MAX_PRIORITY);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockSyncProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockSyncProcessor.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockSyncProcessor.java
index c614737..38720c9 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockSyncProcessor.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockSyncProcessor.java
@@ -230,7 +230,7 @@ public class GridClockSyncProcessor extends GridProcessorAdapter {
if (timeCoord == null && !stopping) {
timeCoord = new TimeCoordinator(discoEvt);
- GridThread th = new GridThread(timeCoord);
+ IgniteThread th = new IgniteThread(timeCoord);
th.setPriority(Thread.MAX_PRIORITY);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousProcessor.java
index 2e5b1c9..969b34d 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousProcessor.java
@@ -63,7 +63,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
private final ConcurrentMap<UUID, Collection<UUID>> waitForStopAck = new ConcurrentHashMap8<>();
/** Threads started by this processor. */
- private final Collection<GridThread> threads = new GridConcurrentHashSet<>();
+ private final Collection<IgniteThread> threads = new GridConcurrentHashSet<>();
/** Pending start requests. */
private final Map<UUID, Collection<GridContinuousMessage>> pending = new HashMap<>();
@@ -895,7 +895,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
if (doRegister) {
if (interval > 0) {
- GridThread checker = new GridThread(new GridWorker(ctx.gridName(), "continuous-buffer-checker", log) {
+ IgniteThread checker = new IgniteThread(new GridWorker(ctx.gridName(), "continuous-buffer-checker", log) {
@SuppressWarnings("ConstantConditions")
@Override protected void body() {
long interval0 = interval;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoaderProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoaderProcessor.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoaderProcessor.java
index 2227f72..fb65bb8 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoaderProcessor.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoaderProcessor.java
@@ -72,7 +72,7 @@ public class GridDataLoaderProcessor<K, V> extends GridProcessorAdapter {
if (ctx.config().isDaemon())
return;
- flusher = new GridThread(new GridWorker(ctx.gridName(), "grid-data-loader-flusher", log) {
+ flusher = new IgniteThread(new GridWorker(ctx.gridName(), "grid-data-loader-flusher", log) {
@Override protected void body() throws InterruptedException, GridInterruptedException {
while (!isCancelled()) {
IgniteDataLoaderImpl<K, V> ldr = flushQ.take();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java
index 1e15bbb..bd70a69 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java
@@ -202,7 +202,7 @@ public class GridGgfsDataManager extends GridGgfsManager {
int coresCnt = Runtime.getRuntime().availableProcessors();
// Note that we do not pre-start threads here as GGFS pool may not be needed.
- putExecSvc = new GridThreadPoolExecutor(coresCnt, coresCnt, 0, new LinkedBlockingDeque<Runnable>());
+ putExecSvc = new IgniteThreadPoolExecutor(coresCnt, coresCnt, 0, new LinkedBlockingDeque<Runnable>());
putExecSvcShutdown = true;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerManager.java
index 4136d3f..11c53d6 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerManager.java
@@ -91,7 +91,7 @@ public class GridGgfsFragmentizerManager extends GridGgfsManager {
ggfsCtx.kernalContext().io().addMessageListener(topic, fragmentizerWorker);
- new GridThread(fragmentizerWorker).start();
+ new IgniteThread(fragmentizerWorker).start();
}
/** {@inheritDoc} */
@@ -205,7 +205,7 @@ public class GridGgfsFragmentizerManager extends GridGgfsManager {
if (fragmentizerCrd == null && !stopping) {
fragmentizerCrd = new FragmentizerCoordinator();
- new GridThread(fragmentizerCrd).start();
+ new IgniteThread(fragmentizerCrd).start();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServer.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServer.java
index 48b337e..03ba200 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServer.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServer.java
@@ -133,7 +133,7 @@ public class GridGgfsServer {
public void onKernalStart() {
// Accept connections only when grid is ready.
if (srvEndpoint != null)
- new GridThread(acceptWorker).start();
+ new IgniteThread(acceptWorker).start();
}
/**
@@ -392,7 +392,7 @@ public class GridGgfsServer {
ClientWorker worker = new ClientWorker(client, acceptCnt++);
- GridThread workerThread = new GridThread(worker);
+ IgniteThread workerThread = new IgniteThread(worker);
ConcurrentLinkedDeque8.Node<ClientWorker> node = clientWorkers.addx(worker);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServerManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServerManager.java
index 4b2063f..1dc8b19 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServerManager.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsServerManager.java
@@ -65,7 +65,7 @@ public class GridGgfsServerManager extends GridGgfsManager {
}
if (bindWorker != null)
- new GridThread(bindWorker).start();
+ new IgniteThread(bindWorker).start();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/service/GridServiceProcessor.java
index 3fb43a5..8cbae3f 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/service/GridServiceProcessor.java
@@ -66,7 +66,7 @@ public class GridServiceProcessor extends GridProcessorAdapter {
private final GridSpinBusyLock busyLock = new GridSpinBusyLock();
/** Thread factory. */
- private ThreadFactory threadFactory = new GridThreadFactory(ctx.gridName());
+ private ThreadFactory threadFactory = new IgniteThreadFactory(ctx.gridName());
/** Thread local for service name. */
private ThreadLocal<String> svcName = new ThreadLocal<>();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/IgniteStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/IgniteStreamerImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/IgniteStreamerImpl.java
index 49eab46..8ee317f 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/IgniteStreamerImpl.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/IgniteStreamerImpl.java
@@ -241,7 +241,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable {
execSvc = c.getExecutorService();
if (execSvc == null) {
- execSvc = new GridThreadPoolExecutor(
+ execSvc = new IgniteThreadPoolExecutor(
ctx.gridName(),
Runtime.getRuntime().availableProcessors(),
Runtime.getRuntime().availableProcessors(),
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/kernal/processors/timeout/GridTimeoutProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/timeout/GridTimeoutProcessor.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/timeout/GridTimeoutProcessor.java
index c6c13fa..79ee81a 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/timeout/GridTimeoutProcessor.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/timeout/GridTimeoutProcessor.java
@@ -24,7 +24,7 @@ import java.util.*;
*/
public class GridTimeoutProcessor extends GridProcessorAdapter {
/** */
- private final GridThread timeoutWorker;
+ private final IgniteThread timeoutWorker;
/** Time-based sorted set for timeout objects. */
private final GridConcurrentSkipListSet<GridTimeoutObject> timeoutObjs =
@@ -47,7 +47,7 @@ public class GridTimeoutProcessor extends GridProcessorAdapter {
public GridTimeoutProcessor(GridKernalContext ctx) {
super(ctx);
- timeoutWorker = new GridThread(ctx.config().getGridName(), "grid-timeout-worker",
+ timeoutWorker = new IgniteThread(ctx.config().getGridName(), "grid-timeout-worker",
new TimeoutWorker());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/spi/communication/tcp/GridTcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/spi/communication/tcp/GridTcpCommunicationSpi.java b/modules/core/src/main/java/org/gridgain/grid/spi/communication/tcp/GridTcpCommunicationSpi.java
index 62b596d..0fd2328 100644
--- a/modules/core/src/main/java/org/gridgain/grid/spi/communication/tcp/GridTcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/gridgain/grid/spi/communication/tcp/GridTcpCommunicationSpi.java
@@ -1152,7 +1152,7 @@ public class GridTcpCommunicationSpi extends GridSpiAdapter
if (shmemSrv != null) {
shmemAcceptWorker = new ShmemAcceptWorker(shmemSrv);
- new GridThread(shmemAcceptWorker).start();
+ new IgniteThread(shmemAcceptWorker).start();
}
nioSrvr.start();
@@ -1938,7 +1938,7 @@ public class GridTcpCommunicationSpi extends GridSpiAdapter
shmemWorkers.add(e);
- new GridThread(e).start();
+ new IgniteThread(e).start();
}
}
catch (GridException e) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/GridStripedThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/GridStripedThreadPoolExecutor.java b/modules/core/src/main/java/org/gridgain/grid/thread/GridStripedThreadPoolExecutor.java
deleted file mode 100644
index 64a5174..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/thread/GridStripedThreadPoolExecutor.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
-package org.gridgain.grid.thread;
-
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-/**
- * An {@link ExecutorService} that executes submitted tasks using pooled grid threads.
- */
-public class GridStripedThreadPoolExecutor implements ExecutorService {
- /** */
- public static final int DFLT_SEG_POOL_SIZE = 8;
-
- /** */
- public static final int DFLT_CONCUR_LVL = 16;
-
- /** */
- private final ExecutorService[] execs;
-
- /** */
- private final int segShift;
-
- /** */
- private final int segMask;
-
- /**
- *
- */
- public GridStripedThreadPoolExecutor() {
- execs = new ExecutorService[DFLT_CONCUR_LVL];
-
- ThreadFactory factory = new GridThreadFactory(null);
-
- for (int i = 0; i < DFLT_CONCUR_LVL; i++)
- execs[i] = Executors.newFixedThreadPool(DFLT_SEG_POOL_SIZE, factory);
-
- // Find power-of-two sizes best matching arguments
- int sshift = 0;
- int ssize = 1;
-
- while (ssize < DFLT_CONCUR_LVL) {
- ++sshift;
-
- ssize <<= 1;
- }
-
- segShift = 32 - sshift;
- segMask = ssize - 1;
-
- }
-
- /** {@inheritDoc} */
- @Override public void shutdown() {
- for (ExecutorService exec : execs)
- exec.shutdown();
- }
-
- /** {@inheritDoc} */
- @Override public List<Runnable> shutdownNow() {
- List<Runnable> res = new LinkedList<>();
-
- for (ExecutorService exec : execs) {
- for (Runnable r : exec.shutdownNow())
- res.add(r);
- }
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isShutdown() {
- for (ExecutorService exec : execs) {
- if (!exec.isShutdown())
- return false;
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isTerminated() {
- for (ExecutorService exec : execs) {
- if (!exec.isTerminated())
- return false;
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
- boolean res = true;
-
- for (ExecutorService exec : execs)
- res &= exec.awaitTermination(timeout, unit);
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public <T> Future<T> submit(Callable<T> task) {
- return execForTask(task).submit(task);
- }
-
- /** {@inheritDoc} */
- @Override public <T> Future<T> submit(Runnable task, T result) {
- return execForTask(task).submit(task, result);
- }
-
- /** {@inheritDoc} */
- @Override public Future<?> submit(Runnable task) {
- return execForTask(task).submit(task);
- }
-
- /** {@inheritDoc} */
- @Override public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
- throws InterruptedException {
- List<Future<T>> futs = new LinkedList<>();
-
- for (Callable<T> task : tasks)
- futs.add(execForTask(task).submit(task));
-
- boolean done = false;
-
- try {
- for (Future<T> fut : futs) {
- try {
- fut.get();
- }
- catch (ExecutionException | InterruptedException ignored) {
- // No-op.
- }
- }
-
- done = true;
-
- return futs;
- }
- finally {
- if (!done) {
- for (Future<T> fut : futs)
- fut.cancel(true);
- }
- }
- }
-
- /** {@inheritDoc} */
- @Override public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout,
- TimeUnit unit) throws InterruptedException {
- throw new RuntimeException("Not implemented.");
- }
-
- /** {@inheritDoc} */
- @Override public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException,
- ExecutionException {
- throw new RuntimeException("Not implemented.");
- }
-
- /** {@inheritDoc} */
- @Override public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
- throws InterruptedException, ExecutionException, TimeoutException {
- throw new RuntimeException("Not implemented.");
- }
-
- /** {@inheritDoc} */
- @Override public void execute(Runnable cmd) {
- execForTask(cmd).execute(cmd);
- }
-
- /**
- * Applies a supplemental hash function to a given hashCode, which
- * defends against poor quality hash functions. This is critical
- * because ConcurrentHashMap uses power-of-two length hash tables,
- * that otherwise encounter collisions for hashCodes that do not
- * differ in lower or upper bits.
- *
- * @param h Hash code.
- * @return Enhanced hash code.
- */
- private int hash(int h) {
- // Spread bits to regularize both segment and index locations,
- // using variant of single-word Wang/Jenkins hash.
- h += (h << 15) ^ 0xffffcd7d;
- h ^= (h >>> 10);
- h += (h << 3);
- h ^= (h >>> 6);
- h += (h << 2) + (h << 14);
- return h ^ (h >>> 16);
- }
-
- /**
- * @param cmd Command.
- * @return Service.
- */
- private <T> ExecutorService execForTask(T cmd) {
- assert cmd != null;
-
- //return execs[ThreadLocalRandom8.current().nextInt(DFLT_CONCUR_LVL)];
- return execs[(hash(cmd.hashCode()) >>> segShift) & segMask];
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridStripedThreadPoolExecutor.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/GridThread.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/GridThread.java b/modules/core/src/main/java/org/gridgain/grid/thread/GridThread.java
deleted file mode 100644
index 73a3d7e..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/thread/GridThread.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
-package org.gridgain.grid.thread;
-
-import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.grid.util.worker.*;
-
-import java.util.concurrent.atomic.*;
-
-/**
- * This class adds some necessary plumbing on top of the {@link Thread} class.
- * Specifically, it adds:
- * <ul>
- * <li>Consistent naming of threads</li>
- * <li>Dedicated parent thread group</li>
- * <li>Backing interrupted flag</li>
- * </ul>
- * <b>Note</b>: this class is intended for internal use only.
- */
-public class GridThread extends Thread {
- /** Default thread's group. */
- private static final ThreadGroup DFLT_GRP = new ThreadGroup("gridgain");
-
- /** Number of all grid threads in the system. */
- private static final AtomicLong threadCntr = new AtomicLong(0);
-
- /** Boolean flag indicating of this thread is currently processing message. */
- private boolean procMsg;
-
- /**
- * Creates thread with given worker.
- *
- * @param worker Runnable to create thread with.
- */
- public GridThread(GridWorker worker) {
- this(DFLT_GRP, worker.gridName(), worker.name(), worker);
- }
-
- /**
- * Creates grid thread with given name for a given grid.
- *
- * @param gridName Name of grid this thread is created for.
- * @param threadName Name of thread.
- * @param r Runnable to execute.
- */
- public GridThread(String gridName, String threadName, Runnable r) {
- this(DFLT_GRP, gridName, threadName, r);
- }
-
- /**
- * Creates grid thread with given name for a given grid with specified
- * thread group.
- *
- * @param grp Thread group.
- * @param gridName Name of grid this thread is created for.
- * @param threadName Name of thread.
- * @param r Runnable to execute.
- */
- public GridThread(ThreadGroup grp, String gridName, String threadName, Runnable r) {
- super(grp, r, createName(threadCntr.incrementAndGet(), threadName, gridName));
- }
-
- /**
- * Creates new thread name.
- *
- * @param num Thread number.
- * @param threadName Thread name.
- * @param gridName Grid name.
- * @return New thread name.
- */
- private static String createName(long num, String threadName, String gridName) {
- return threadName + "-#" + num + '%' + gridName + '%';
- }
-
- /**
- * @param procMsg Flag indicating whether thread is currently processing message.
- */
- public void processingMessage(boolean procMsg) {
- this.procMsg = procMsg;
- }
-
- /**
- * @return Flag indicating whether thread is currently processing message.
- */
- public boolean processingMessage() {
- return procMsg;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridThread.class, this, "name", getName());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadFactory.java b/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadFactory.java
deleted file mode 100644
index 1eecb0f..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
-package org.gridgain.grid.thread;
-
-import org.jetbrains.annotations.*;
-
-import java.util.concurrent.*;
-
-/**
- * This class provides implementation of {@link ThreadFactory} factory
- * for creating grid threads.
- */
-public class GridThreadFactory implements ThreadFactory {
- /** Grid name. */
- private final String gridName;
-
- /** Thread name. */
- private final String threadName;
-
- /**
- * Constructs new thread factory for given grid. All threads will belong
- * to the same default thread group.
- *
- * @param gridName Grid name.
- */
- public GridThreadFactory(String gridName) {
- this(gridName, "gridgain");
- }
-
- /**
- * Constructs new thread factory for given grid. All threads will belong
- * to the same default thread group.
- *
- * @param gridName Grid name.
- * @param threadName Thread name.
- */
- public GridThreadFactory(String gridName, String threadName) {
- this.gridName = gridName;
- this.threadName = threadName;
- }
-
- /** {@inheritDoc} */
- @Override public Thread newThread(@NotNull Runnable r) {
- return new GridThread(gridName, threadName, r);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadPoolExecutor.java b/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadPoolExecutor.java
deleted file mode 100644
index e43e084..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/thread/GridThreadPoolExecutor.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
-package org.gridgain.grid.thread;
-
-import org.jetbrains.annotations.*;
-
-import java.util.concurrent.*;
-
-/**
- * An {@link ExecutorService} that executes submitted tasks using pooled grid threads.
- */
-public class GridThreadPoolExecutor 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 GridThreadPoolExecutor() {
- this(
- DFLT_CORE_POOL_SIZE,
- DFLT_CORE_POOL_SIZE,
- 0,
- new LinkedBlockingDeque<Runnable>(),
- new GridThreadFactory(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 GridThreadPoolExecutor(
- int corePoolSize,
- int maxPoolSize,
- long keepAliveTime,
- BlockingQueue<Runnable> workQueue) {
- this(
- corePoolSize,
- maxPoolSize,
- keepAliveTime,
- workQueue,
- new GridThreadFactory(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 GridThreadPoolExecutor(
- int corePoolSize,
- int maxPoolSize,
- long keepAliveTime,
- BlockingQueue<Runnable> workQ,
- RejectedExecutionHandler hnd) {
- this(
- corePoolSize,
- maxPoolSize,
- keepAliveTime,
- workQ,
- new GridThreadFactory(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 gridName Name of the grid.
- */
- public GridThreadPoolExecutor(String gridName) {
- this(
- DFLT_CORE_POOL_SIZE,
- DFLT_CORE_POOL_SIZE,
- 0,
- new LinkedBlockingDeque<Runnable>(),
- new GridThreadFactory(gridName),
- null
- );
- }
-
- /**
- * Creates a new service with the given initial parameters.
- *
- * @param gridName Name of the grid
- * @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
- * runnable tasks submitted by the {@link #execute(Runnable)} method.
- */
- public GridThreadPoolExecutor(
- String gridName,
- int corePoolSize,
- int maxPoolSize,
- long keepAliveTime,
- BlockingQueue<Runnable> workQ) {
- super(
- corePoolSize,
- maxPoolSize,
- keepAliveTime,
- TimeUnit.MILLISECONDS,
- workQ,
- new GridThreadFactory(gridName)
- );
- }
-
- /**
- * Creates a new service with the given initial parameters.
- *
- * @param gridName Name of the grid.
- * @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 GridThreadPoolExecutor(
- String gridName,
- int corePoolSize,
- int maxPoolSize,
- long keepAliveTime,
- BlockingQueue<Runnable> workQ,
- RejectedExecutionHandler hnd) {
- this(
- corePoolSize,
- maxPoolSize,
- keepAliveTime,
- workQ,
- new GridThreadFactory(gridName),
- hnd
- );
- }
-
- /**
- * 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 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 GridThreadPoolExecutor(
- int corePoolSize,
- int maxPoolSize,
- long keepAliveTime,
- BlockingQueue<Runnable> workQ,
- ThreadFactory threadFactory,
- @Nullable RejectedExecutionHandler hnd) {
- super(
- corePoolSize,
- maxPoolSize,
- keepAliveTime,
- TimeUnit.MILLISECONDS,
- workQ,
- threadFactory,
- hnd == null ? new AbortPolicy() : hnd
- );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/IgniteStripedThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/IgniteStripedThreadPoolExecutor.java b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteStripedThreadPoolExecutor.java
new file mode 100644
index 0000000..dcd7094
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteStripedThreadPoolExecutor.java
@@ -0,0 +1,216 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.gridgain.grid.thread;
+
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * An {@link ExecutorService} that executes submitted tasks using pooled grid threads.
+ */
+public class IgniteStripedThreadPoolExecutor implements ExecutorService {
+ /** */
+ public static final int DFLT_SEG_POOL_SIZE = 8;
+
+ /** */
+ public static final int DFLT_CONCUR_LVL = 16;
+
+ /** */
+ private final ExecutorService[] execs;
+
+ /** */
+ private final int segShift;
+
+ /** */
+ private final int segMask;
+
+ /**
+ *
+ */
+ public IgniteStripedThreadPoolExecutor() {
+ execs = new ExecutorService[DFLT_CONCUR_LVL];
+
+ ThreadFactory factory = new IgniteThreadFactory(null);
+
+ for (int i = 0; i < DFLT_CONCUR_LVL; i++)
+ execs[i] = Executors.newFixedThreadPool(DFLT_SEG_POOL_SIZE, factory);
+
+ // Find power-of-two sizes best matching arguments
+ int sshift = 0;
+ int ssize = 1;
+
+ while (ssize < DFLT_CONCUR_LVL) {
+ ++sshift;
+
+ ssize <<= 1;
+ }
+
+ segShift = 32 - sshift;
+ segMask = ssize - 1;
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void shutdown() {
+ for (ExecutorService exec : execs)
+ exec.shutdown();
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<Runnable> shutdownNow() {
+ List<Runnable> res = new LinkedList<>();
+
+ for (ExecutorService exec : execs) {
+ for (Runnable r : exec.shutdownNow())
+ res.add(r);
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isShutdown() {
+ for (ExecutorService exec : execs) {
+ if (!exec.isShutdown())
+ return false;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isTerminated() {
+ for (ExecutorService exec : execs) {
+ if (!exec.isTerminated())
+ return false;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
+ boolean res = true;
+
+ for (ExecutorService exec : execs)
+ res &= exec.awaitTermination(timeout, unit);
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> Future<T> submit(Callable<T> task) {
+ return execForTask(task).submit(task);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> Future<T> submit(Runnable task, T result) {
+ return execForTask(task).submit(task, result);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Future<?> submit(Runnable task) {
+ return execForTask(task).submit(task);
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
+ throws InterruptedException {
+ List<Future<T>> futs = new LinkedList<>();
+
+ for (Callable<T> task : tasks)
+ futs.add(execForTask(task).submit(task));
+
+ boolean done = false;
+
+ try {
+ for (Future<T> fut : futs) {
+ try {
+ fut.get();
+ }
+ catch (ExecutionException | InterruptedException ignored) {
+ // No-op.
+ }
+ }
+
+ done = true;
+
+ return futs;
+ }
+ finally {
+ if (!done) {
+ for (Future<T> fut : futs)
+ fut.cancel(true);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout,
+ TimeUnit unit) throws InterruptedException {
+ throw new RuntimeException("Not implemented.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException,
+ ExecutionException {
+ throw new RuntimeException("Not implemented.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ throw new RuntimeException("Not implemented.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(Runnable cmd) {
+ execForTask(cmd).execute(cmd);
+ }
+
+ /**
+ * Applies a supplemental hash function to a given hashCode, which
+ * defends against poor quality hash functions. This is critical
+ * because ConcurrentHashMap uses power-of-two length hash tables,
+ * that otherwise encounter collisions for hashCodes that do not
+ * differ in lower or upper bits.
+ *
+ * @param h Hash code.
+ * @return Enhanced hash code.
+ */
+ private int hash(int h) {
+ // Spread bits to regularize both segment and index locations,
+ // using variant of single-word Wang/Jenkins hash.
+ h += (h << 15) ^ 0xffffcd7d;
+ h ^= (h >>> 10);
+ h += (h << 3);
+ h ^= (h >>> 6);
+ h += (h << 2) + (h << 14);
+ return h ^ (h >>> 16);
+ }
+
+ /**
+ * @param cmd Command.
+ * @return Service.
+ */
+ private <T> ExecutorService execForTask(T cmd) {
+ assert cmd != null;
+
+ //return execs[ThreadLocalRandom8.current().nextInt(DFLT_CONCUR_LVL)];
+ return execs[(hash(cmd.hashCode()) >>> segShift) & segMask];
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IgniteStripedThreadPoolExecutor.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThread.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThread.java b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThread.java
new file mode 100644
index 0000000..e6c5c23
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThread.java
@@ -0,0 +1,100 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.gridgain.grid.thread;
+
+import org.gridgain.grid.util.typedef.internal.*;
+import org.gridgain.grid.util.worker.*;
+
+import java.util.concurrent.atomic.*;
+
+/**
+ * This class adds some necessary plumbing on top of the {@link Thread} class.
+ * Specifically, it adds:
+ * <ul>
+ * <li>Consistent naming of threads</li>
+ * <li>Dedicated parent thread group</li>
+ * <li>Backing interrupted flag</li>
+ * </ul>
+ * <b>Note</b>: this class is intended for internal use only.
+ */
+public class IgniteThread extends Thread {
+ /** Default thread's group. */
+ private static final ThreadGroup DFLT_GRP = new ThreadGroup("gridgain");
+
+ /** Number of all grid threads in the system. */
+ private static final AtomicLong threadCntr = new AtomicLong(0);
+
+ /** Boolean flag indicating of this thread is currently processing message. */
+ private boolean procMsg;
+
+ /**
+ * Creates thread with given worker.
+ *
+ * @param worker Runnable to create thread with.
+ */
+ public IgniteThread(GridWorker worker) {
+ this(DFLT_GRP, worker.gridName(), worker.name(), worker);
+ }
+
+ /**
+ * Creates grid thread with given name for a given grid.
+ *
+ * @param gridName Name of grid this thread is created for.
+ * @param threadName Name of thread.
+ * @param r Runnable to execute.
+ */
+ public IgniteThread(String gridName, String threadName, Runnable r) {
+ this(DFLT_GRP, gridName, threadName, r);
+ }
+
+ /**
+ * Creates grid thread with given name for a given grid with specified
+ * thread group.
+ *
+ * @param grp Thread group.
+ * @param gridName Name of grid this thread is created for.
+ * @param threadName Name of thread.
+ * @param r Runnable to execute.
+ */
+ public IgniteThread(ThreadGroup grp, String gridName, String threadName, Runnable r) {
+ super(grp, r, createName(threadCntr.incrementAndGet(), threadName, gridName));
+ }
+
+ /**
+ * Creates new thread name.
+ *
+ * @param num Thread number.
+ * @param threadName Thread name.
+ * @param gridName Grid name.
+ * @return New thread name.
+ */
+ private static String createName(long num, String threadName, String gridName) {
+ return threadName + "-#" + num + '%' + gridName + '%';
+ }
+
+ /**
+ * @param procMsg Flag indicating whether thread is currently processing message.
+ */
+ public void processingMessage(boolean procMsg) {
+ this.procMsg = procMsg;
+ }
+
+ /**
+ * @return Flag indicating whether thread is currently processing message.
+ */
+ public boolean processingMessage() {
+ return procMsg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IgniteThread.class, this, "name", getName());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadFactory.java b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadFactory.java
new file mode 100644
index 0000000..7caa5b2
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadFactory.java
@@ -0,0 +1,53 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.gridgain.grid.thread;
+
+import org.jetbrains.annotations.*;
+
+import java.util.concurrent.*;
+
+/**
+ * This class provides implementation of {@link ThreadFactory} factory
+ * for creating grid threads.
+ */
+public class IgniteThreadFactory implements ThreadFactory {
+ /** Grid name. */
+ private final String gridName;
+
+ /** Thread name. */
+ private final String threadName;
+
+ /**
+ * Constructs new thread factory for given grid. All threads will belong
+ * to the same default thread group.
+ *
+ * @param gridName Grid name.
+ */
+ public IgniteThreadFactory(String gridName) {
+ this(gridName, "gridgain");
+ }
+
+ /**
+ * Constructs new thread factory for given grid. All threads will belong
+ * to the same default thread group.
+ *
+ * @param gridName Grid name.
+ * @param threadName Thread name.
+ */
+ public IgniteThreadFactory(String gridName, String threadName) {
+ this.gridName = gridName;
+ this.threadName = threadName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Thread newThread(@NotNull Runnable r) {
+ return new IgniteThread(gridName, threadName, r);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadPoolExecutor.java b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadPoolExecutor.java
new file mode 100644
index 0000000..500d50e
--- /dev/null
+++ b/modules/core/src/main/java/org/gridgain/grid/thread/IgniteThreadPoolExecutor.java
@@ -0,0 +1,242 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.gridgain.grid.thread;
+
+import org.jetbrains.annotations.*;
+
+import java.util.concurrent.*;
+
+/**
+ * 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 gridName Name of the grid.
+ */
+ public IgniteThreadPoolExecutor(String gridName) {
+ this(
+ DFLT_CORE_POOL_SIZE,
+ DFLT_CORE_POOL_SIZE,
+ 0,
+ new LinkedBlockingDeque<Runnable>(),
+ new IgniteThreadFactory(gridName),
+ null
+ );
+ }
+
+ /**
+ * Creates a new service with the given initial parameters.
+ *
+ * @param gridName Name of the grid
+ * @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
+ * runnable tasks submitted by the {@link #execute(Runnable)} method.
+ */
+ public IgniteThreadPoolExecutor(
+ String gridName,
+ int corePoolSize,
+ int maxPoolSize,
+ long keepAliveTime,
+ BlockingQueue<Runnable> workQ) {
+ super(
+ corePoolSize,
+ maxPoolSize,
+ keepAliveTime,
+ TimeUnit.MILLISECONDS,
+ workQ,
+ new IgniteThreadFactory(gridName)
+ );
+ }
+
+ /**
+ * Creates a new service with the given initial parameters.
+ *
+ * @param gridName Name of the grid.
+ * @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(
+ String gridName,
+ int corePoolSize,
+ int maxPoolSize,
+ long keepAliveTime,
+ BlockingQueue<Runnable> workQ,
+ RejectedExecutionHandler hnd) {
+ this(
+ corePoolSize,
+ maxPoolSize,
+ keepAliveTime,
+ workQ,
+ new IgniteThreadFactory(gridName),
+ hnd
+ );
+ }
+
+ /**
+ * 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 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) {
+ super(
+ corePoolSize,
+ maxPoolSize,
+ keepAliveTime,
+ TimeUnit.MILLISECONDS,
+ workQ,
+ threadFactory,
+ hnd == null ? new AbortPolicy() : hnd
+ );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java b/modules/core/src/main/java/org/gridgain/grid/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java
index 5fcdc26..f2c74ed 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java
@@ -179,7 +179,7 @@ public class GridIpcSharedMemoryServerEndpoint implements GridIpcServerEndpoint
gcWorker = new GcWorker(gridName, "ipc-shmem-gc", log);
- new GridThread(gcWorker).start();
+ new IgniteThread(gcWorker).start();
if (log.isInfoEnabled())
log.info("IPC shared memory server endpoint started [port=" + port +
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioBackPressureControl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioBackPressureControl.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioBackPressureControl.java
index 4a1eba6..98d452f 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioBackPressureControl.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioBackPressureControl.java
@@ -28,8 +28,8 @@ public class GridNioBackPressureControl {
public static boolean threadProcessingMessage() {
Thread th = Thread.currentThread();
- if (th instanceof GridThread)
- return ((GridThread)th).processingMessage();
+ if (th instanceof IgniteThread)
+ return ((IgniteThread)th).processingMessage();
return threadProcMsg.get();
}
@@ -40,8 +40,8 @@ public class GridNioBackPressureControl {
public static void threadProcessingMessage(boolean processing) {
Thread th = Thread.currentThread();
- if (th instanceof GridThread)
- ((GridThread)th).processingMessage(processing);
+ if (th instanceof IgniteThread)
+ ((IgniteThread)th).processingMessage(processing);
else
threadProcMsg.set(processing);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java
index 0f6acb4..f279ef7 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java
@@ -66,10 +66,10 @@ public class GridNioServer<T> {
/** Accept worker thread. */
@GridToStringExclude
- private final GridThread acceptThread;
+ private final IgniteThread acceptThread;
/** Read worker threads. */
- private final GridThread[] clientThreads;
+ private final IgniteThread[] clientThreads;
/** Read workers. */
private final List<AbstractNioClientWorker> clientWorkers;
@@ -222,7 +222,7 @@ public class GridNioServer<T> {
// This method will throw exception if address already in use.
Selector acceptSelector = createSelector(locAddr);
- acceptThread = new GridThread(new GridNioAcceptWorker(gridName, "nio-acceptor", log, acceptSelector));
+ acceptThread = new IgniteThread(new GridNioAcceptWorker(gridName, "nio-acceptor", log, acceptSelector));
}
else {
locAddr = null;
@@ -230,7 +230,7 @@ public class GridNioServer<T> {
}
clientWorkers = new ArrayList<>(selectorCnt);
- clientThreads = new GridThread[selectorCnt];
+ clientThreads = new IgniteThread[selectorCnt];
for (int i = 0; i < selectorCnt; i++) {
AbstractNioClientWorker worker = directMode ?
@@ -239,7 +239,7 @@ public class GridNioServer<T> {
clientWorkers.add(worker);
- clientThreads[i] = new GridThread(worker);
+ clientThreads[i] = new IgniteThread(worker);
clientThreads[i].setDaemon(daemon);
}
@@ -267,7 +267,7 @@ public class GridNioServer<T> {
if (acceptThread != null)
acceptThread.start();
- for (GridThread thread : clientThreads)
+ for (IgniteThread thread : clientThreads)
thread.start();
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/test/config/job-loadtest/client.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/job-loadtest/client.xml b/modules/core/src/test/config/job-loadtest/client.xml
index 6abfb76..32fc339 100644
--- a/modules/core/src/test/config/job-loadtest/client.xml
+++ b/modules/core/src/test/config/job-loadtest/client.xml
@@ -45,7 +45,7 @@
<!-- Disable pools -->
<property name="executorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg type="int" value="20"/>
<constructor-arg type="int" value="20"/>
<constructor-arg type="long">
@@ -58,7 +58,7 @@
</property>
<property name="systemExecutorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg type="int" value="20"/>
<constructor-arg type="int" value="20"/>
<constructor-arg type="long">
@@ -71,7 +71,7 @@
</property>
<property name="peerClassLoadingExecutorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg type="int" value="2"/>
<constructor-arg type="int" value="2"/>
<constructor-arg type="long">
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/test/config/job-loadtest/server.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/job-loadtest/server.xml b/modules/core/src/test/config/job-loadtest/server.xml
index 122d4aa..9723503 100644
--- a/modules/core/src/test/config/job-loadtest/server.xml
+++ b/modules/core/src/test/config/job-loadtest/server.xml
@@ -23,7 +23,7 @@
<property name="deploymentMode" value="CONTINUOUS"/>
<property name="executorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg type="int" value="300"/>
<constructor-arg type="int" value="300"/>
<constructor-arg type="long">
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5068cc6e/modules/core/src/test/config/jobs-load-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/jobs-load-base.xml b/modules/core/src/test/config/jobs-load-base.xml
index a5b83c7..2b721f6 100644
--- a/modules/core/src/test/config/jobs-load-base.xml
+++ b/modules/core/src/test/config/jobs-load-base.xml
@@ -71,7 +71,7 @@
<property name="deploymentMode" value="SHARED"/>
<property name="executorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg type="int" value="#{T(java.lang.Runtime).getRuntime().availableProcessors() / 2}"/>
<constructor-arg type="int" value="#{T(java.lang.Runtime).getRuntime().availableProcessors() / 2}"/>
<constructor-arg type="long">
@@ -84,7 +84,7 @@
</property>
<property name="systemExecutorService">
- <bean class="org.gridgain.grid.thread.GridThreadPoolExecutor">
+ <bean class="org.gridgain.grid.thread.IgniteThreadPoolExecutor">
<constructor-arg type="int" value="#{T(java.lang.Runtime).getRuntime().availableProcessors() / 2}"/>
<constructor-arg type="int" value="#{T(java.lang.Runtime).getRuntime().availableProcessors() / 2}"/>
<constructor-arg type="long">