Skip to content

Commit

Permalink
Improving logging of session start/stop
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Feb 9, 2018
1 parent e522ebd commit 68b9e10
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public Optional<ActiveSession> apply(Set<Dialect> downstreamDialects, Capabiliti
LOG.info("Capabilities are: " + caps);
return factories.stream()
.filter(factory -> factory.isSupporting(caps))
.peek(factory -> LOG.info(String.format("%s matched %s", caps, factory)))
.peek(factory -> LOG.info(String.format("Matched factory %s", factory)))
.map(factory -> factory.apply(downstreamDialects, caps))
.filter(Optional::isPresent)
.map(Optional::get)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ protected Optional<ActiveSession> performHandshake(

Response response = result.createResponse();
//noinspection unchecked
return Optional.of(newActiveSession(
Optional<ActiveSession> activeSession = Optional.of(newActiveSession(
additionalData,
downstream,
upstream,
codec,
new SessionId(response.getSessionId()),
(Map<String, Object>) response.getValue()));
activeSession.ifPresent(session -> log.info("Started new session " + session));
return activeSession;
} catch (IOException | IllegalStateException | NullPointerException e) {
log.log(Level.WARNING, e.getMessage(), e);
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected ServicedSession newActiveSession(

@Override
public String toString() {
return getClass() + " (provider: " + serviceClassName + ")";
return getClass().getName() + " (provider: " + serviceClassName + ")";
}
}

Expand Down

0 comments on commit 68b9e10

Please sign in to comment.