|
112 | 112 | * @author Yang Qiju |
113 | 113 | * @author Tom van den Berge |
114 | 114 | */ |
115 | | -public class KafkaMessageListenerContainer<K, V> |
116 | | - extends AbstractMessageListenerContainer<K, V> { // NOSONAR comment density |
| 115 | +public class KafkaMessageListenerContainer<K, V> // NOSONAR comment density |
| 116 | + extends AbstractMessageListenerContainer<K, V> { |
117 | 117 |
|
118 | 118 | private static final int DEFAULT_ACK_TIME = 5000; |
119 | 119 |
|
@@ -383,6 +383,8 @@ public String toString() { |
383 | 383 |
|
384 | 384 | private final class ListenerConsumer implements SchedulingAwareRunnable, ConsumerSeekCallback { |
385 | 385 |
|
| 386 | + private static final String UNCHECKED = "unchecked"; |
| 387 | + |
386 | 388 | private static final String RAWTYPES = "rawtypes"; |
387 | 389 |
|
388 | 390 | private static final String RAW_TYPES = RAWTYPES; |
@@ -486,7 +488,7 @@ private final class ListenerConsumer implements SchedulingAwareRunnable, Consume |
486 | 488 |
|
487 | 489 | private volatile long lastPoll = System.currentTimeMillis(); |
488 | 490 |
|
489 | | - @SuppressWarnings("unchecked") |
| 491 | + @SuppressWarnings(UNCHECKED) |
490 | 492 | ListenerConsumer(GenericMessageListener<?> listener, ListenerType listenerType) { |
491 | 493 | Assert.state(!this.isAnyManualAck || !this.autoCommit, |
492 | 494 | () -> "Consumer cannot be configured for auto commit for ackMode " |
@@ -947,7 +949,7 @@ private void invokeBatchListener(final ConsumerRecords<K, V> records) { |
947 | 949 | } |
948 | 950 | } |
949 | 951 |
|
950 | | - @SuppressWarnings({ "unchecked", RAW_TYPES }) |
| 952 | + @SuppressWarnings({ UNCHECKED, RAW_TYPES }) |
951 | 953 | private void invokeBatchListenerInTx(final ConsumerRecords<K, V> records, |
952 | 954 | final List<ConsumerRecord<K, V>> recordList) { |
953 | 955 | try { |
@@ -1100,7 +1102,7 @@ private void invokeRecordListener(final ConsumerRecords<K, V> records) { |
1100 | 1102 | * Invoke the listener with each record in a separate transaction. |
1101 | 1103 | * @param records the records. |
1102 | 1104 | */ |
1103 | | - @SuppressWarnings({ "unchecked", RAW_TYPES }) |
| 1105 | + @SuppressWarnings({ UNCHECKED, RAW_TYPES }) |
1104 | 1106 | private void invokeRecordListenerInTx(final ConsumerRecords<K, V> records) { |
1105 | 1107 | Iterator<ConsumerRecord<K, V>> iterator = records.iterator(); |
1106 | 1108 | while (iterator.hasNext()) { |
@@ -1317,7 +1319,7 @@ else if (!this.isAnyManualAck && !this.autoCommit) { |
1317 | 1319 | } |
1318 | 1320 | } |
1319 | 1321 |
|
1320 | | - @SuppressWarnings({ "unchecked", RAW_TYPES }) |
| 1322 | + @SuppressWarnings({ UNCHECKED, RAW_TYPES }) |
1321 | 1323 | private void sendOffsetsToTransaction(Producer producer) { |
1322 | 1324 | handleAcks(); |
1323 | 1325 | Map<TopicPartition, OffsetAndMetadata> commits = buildCommits(); |
@@ -1674,7 +1676,7 @@ public void onPartitionsAssigned(Collection<TopicPartition> partitions) { |
1674 | 1676 | ListenerConsumer.this.transactionTemplate |
1675 | 1677 | .execute(new TransactionCallbackWithoutResult() { |
1676 | 1678 |
|
1677 | | - @SuppressWarnings({"unchecked", RAWTYPES}) |
| 1679 | + @SuppressWarnings({UNCHECKED, RAWTYPES}) |
1678 | 1680 | @Override |
1679 | 1681 | protected void doInTransactionWithoutResult(TransactionStatus status) { |
1680 | 1682 | KafkaResourceHolder holder = |
|
0 commit comments