Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
petrov-mg merged PR #13101: URL: https://github.com/apache/ignite/pull/13101 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
sonarqubecloud[bot] commented on PR #13101: URL: https://github.com/apache/ignite/pull/13101#issuecomment-4396014504 ## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) **Quality Gate passed** Issues  [2 New issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13101&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13101&issueStatuses=ACCEPTED) Measures  [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_ignite&pullRequest=13101&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13101&metric=new_coverage&view=list)  [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13101&metric=new_duplicated_lines_density&view=list) [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
petrov-mg commented on code in PR #13101:
URL: https://github.com/apache/ignite/pull/13101#discussion_r3200409544
##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/diagnostic/pagelocktracker/SharedPageLockTracker.java:
##
@@ -320,17 +329,38 @@ public void stop() {
/**
*
*/
-private class TimeOutWorker extends CycleThread {
+private class TimeOutWorker extends GridWorker {
+/** Sleep interval before each iteration. */
+private final long sleepInterval;
/**
+ * Creates new timeout worker with given parameters.
*
+ * @param sleepInterval sleep interval before each iteration
*/
-TimeOutWorker(long interval) {
-super("page-lock-tracker-timeout", interval);
+protected TimeOutWorker(String igniteInstanceName, long sleepInterval,
IgniteLogger log) {
+super(igniteInstanceName, "page-lock-tracker-timeout", log);
+
+this.sleepInterval = sleepInterval;
}
/** {@inheritDoc} */
-@Override public void iteration() {
+@SuppressWarnings("BusyWait")
+@Override public final void body() {
+try {
+while (!runner().isInterrupted()) {
+Thread.sleep(sleepInterval);
+
+iteration();
+}
+}
+catch (InterruptedException e) {
Review Comment:
Done.
##
modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteKillTask.java:
##
@@ -69,25 +72,19 @@ class IgniteKillTask extends ComputeTaskAdapter {
* Kill job.
*/
private class IgniteKillJob extends ComputeJobAdapter {
+/** */
+@IgniteInstanceResource
+private Ignite ignite;
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
petrov-mg commented on code in PR #13101:
URL: https://github.com/apache/ignite/pull/13101#discussion_r3200407834
##
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/diagnostic/pagelocktracker/SharedPageLockTrackerTest.java:
##
@@ -305,11 +304,16 @@ private void doTestTakeDumpByTime(
public void testMemoryLeakOnThreadTerminates() throws Exception {
int threadLimits = 1000;
int timeOutWorkerInterval = 10_000;
-Consumer> hnd = (threads) -> {
-};
+Consumer> hnd = (threads) -> {};
Review Comment:
Done.
##
modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridUpdateNotifier.java:
##
@@ -103,23 +104,21 @@ class GridUpdateNotifier {
this.updatesChecker = updatesChecker;
this.reportOnlyNew = reportOnlyNew;
-workerThread = new Thread(new Runnable() {
-@Override public void run() {
-try {
-while (!Thread.currentThread().isInterrupted()) {
-Runnable cmd0 = cmd.getAndSet(null);
+workerThread = new IgniteThread(igniteInstanceName, "upd-ver-checker",
() -> {
+try {
+while (!Thread.currentThread().isInterrupted()) {
+Runnable cmd0 = cmd.getAndSet(null);
-if (cmd0 != null)
-cmd0.run();
-else
-Thread.sleep(WORKER_THREAD_SLEEP_TIME);
-}
-}
-catch (InterruptedException ignore) {
-// No-op.
+if (cmd0 != null)
+cmd0.run();
+else
+Thread.sleep(WORKER_THREAD_SLEEP_TIME);
}
}
-}, "upd-ver-checker");
+catch (InterruptedException ignore) {
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
sergey-chugunov-1985 commented on code in PR #13101:
URL: https://github.com/apache/ignite/pull/13101#discussion_r3196339597
##
modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteKillTask.java:
##
@@ -69,25 +72,19 @@ class IgniteKillTask extends ComputeTaskAdapter {
* Kill job.
*/
private class IgniteKillJob extends ComputeJobAdapter {
+/** */
+@IgniteInstanceResource
+private Ignite ignite;
Review Comment:
There is a comment from code analisys tool saying that we need to make
Ignite field transient. I think it is a good idea.
##
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/diagnostic/pagelocktracker/SharedPageLockTracker.java:
##
@@ -320,17 +329,38 @@ public void stop() {
/**
*
*/
-private class TimeOutWorker extends CycleThread {
+private class TimeOutWorker extends GridWorker {
+/** Sleep interval before each iteration. */
+private final long sleepInterval;
/**
+ * Creates new timeout worker with given parameters.
*
+ * @param sleepInterval sleep interval before each iteration
*/
-TimeOutWorker(long interval) {
-super("page-lock-tracker-timeout", interval);
+protected TimeOutWorker(String igniteInstanceName, long sleepInterval,
IgniteLogger log) {
+super(igniteInstanceName, "page-lock-tracker-timeout", log);
+
+this.sleepInterval = sleepInterval;
}
/** {@inheritDoc} */
-@Override public void iteration() {
+@SuppressWarnings("BusyWait")
+@Override public final void body() {
+try {
+while (!runner().isInterrupted()) {
+Thread.sleep(sleepInterval);
+
+iteration();
+}
+}
+catch (InterruptedException e) {
Review Comment:
We should not catch this exception. Otherwise I see a risk of losing an
interruption signal and stucking in the while loop forever (as
`runner().isInterrupted()` will be returning `false` because we caught
InterruptedException but didn't restore interrupted state of the runner thread).
##
modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridUpdateNotifier.java:
##
@@ -103,23 +104,21 @@ class GridUpdateNotifier {
this.updatesChecker = updatesChecker;
this.reportOnlyNew = reportOnlyNew;
-workerThread = new Thread(new Runnable() {
-@Override public void run() {
-try {
-while (!Thread.currentThread().isInterrupted()) {
-Runnable cmd0 = cmd.getAndSet(null);
+workerThread = new IgniteThread(igniteInstanceName, "upd-ver-checker",
() -> {
+try {
+while (!Thread.currentThread().isInterrupted()) {
+Runnable cmd0 = cmd.getAndSet(null);
-if (cmd0 != null)
-cmd0.run();
-else
-Thread.sleep(WORKER_THREAD_SLEEP_TIME);
-}
-}
-catch (InterruptedException ignore) {
-// No-op.
+if (cmd0 != null)
+cmd0.run();
+else
+Thread.sleep(WORKER_THREAD_SLEEP_TIME);
}
}
-}, "upd-ver-checker");
+catch (InterruptedException ignore) {
Review Comment:
We should not catch InterruptedException here as well.
##
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/diagnostic/pagelocktracker/SharedPageLockTrackerTest.java:
##
@@ -305,11 +304,16 @@ private void doTestTakeDumpByTime(
public void testMemoryLeakOnThreadTerminates() throws Exception {
int threadLimits = 1000;
int timeOutWorkerInterval = 10_000;
-Consumer> hnd = (threads) -> {
-};
+Consumer> hnd = (threads) -> {};
Review Comment:
Please address SonarCube comment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
sonarqubecloud[bot] commented on PR #13101: URL: https://github.com/apache/ignite/pull/13101#issuecomment-4377839410 ## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) **Quality Gate failed** Failed conditions  [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) (required ≤ 1) [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) ##  Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
sonarqubecloud[bot] commented on PR #13101: URL: https://github.com/apache/ignite/pull/13101#issuecomment-4377429545 ## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) **Quality Gate failed** Failed conditions  [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) (required ≤ 1) [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) ##  Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
sonarqubecloud[bot] commented on PR #13101: URL: https://github.com/apache/ignite/pull/13101#issuecomment-4374133079 ## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) **Quality Gate failed** Failed conditions  [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) (required ≤ 1) [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13101) ##  Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
[PR] IGNITE-28642 java.langThread usages replaced with org.apache.ignite.thread.IgniteThread [ignite]
petrov-mg opened a new pull request, #13101: URL: https://github.com/apache/ignite/pull/13101 Thank you for submitting the pull request to the Apache Ignite. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### The Contribution Checklist - [ ] There is a single JIRA ticket related to the pull request. - [ ] The web-link to the pull request is attached to the JIRA ticket. - [ ] The JIRA ticket has the _Patch Available_ state. - [ ] The pull request body describes changes that have been made. The description explains _WHAT_ and _WHY_ was made instead of _HOW_. - [ ] The pull request title is treated as the final commit message. The following pattern must be used: `IGNITE- Change summary` where `` - number of JIRA issue. - [ ] A reviewer has been mentioned through the JIRA comments (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) - [ ] The pull request has been checked by the Teamcity Bot and the `green visa` attached to the JIRA ticket (see tab `PR Check` at [TC.Bot - Instance 1](https://tcbot2.sbt-ignite-dev.ru/prs.html) or [TC.Bot - Instance 2](https://mtcga.gridgain.com/prs.html)) ### Notes - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute) - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules) - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines) - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot) If you need any help, please email [email protected] or ask anу advice on http://asf.slack.com _#ignite_ channel. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
