Skip to content

Commit 7b1719e

Browse files
committed
During rolling restart, the Coherence MBeans may take several seconds to be available. Loop until they are accessible if Coherence exists
1 parent 2824e9a commit 7b1719e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

operator/src/main/resources/scripts/stop-server.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,15 @@ def waitUntilCoherenceSafe():
123123
while (not done):
124124
try:
125125
beans = list(mbs.queryMBeans(ObjectName(query), None))
126-
print("Shutdown: Coherence service bean count " + str(len(beans)))
126+
if beans is None or len(beans) == 0:
127+
# during rolling restart the beans might not be available right away
128+
# we need to wait since we know Coherence is enabled
129+
print('Shutdown: Waiting until Coherence MBeans available... ')
130+
systime.sleep(5)
131+
continue
127132

128133
# Loop waiting for each service to be safe
134+
print('Shutdown: Coherence service bean count ' + str(len(beans)))
129135
for serviceBean in beans:
130136
objectName = serviceBean.getObjectName()
131137
waitUntilServiceSafeToShutdown(objectName)
@@ -231,12 +237,12 @@ def waitUntilServiceSafeToShutdown(objectName):
231237
domainDir=domain_path,
232238
nmType='plain')
233239

234-
print('Shutdown: Successfully connected to server. Calling server shutdown')
235-
240+
print('Shutdown: Successfully connected to server')
236241
if (cohExists):
237242
waitUntilCoherenceSafe()
238243
cohSafe = True
239244

245+
print('Shutdown: Calling server shutdown')
240246
shutdown(server_name, 'Server', ignoreSessions=ignore_sessions, timeOut=int(timeout), block='true', force=force)
241247
print('Shutdown: Successfully shutdown the server')
242248

0 commit comments

Comments
 (0)