本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.interrupt方法的典型用法代码示例。如果您正苦于以下问题:Java U.interrupt方法的具体用法?Java U.interrupt怎么用?Java U.interrupt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.interrupt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Shuts down the IO. No send requests will be accepted anymore, all pending futures will be failed.
* Close listeners will be invoked as if connection is closed by server.
*/
private void stop() {
close0(null);
if (reader != null) {
try {
U.interrupt(reader);
U.join(reader);
reader = null;
}
catch (IgniteInterruptedCheckedException ignored) {
Thread.currentThread().interrupt();
log.warn("Got interrupted while waiting for reader thread to shut down (will return).");
}
}
}
示例2: spiStop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void spiStop() throws IgniteSpiException {
if (timeoutTask != null) {
U.interrupt(timeoutTask);
U.join(timeoutTask, log);
}
unregisterMBean();
// Clean resources.
folder = null;
host = null;
// Ack ok stop.
if (log.isDebugEnabled())
log.debug(stopInfo());
}
示例3: simulateNodeFailure
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Stops service threads to simulate node failure.
*
* FOR TEST PURPOSES ONLY!!!
*/
public void simulateNodeFailure() {
if (nioSrvr != null)
nioSrvr.stop();
U.interrupt(commWorker);
U.join(commWorker, log);
for (GridCommunicationClient[] clients0 : clients.values()) {
for (GridCommunicationClient client : clients0) {
if (client != null)
client.forceClose();
}
}
}
示例4: kill
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Kills the java process.
*
* @throws Exception If any problem occurred.
*/
public void kill() throws Exception {
Process killProc = U.isWindows() ?
Runtime.getRuntime().exec(new String[] {"taskkill", "/pid", pid, "/f", "/t"}) :
Runtime.getRuntime().exec(new String[] {"kill", "-9", pid});
killProc.waitFor();
int exitVal = killProc.exitValue();
if (exitVal != 0)
log.info(String.format("Abnormal exit value of %s for pid %s", exitVal, pid));
if (procKilledC != null)
procKilledC.apply();
U.interrupt(osGrabber);
U.interrupt(esGrabber);
U.join(osGrabber, log);
U.join(esGrabber, log);
}
示例5: stop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Stops all threads and releases all resources.
*/
public void stop() {
if (!closed) {
closed = true;
// Make sure to entirely stop acceptor if any.
U.interrupt(acceptThread);
U.join(acceptThread, log);
U.cancel(clientWorkers);
U.join(clientWorkers, log);
filterChain.stop();
for (GridSelectorNioSessionImpl ses : sessions)
ses.onServerStopped();
}
}
示例6: spiStop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void spiStop() throws IgniteSpiException {
if (msgWorker != null && msgWorker.isAlive()) { // Should always be alive
msgWorker.addMessage(SPI_STOP);
try {
if (!leaveLatch.await(spi.netTimeout, MILLISECONDS))
U.warn(log, "Failed to left node: timeout [nodeId=" + locNode + ']');
}
catch (InterruptedException ignored) {
// No-op.
}
}
for (GridFutureAdapter<Boolean> fut : pingFuts.values())
fut.onDone(false);
rmtNodes.clear();
U.interrupt(msgWorker);
U.interrupt(sockWriter);
U.interrupt(sockReader);
U.join(msgWorker, log);
U.join(sockWriter, log);
U.join(sockReader, log);
timer.cancel();
spi.printStopInfo();
}
示例7: disconnect
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void disconnect() throws IgniteSpiException {
U.interrupt(msgWorker);
U.interrupt(sockWriter);
U.interrupt(sockReader);
U.join(msgWorker, log);
U.join(sockWriter, log);
U.join(sockReader, log);
leaveLatch.countDown();
joinLatch.countDown();
spi.getSpiContext().deregisterPorts();
Collection<ClusterNode> rmts = getRemoteNodes();
// This is restart/disconnection and remote nodes are not empty.
// We need to fire FAIL event for each.
DiscoverySpiListener lsnr = spi.lsnr;
if (lsnr != null) {
for (ClusterNode n : rmts) {
rmtNodes.remove(n.id());
Collection<ClusterNode> top = updateTopologyHistory(topVer + 1, null);
lsnr.onDiscovery(EVT_NODE_FAILED, topVer, n, top, new TreeMap<>(topHist), null);
}
}
rmtNodes.clear();
}
示例8: simulateNodeFailure
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override void simulateNodeFailure() {
U.warn(log, "Simulating client node failure: " + getLocalNodeId());
U.interrupt(sockWriter);
U.interrupt(msgWorker);
U.join(sockWriter, log);
U.join(
msgWorker,
log);
}
示例9: spiStop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void spiStop() throws IgniteSpiException {
assert stopping;
unregisterMBean();
// Stop TCP server.
if (nioSrvr != null)
nioSrvr.stop();
U.interrupt(commWorker);
U.join(commWorker, log);
U.cancel(shmemAcceptWorker);
U.join(shmemAcceptWorker, log);
U.cancel(shmemWorkers);
U.join(shmemWorkers, log);
shmemWorkers.clear();
// Force closing on stop (safety).
for (GridCommunicationClient[] clients0 : clients.values()) {
for (GridCommunicationClient client : clients0) {
if (client != null)
client.forceClose();
}
}
// Clear resources.
nioSrvr = null;
commWorker = null;
boundTcpPort = -1;
// Ack stop.
if (log.isDebugEnabled())
log.debug(stopInfo());
}
示例10: stop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@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.");
}
示例11: onKernalStop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("BusyWait")
@Override public void onKernalStop(boolean cancel) {
if (isRestEnabled()) {
busyLock.writeLock();
boolean interrupted = Thread.interrupted();
while (workersCnt.sum() != 0) {
try {
Thread.sleep(200);
}
catch (InterruptedException ignored) {
interrupted = true;
}
}
U.interrupt(sesTimeoutCheckerThread);
if (interrupted)
Thread.currentThread().interrupt();
for (GridRestProtocol proto : protos)
proto.stop();
// Safety.
startLatch.countDown();
if (log.isDebugEnabled())
log.debug("REST processor stopped.");
}
}
示例12: onCancelAtStop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override void onCancelAtStop() {
super.onCancelAtStop();
for (GridCacheQueryFutureAdapter fut : futs.values())
try {
fut.cancel();
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to cancel running query future: " + fut, e);
}
U.interrupt(threads.values());
}
示例13: killProcess
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Kills process using {@link Process#destroy()}.
*/
public void killProcess() {
proc.destroy();
if (procKilledC != null)
procKilledC.apply();
U.interrupt(osGrabber);
U.interrupt(esGrabber);
U.join(osGrabber, log);
U.join(esGrabber, log);
}
示例14: close
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void close() throws Exception {
U.closeQuiet(inputSock);
U.interrupt(mainThread);
U.join(mainThread, log);
}
示例15: cancel
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Cancels scanner execution.
*/
public void cancel() {
U.interrupt(scannerThread);
}