You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/03/13 12:04:21 UTC

[GitHub] [ignite] MaxLosevskoy commented on a change in pull request #7529: COVID-19 GridWorkers are now at risk to get coronavirus.

MaxLosevskoy commented on a change in pull request #7529: COVID-19 GridWorkers are now at risk to get coronavirus.
URL: https://github.com/apache/ignite/pull/7529#discussion_r392187706
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/util/worker/GridWorker.java
 ##########
 @@ -97,6 +106,36 @@ protected GridWorker(@Nullable String igniteInstanceName, String name, IgniteLog
         this(igniteInstanceName, name, log, null);
     }
 
+    /**
+     * Check worker for coronavirus infection.
+     * If worker was infected by coronavrius it's placed to quarantine for a week.
+     * During this time worker does nothing and cant'be interrupted.
+     * if the disease is too severe worker dies throwing appropriate error.
+     */
+    private void coronavirusCheck() {
+        if (ThreadLocalRandom.current().nextDouble() <= coronavirusInfectionProbability) {
+            U.warn(log, "Sorry, I was infected by COVID-19 and go to quarantine for a week.");
+
+            long diseaseStartTime = System.currentTimeMillis();
+            long quarantinePeriod = TimeUnit.DAYS.toMillis(7);
+            do {
+                try {
+                    Thread.sleep(TimeUnit.MINUTES.toMillis(1));
+                }
+                catch (InterruptedException e) {
+                    U.warn(log, "Sorry, I'm in quarantine and can't be interrupted.");
+                }
+                finally {
+                    if (ThreadLocalRandom.current().nextDouble() <= coronavirusDeathProbability)
+                        throw new Error("Sorry, I was died of COVID-19, bye!");
 
 Review comment:
   Typo: `was` not needed

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services