-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compile warnings in mantis server worker #423
base: master
Are you sure you want to change the base?
Fix compile warnings in mantis server worker #423
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
I provided some early comments. Will take a look next week. Thanks
} | ||
this.onTerminateCallback = blockUntilTerminate::countDown; | ||
this.onCompleteCallback = () -> { | ||
logger.info("JobId: " + jobId + " stage: " + stageNum + ", completed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace string concatenation with parameterized / placeholder in logging? It applies to other logging lines in this module.
logger.info("JobId: {} stage: {} completed", jobId, stageNum);
See this doc for advantages: https://www.tutorialspoint.com/slf4j/slf4j_parameterized_logging.htm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Fixed in e9ad7a8
} | ||
Schedulers.newThread().createWorker().schedule(() -> { | ||
try { | ||
WrappedExecuteStageRequest request; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge the two lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean to merge them like that
Schedulers.newThread().createWorker().schedule(() -> { try {
It looks more well-formated to me with the line break.
logger.info("onNext'ing WrappedExecuteStageRequest: {}", request); | ||
executeStageRequestObserver.onNext(request); | ||
} catch (MalformedURLException e) { | ||
e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use logger.error and attach request information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 4df01c3
But I think the request would be null in this case. Because the exception would be thrown during the initialization of the request.
} | ||
vmTaskStatusObservable.subscribe(vmTaskStatus -> { | ||
TYPE type = vmTaskStatus.getType(); | ||
if (type == TYPE.COMPLETED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's replace this with switch-case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 4df01c3
@@ -22,8 +22,8 @@ | |||
|
|||
public class WorkerIndexHistory { | |||
|
|||
final Set<Integer> runningWorkerIndex = new HashSet<Integer>(); | |||
final Set<Integer> terminalWorkerIndex = new HashSet<Integer>(); | |||
final Set<Integer> runningWorkerIndex = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 0b3695b
@@ -119,38 +120,38 @@ public boolean equals(Object o) { | |||
if (Double.compare(this.getRps(), other.getRps()) != 0) return false; | |||
final Object this$minSamples = this.getMinSamples(); | |||
final Object other$minSamples = other.getMinSamples(); | |||
if (this$minSamples == null ? other$minSamples != null : !this$minSamples.equals(other$minSamples)) | |||
if (!Objects.equals(this$minSamples, other$minSamples)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sundargates this code is too verbose. I'm wondering if it's a good idea to pull in commons-lang3 dependency and use EqualsBuilder()
for this.
} | ||
}; | ||
Thread t = new Thread(() -> { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line break seems odd here.
} | ||
vmTaskStatusObservable.subscribe(vmTaskStatus -> { | ||
TYPE type = vmTaskStatus.getType(); | ||
if (type == TYPE.COMPLETED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use switch-case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 4526f92
payloads = heartbeat.getCurrentHeartbeatStatus().getPayloads(); | ||
Assert.assertEquals(1, payloads.size()); | ||
assertEquals(1, payloads.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets log the payloads before asserting the size, so when the test fails, it's clearer why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Fixed in 07ad134
Context
Resolves #394
Checklist
./gradlew build
compiles code correctly./gradlew test
passes all tests