Source:
<code>public void cleanUp() { if (theInstance != this && theInstance != null) { LOGGER.log(Level.WARNING, "This instance is no longer the singleton, ignoring cleanUp()"); return; } synchronized (Jenkins.class) { if (cleanUpStarted) { LOGGER.log(Level.WARNING, "Jenkins.cleanUp() already started, ignoring repeated cleanUp()"); return; } cleanUpStarted = true; } try { LOGGER.log(Level.INFO, "Stopping Jenkins"); final List<Throwable> errors = new ArrayList<>(); fireBeforeShutdown(errors); _cleanUpRunTerminators(errors); terminating = true; final Set<Future<?>> pending = _cleanUpDisconnectComputers(errors); _cleanUpShutdownUDPBroadcast(errors); _cleanUpCloseDNSMulticast(errors); _cleanUpInterruptReloadThread(errors); _cleanUpShutdownTriggers(errors); _cleanUpShutdownTimer(errors); _cleanUpShutdownTcpSlaveAgent(errors); _cleanUpShutdownPluginManager(errors); _cleanUpPersistQueue(errors); _cleanUpShutdownThreadPoolForLoad(errors); _cleanUpAwaitDisconnects(errors, pending); _cleanUpPluginServletFilters(errors); _cleanUpReleaseAllLoggers(errors); LOGGER.log(Level.INFO, "Jenkins stopped"); if (!errors.isEmpty()) { StringBuilder message = new StringBuilder("Unexpected issues encountered during cleanUp: "); boolean first = true; for (Throwable e : errors) { if (first) { first = false; } else { message.append("; "); } message.append(e.getMessage()); } <START> throw new RuntimeException(message.toString(), errors.get(0)); <END> } } finally { theInstance = null; } }</code><technical_language>ant: Throwable.addSuppressed others</technical_language>

Target:
public void cleanUp() { if (theInstance != this && theInstance != null) { LOGGER.log(Level.WARNING, "This instance is no longer the singleton, ignoring cleanUp()"); return; } synchronized (Jenkins.class) { if (cleanUpStarted) { LOGGER.log(Level.WARNING, "Jenkins.cleanUp() already started, ignoring repeated cleanUp()"); return; } cleanUpStarted = true; } try { LOGGER.log(Level.INFO, "Stopping Jenkins"); final List<Throwable> errors = new ArrayList<>(); fireBeforeShutdown(errors); _cleanUpRunTerminators(errors); terminating = true; final Set<Future<?>> pending = _cleanUpDisconnectComputers(errors); _cleanUpShutdownUDPBroadcast(errors); _cleanUpCloseDNSMulticast(errors); _cleanUpInterruptReloadThread(errors); _cleanUpShutdownTriggers(errors); _cleanUpShutdownTimer(errors); _cleanUpShutdownTcpSlaveAgent(errors); _cleanUpShutdownPluginManager(errors); _cleanUpPersistQueue(errors); _cleanUpShutdownThreadPoolForLoad(errors); _cleanUpAwaitDisconnects(errors, pending); _cleanUpPluginServletFilters(errors); _cleanUpReleaseAllLoggers(errors); LOGGER.log(Level.INFO, "Jenkins stopped"); if (!errors.isEmpty()) { StringBuilder message = new StringBuilder("Unexpected issues encountered during cleanUp: "); Iterator<Throwable> iterator = errors.iterator(); message.append(iterator.next().getMessage()); while (iterator.hasNext()) { message.append("; "); message.append(iterator.next().getMessage()); } iterator = errors.iterator(); RuntimeException exception = new RuntimeException(message.toString(), iterator.next()); while (iterator.hasNext()) { exception.addSuppressed(iterator.next()); } throw exception; } } finally { theInstance = null; if (JenkinsJVM.isJenkinsJVM()) { JenkinsJVMAccess._setJenkinsJVM(oldJenkinsJVM); } } }