Skip to content

Commit

Permalink
fix: spotless, changed log levels
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Peterson <[email protected]>
  • Loading branch information
mattp-swirldslabs committed Aug 7, 2024
1 parent 5cc2bc8 commit 51f1e8b
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 54 deletions.
28 changes: 7 additions & 21 deletions server/src/main/java/com/hedera/block/server/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,25 @@
public final class Constants {
private Constants() {}

/**
* Constant mapped to the root path config key where the block files are stored
*/
/** Constant mapped to the root path config key where the block files are stored */
public static final String BLOCKNODE_STORAGE_ROOT_PATH_KEY = "blocknode.storage.root.path";

/**
* Constant mapped to the timeout for stream consumers in milliseconds
*/
/** Constant mapped to the timeout for stream consumers in milliseconds */
public static final String BLOCKNODE_SERVER_CONSUMER_TIMEOUT_THRESHOLD_KEY =
"blocknode.server.consumer.timeout.threshold";

/**
* Constant mapped to the name of the service in the .proto file
*/
/** Constant mapped to the name of the service in the .proto file */
public static final String SERVICE_NAME = "BlockStreamGrpcService";

/**
* Constant mapped to the publishBlockStream service method name in the .proto file
*/
/** Constant mapped to the publishBlockStream service method name in the .proto file */
public static final String CLIENT_STREAMING_METHOD_NAME = "publishBlockStream";

/**
* Constant mapped to the subscribeBlockStream service method name in the .proto file
*/
/** Constant mapped to the subscribeBlockStream service method name in the .proto file */
public static final String SERVER_STREAMING_METHOD_NAME = "subscribeBlockStream";

/**
* Constant mapped to the singleBlock service method name in the .proto file
*/
/** Constant mapped to the singleBlock service method name in the .proto file */
public static final String SINGLE_BLOCK_METHOD_NAME = "singleBlock";

/**
* Constant defining the block file extension
*/
/** Constant defining the block file extension */
public static final String BLOCK_FILE_EXTENSION = ".blk";
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public class ServiceStatusImpl implements ServiceStatus {
private final AtomicBoolean isRunning = new AtomicBoolean(true);
private WebServer webServer;

/**
* Constructor for the ServiceStatusImpl class.
*/
/** Constructor for the ServiceStatusImpl class. */
public ServiceStatusImpl() {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public class ConsumerStreamResponseObserver
protected Runnable onCancel;

/**
* The onClose handler to execute when the consumer closes the stream. This handler is
* protected to facilitate testing.
* The onClose handler to execute when the consumer closes the stream. This handler is protected
* to facilitate testing.
*/
protected Runnable onClose;

Expand All @@ -65,10 +65,11 @@ public class ConsumerStreamResponseObserver
* SubscribeStreamResponse events from the Disruptor and passing them to the downstream consumer
* via the subscribeStreamResponseObserver.
*
* @param timeoutThresholdMillis the timeout threshold in milliseconds for the producer to publish
* block items
* @param timeoutThresholdMillis the timeout threshold in milliseconds for the producer to
* publish block items
* @param producerLivenessClock the clock to use to determine the producer liveness
* @param subscriptionHandler the subscription handler to use to manage the subscription lifecycle
* @param subscriptionHandler the subscription handler to use to manage the subscription
* lifecycle
* @param subscribeStreamResponseObserver the observer to use to send responses to the consumer
*/
public ConsumerStreamResponseObserver(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
*/
public class ObjectEvent<T> {

/**
* Constructor for the ObjectEvent class.
*/
/** Constructor for the ObjectEvent class. */
public ObjectEvent() {}

private T val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void publish(final BlockItem blockItem) throws IOException {
if (serviceStatus.isRunning()) {

// Publish the block for all subscribers to receive
LOGGER.log(System.Logger.Level.INFO, "Publishing BlockItem: {0}", blockItem);
LOGGER.log(System.Logger.Level.DEBUG, "Publishing BlockItem: {0}", blockItem);
final var subscribeStreamResponse =
SubscribeStreamResponse.newBuilder().setBlockItem(blockItem).build();
ringBuffer.publishEvent((event, sequence) -> event.set(subscribeStreamResponse));
Expand All @@ -130,15 +130,15 @@ public void publish(final BlockItem blockItem) throws IOException {
+ blockItem,
e);

LOGGER.log(System.Logger.Level.INFO, "Send a response to end the stream");
LOGGER.log(System.Logger.Level.DEBUG, "Send a response to end the stream");

// Publish the block for all subscribers to receive
final SubscribeStreamResponse endStreamResponse = buildEndStreamResponse();
ringBuffer.publishEvent((event, sequence) -> event.set(endStreamResponse));

// Unsubscribe all downstream consumers
for (final var subscriber : subscribers.keySet()) {
LOGGER.log(System.Logger.Level.INFO, "Unsubscribing: {0}", subscriber);
LOGGER.log(System.Logger.Level.DEBUG, "Unsubscribing: {0}", subscriber);
unsubscribe(subscriber);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class BlockAsDirReader implements BlockReader<Block> {
private final FileAttribute<Set<PosixFilePermission>> filePerms;

/**
* Constructor for the BlockAsDirReader class. It initializes the BlockAsDirReader with the given
* parameters.
* Constructor for the BlockAsDirReader class. It initializes the BlockAsDirReader with the
* given parameters.
*
* @param key the key to retrieve the block node root path from the configuration
* @param config the configuration to retrieve the block node root path
Expand All @@ -69,8 +69,8 @@ public BlockAsDirReader(
}

/**
* Constructor for the BlockAsDirReader class. It initializes the BlockAsDirReader with the given
* parameters.
* Constructor for the BlockAsDirReader class. It initializes the BlockAsDirReader with the
* given parameters.
*
* @param key the key to retrieve the block node root path from the configuration
* @param config the configuration to retrieve the block node root path
Expand All @@ -80,8 +80,8 @@ public BlockAsDirReader(final String key, final Config config) {
}

/**
* Reads a block from the file system. The block is stored as a directory containing block items.
* The block items are stored as files within the block directory.
* Reads a block from the file system. The block is stored as a directory containing block
* items. The block items are stored as files within the block directory.
*
* @param blockNumber the block number to read
* @return an optional of the block read from the file system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.Set;

/**
* The BlockAsDirRemover class removes a block from the file system. The block is stored as a directory
* containing block items. The block items are stored as files within the block directory.
* The BlockAsDirRemover class removes a block from the file system. The block is stored as a
* directory containing block items. The block items are stored as files within the block directory.
*/
public class BlockAsDirRemover implements BlockRemover {

Expand All @@ -36,8 +36,8 @@ public class BlockAsDirRemover implements BlockRemover {
private final FileAttribute<Set<PosixFilePermission>> filePerms;

/**
* Constructor for the BlockAsDirRemover class. It initializes the BlockAsDirRemover with the given
* parameters.
* Constructor for the BlockAsDirRemover class. It initializes the BlockAsDirRemover with the
* given parameters.
*
* @param blockNodeRootPath the root path where the block files are stored
* @param filePerms the file permissions to set on the block node root path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public class BlockAsDirWriter implements BlockWriter<BlockItem> {
private final BlockRemover blockRemover;

/**
* Constructor for the BlockAsDirWriter class. It initializes the BlockAsDirWriter with the given
* key, config, block remover, and file permissions.
* Constructor for the BlockAsDirWriter class. It initializes the BlockAsDirWriter with the
* given key, config, block remover, and file permissions.
*
* @param key the key to use to retrieve the block node root path from the config
* @param config the config to use to retrieve the block node root path
* @param blockRemover the block remover to use to remove blocks if there's an exception while
* writing a partial block
* writing a partial block
* @param filePerms the file permissions to set on the block node root path
* @throws IOException if an error occurs while initializing the BlockAsDirWriter
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
*/
public class ItemAckBuilder {

/**
* Constructor for the ItemAckBuilder class.
*/
/** Constructor for the ItemAckBuilder class. */
public ItemAckBuilder() {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
* Utility class for the BlockNode service.
*/
/** Utility class for the BlockNode service. */
public final class Util {
private Util() {}

Expand Down

0 comments on commit 51f1e8b

Please sign in to comment.