本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.join方法的典型用法代码示例。如果您正苦于以下问题:Java U.join方法的具体用法?Java U.join怎么用?Java U.join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Stops the server.
*
* @throws IgniteCheckedException
*/
public void stop() throws IgniteCheckedException {
// Stop TCP server.
if (nioSrvr != null)
nioSrvr.stop();
U.cancel(shmemAcceptWorker);
U.join(shmemAcceptWorker, log);
U.cancel(shmemWorkers);
U.join(shmemWorkers, log);
shmemWorkers.clear();
// Force closing on stop (safety).
for (HadoopCommunicationClient client : clients.values())
client.forceClose();
// Clear resources.
nioSrvr = null;
boundTcpPort = -1;
}
示例2: 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).");
}
}
}
示例3: 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);
}
示例4: close
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void close() {
closed = true;
U.closeQuiet(srvSock);
if (gcWorker != null) {
U.cancel(gcWorker);
// This method may be called from already interrupted thread.
// Need to ensure cleaning on close.
boolean interrupted = Thread.interrupted();
try {
U.join(gcWorker);
}
catch (IgniteInterruptedCheckedException e) {
U.warn(log, "Interrupted when stopping GC worker.", e);
}
finally {
if (interrupted)
Thread.currentThread().interrupt();
}
}
}
示例5: stop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Performs shutdown logic for store. No put, get and remove requests will be processed after
* this method is called.
*/
@Override public void stop() {
if (stopping.compareAndSet(false, true)) {
if (log.isDebugEnabled())
log.debug("Stopping write-behind store for cache '" + cacheName + '\'');
for (Flusher f : flushThreads) {
if (!f.isEmpty())
f.wakeUp();
}
boolean graceful = true;
for (GridWorker worker : flushThreads)
graceful &= U.join(worker, log);
if (!graceful)
log.warning("Write behind store shutdown was aborted.");
}
}
示例6: stop
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void stop(boolean cancel) throws IgniteCheckedException {
busyLock.block();
// Stop receiving notifications.
getSpi().setListener(null);
// Stop discovery worker and metrics updater.
U.closeQuiet(metricsUpdateTask);
U.cancel(discoWrk);
U.join(discoWrk, log);
// Stop SPI itself.
stopSpi();
// Stop spi if was not add in spi map but port was open.
if (!registeredDiscoSpi)
getSpi().spiStop();
registeredDiscoSpi = false;
if (log.isDebugEnabled())
log.debug(stopInfo());
}
示例7: 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();
}
}
示例8: join
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Waits for all workers to finish.
*
* @param cancel Flag to indicate whether workers should be cancelled
* before waiting for them to finish.
*/
public void join(boolean cancel) {
if (cancel)
U.cancel(workers);
// Record current interrupted status of calling thread.
boolean interrupted = Thread.interrupted();
try {
U.join(workers, log);
}
finally {
// Reset interrupted flag on calling thread.
if (interrupted)
Thread.currentThread().interrupt();
}
}
示例9: join
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Joins scanner thread.
*/
public void join() {
U.join(scannerThread, log);
if (log.isDebugEnabled())
log.debug("Grid URI deployment scanner stopped: " + this);
}
示例10: 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();
}
示例11: 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();
}
示例12: 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);
}
示例13: stopCleanupWorker
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
*
*/
private void stopCleanupWorker() {
if (null != cleanupWorker) {
U.cancel(cleanupWorker);
U.join(cleanupWorker, log);
cleanupWorker = null;
}
}
示例14: onKernalStop0
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void onKernalStop0(boolean cancel) {
if (cancel)
delWorker.cancel();
else
delWorker.stop();
try {
// Always wait thread exit.
U.join(delWorker);
}
catch (IgniteInterruptedCheckedException e) {
log.warning("Got interrupter while waiting for delete worker to stop (will continue stopping).", e);
}
}
示例15: 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);
}