public void run() { while (!shellStatus.getStatus().equals(Status.SHUTTING_DOWN) && !shutdownHookFired) { synchronized (flashInfoMap) { long now = System.currentTimeMillis(); Set<String> toRemove = new HashSet<String>(); for (String slot : flashInfoMap.keySet()) { FlashInfo flashInfo = flashInfoMap.get(slot); if (flashInfo.flashMessageUntil < now) { // Message has expired, so clear it toRemove.add(slot); doAnsiFlash(flashInfo.rowNumber, Level.ALL, ""); } else { // The expiration time for this message has not been reached, so preserve it doAnsiFlash(flashInfo.rowNumber, flashInfo.flashLevel, flashInfo.flashMessage); } } for (String slot : toRemove) { flashInfoMap.remove(slot); } } try { Thread.sleep(200); } catch (InterruptedException ignore) { } } } }, getProductName() + " JLine Flash Message Manager");
@Override public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ShellStatus other = (ShellStatus) obj; if (message == null) { if (other.message != null) return false; } else if (!message.equals(other.message)) return false; if (parseResult == null) { if (other.parseResult != null) return false; } else if (!parseResult.equals(other.parseResult)) return false; if (status == null) { if (other.status != null) return false; } else if (!status.equals(other.status)) return false; return true; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((message == null) ? 0 : message.hashCode()); result = prime * result + ((parseResult == null) ? 0 : parseResult.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); return result; }
public void onShellStatusChange(final ShellStatus oldStatus, final ShellStatus newStatus) { if (newStatus.getStatus().equals(Status.SHUTTING_DOWN)) { ansiOut.close(); } } };