Skip to content

Commit

Permalink
Use Lock interface to declare properties
Browse files Browse the repository at this point in the history
Not ReentrantLock.

References #1119
  • Loading branch information
acogoluegnes committed Sep 25, 2023
1 parent 06346ed commit 3f72657
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/rabbitmq/client/impl/AMQChannel.java
Expand Up @@ -32,6 +32,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;

Expand All @@ -56,7 +57,7 @@ public abstract class AMQChannel extends ShutdownNotifierComponent {
* so that clients can themselves use the channel to synchronize
* on.
*/
protected final ReentrantLock _channelLock = new ReentrantLock();
protected final Lock _channelLock = new ReentrantLock();
protected final Condition _channelLockCondition = _channelLock.newCondition();

/** The connection this channel is associated with. */
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/rabbitmq/client/impl/AMQCommand.java
Expand Up @@ -18,6 +18,7 @@
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import com.rabbitmq.client.AMQP;
Expand All @@ -44,7 +45,7 @@ public class AMQCommand implements Command {

/** The assembler for this command - synchronised on - contains all the state */
private final CommandAssembler assembler;
private final ReentrantLock assemblerLock = new ReentrantLock();
private final Lock assemblerLock = new ReentrantLock();

AMQCommand(int maxBodyLength) {
this(null, null, null, maxBodyLength);
Expand Down
Expand Up @@ -29,6 +29,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
Expand All @@ -49,11 +50,11 @@ public class SocketFrameHandler implements FrameHandler {

/** Socket's inputstream - data from the broker - synchronized on */
private final DataInputStream _inputStream;
private final ReentrantLock _inputStreamLock = new ReentrantLock();
private final Lock _inputStreamLock = new ReentrantLock();

/** Socket's outputstream - data to the broker - synchronized on */
private final DataOutputStream _outputStream;
private final ReentrantLock _outputStreamLock = new ReentrantLock();
private final Lock _outputStreamLock = new ReentrantLock();

private final int maxInboundMessageBodySize;

Expand Down

0 comments on commit 3f72657

Please sign in to comment.