Skip to content

Commit

Permalink
chore: add call thread debug logging (#15294) (#15302)
Browse files Browse the repository at this point in the history
Add debug logging for incrementing
server id to be able to see what is
calling it during runtime.

Targets #14797

Co-authored-by: caalador <[email protected]>
  • Loading branch information
vaadin-bot and caalador authored Nov 28, 2022
1 parent 257a2ca commit 4d60389
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.Serializable;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -78,6 +79,7 @@
import com.vaadin.flow.server.frontend.FallbackChunk.CssImportData;
import com.vaadin.flow.shared.Registration;
import com.vaadin.flow.shared.communication.PushMode;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -316,6 +318,12 @@ public int getServerSyncId() {
*/
public void incrementServerId() {
serverSyncId++;
if (getLogger().isDebugEnabled()) {
getLogger().debug("Increment syncId:\n{}", Arrays
.stream(Thread.currentThread().getStackTrace()).skip(1)
.map(String::valueOf)
.collect(Collectors.joining(System.lineSeparator())));
}
}

/**
Expand All @@ -325,10 +333,9 @@ public void incrementServerId() {
* should be taken since this method might be called in situations where
* {@link UI#getCurrent()} does not return the UI.
*
* @see VaadinService#closeInactiveUIs(VaadinSession)
*
* @return The time the last heartbeat request occurred, in milliseconds
* since the epoch.
* @see VaadinService#closeInactiveUIs(VaadinSession)
*/
public long getLastHeartbeatTimestamp() {
return lastHeartbeatTimestamp;
Expand Down Expand Up @@ -389,10 +396,8 @@ private static String getSessionDetails(VaadinSession session) {
*
* @param session
* the session to set
*
* @throws IllegalStateException
* if the session has already been set
*
* @see #getSession()
*/
public void setSession(VaadinSession session) {
Expand Down

0 comments on commit 4d60389

Please sign in to comment.