Skip to content

Commit 0c25c3c

Browse files
Squash a few IDEA warnings in AMQChannel
1 parent 106bade commit 0c25c3c

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

src/main/java/com/rabbitmq/client/impl/AMQChannel.java

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ public abstract class AMQChannel extends ShutdownNotifierComponent {
4646

4747
private static final Logger LOGGER = LoggerFactory.getLogger(AMQChannel.class);
4848

49-
protected static final int NO_RPC_TIMEOUT = 0;
49+
static final int NO_RPC_TIMEOUT = 0;
5050

5151
/**
5252
* Protected; used instead of synchronizing on the channel itself,
5353
* so that clients can themselves use the channel to synchronize
5454
* on.
5555
*/
56-
protected final Object _channelMutex = new Object();
56+
final Object _channelMutex = new Object();
5757

5858
/** The connection this channel is associated with. */
5959
private final AMQConnection _connection;
@@ -68,10 +68,10 @@ public abstract class AMQChannel extends ShutdownNotifierComponent {
6868
private RpcWrapper _activeRpc = null;
6969

7070
/** Whether transmission of content-bearing methods should be blocked */
71-
protected volatile boolean _blockContent = false;
71+
volatile boolean _blockContent = false;
7272

7373
/** Timeout for RPC calls */
74-
protected final int _rpcTimeout;
74+
final int _rpcTimeout;
7575

7676
private final boolean _checkRpcResponseType;
7777

@@ -107,7 +107,7 @@ public int getChannelNumber() {
107107
* @param frame the incoming frame
108108
* @throws IOException if an error is encountered
109109
*/
110-
public void handleFrame(Frame frame) throws IOException {
110+
void handleFrame(Frame frame) throws IOException {
111111
AMQCommand command = _command;
112112
if (command.handleFrame(frame)) { // a complete command has rolled off the assembly line
113113
_command = new AMQCommand(); // prepare for the next one
@@ -126,9 +126,7 @@ public static IOException wrap(ShutdownSignalException ex) {
126126
}
127127

128128
public static IOException wrap(ShutdownSignalException ex, String message) {
129-
IOException ioe = new IOException(message);
130-
ioe.initCause(ex);
131-
return ioe;
129+
return new IOException(message, ex);
132130
}
133131

134132
/**
@@ -148,7 +146,7 @@ public AMQCommand exnWrappingRpc(Method m)
148146
}
149147
}
150148

151-
public CompletableFuture<Command> exnWrappingAsyncRpc(Method m)
149+
CompletableFuture<Command> exnWrappingAsyncRpc(Method m)
152150
throws IOException
153151
{
154152
try {
@@ -167,7 +165,7 @@ public CompletableFuture<Command> exnWrappingAsyncRpc(Method m)
167165
* @throws IOException if there's any problem
168166
*
169167
* @param command the incoming command
170-
* @throws IOException
168+
* @throws IOException when operation is interrupted by an I/O exception
171169
*/
172170
public void handleCompleteInboundCommand(AMQCommand command) throws IOException {
173171
// First, offer the command to the asynchronous-command
@@ -208,7 +206,7 @@ public void enqueueRpc(RpcContinuation k)
208206
doEnqueueRpc(() -> new RpcContinuationRpcWrapper(k));
209207
}
210208

211-
public void enqueueAsyncRpc(Method method, CompletableFuture<Command> future) {
209+
private void enqueueAsyncRpc(Method method, CompletableFuture<Command> future) {
212210
doEnqueueRpc(() -> new CompletableFutureRpcWrapper(method, future));
213211
}
214212

@@ -230,7 +228,7 @@ private void doEnqueueRpc(Supplier<RpcWrapper> rpcWrapperSupplier) {
230228
}
231229
}
232230

233-
public boolean isOutstandingRpc()
231+
boolean isOutstandingRpc()
234232
{
235233
synchronized (_channelMutex) {
236234
return (_activeRpc != null);
@@ -251,7 +249,7 @@ protected void markRpcFinished() {
251249
// no-op
252250
}
253251

254-
public void ensureIsOpen()
252+
private void ensureIsOpen()
255253
throws AlreadyClosedException
256254
{
257255
if (!isOpen()) {
@@ -308,7 +306,7 @@ private void cleanRpcChannelState() {
308306
}
309307

310308
/** Cleans RPC channel state after a timeout and wraps the TimeoutException in a ChannelContinuationTimeoutException */
311-
protected ChannelContinuationTimeoutException wrapTimeoutException(final Method m, final TimeoutException e) {
309+
ChannelContinuationTimeoutException wrapTimeoutException(final Method m, final TimeoutException e) {
312310
cleanRpcChannelState();
313311
return new ChannelContinuationTimeoutException(e, this, this._channelNumber, m);
314312
}
@@ -343,7 +341,7 @@ public void rpc(Method m, RpcContinuation k)
343341
}
344342
}
345343

346-
public void quiescingRpc(Method m, RpcContinuation k)
344+
void quiescingRpc(Method m, RpcContinuation k)
347345
throws IOException
348346
{
349347
synchronized (_channelMutex) {
@@ -352,7 +350,7 @@ public void quiescingRpc(Method m, RpcContinuation k)
352350
}
353351
}
354352

355-
public void asyncRpc(Method m, CompletableFuture<Command> future)
353+
private void asyncRpc(Method m, CompletableFuture<Command> future)
356354
throws IOException
357355
{
358356
synchronized (_channelMutex) {
@@ -361,7 +359,7 @@ public void asyncRpc(Method m, CompletableFuture<Command> future)
361359
}
362360
}
363361

364-
public void quiescingAsyncRpc(Method m, CompletableFuture<Command> future)
362+
private void quiescingAsyncRpc(Method m, CompletableFuture<Command> future)
365363
throws IOException
366364
{
367365
synchronized (_channelMutex) {
@@ -409,33 +407,33 @@ public void processShutdownSignal(ShutdownSignalException signal,
409407
}
410408
}
411409

412-
public void notifyOutstandingRpc(ShutdownSignalException signal) {
410+
void notifyOutstandingRpc(ShutdownSignalException signal) {
413411
RpcWrapper k = nextOutstandingRpc();
414412
if (k != null) {
415413
k.shutdown(signal);
416414
}
417415
}
418416

419-
public void transmit(Method m) throws IOException {
417+
protected void transmit(Method m) throws IOException {
420418
synchronized (_channelMutex) {
421419
transmit(new AMQCommand(m));
422420
}
423421
}
424422

425-
public void transmit(AMQCommand c) throws IOException {
423+
void transmit(AMQCommand c) throws IOException {
426424
synchronized (_channelMutex) {
427425
ensureIsOpen();
428426
quiescingTransmit(c);
429427
}
430428
}
431429

432-
public void quiescingTransmit(Method m) throws IOException {
430+
void quiescingTransmit(Method m) throws IOException {
433431
synchronized (_channelMutex) {
434432
quiescingTransmit(new AMQCommand(m));
435433
}
436434
}
437435

438-
public void quiescingTransmit(AMQCommand c) throws IOException {
436+
private void quiescingTransmit(AMQCommand c) throws IOException {
439437
synchronized (_channelMutex) {
440438
if (c.getMethod().hasContent()) {
441439
while (_blockContent) {
@@ -468,16 +466,16 @@ public interface RpcContinuation {
468466
}
469467

470468
public static abstract class BlockingRpcContinuation<T> implements RpcContinuation {
471-
public final BlockingValueOrException<T, ShutdownSignalException> _blocker =
472-
new BlockingValueOrException<T, ShutdownSignalException>();
469+
final BlockingValueOrException<T, ShutdownSignalException> _blocker =
470+
new BlockingValueOrException<>();
473471

474472
protected final Method request;
475473

476-
public BlockingRpcContinuation() {
474+
BlockingRpcContinuation() {
477475
request = null;
478476
}
479477

480-
public BlockingRpcContinuation(final Method request) {
478+
BlockingRpcContinuation(final Method request) {
481479
this.request = request;
482480
}
483481

@@ -496,7 +494,7 @@ public T getReply() throws ShutdownSignalException
496494
return _blocker.uninterruptibleGetValue();
497495
}
498496

499-
public T getReply(int timeout)
497+
T getReply(int timeout)
500498
throws ShutdownSignalException, TimeoutException
501499
{
502500
return _blocker.uninterruptibleGetValue(timeout);
@@ -509,7 +507,7 @@ public boolean canHandleReply(AMQCommand command) {
509507

510508
public abstract T transformReply(AMQCommand command);
511509

512-
public static boolean isResponseCompatibleWithRequest(Method request, Method response) {
510+
static boolean isResponseCompatibleWithRequest(Method request, Method response) {
513511
// make a best effort attempt to ensure the reply was intended for this rpc request
514512
// Ideally each rpc request would tag an id on it that could be returned and referenced on its reply.
515513
// But because that would be a very large undertaking to add passively this logic at least protects against ClassCastExceptions
@@ -570,11 +568,11 @@ public static class SimpleBlockingRpcContinuation
570568
extends BlockingRpcContinuation<AMQCommand>
571569
{
572570

573-
public SimpleBlockingRpcContinuation() {
571+
SimpleBlockingRpcContinuation() {
574572
super();
575573
}
576574

577-
public SimpleBlockingRpcContinuation(final Method method) {
575+
SimpleBlockingRpcContinuation(final Method method) {
578576
super(method);
579577
}
580578

0 commit comments

Comments
 (0)