File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
operator/src/main/java/oracle/kubernetes/operator Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 25
25
import java .util .concurrent .ConcurrentMap ;
26
26
import java .util .concurrent .ExecutionException ;
27
27
import java .util .concurrent .ScheduledExecutorService ;
28
+ import java .util .concurrent .Semaphore ;
28
29
import java .util .concurrent .ThreadFactory ;
29
30
import java .util .concurrent .TimeUnit ;
30
31
import java .util .concurrent .atomic .AtomicBoolean ;
@@ -128,7 +129,6 @@ public Thread newThread(Runnable r) {
128
129
129
130
private static String principal ;
130
131
private static RestServer restServer = null ;
131
- private static Thread livenessThread = null ;
132
132
private static KubernetesVersion version = null ;
133
133
134
134
static final String READINESS_PROBE_FAILURE_EVENT_FILTER =
@@ -438,10 +438,20 @@ private static void startLivenessThread() {
438
438
wrappedExecutorService .scheduleWithFixedDelay (new OperatorLiveness (), 5 , 5 , TimeUnit .SECONDS );
439
439
}
440
440
441
+ private static final Semaphore shutdownSignal = new Semaphore (0 );
442
+
441
443
private static void waitForDeath () {
444
+ Runtime .getRuntime ()
445
+ .addShutdownHook (
446
+ new Thread () {
447
+ @ Override
448
+ public void run () {
449
+ shutdownSignal .release ();
450
+ }
451
+ });
442
452
443
453
try {
444
- livenessThread . join ();
454
+ shutdownSignal . acquire ();
445
455
} catch (InterruptedException ignore ) {
446
456
// ignoring
447
457
}
You can’t perform that action at this time.
0 commit comments