Skip to content

Commit a4e1520

Browse files
committed
merge bug19129 into default
2 parents 2fffd7a + f0f6b4d commit a4e1520

40 files changed

+323
-610
lines changed

src/com/rabbitmq/client/Channel.java

Lines changed: 28 additions & 76 deletions
Large diffs are not rendered by default.

src/com/rabbitmq/client/Connection.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@
4040
* ConnectionFactory factory = new ConnectionFactory(params);
4141
* Connection conn = factory.newConnection(hostName, AMQP.PROTOCOL.PORT);
4242
*
43-
* // Then open a channel and retrieve an access ticket:
43+
* // Then open a channel:
4444
*
4545
* Channel channel = conn.createChannel();
46-
* int ticket = channel.accessRequest(realmName);
4746
* </pre>
4847
*
4948
* Current implementations are thread-safe for code at the client API level,

src/com/rabbitmq/client/ConnectionParameters.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,12 @@ private static String safeGetProperty(String key, String def) {
5959
/** Default value for desired heartbeat interval; zero for none */
6060
public static final int DEFAULT_HEARTBEAT = 3;
6161

62-
/**
63-
* Default value for suppressAccessRequest flag. Retrieved from
64-
* system property
65-
* "com.rabbitmq.client.ConnectionParameters.suppressAccessRequest"
66-
* and defaulting to true.
67-
*/
68-
public static final boolean DEFAULT_SUPPRESS_ACCESS_REQUEST =
69-
safeGetProperty("com.rabbitmq.client.ConnectionParameters.suppressAccessRequest", new Boolean(false).toString()).equals("true");
70-
7162
private String _userName = DEFAULT_USER;
7263
private String _password = DEFAULT_PASS;
7364
private String _virtualHost = DEFAULT_VHOST;
7465
private int _requestedChannelMax = DEFAULT_CHANNEL_MAX;
7566
private int _requestedFrameMax = DEFAULT_FRAME_MAX;
7667
private int _requestedHeartbeat = DEFAULT_HEARTBEAT;
77-
private boolean _suppressAccessRequest = DEFAULT_SUPPRESS_ACCESS_REQUEST;
7868

7969
/**
8070
* Instantiate a set of parameters with all values set to the defaults
@@ -177,21 +167,4 @@ public void setRequestedChannelMax(int requestedChannelMax) {
177167
_requestedChannelMax = requestedChannelMax;
178168
}
179169

180-
/**
181-
* Retrieve the setting for the suppression of sending
182-
* "access.request" methods.
183-
* @return true of "access.request" methods are suppressed, false otherwise.
184-
*/
185-
public boolean getSuppressAccessRequest() {
186-
return _suppressAccessRequest;
187-
}
188-
189-
/**
190-
* Enable or disable the suppression of sending "access.request"
191-
* methods.
192-
* @param suppressAccessRequest true of "access.request" methods are suppressed, false otherwise.
193-
*/
194-
public void setSuppressAccessRequest(boolean suppressAccessRequest) {
195-
_suppressAccessRequest = suppressAccessRequest;
196-
}
197170
}

