[NEMO-429] SWPP TEAM18 Code Smell Fix (#271)
* change private to transient
* fix lambda
Co-authored-by: lim8540 <51064261+lim8540@users.noreply.github.com>
Co-authored-by: gywls00 <49047636+gywls00@users.noreply.github.com>
Co-authored-by: Namkoong Hugh <47518167+mmsori@users.noreply.github.com>
diff --git a/client/src/main/java/org/apache/nemo/client/JobLauncher.java b/client/src/main/java/org/apache/nemo/client/JobLauncher.java
index adafcd8..c349ecf 100644
--- a/client/src/main/java/org/apache/nemo/client/JobLauncher.java
+++ b/client/src/main/java/org/apache/nemo/client/JobLauncher.java
@@ -175,6 +175,7 @@
/**
* Clean up everything.
*/
+ private static final String INTERRUPTED = "Interrupted: ";
public static void shutdown() {
// Trigger driver shutdown afterwards
driverRPCServer.send(ControlMessage.ClientToDriverMessage.newBuilder()
@@ -186,7 +187,7 @@
LOG.info("Wait for the driver to finish");
driverLauncher.wait();
} catch (final InterruptedException e) {
- LOG.warn("Interrupted: ", e);
+ LOG.warn(INTERRUPTED, e);
// clean up state...
Thread.currentThread().interrupt();
}
@@ -247,7 +248,7 @@
LOG.info("Waiting for the driver to be ready");
driverReadyLatch.await();
} catch (final InterruptedException e) {
- LOG.warn("Interrupted: ", e);
+ LOG.warn(INTERRUPTED, e);
// clean up state...
Thread.currentThread().interrupt();
}
@@ -269,7 +270,7 @@
LOG.info("Waiting for the DAG to finish execution");
jobDoneLatch.await();
} catch (final InterruptedException e) {
- LOG.warn("Interrupted: ", e);
+ LOG.warn(INTERRUPTED, e);
// clean up state...
Thread.currentThread().interrupt();
throw new RuntimeException(e);
@@ -337,9 +338,8 @@
* Get driver ncs configuration.
*
* @return driver ncs configuration.
- * @throws InjectionException exception while injection.
*/
- private static Configuration getDriverNcsConf() throws InjectionException {
+ private static Configuration getDriverNcsConf() {
return Configurations.merge(NameServerConfiguration.CONF.build(),
LocalNameResolverConfiguration.CONF.build(),
TANG.newConfigurationBuilder()
@@ -351,9 +351,8 @@
* Get driver message configuration.
*
* @return driver message configuration.
- * @throws InjectionException exception while injection.
*/
- private static Configuration getDriverMessageConf() throws InjectionException {
+ private static Configuration getDriverMessageConf() {
return TANG.newConfigurationBuilder()
.bindNamedParameter(MessageParameters.SenderId.class, MessageEnvironment.MASTER_COMMUNICATION_ID)
.build();
@@ -389,10 +388,9 @@
* @param args arguments to be processed as command line.
* @return job configuration.
* @throws IOException exception while processing command line.
- * @throws InjectionException exception while injection.
*/
@VisibleForTesting
- public static Configuration getJobConf(final String[] args) throws IOException, InjectionException {
+ public static Configuration getJobConf(final String[] args) throws IOException {
final JavaConfigurationBuilder confBuilder = TANG.newConfigurationBuilder();
final CommandLine cl = new CommandLine(confBuilder);
cl.registerShortNameOfClass(JobConf.JobId.class);
diff --git a/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java b/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java
index 03f3694..7fe4047 100644
--- a/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java
+++ b/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java
@@ -58,7 +58,7 @@
*/
private final class BytesEncoder implements Encoder<byte[]> {
- private final OutputStream outputStream;
+ private final transient OutputStream outputStream;
/**
* Constructor.
diff --git a/common/src/main/java/org/apache/nemo/common/ir/IRDAG.java b/common/src/main/java/org/apache/nemo/common/ir/IRDAG.java
index 36ef6d0..37e2463 100644
--- a/common/src/main/java/org/apache/nemo/common/ir/IRDAG.java
+++ b/common/src/main/java/org/apache/nemo/common/ir/IRDAG.java
@@ -416,7 +416,7 @@
////////////////////////////////// STEP 2: Annotate the MessageId on optimization target edges
- modifiedDAG.topologicalDo(v -> {
+ modifiedDAG.topologicalDo(v ->
modifiedDAG.getIncomingEdgesOf(v).forEach(inEdge -> {
if (edgesToOptimize.contains(inEdge)) {
final HashSet<Integer> msgEdgeIds =
@@ -424,8 +424,8 @@
msgEdgeIds.add(messageAggregatorVertex.getPropertyValue(MessageIdVertexProperty.class).get());
inEdge.setProperty(MessageIdEdgeProperty.of(msgEdgeIds));
}
- });
- });
+ })
+ );
final Set<IRVertex> insertedVertices = new HashSet<>();
insertedVertices.addAll(triggerList);
diff --git a/common/src/main/java/org/apache/nemo/common/ir/vertex/InMemorySourceVertex.java b/common/src/main/java/org/apache/nemo/common/ir/vertex/InMemorySourceVertex.java
index 1cf4e7d..72acaf9 100644
--- a/common/src/main/java/org/apache/nemo/common/ir/vertex/InMemorySourceVertex.java
+++ b/common/src/main/java/org/apache/nemo/common/ir/vertex/InMemorySourceVertex.java
@@ -33,7 +33,7 @@
* @param <T> type of data.
*/
public final class InMemorySourceVertex<T> extends SourceVertex<T> {
- private Iterable<T> initializedSourceData;
+ private transient Iterable<T> initializedSourceData;
/**
* Constructor for InMemorySourceVertex.
@@ -106,7 +106,7 @@
*/
private static final class InMemorySourceReadable<T> extends BoundedIteratorReadable<T> {
- private final Iterable<T> initializedSourceData;
+ private final transient Iterable<T> initializedSourceData;
/**
* Constructor.