File tree 1 file changed +7
-1
lines changed
src/main/java/com/uid2/shared/health
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .io .File ;
4
4
import java .util .concurrent .atomic .AtomicReference ;
5
+ import org .slf4j .Logger ;
6
+ import org .slf4j .LoggerFactory ;
5
7
6
8
public class PodTerminationMonitor implements IHealthComponent {
9
+ private static final Logger LOGGER = LoggerFactory .getLogger (PodTerminationMonitor .class );
7
10
private AtomicReference <Boolean > cachedPodTerminating = new AtomicReference <>(false );
8
11
private long lastPodCheckTime = 0 ;
9
12
private long fileCheckIntervalMs = 3000 ;
@@ -33,8 +36,11 @@ public boolean isHealthy() {
33
36
private boolean checkPodTerminating () {
34
37
long currentTime = System .currentTimeMillis ();
35
38
if (currentTime - lastPodCheckTime >= fileCheckIntervalMs ) {
36
- File file = new File (File .separator + "app" + File .separator + "pod_terminating" );
39
+ File file = new File (File .separator + "app" + File .separator + "pod_terminating" + File . separator + "pod_terminating" );
37
40
boolean newStatus = file .exists ();
41
+ if (newStatus ) {
42
+ LOGGER .info ("pod will terminate soon" );
43
+ }
38
44
cachedPodTerminating .set (newStatus );
39
45
lastPodCheckTime = currentTime ;
40
46
}
You can’t perform that action at this time.
0 commit comments