@@ -1268,17 +1268,25 @@ public void shutdown() {
1268
1268
1269
1269
// First wake up the closer thread, it'll terminate almost immediately since it checks
1270
1270
// isShutDown.
1271
- synchronized (solrCores .getModifyLock ()) {
1272
- solrCores .getModifyLock ().notifyAll (); // wake up anyone waiting
1271
+ solrCores .getWriteLock ().lock ();
1272
+ try {
1273
+ solrCores .getWriteLockCondition ().signalAll (); // wake up anyone waiting
1274
+ } finally {
1275
+ solrCores .getWriteLock ().unlock ();
1273
1276
}
1274
1277
if (backgroundCloser
1275
1278
!= null ) { // Doesn't seem right, but tests get in here without initializing the core.
1276
1279
try {
1277
1280
while (true ) {
1278
1281
backgroundCloser .join (15000 );
1279
1282
if (backgroundCloser .isAlive ()) {
1280
- synchronized (solrCores .getModifyLock ()) {
1281
- solrCores .getModifyLock ().notifyAll (); // there is a race we have to protect against
1283
+ solrCores .getWriteLock ().lock ();
1284
+ try {
1285
+ solrCores
1286
+ .getWriteLockCondition ()
1287
+ .signalAll (); // there is a race we have to protect against
1288
+ } finally {
1289
+ solrCores .getWriteLock ().unlock ();
1282
1290
}
1283
1291
} else {
1284
1292
break ;
@@ -1314,8 +1322,11 @@ public void shutdown() {
1314
1322
// It's still possible that one of the pending dynamic load operation is waiting, so wake it
1315
1323
// up if so. Since all the pending operations queues have been drained, there should be
1316
1324
// nothing to do.
1317
- synchronized (solrCores .getModifyLock ()) {
1318
- solrCores .getModifyLock ().notifyAll (); // wake up the thread
1325
+ solrCores .getWriteLock ().lock ();
1326
+ try {
1327
+ solrCores .getWriteLockCondition ().signalAll (); // wake up the thread
1328
+ } finally {
1329
+ solrCores .getWriteLock ().unlock ();
1319
1330
}
1320
1331
1321
1332
customThreadPool .submit (
@@ -2611,13 +2622,16 @@ class CloserThread extends Thread {
2611
2622
@ Override
2612
2623
public void run () {
2613
2624
while (!container .isShutDown ()) {
2614
- synchronized (solrCores .getModifyLock ()) { // need this so we can wait and be awoken.
2625
+ solrCores .getWriteLock ().lock ();
2626
+ try { // need this so we can wait and be awoken.
2615
2627
try {
2616
- solrCores .getModifyLock ().wait ();
2628
+ solrCores .getWriteLockCondition ().await ();
2617
2629
} catch (InterruptedException e ) {
2618
2630
// Well, if we've been told to stop, we will. Otherwise, continue on and check to see if
2619
2631
// there are any cores to close.
2620
2632
}
2633
+ } finally {
2634
+ solrCores .getWriteLock ().unlock ();
2621
2635
}
2622
2636
2623
2637
SolrCore core ;
0 commit comments