src/com/rabbitmq/client/MapRpcServer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
* requests and replies.
4242
*/
4343
public class MapRpcServer extends RpcServer {
44-
public MapRpcServer(Channel channel, int ticket) throws IOException
45-
{ super(channel, ticket); }
44+
public MapRpcServer(Channel channel) throws IOException
45+
{ super(channel); }
4646

47-
public MapRpcServer(Channel channel, int ticket, String queueName) throws IOException
48-
{ super(channel, ticket, queueName); }
47+
public MapRpcServer(Channel channel, String queueName) throws IOException
48+
{ super(channel, queueName); }
4949

5050
/**
5151
* Overridden to delegate to handleMapCall.

src/com/rabbitmq/client/RpcClient.java

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
public class RpcClient {
5050
/** Channel we are communicating on */
5151
private final Channel _channel;
52-
/** Access ticket this RpcClient uses */
53-
private final int _ticket;
5452
/** Exchange to send requests to */
5553
private final String _exchange;
5654
/** Routing key to use for requests */
@@ -67,21 +65,18 @@ public class RpcClient {
6765
private DefaultConsumer _consumer;
6866

6967
/**
70-
* Construct a new RpcClient that will communicate on the given
71-
* channel, using the given ticket for permission, sending
68+
* Construct a new RpcClient that will communicate on the given channel, sending
7269
* requests to the given exchange with the given routing key.
7370
* <p>
7471
* Causes the creation of a temporary private autodelete queue.
7572
* @param channel the channel to use for communication
76-
* @param ticket the access ticket for the appropriate realm
7773
* @param exchange the exchange to connect to
7874
* @param routingKey the routing key
7975
* @throws IOException if an error is encountered
8076
* @see #setupReplyQueue
8177
*/
82-
public RpcClient(Channel channel, int ticket, String exchange, String routingKey) throws IOException {
78+
public RpcClient(Channel channel, String exchange, String routingKey) throws IOException {
8379
_channel = channel;
84-
_ticket = ticket;
8580
_exchange = exchange;
8681
_routingKey = routingKey;
8782
_correlationId = 0;
@@ -118,7 +113,7 @@ public void close() throws IOException {
118113
* @return the name of the reply queue
119114
*/
120115
private String setupReplyQueue() throws IOException {
121-
return _channel.queueDeclare(_ticket, "", false, false, true, true, null).getQueue();
116+
return _channel.queueDeclare("", false, false, true, true, null).getQueue();
122117
}
123118

124119
/**
@@ -153,14 +148,14 @@ public void handleDelivery(String consumerTag,
153148
}
154149
}
155150
};
156-
_channel.basicConsume(_ticket, _replyQueue, true, consumer);
151+
_channel.basicConsume(_replyQueue, true, consumer);
157152
return consumer;
158153
}
159154

160155
public void publish(AMQP.BasicProperties props, byte[] message)
161156
throws IOException
162157
{
163-
_channel.basicPublish(_ticket, _exchange, _routingKey, props, message);
158+
_channel.basicPublish(_exchange, _routingKey, props, message);
164159
}
165160

166161
public byte[] primitiveCall(AMQP.BasicProperties props, byte[] message)
@@ -279,14 +274,6 @@ public Channel getChannel() {
279274
return _channel;
280275
}
281276

282-
/**
283-
* Retrieve the access ticket.
284-
* @return the access ticket for the appropriate realm
285-
*/
286-
public int getTicket() {
287-
return _ticket;
288-
}
289-
290277
/**
291278
* Retrieve the exchange.
292279
* @return the exchange to which this client is connected

src/com/rabbitmq/client/RpcServer.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
public class RpcServer {
3535
/** Channel we are communicating on */
3636
protected final Channel _channel;
37-
/** Access ticket this RpcServer uses */
38-
protected final int _ticket;
3937
/** Queue to receive requests from */
4038
protected final String _queueName;
4139
/** Boolean controlling the exit from the mainloop. */
@@ -48,24 +46,23 @@ public class RpcServer {
4846
* Creates an RpcServer listening on a temporary exclusive
4947
* autodelete queue.
5048
*/
51-
public RpcServer(Channel channel, int ticket)
49+
public RpcServer(Channel channel)
5250
throws IOException
5351
{
54-
this(channel, ticket, null);
52+
this(channel, null);
5553
}
5654

5755
/**
5856
* If the passed-in queue name is null, creates a server-named
5957
* temporary exclusive autodelete queue to use; otherwise expects
6058
* the queue to have already been declared.
6159
*/
62-
public RpcServer(Channel channel, int ticket, String queueName)
60+
public RpcServer(Channel channel, String queueName)
6361
throws IOException
6462
{
6563
_channel = channel;
66-
_ticket = ticket;
6764
if (queueName == null || queueName.equals("")) {
68-
_queueName = _channel.queueDeclare(_ticket).getQueue();
65+
_queueName = _channel.queueDeclare().getQueue();
6966
} else {
7067
_queueName = queueName;
7168
}
@@ -96,7 +93,7 @@ protected QueueingConsumer setupConsumer()
9693
throws IOException
9794
{
9895
QueueingConsumer consumer = new QueueingConsumer(_channel);
99-
_channel.basicConsume(_ticket, _queueName, consumer);
96+
_channel.basicConsume(_queueName, consumer);
10097
return consumer;
10198
}
10299

@@ -157,7 +154,7 @@ public void processRequest(QueueingConsumer.Delivery request)
157154
AMQP.BasicProperties replyProperties = new AMQP.BasicProperties();
158155
byte[] replyBody = handleCall(request, replyProperties);
159156
replyProperties.correlationId = requestProperties.correlationId;
160-
_channel.basicPublish(_ticket, "", requestProperties.replyTo,
157+
_channel.basicPublish("", requestProperties.replyTo,
161158
replyProperties, replyBody);
162159
} else {
163160
handleCast(request);
@@ -234,14 +231,6 @@ public Channel getChannel() {
234231
return _channel;
235232
}
236233

237-
/**
238-
* Retrieve the access ticket.
239-
* @return the access ticket for the appropriate realm
240-
*/
241-
public int getTicket() {
242-
return _ticket;
243-
}
244-
245234
/**
246235
* Retrieve the queue name.
247236
* @return the queue which this server is consuming from

src/com/rabbitmq/client/StringRpcServer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
* Subclass of RpcServer which accepts UTF-8 string requests.
3333
*/
3434
public class StringRpcServer extends RpcServer {
35-
public StringRpcServer(Channel channel, int ticket) throws IOException
36-
{ super(channel, ticket); }
35+
public StringRpcServer(Channel channel) throws IOException
36+
{ super(channel); }
3737

38-
public StringRpcServer(Channel channel, int ticket, String queueName) throws IOException
39-
{ super(channel, ticket, queueName); }
38+
public StringRpcServer(Channel channel, String queueName) throws IOException
39+
{ super(channel, queueName); }
4040

4141
/**
4242
* Overridden to do UTF-8 processing, and delegate to

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@
5454
* conn.open(userName, portNumber, virtualHost);
5555
* </pre>
5656
*
57-
* Then open a channel and retrieve an access ticket:
58-
*
5957
* <pre>
6058
* ChannelN ch1 = conn.createChannel(1);
6159
* ch1.open(&quot;&quot;);
62-
* int ticket = ch1.accessRequest(realmName);
6360
* </pre>
6461
*/
6562
public class AMQConnection extends ShutdownNotifierComponent implements Connection {

0 commit comments

Comments
 (0)