/** * @return a String representing a particular timestamp (in milliseconds) */ public static String format(long timestamp) { return format(Instant.ofEpochMilli(timestamp)); }
connectedSince = DateFormatter.now();
public Producer(Topic topic, ServerCnx cnx, long producerId, String producerName, String appId, boolean isEncrypted, Map<String, String> metadata, SchemaVersion schemaVersion) { this.topic = topic; this.cnx = cnx; this.producerId = producerId; this.producerName = checkNotNull(producerName); this.closeFuture = new CompletableFuture<>(); this.appId = appId; this.authenticationData = cnx.authenticationData; this.msgIn = new Rate(); this.isNonPersistentTopic = topic instanceof NonPersistentTopic; this.msgDrop = this.isNonPersistentTopic ? new Rate() : null; this.metadata = metadata != null ? metadata : Collections.emptyMap(); this.stats = isNonPersistentTopic ? new NonPersistentPublisherStats() : new PublisherStats(); stats.setAddress(cnx.clientAddress().toString()); stats.setConnectedSince(DateFormatter.now()); stats.setClientVersion(cnx.getClientVersion()); stats.setProducerName(producerName); stats.producerId = producerId; stats.metadata = this.metadata; this.isRemote = producerName .startsWith(cnx.getBrokerService().pulsar().getConfiguration().getReplicatorPrefix()); this.remoteCluster = isRemote ? producerName.split("\\.")[2] : null; this.isEncrypted = isEncrypted; this.schemaVersion = schemaVersion; }
/** * @return a String representing the current datetime */ public static String now() { return format(Instant.now()); }
connectedSince = DateFormatter.now();
/** * @return a String representing the current datetime */ public static String now() { return format(Instant.now()); }
stats.setAddress(cnx.clientAddress().toString()); stats.consumerName = consumerName; stats.setConnectedSince(DateFormatter.now()); stats.setClientVersion(cnx.getClientVersion()); stats.metadata = this.metadata;
/** * @return a String representing a particular timestamp (in milliseconds) */ public static String format(long timestamp) { return format(Instant.ofEpochMilli(timestamp)); }
stats.currentLedgerEntries = ml.getCurrentLedgerEntries(); stats.currentLedgerSize = ml.getCurrentLedgerSize(); stats.lastLedgerCreatedTimestamp = DateFormatter.format(ml.getLastLedgerCreatedTimestamp()); if (ml.getLastLedgerCreationFailureTimestamp() != 0) { stats.lastLedgerCreationFailureTimestamp = DateFormatter.format(ml.getLastLedgerCreationFailureTimestamp()); cs.cursorLedgerLastEntry = cursor.getCursorLedgerLastEntry(); cs.individuallyDeletedMessages = cursor.getIndividuallyDeletedMessages(); cs.lastLedgerSwitchTimestamp = DateFormatter.format(cursor.getLastLedgerSwitchTimestamp()); cs.state = cursor.getState(); cs.numberOfEntriesSinceFirstNotAckedMessage = cursor.getNumberOfEntriesSinceFirstNotAckedMessage();