Skip to content

Commit 2b8f183

Browse files
committed
Remove redundant casts in the RabbitAmqpTemplate
1 parent 3f33f0f commit 2b8f183

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spring-rabbitmq-client/src/main/java/org/springframework/amqp/rabbitmq/client/RabbitAmqpTemplate.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class RabbitAmqpTemplate implements AsyncAmqpTemplate, DisposableBean {
6767

6868
private final Lock instanceLock = new ReentrantLock();
6969

70-
private @Nullable Object publisher;
70+
private @Nullable Publisher publisher;
7171

7272
private MessageConverter messageConverter = new SimpleMessageConverter();
7373

@@ -176,7 +176,7 @@ private String getRequiredQueue() throws IllegalStateException {
176176
* @return the {@link Publisher} for low-level AMQP operations.
177177
*/
178178
public Publisher getPublisher() {
179-
Object publisherToReturn = this.publisher;
179+
Publisher publisherToReturn = this.publisher;
180180
if (publisherToReturn == null) {
181181
this.instanceLock.lock();
182182
try {
@@ -195,14 +195,14 @@ public Publisher getPublisher() {
195195
this.instanceLock.unlock();
196196
}
197197
}
198-
return (Publisher) publisherToReturn;
198+
return publisherToReturn;
199199
}
200200

201201
@Override
202202
public void destroy() {
203-
Object publisherToClose = this.publisher;
203+
Publisher publisherToClose = this.publisher;
204204
if (publisherToClose != null) {
205-
((Publisher) publisherToClose).close();
205+
publisherToClose.close();
206206
this.publisher = null;
207207
}
208208
}

0 commit comments

Comments
 (0)