[Nemo-429] SWPP TEAM15 Code Smell Fix (#273)
* replace lambda with method reference
* Remove unnecessary exceptions
Co-authored-by: Minji1234 <34624667+Minji1234@users.noreply.github.com>
Co-authored-by: rachelg98 <37978535+rachelg98@users.noreply.github.com>
Co-authored-by: Jangho Seo <jangho@jangho.io>
diff --git a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/PipeManagerWorker.java b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/PipeManagerWorker.java
index af2689b..cafa2ee 100644
--- a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/PipeManagerWorker.java
+++ b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/PipeManagerWorker.java
@@ -189,10 +189,10 @@
private int getNumOfPipeToWait(final RuntimeEdge runtimeEdge) {
final int dstParallelism = ((StageEdge) runtimeEdge).getDstIRVertex().getPropertyValue(ParallelismProperty.class)
- .orElseThrow(() -> new IllegalStateException());
+ .orElseThrow(IllegalStateException::new);
final CommunicationPatternProperty.Value commPattern = ((StageEdge) runtimeEdge)
.getPropertyValue(CommunicationPatternProperty.class)
- .orElseThrow(() -> new IllegalStateException());
+ .orElseThrow(IllegalStateException::new);
return commPattern.equals(CommunicationPatternProperty.Value.ONE_TO_ONE) ? 1 : dstParallelism;
}
diff --git a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/stores/GlusterFileStore.java b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/stores/GlusterFileStore.java
index 6ca78b1..aff6e73 100644
--- a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/stores/GlusterFileStore.java
+++ b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/stores/GlusterFileStore.java
@@ -80,10 +80,9 @@
* Writes a committed block to this store.
*
* @param block the block to write.
- * @throws BlockWriteException if fail to write.
*/
@Override
- public void writeBlock(final Block block) throws BlockWriteException {
+ public void writeBlock(final Block block) {
if (!(block instanceof FileBlock)) {
throw new BlockWriteException(new Throwable(
this.toString() + " only accept " + FileBlock.class.getName()));
@@ -98,10 +97,9 @@
*
* @param blockId of the target partition.
* @return the target block (if it exists).
- * @throws BlockFetchException for any error occurred while trying to fetch a block.
*/
@Override
- public Optional<Block> readBlock(final String blockId) throws BlockFetchException {
+ public Optional<Block> readBlock(final String blockId) {
final String filePath = DataUtil.blockIdToFilePath(blockId, fileDirectory);
if (!new File(filePath).isFile()) {
return Optional.empty();
@@ -122,7 +120,7 @@
* @return whether the block exists or not.
*/
@Override
- public boolean deleteBlock(final String blockId) throws BlockFetchException {
+ public boolean deleteBlock(final String blockId) {
final String filePath = DataUtil.blockIdToFilePath(blockId, fileDirectory);
try {