Skip to content

Commit c176ff9

Browse files
committed
Fix some Sonar warnings
1 parent 07b86ca commit c176ff9

File tree

8 files changed

+11
-8
lines changed

8 files changed

+11
-8
lines changed

src/main/java/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ public Connection newConnection(ExecutorService executor, AddressResolver addres
10991099

11001100
if (isAutomaticRecoveryEnabled()) {
11011101
// see com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory#newConnection
1102-
AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector); //NOSONAR
1102+
AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector);
11031103

11041104
conn.init();
11051105
return conn;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ public void quiescingTransmit(AMQCommand c) throws IOException {
440440
while (_blockContent) {
441441
try {
442442
_channelMutex.wait();
443-
} catch (InterruptedException ignored) {}
443+
} catch (InterruptedException ignored) {
444+
Thread.currentThread().interrupt();
445+
}
444446

445447
// This is to catch a situation when the thread wakes up during
446448
// shutdown. Currently, no command that has content is allowed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public WorkPool(final int queueingTimeout) {
7474
throw new WorkPoolFullException("Could not enqueue in work pool after " + queueingTimeout + " ms.");
7575
}
7676
} catch (InterruptedException e) {
77-
Thread.currentThread();
77+
Thread.currentThread().interrupt();
7878
}
7979
};
8080
} else {

src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public FrameHandler create(Address addr, String connectionName) throws IOExcepti
7878
}
7979

8080
SocketAddress address = new InetSocketAddress(addr.getHost(), portNumber);
81-
channel = SocketChannel.open(); //NOSONAR
81+
channel = SocketChannel.open();
8282
channel.configureBlocking(true);
8383
if(nioParams.getSocketChannelConfigurator() != null) {
8484
nioParams.getSocketChannelConfigurator().configure(channel);

src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ private void sendWriteRequest(WriteRequest writeRequest) throws IOException {
137137
}
138138
} catch (InterruptedException e) {
139139
LOGGER.warn("Thread interrupted during enqueuing frame in write queue");
140+
Thread.currentThread().interrupt();
140141
}
141142
}
142143

src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private static int retryRead(ReadableByteChannel channel, ByteBuffer buffer) thr
113113
try {
114114
Thread.sleep(100L);
115115
} catch (InterruptedException e) {
116-
// ignore
116+
Thread.currentThread().interrupt();
117117
}
118118
read = NioHelper.read(channel, buffer);
119119
if(read > 0) {

src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ public void automaticallyRecover(AutorecoveringConnection connection, Connection
761761
this.connection = connection;
762762

763763
final RecoveryAwareChannelN newChannel = (RecoveryAwareChannelN) connDelegate.createChannel(this.getChannelNumber());
764-
if (newChannel == null) //NOSONAR
764+
if (newChannel == null)
765765
throw new IOException("Failed to create new channel for channel number=" + this.getChannelNumber() + " during recovery");
766766
newChannel.inheritOffsetFrom(defunctChannel);
767767
this.delegate = newChannel;

src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public void init() throws IOException, TimeoutException {
163163
@Override
164164
public Channel createChannel() throws IOException {
165165
RecoveryAwareChannelN ch = (RecoveryAwareChannelN) delegate.createChannel();
166-
if (ch == null) { //NOSONAR
166+
if (ch == null) {
167167
return null;
168168
} else {
169169
return this.wrapChannel(ch);
@@ -559,7 +559,7 @@ public void removeConsumerRecoveryListener(ConsumerRecoveryListener listener) {
559559
}
560560

561561
private synchronized void beginAutomaticRecovery() throws InterruptedException {
562-
Thread.sleep(this.params.getRecoveryDelayHandler().getDelay(0));
562+
this.wait(this.params.getRecoveryDelayHandler().getDelay(0));
563563

564564
this.notifyRecoveryListenersStarted();
565565

0 commit comments

Comments
 (0)