@@ -105,20 +105,22 @@ def checkCoherenceClusterExist(configData):
105
105
# The user must set that timeout to a large enough value to give Coherence time to get safe.
106
106
def waitUntilCoherenceSafe ():
107
107
print ('Shutdown: getting all service Coherence MBeans' )
108
-
109
- domainRuntime ()
110
108
query = 'Coherence:type=PartitionAssignment,service=*,*'
111
109
112
110
# Wait forever until we get positive ack that it is ok to shutdown this server.
113
111
done = False
112
+ warnSleep = True
114
113
while (not done ):
115
114
try :
115
+ domainRuntime ()
116
116
beans = list (mbs .queryMBeans (ObjectName (query ), None ))
117
117
if beans is None or len (beans ) == 0 :
118
118
# during rolling restart the beans might not be available right away
119
119
# we need to wait since we know Coherence is enabled
120
- print ('Shutdown: Waiting until Coherence MBeans available... ' )
121
- systime .sleep (5 )
120
+ if warnSleep :
121
+ print ('Shutdown: Waiting until Coherence MBeans available... ' )
122
+ warnSleep = False
123
+ systime .sleep (1 )
122
124
continue
123
125
124
126
# Loop waiting for each service to be safe
@@ -133,7 +135,7 @@ def waitUntilCoherenceSafe():
133
135
print ("Shutdown: Exception checking a service Coherence HAStatus, retrying..." )
134
136
traceback .print_exc (file = sys .stdout )
135
137
dumpStack ()
136
- systime .sleep (30 )
138
+ systime .sleep (10 )
137
139
pass
138
140
139
141
@@ -167,7 +169,7 @@ def waitUntilServiceSafeToShutdown(objectName):
167
169
print ('Shutdown: An exception occurred getting Coherence MBeans, staying in loop checking for safe' )
168
170
traceback .print_exc (file = sys .stdout )
169
171
dumpStack ()
170
- systime .sleep (30 )
172
+ systime .sleep (10 )
171
173
pass
172
174
173
175
@@ -176,6 +178,7 @@ def waitUntilServiceSafeToShutdown(objectName):
176
178
#----------------------------------
177
179
print ("Shutdown: main script" )
178
180
domain_uid = getEnvVar ('DOMAIN_UID' )
181
+ admin_name = getEnvVar ('ADMIN_NAME' )
179
182
server_name = getEnvVar ('SERVER_NAME' )
180
183
domain_name = getEnvVar ('DOMAIN_NAME' )
181
184
domain_path = getEnvVar ('DOMAIN_HOME' )
@@ -209,6 +212,12 @@ def waitUntilServiceSafeToShutdown(objectName):
209
212
if (cohExists ):
210
213
print ('Shutdown: Coherence cluster exists' )
211
214
connect_url = local_admin_protocol + '://' + admin_host + ':' + admin_port
215
+
216
+ # must use force shutdown for admin server since Coherence MBeans cannot be found after
217
+ # a graceful admin server restart
218
+ if admin_name == server_name :
219
+ force = 'true'
220
+
212
221
else :
213
222
print ('Shutdown: Coherence cluster does not exist' )
214
223
connect_url = local_admin_protocol + '://' + service_name + ':' + local_admin_port
@@ -233,7 +242,7 @@ def waitUntilServiceSafeToShutdown(objectName):
233
242
waitUntilCoherenceSafe ()
234
243
cohSafe = True
235
244
236
- print ('Shutdown: Calling server shutdown' )
245
+ print ('Shutdown: Calling server shutdown with force = ' + force )
237
246
shutdown (server_name , 'Server' , ignoreSessions = ignore_sessions , timeOut = int (timeout ), block = 'true' , force = force )
238
247
print ('Shutdown: Successfully shutdown the server' )
239
248
@@ -243,7 +252,7 @@ def waitUntilServiceSafeToShutdown(objectName):
243
252
if (cohExists and not cohSafe ):
244
253
print ('Shutdown: Coherence not safe to shutdown. Sleeping before connect retry ...' )
245
254
stayInConnectLoop = True
246
- systime .sleep (30 )
255
+ systime .sleep (10 )
247
256
else :
248
257
try :
249
258
shutdownUsingNodeManager (domain_name , domain_path )
0 commit comments