use of org.apache.ignite.thread.IgniteThread in project ignite by apache.
the class GridContinuousProcessor method stop.
/** {@inheritDoc} */
@Override
public void stop(boolean cancel) throws IgniteCheckedException {
if (ctx.config().isDaemon())
return;
ctx.io().removeMessageListener(TOPIC_CONTINUOUS);
for (IgniteThread thread : bufCheckThreads.values()) {
U.interrupt(thread);
U.join(thread);
}
if (log.isDebugEnabled())
log.debug("Continuous processor stopped.");
}
use of org.apache.ignite.thread.IgniteThread in project ignite by apache.
the class IgfsFragmentizerManager method checkLaunchCoordinator.
/**
* Checks if current node is the oldest node in topology and starts coordinator thread if so.
* Note that once node is the oldest one, it will be the oldest until it leaves grid.
*
* @param discoEvt Discovery event.
*/
private void checkLaunchCoordinator(DiscoveryEvent discoEvt) {
rw.readLock();
try {
if (stopping)
return;
if (fragmentizerCrd == null) {
long minNodeOrder = Long.MAX_VALUE;
Collection<ClusterNode> nodes = discoEvt.topologyNodes();
for (ClusterNode node : nodes) {
if (node.order() < minNodeOrder && igfsCtx.igfsNode(node))
minNodeOrder = node.order();
}
ClusterNode locNode = igfsCtx.kernalContext().grid().localNode();
if (locNode.order() == minNodeOrder) {
if (log.isDebugEnabled())
log.debug("Detected local node to be the eldest IGFS node in topology, starting fragmentizer " + "coordinator thread [discoEvt=" + discoEvt + ", locNode=" + locNode + ']');
synchronized (this) {
if (fragmentizerCrd == null && !stopping) {
fragmentizerCrd = new FragmentizerCoordinator();
new IgniteThread(fragmentizerCrd).start();
}
}
}
}
} finally {
rw.readUnlock();
}
}
use of org.apache.ignite.thread.IgniteThread in project ignite by apache.
the class StripedCompositeReadWriteLock method readLock.
/** {@inheritDoc} */
@NotNull
@Override
public Lock readLock() {
int idx;
if (Thread.currentThread() instanceof IgniteThread) {
IgniteThread igniteThread = (IgniteThread) Thread.currentThread();
idx = igniteThread.compositeRwLockIndex();
if (idx == IgniteThread.GRP_IDX_UNASSIGNED) {
idx = IDX_GEN.incrementAndGet();
igniteThread.compositeRwLockIndex(idx);
}
} else
idx = IDX.get();
return locks[idx % locks.length].readLock();
}
use of org.apache.ignite.thread.IgniteThread in project ignite by apache.
the class TcpCommunicationSpi method spiStart.
/** {@inheritDoc} */
@Override
public void spiStart(String igniteInstanceName) throws IgniteSpiException {
assert locHost != null;
// Start SPI start stopwatch.
startStopwatch();
// Ack parameters.
if (log.isDebugEnabled()) {
log.debug(configInfo("locAddr", locAddr));
log.debug(configInfo("locPort", locPort));
log.debug(configInfo("locPortRange", locPortRange));
log.debug(configInfo("idleConnTimeout", idleConnTimeout));
log.debug(configInfo("directBuf", directBuf));
log.debug(configInfo("directSendBuf", directSndBuf));
log.debug(configInfo("selectorsCnt", selectorsCnt));
log.debug(configInfo("tcpNoDelay", tcpNoDelay));
log.debug(configInfo("sockSndBuf", sockSndBuf));
log.debug(configInfo("sockRcvBuf", sockRcvBuf));
log.debug(configInfo("shmemPort", shmemPort));
log.debug(configInfo("msgQueueLimit", msgQueueLimit));
log.debug(configInfo("connectionsPerNode", connectionsPerNode));
if (failureDetectionTimeoutEnabled()) {
log.debug(configInfo("connTimeout", connTimeout));
log.debug(configInfo("maxConnTimeout", maxConnTimeout));
log.debug(configInfo("reconCnt", reconCnt));
} else
log.debug(configInfo("failureDetectionTimeout", failureDetectionTimeout()));
log.debug(configInfo("sockWriteTimeout", sockWriteTimeout));
log.debug(configInfo("ackSndThreshold", ackSndThreshold));
log.debug(configInfo("unackedMsgsBufSize", unackedMsgsBufSize));
}
if (!tcpNoDelay)
U.quietAndWarn(log, "'TCP_NO_DELAY' for communication is off, which should be used with caution " + "since may produce significant delays with some scenarios.");
if (slowClientQueueLimit > 0 && msgQueueLimit > 0 && slowClientQueueLimit >= msgQueueLimit) {
U.quietAndWarn(log, "Slow client queue limit is set to a value greater than message queue limit " + "(slow client queue limit will have no effect) [msgQueueLimit=" + msgQueueLimit + ", slowClientQueueLimit=" + slowClientQueueLimit + ']');
}
if (msgQueueLimit == 0)
U.quietAndWarn(log, "Message queue limit is set to 0 which may lead to " + "potential OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes " + "due to message queues growth on sender and receiver sides.");
registerMBean(igniteInstanceName, new TcpCommunicationSpiMBeanImpl(this), TcpCommunicationSpiMBean.class);
connectGate = new ConnectGateway();
if (shmemSrv != null) {
shmemAcceptWorker = new ShmemAcceptWorker(shmemSrv);
new IgniteThread(shmemAcceptWorker).start();
}
nioSrvr.start();
commWorker = new CommunicationWorker(igniteInstanceName);
commWorker.start();
// Ack start.
if (log.isDebugEnabled())
log.debug(startInfo());
}
use of org.apache.ignite.thread.IgniteThread in project ignite by apache.
the class HadoopShuffleJob method startSending.
/**
* @param igniteInstanceName Ignite instance name.
* @param io IO Closure for sending messages.
*/
@SuppressWarnings("BusyWait")
public void startSending(String igniteInstanceName, IgniteInClosure2X<T, HadoopMessage> io) {
assert snd == null;
assert io != null;
this.io = io;
if (!stripeMappers) {
if (!flushed) {
snd = new GridWorker(igniteInstanceName, "hadoop-shuffle-" + job.id(), log) {
@Override
protected void body() throws InterruptedException {
try {
while (!isCancelled()) {
if (throttle > 0)
Thread.sleep(throttle);
collectUpdatesAndSend(false);
}
} catch (IgniteCheckedException e) {
throw new IllegalStateException(e);
}
}
};
new IgniteThread(snd).start();
}
}
ioInitLatch.countDown();
}
Aggregations