Skip to content

Commit 34d6acc

Browse files
fix: removing hyphens and javadoc message grooming
Signed-off-by: Matt Peterson <[email protected]>
1 parent 678d527 commit 34d6acc

File tree

9 files changed

+25
-27
lines changed

9 files changed

+25
-27
lines changed

server/src/main/java/com/hedera/block/server/BlockStreamService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Descriptors.FileDescriptor proto() {
6969
* Returns the service name for the BlockStreamService. This service name corresponds to the service name in
7070
* the proto file.
7171
*
72-
* @return the service name
72+
* @return the service name corresponding to the service name in the proto file
7373
*/
7474
@Override
7575
public String serviceName() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
* the implementation of this interface can receive and process inbound messages with different types from
2525
* the producer and response messages from the consumer.
2626
*
27-
* @param <U> - the type of the block
28-
* @param <V> - the type of the StreamObserver
27+
* @param <U> the type of the block
28+
* @param <V> the type of the StreamObserver
2929
*/
3030
public interface LiveStreamObserver<U, V> extends StreamObserver<V> {
3131

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public LiveStreamObserverImpl(
5959
/**
6060
* Pass the block to the observer provided by Helidon
6161
*
62-
* @param block - the block to be passed to the observer
62+
* @param block the block to be passed to the observer
6363
*/
6464
@Override
6565
public void notify(final BlockStreamServiceGrpcProto.Block block) {
@@ -108,8 +108,7 @@ public void onError(final Throwable t) {
108108

109109
/**
110110
* The onCompleted() method is triggered by Helidon when the bidirectional stream to the downstream consumer is completed.
111-
* Unsubscribe the observer from the mediator.
112-
*
111+
* This implementation will then unsubscribe the observer from the mediator.
113112
*/
114113
@Override
115114
public void onCompleted() {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public LiveStreamMediatorImpl(final BlockPersistenceHandler<BlockStreamServiceGr
4949
/**
5050
* Subscribe a new observer to the mediator
5151
*
52-
* @param liveStreamObserver - the observer to be subscribed
52+
* @param liveStreamObserver the observer to be subscribed
5353
*/
5454
@Override
5555
public void subscribe(final LiveStreamObserver<BlockStreamServiceGrpcProto.Block, BlockStreamServiceGrpcProto.BlockResponse> liveStreamObserver) {
@@ -59,7 +59,7 @@ public void subscribe(final LiveStreamObserver<BlockStreamServiceGrpcProto.Block
5959
/**
6060
* Unsubscribe an observer from the mediator
6161
*
62-
* @param liveStreamObserver - the observer to be unsubscribed
62+
* @param liveStreamObserver the observer to be unsubscribed
6363
*/
6464
@Override
6565
public void unsubscribe(final LiveStreamObserver<BlockStreamServiceGrpcProto.Block, BlockStreamServiceGrpcProto.BlockResponse> liveStreamObserver) {
@@ -73,7 +73,7 @@ public void unsubscribe(final LiveStreamObserver<BlockStreamServiceGrpcProto.Blo
7373
/**
7474
* Check if an observer is subscribed to the mediator
7575
*
76-
* @param observer - the observer to be checked
76+
* @param observer the observer to be checked
7777
* @return true if the observer is subscribed, false otherwise
7878
*/
7979
@Override
@@ -92,7 +92,7 @@ public void unsubscribeAll() {
9292
/**
9393
* Notify all observers of a new block
9494
*
95-
* @param block - the block to be notified to all observers
95+
* @param block the block to be notified to all observers
9696
*/
9797
@Override
9898
public void notifyAll(final BlockStreamServiceGrpcProto.Block block) {

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
@@ -34,21 +34,21 @@ public interface StreamMediator<U, V> {
3434
/**
3535
* Subscribes a new LiveStreamObserver to receive blocks from the producer as they arrive
3636
*
37-
* @param observer - the LiveStreamObserver to subscribe
37+
* @param observer the LiveStreamObserver to subscribe
3838
*/
3939
void subscribe(final LiveStreamObserver<U, V> observer);
4040

4141
/**
4242
* Unsubscribes a LiveStreamObserver from the producer
4343
*
44-
* @param observer - the LiveStreamObserver to unsubscribe
44+
* @param observer the LiveStreamObserver to unsubscribe
4545
*/
4646
void unsubscribe(final LiveStreamObserver<U, V> observer);
4747

4848
/**
4949
* Checks if the observer is subscribed to the producer
5050
*
51-
* @param observer - the LiveStreamObserver to check
51+
* @param observer the LiveStreamObserver to check
5252
* @return true if the observer is subscribed, false otherwise
5353
*/
5454
boolean isSubscribed(final LiveStreamObserver<U, V> observer);
@@ -61,7 +61,7 @@ public interface StreamMediator<U, V> {
6161
/**
6262
* Passes the newly arrived block to all subscribers
6363
*
64-
* @param block - the block to pass to the subscribers
64+
* @param block the block to pass to the subscribers
6565
*/
6666
void notifyAll(final U block);
6767
}

server/src/main/java/com/hedera/block/server/persistence/BlockPersistenceHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface BlockPersistenceHandler<V> {
3939
* Reads a block.
4040
*
4141
* @param id the id of the block to read
42-
* @return the block
42+
* @return an Optional of the block
4343
*/
4444
Optional<V> read(final long id);
4545

server/src/main/java/com/hedera/block/server/persistence/WriteThroughCacheHandler.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public Long persist(final BlockStreamServiceGrpcProto.Block block) {
6464
*
6565
* @param startBlockId the start block id
6666
* @param endBlockId the end block id
67-
* @return the blocks
67+
* @return a queue of blocks
6868
*/
6969
@Override
7070
public Queue<BlockStreamServiceGrpcProto.Block> readRange(final long startBlockId, final long endBlockId) {
@@ -82,10 +82,12 @@ public Queue<BlockStreamServiceGrpcProto.Block> readRange(final long startBlockI
8282
}
8383

8484
/**
85-
* Reads a block from cache first. If the block is not in cache, read from storage and update the cache.
85+
* The read method first checks the cache for the block.
86+
* If the block is not in cache, then it reads from storage and
87+
* updates the cache.
8688
*
8789
* @param id the block id
88-
* @return the block
90+
* @return an Optional with the block
8991
*/
9092
@Override
9193
public Optional<BlockStreamServiceGrpcProto.Block> read(final long id) {

server/src/main/java/com/hedera/block/server/persistence/cache/LRUCache.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
@Singleton
3030
public class LRUCache implements BlockCache<BlockStreamServiceGrpcProto.Block> {
3131

32-
private final Map<Long, BlockStreamServiceGrpcProto.Block> m;
32+
private final Map<Long, BlockStreamServiceGrpcProto.Block> cache;
3333

3434
/**
3535
* Constructor for the LRUCache class.
@@ -40,7 +40,7 @@ public LRUCache(final long maxEntries) {
4040
final System.Logger LOGGER = System.getLogger(getClass().getName());
4141
LOGGER.log(System.Logger.Level.INFO, "Creating LRUCache with maxEntries: " + maxEntries);
4242

43-
m = Collections.synchronizedMap(new BNLinkedHashMap<>(maxEntries));
43+
cache = Collections.synchronizedMap(new BNLinkedHashMap<>(maxEntries));
4444
}
4545

4646
/**
@@ -52,7 +52,7 @@ public LRUCache(final long maxEntries) {
5252
@Override
5353
public Long insert(final BlockStreamServiceGrpcProto.Block block) {
5454
final long id = block.getId();
55-
m.putIfAbsent(id, block);
55+
cache.putIfAbsent(id, block);
5656
return id;
5757
}
5858

@@ -64,7 +64,7 @@ public Long insert(final BlockStreamServiceGrpcProto.Block block) {
6464
*/
6565
@Override
6666
public BlockStreamServiceGrpcProto.Block get(final Long id) {
67-
return m.get(id);
67+
return cache.get(id);
6868
}
6969

7070
/**
@@ -74,6 +74,6 @@ public BlockStreamServiceGrpcProto.Block get(final Long id) {
7474
*/
7575
@Override
7676
public boolean contains(final Long id) {
77-
return m.containsKey(id);
77+
return cache.containsKey(id);
7878
}
7979
}

server/src/main/java/com/hedera/block/server/producer/ProducerBlockStreamObserver.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
* gRPC service implementation. Helidon calls methods on this class as networking events occur
2626
* with the connection to the upstream producer (e.g. blocks streamed from the Consensus Node to
2727
* the server).
28-
*
2928
*/
3029
public class ProducerBlockStreamObserver implements StreamObserver<BlockStreamServiceGrpcProto.Block> {
3130

@@ -40,7 +39,6 @@ public class ProducerBlockStreamObserver implements StreamObserver<BlockStreamSe
4039
*
4140
* @param streamMediator the stream mediator
4241
* @param responseStreamObserver the response stream observer
43-
*
4442
*/
4543
public ProducerBlockStreamObserver(final StreamMediator<BlockStreamServiceGrpcProto.Block, BlockStreamServiceGrpcProto.BlockResponse> streamMediator,
4644
final StreamObserver<BlockStreamServiceGrpcProto.BlockResponse> responseStreamObserver) {
@@ -52,7 +50,7 @@ public ProducerBlockStreamObserver(final StreamMediator<BlockStreamServiceGrpcPr
5250
* Helidon triggers this method when it receives a new block from the upstream producer. The method notifies all
5351
* the mediator subscribers and sends a response back to the upstream producer.
5452
*
55-
* @param block - the block streamed from the upstream producer
53+
* @param block the block streamed from the upstream producer
5654
*/
5755
@Override
5856
public void onNext(final BlockStreamServiceGrpcProto.Block block) {
@@ -75,7 +73,6 @@ public void onError(final Throwable t) {
7573
/**
7674
* Helidon triggers this method when the bidirectional stream to the upstream producer is completed.
7775
* Unsubscribe all the observers from the mediator.
78-
*
7976
*/
8077
@Override
8178
public void onCompleted() {

0 commit comments

Comments
 (0)