Skip to content

Commit 70e2af2

Browse files
wip: spotless
Signed-off-by: Matt Peterson <matt.peterson@swirldslabs.com>
1 parent 3dd03b6 commit 70e2af2

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

server/src/main/java/com/hedera/block/server/consumer/ConsumerBlockItemObserver.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@
1616

1717
package com.hedera.block.server.consumer;
1818

19+
import static com.hedera.block.protos.BlockStreamService.BlockItem;
20+
import static com.hedera.block.protos.BlockStreamService.SubscribeStreamResponse;
21+
1922
import com.hedera.block.server.data.ObjectEvent;
2023
import com.hedera.block.server.mediator.StreamMediator;
2124
import io.grpc.stub.ServerCallStreamObserver;
2225
import io.grpc.stub.StreamObserver;
23-
2426
import java.time.InstantSource;
2527
import java.util.concurrent.atomic.AtomicBoolean;
2628

27-
import static com.hedera.block.protos.BlockStreamService.BlockItem;
28-
import static com.hedera.block.protos.BlockStreamService.SubscribeStreamResponse;
29-
3029
/**
31-
* The ConsumerBlockItemObserver class is the primary integration point between the LMAX Disruptor and
32-
* an instance of a downstream consumer (represented by subscribeStreamResponseObserver provided by Helidon).
33-
* The ConsumerBlockItemObserver implements the EventHandler interface so the Disruptor can invoke
34-
* the onEvent() method when a new SubscribeStreamResponse is available.
30+
* The ConsumerBlockItemObserver class is the primary integration point between the LMAX Disruptor
31+
* and an instance of a downstream consumer (represented by subscribeStreamResponseObserver provided
32+
* by Helidon). The ConsumerBlockItemObserver implements the EventHandler interface so the Disruptor
33+
* can invoke the onEvent() method when a new SubscribeStreamResponse is available.
3534
*/
3635
public class ConsumerBlockItemObserver
3736
implements BlockItemEventHandler<ObjectEvent<SubscribeStreamResponse>> {
@@ -114,7 +113,9 @@ public void onEvent(
114113
final long currentMillis = producerLivenessClock.millis();
115114
if (currentMillis - producerLivenessMillis > timeoutThresholdMillis) {
116115
streamMediator.unsubscribe(this);
117-
LOGGER.log(System.Logger.Level.DEBUG, "Unsubscribed ConsumerBlockItemObserver due to producer timeout");
116+
LOGGER.log(
117+
System.Logger.Level.DEBUG,
118+
"Unsubscribed ConsumerBlockItemObserver due to producer timeout");
118119
} else {
119120

120121
// Only send the response if the consumer has not cancelled
@@ -133,7 +134,10 @@ public void onEvent(
133134
}
134135

135136
if (streamStarted) {
136-
LOGGER.log(System.Logger.Level.DEBUG, "Send BlockItem downstream: {0} ", blockItem);
137+
LOGGER.log(
138+
System.Logger.Level.DEBUG,
139+
"Send BlockItem downstream: {0} ",
140+
blockItem);
137141
subscribeStreamResponseObserver.onNext(subscribeStreamResponse);
138142
}
139143
}

server/src/main/java/com/hedera/block/server/mediator/StreamMediator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
import java.io.IOException;
2121

2222
/**
23-
* The StreamMediator interface represents a bridge between a bidirectional stream of
24-
* items from a producer (e.g. a Consensus Node) and N consumers each requesting a gRPC
25-
* server stream of items. The StreamMediator manages adding and removing consumers
26-
* dynamically to receive items as they arrive from upstream.
23+
* The StreamMediator interface represents a bridge between a bidirectional stream of items from a
24+
* producer (e.g. a Consensus Node) and N consumers each requesting a gRPC server stream of items.
25+
* The StreamMediator manages adding and removing consumers dynamically to receive items as they
26+
* arrive from upstream.
2727
*
2828
* @param <U> The type of items sent by the upstream producer.
2929
* @param <V> The type of the response published to the downstream consumers.

0 commit comments

Comments
 (0)