Source:
<code>private void writeUnlock(String opName, boolean suppressWriteLockReport, Supplier<String> lockReportInfoSupplier) { final boolean needReport = !suppressWriteLockReport && coarseLock .getWriteHoldCount() == 1 && coarseLock.isWriteLockedByCurrentThread(); final long writeLockIntervalNanos = timer.monotonicNowNanos() - writeLockHeldTimeStampNanos; final long currentTimeMs = timer.now(); final long writeLockIntervalMs = TimeUnit.NANOSECONDS.toMillis(writeLockIntervalNanos); LogAction logAction = LogThrottlingHelper.DO_NOT_LOG; if (needReport && writeLockIntervalMs >= this.writeLockReportingThresholdMs) { if (longestWriteLockHeldInfo.getIntervalMs() <= writeLockIntervalMs) { String lockReportInfo = lockReportInfoSupplier != null ? " (" + lockReportInfoSupplier.get() + ")" : ""; longestWriteLockHeldInfo = new LockHeldInfo(currentTimeMs, writeLockIntervalMs, <START> StringUtils.getStackTrace(Thread.currentThread()), opName, lockReportInfo); <END> } logAction = writeLockReportLogger .record("write", currentTimeMs, writeLockIntervalMs); } LockHeldInfo lockHeldInfo = longestWriteLockHeldInfo; if (logAction.shouldLog()) { longestWriteLockHeldInfo = new LockHeldInfo(0, 0, null, null, null); } coarseLock.writeLock().unlock(); if (needReport) { addMetric(opName, writeLockIntervalNanos, true); } if (logAction.shouldLog()) { FSNamesystem.LOG.info( "\tNumber of suppressed write-lock reports: {}" + "\n\tLongest write-lock held at for {}ms by {}{} via {}" + "\n\tTotal suppressed write-lock held time: {}", logAction.getCount() - 1, Time.formatTime(lockHeldInfo.getStartTimeMs()), lockHeldInfo.getIntervalMs(), lockHeldInfo.getOpName(), lockHeldInfo.getLockReportInfo(), lockHeldInfo.getStackTrace(), logAction.getStats(0).getSum() - lockHeldInfo.getIntervalMs()); } }</code><technical_language>Extract trace least</technical_language>

Target:
private void writeUnlock(String opName, boolean suppressWriteLockReport, Supplier<String> lockReportInfoSupplier) { final boolean needReport = !suppressWriteLockReport && coarseLock .getWriteHoldCount() == 1 && coarseLock.isWriteLockedByCurrentThread(); final long writeLockIntervalNanos = timer.monotonicNowNanos() - writeLockHeldTimeStampNanos; final long currentTimeMs = timer.now(); final long writeLockIntervalMs = TimeUnit.NANOSECONDS.toMillis(writeLockIntervalNanos); LogAction logAction = LogThrottlingHelper.DO_NOT_LOG; if (needReport && writeLockIntervalMs >= this.writeLockReportingThresholdMs) { if (longestWriteLockHeldInfo.getIntervalMs() <= writeLockIntervalMs) { String lockReportInfo = lockReportInfoSupplier != null ? " (" + lockReportInfoSupplier.get() + ")" : ""; longestWriteLockHeldInfo = new LockHeldInfo(currentTimeMs, writeLockIntervalMs, StringUtils.getStackTrace(Thread.currentThread()), opName, lockReportInfo); } logAction = writeLockReportLogger .record("write", currentTimeMs, writeLockIntervalMs); } LockHeldInfo lockHeldInfo = longestWriteLockHeldInfo; if (logAction.shouldLog()) { longestWriteLockHeldInfo = new LockHeldInfo(); } coarseLock.writeLock().unlock(); if (needReport) { addMetric(opName, writeLockIntervalNanos, true); } if (logAction.shouldLog()) { FSNamesystem.LOG.info( "\tNumber of suppressed write-lock reports: {}" + "\n\tLongest write-lock held at for {}ms by {}{} via {}" + "\n\tTotal suppressed write-lock held time: {}", logAction.getCount() - 1, Time.formatTime(lockHeldInfo.getStartTimeMs()), lockHeldInfo.getIntervalMs(), lockHeldInfo.getOpName(), lockHeldInfo.getLockReportInfo(), lockHeldInfo.getStackTrace(), logAction.getStats(0).getSum() - lockHeldInfo.getIntervalMs()); } }