@Override public String toString() { final StringBuilder sb = new StringBuilder(); if (isUDP()) { sb.append("U "); } else if (isTCP()) { sb.append("T "); } else { // TODO: need WS, SCTP etc as well. but not as common // right now so no big deal. } // final DateTimeFormatter formatter = // DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss.SSS"); final Instant timestamp = Instant.ofEpochMilli(getArrivalTime() / 1000); sb.append(timestamp.toString()) .append(" ") .append(getSourceIP()) .append(":") .append(getSourcePort()) .append(" -> ") .append(getDestinationIP()) .append(":") .append(getDestinationPort()) .append("\n") .append(this.msg.toString()); return sb.toString(); }
@Override public void addHeartbeat(Heartbeat gb, Instant timestamp) { LOGGER.debug( "Updating exsisting heartbeat for customer {} and network, current timestamp: {}", new Object[] {gb.getCustomer(), gb.getNetwork(), timestamp.toString()}); if (heartbeatMap.containsKey(gb)) { heartbeatMap.replace(gb, timestamp); } else { heartbeatMap.put(gb, timestamp); } }
@Override public String toNonNullValue(Instant value) { return value.toString(); }
@Override public String print(Instant object, Locale locale) { return object.toString(); }
@JsonProperty("@ts") private String strValue() { return value.toString(); }