use of org.apache.ignite.internal.IgniteDiagnosticAware in project ignite by apache.
the class GridCachePartitionExchangeManager method dumpLongRunningOperations0.
/**
* @param timeout Operation timeout.
* @return {@code True} if found long running operations.
*/
private boolean dumpLongRunningOperations0(long timeout) {
long curTime = U.currentTimeMillis();
boolean found = false;
IgniteTxManager tm = cctx.tm();
GridCacheMvccManager mvcc = cctx.mvcc();
final IgniteDiagnosticPrepareContext diagCtx = cctx.kernalContext().cluster().diagnosticEnabled() ? new IgniteDiagnosticPrepareContext(cctx.localNodeId()) : null;
if (tm != null) {
for (IgniteInternalTx tx : tm.activeTransactions()) {
if (curTime - tx.startTime() > timeout) {
found = true;
U.warn(diagnosticLog, "Found long running transaction [startTime=" + formatTime(tx.startTime()) + ", curTime=" + formatTime(curTime) + ", tx=" + tx + ']');
}
}
}
if (mvcc != null) {
for (GridCacheFuture<?> fut : mvcc.activeFutures()) {
if (curTime - fut.startTime() > timeout) {
found = true;
U.warn(diagnosticLog, "Found long running cache future [startTime=" + formatTime(fut.startTime()) + ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
if (diagCtx != null && fut instanceof IgniteDiagnosticAware)
((IgniteDiagnosticAware) fut).addDiagnosticRequest(diagCtx);
}
}
for (GridCacheFuture<?> fut : mvcc.atomicFutures()) {
if (curTime - fut.startTime() > timeout) {
found = true;
U.warn(diagnosticLog, "Found long running cache future [startTime=" + formatTime(fut.startTime()) + ", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
if (diagCtx != null && fut instanceof IgniteDiagnosticAware)
((IgniteDiagnosticAware) fut).addDiagnosticRequest(diagCtx);
}
}
}
if (diagCtx != null && !diagCtx.empty()) {
try {
cctx.kernalContext().closure().runLocal(new Runnable() {
@Override
public void run() {
diagCtx.send(cctx.kernalContext(), null);
}
}, SYSTEM_POOL);
} catch (IgniteCheckedException e) {
U.error(diagnosticLog, "Failed to submit diagnostic closure: " + e, e);
}
}
return found;
}
Aggregations