Source:
<code>public TrackingEventStream openStream(TrackingToken trackingToken) { Assert.isTrue(trackingToken == null || trackingToken instanceof GlobalSequenceTrackingToken, () -> "Invalid tracking token type. Must be GlobalSequenceTrackingToken."); long nextToken = trackingToken == null ? 0 : ((GlobalSequenceTrackingToken) trackingToken).getGlobalIndex() + 1; EventBuffer consumer = new EventBuffer(upcasterChain, getEventSerializer()); logger.info("open stream: {}", nextToken); StreamObserver<GetEventsRequest> requestStream = eventStoreClient .listEvents(new StreamObserver<EventWithToken>() { @Override public void onNext(EventWithToken eventWithToken) { <START> logger.debug("Received event with token: {}. Stream Observer {}.", <END> eventWithToken.getToken(), this); consumer.push(eventWithToken); } @Override public void onError(Throwable throwable) { consumer.fail(new EventStoreException( "Error while reading events from the server", throwable )); } @Override public void onCompleted() { consumer.fail(new EventStoreException("Error while reading events from the server", new RuntimeException("Connection closed by server"))); } }); FlowControllingStreamObserver<GetEventsRequest> observer = new FlowControllingStreamObserver<>( requestStream, configuration, t -> GetEventsRequest.newBuilder().setNumberOfPermits(t.getPermits()).build(), t -> false ); GetEventsRequest request = GetEventsRequest.newBuilder() .setTrackingToken(nextToken) .setClientId(configuration.getClientId()) .setComponentName(configuration.getComponentName()) .setNumberOfPermits(configuration.getInitialNrOfPermits()) .build(); observer.onNext(request); consumer.registerCloseListener((eventConsumer) -> observer.onCompleted()); consumer.registerConsumeListener(observer::markConsumed); return consumer; }</code><technical_language>other methods trace(), this debug(). Is done purpose</technical_language>

Target:
public TrackingEventStream openStream(TrackingToken trackingToken) { Assert.isTrue(trackingToken == null || trackingToken instanceof GlobalSequenceTrackingToken, () -> "Invalid tracking token type. Must be GlobalSequenceTrackingToken."); long nextToken = trackingToken == null ? 0 : ((GlobalSequenceTrackingToken) trackingToken).getGlobalIndex() + 1; EventBuffer consumer = new EventBuffer(upcasterChain, getEventSerializer()); logger.info("open stream: {}", nextToken); StreamObserver<GetEventsRequest> requestStream = eventStoreClient .listEvents(new StreamObserver<EventWithToken>() { @Override public void onNext(EventWithToken eventWithToken) { if (logger.isTraceEnabled()) { logger.trace("Received event with token: {}. Stream Observer {}.", eventWithToken.getToken(), this); } consumer.push(eventWithToken); } @Override public void onError(Throwable throwable) { consumer.fail(new EventStoreException( "Error while reading events from the server", throwable )); } @Override public void onCompleted() { consumer.fail(new EventStoreException("Error while reading events from the server", new RuntimeException("Connection closed by server"))); } }); FlowControllingStreamObserver<GetEventsRequest> observer = new FlowControllingStreamObserver<>( requestStream, configuration, t -> GetEventsRequest.newBuilder().setNumberOfPermits(t.getPermits()).build(), t -> false ); GetEventsRequest request = GetEventsRequest.newBuilder() .setTrackingToken(nextToken) .setClientId(configuration.getClientId()) .setComponentName(configuration.getComponentName()) .setNumberOfPermits(configuration.getInitialNrOfPermits()) .build(); observer.onNext(request); consumer.registerCloseListener((eventConsumer) -> observer.onCompleted()); consumer.registerConsumeListener(observer::markConsumed); return consumer; }