@@ -56,8 +56,8 @@ public abstract class AMQChannel extends ShutdownNotifierComponent {
5656 * so that clients can themselves use the channel to synchronize
5757 * on.
5858 */
59- protected final ReentrantLock _channelMutex = new ReentrantLock ();
60- protected final Condition _channelMutexCondition = _channelMutex .newCondition ();
59+ protected final ReentrantLock _channelLock = new ReentrantLock ();
60+ protected final Condition _channelLockCondition = _channelLock .newCondition ();
6161
6262 /** The connection this channel is associated with. */
6363 private final AMQConnection _connection ;
@@ -194,7 +194,7 @@ public void handleCompleteInboundCommand(AMQCommand command) throws IOException
194194 // so it must be a response to an earlier RPC.
195195
196196 if (_checkRpcResponseType ) {
197- _channelMutex .lock ();
197+ _channelLock .lock ();
198198 try {
199199 // check if this reply command is intended for the current waiting request before calling nextOutstandingRpc()
200200 if (_activeRpc != null && !_activeRpc .canHandleReply (command )) {
@@ -204,7 +204,7 @@ public void handleCompleteInboundCommand(AMQCommand command) throws IOException
204204 return ;
205205 }
206206 } finally {
207- _channelMutex .unlock ();
207+ _channelLock .unlock ();
208208 }
209209 }
210210 final RpcWrapper nextOutstandingRpc = nextOutstandingRpc ();
@@ -226,12 +226,12 @@ public void enqueueAsyncRpc(Method method, CompletableFuture<Command> future) {
226226 }
227227
228228 private void doEnqueueRpc (Supplier <RpcWrapper > rpcWrapperSupplier ) {
229- _channelMutex .lock ();
229+ _channelLock .lock ();
230230 try {
231231 boolean waitClearedInterruptStatus = false ;
232232 while (_activeRpc != null ) {
233233 try {
234- _channelMutexCondition .await ();
234+ _channelLockCondition .await ();
235235 } catch (InterruptedException e ) { //NOSONAR
236236 waitClearedInterruptStatus = true ;
237237 // No Sonar: we re-interrupt the thread later
@@ -242,30 +242,30 @@ private void doEnqueueRpc(Supplier<RpcWrapper> rpcWrapperSupplier) {
242242 }
243243 _activeRpc = rpcWrapperSupplier .get ();
244244 } finally {
245- _channelMutex .unlock ();
245+ _channelLock .unlock ();
246246 }
247247 }
248248
249249 public boolean isOutstandingRpc ()
250250 {
251- _channelMutex .lock ();
251+ _channelLock .lock ();
252252 try {
253253 return (_activeRpc != null );
254254 } finally {
255- _channelMutex .unlock ();
255+ _channelLock .unlock ();
256256 }
257257 }
258258
259259 public RpcWrapper nextOutstandingRpc ()
260260 {
261- _channelMutex .lock ();
261+ _channelLock .lock ();
262262 try {
263263 RpcWrapper result = _activeRpc ;
264264 _activeRpc = null ;
265- _channelMutexCondition .signalAll ();
265+ _channelLockCondition .signalAll ();
266266 return result ;
267267 } finally {
268- _channelMutex .unlock ();
268+ _channelLock .unlock ();
269269 }
270270 }
271271
@@ -359,48 +359,48 @@ private AMQCommand privateRpc(Method m, int timeout)
359359 public void rpc (Method m , RpcContinuation k )
360360 throws IOException
361361 {
362- _channelMutex .lock ();
362+ _channelLock .lock ();
363363 try {
364364 ensureIsOpen ();
365365 quiescingRpc (m , k );
366366 } finally {
367- _channelMutex .unlock ();
367+ _channelLock .unlock ();
368368 }
369369 }
370370
371371 public void quiescingRpc (Method m , RpcContinuation k )
372372 throws IOException
373373 {
374- _channelMutex .lock ();
374+ _channelLock .lock ();
375375 try {
376376 enqueueRpc (k );
377377 quiescingTransmit (m );
378378 } finally {
379- _channelMutex .unlock ();
379+ _channelLock .unlock ();
380380 }
381381 }
382382
383383 public void asyncRpc (Method m , CompletableFuture <Command > future )
384384 throws IOException
385385 {
386- _channelMutex .lock ();
386+ _channelLock .lock ();
387387 try {
388388 ensureIsOpen ();
389389 quiescingAsyncRpc (m , future );
390390 } finally {
391- _channelMutex .unlock ();
391+ _channelLock .unlock ();
392392 }
393393 }
394394
395395 public void quiescingAsyncRpc (Method m , CompletableFuture <Command > future )
396396 throws IOException
397397 {
398- _channelMutex .lock ();
398+ _channelLock .lock ();
399399 try {
400400 enqueueAsyncRpc (m , future );
401401 quiescingTransmit (m );
402402 } finally {
403- _channelMutex .unlock ();
403+ _channelLock .unlock ();
404404 }
405405 }
406406
@@ -429,16 +429,16 @@ public void processShutdownSignal(ShutdownSignalException signal,
429429 boolean ignoreClosed ,
430430 boolean notifyRpc ) {
431431 try {
432- _channelMutex .lock ();
432+ _channelLock .lock ();
433433 try {
434434 if (!setShutdownCauseIfOpen (signal )) {
435435 if (!ignoreClosed )
436436 throw new AlreadyClosedException (getCloseReason ());
437437 }
438438
439- _channelMutexCondition .signalAll ();
439+ _channelLockCondition .signalAll ();
440440 } finally {
441- _channelMutex .unlock ();
441+ _channelLock .unlock ();
442442 }
443443 } finally {
444444 if (notifyRpc )
@@ -454,40 +454,40 @@ public void notifyOutstandingRpc(ShutdownSignalException signal) {
454454 }
455455
456456 public void transmit (Method m ) throws IOException {
457- _channelMutex .lock ();
457+ _channelLock .lock ();
458458 try {
459459 transmit (new AMQCommand (m ));
460460 } finally {
461- _channelMutex .unlock ();
461+ _channelLock .unlock ();
462462 }
463463 }
464464
465465 public void transmit (AMQCommand c ) throws IOException {
466- _channelMutex .lock ();
466+ _channelLock .lock ();
467467 try {
468468 ensureIsOpen ();
469469 quiescingTransmit (c );
470470 } finally {
471- _channelMutex .unlock ();
471+ _channelLock .unlock ();
472472 }
473473 }
474474
475475 public void quiescingTransmit (Method m ) throws IOException {
476- _channelMutex .lock ();
476+ _channelLock .lock ();
477477 try {
478478 quiescingTransmit (new AMQCommand (m ));
479479 } finally {
480- _channelMutex .unlock ();
480+ _channelLock .unlock ();
481481 }
482482 }
483483
484484 public void quiescingTransmit (AMQCommand c ) throws IOException {
485- _channelMutex .lock ();
485+ _channelLock .lock ();
486486 try {
487487 if (c .getMethod ().hasContent ()) {
488488 while (_blockContent ) {
489489 try {
490- _channelMutexCondition .await ();
490+ _channelLockCondition .await ();
491491 } catch (InterruptedException ignored ) {
492492 Thread .currentThread ().interrupt ();
493493 }
@@ -501,7 +501,7 @@ public void quiescingTransmit(AMQCommand c) throws IOException {
501501 this ._trafficListener .write (c );
502502 c .transmit (this );
503503 } finally {
504- _channelMutex .unlock ();
504+ _channelLock .unlock ();
505505 }
506506 }
507507
0 commit comments