You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by "mattrpav (via GitHub)" <gi...@apache.org> on 2025/02/03 23:19:31 UTC
[PR] [AMQ-9656] Cleanup kahadb compiler warnings [activemq]
mattrpav opened a new pull request, #1386:
URL: https://github.com/apache/activemq/pull/1386
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] [AMQ-9656] Cleanup kahadb compiler warnings [activemq]
Posted by "cshannon (via GitHub)" <gi...@apache.org>.
cshannon commented on code in PR #1386:
URL: https://github.com/apache/activemq/pull/1386#discussion_r1941573565
##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MultiKahaDBTransactionStore.java:
##########
@@ -427,15 +427,16 @@ private void recoverPendingLocalTransactions() throws IOException {
}
public JournalCommand<?> load(Location location) throws IOException {
- DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location));
- byte readByte = is.readByte();
- KahaEntryType type = KahaEntryType.valueOf(readByte);
- if (type == null) {
- throw new IOException("Could not load journal record. Invalid location: " + location);
- }
- JournalCommand<?> message = (JournalCommand<?>) type.createMessage();
- message.mergeFramed(is);
- return message;
+ try(DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location))) {
Review Comment:
Looking at it more carefully i don't think it matters either way. The source value returned is a ByteSequence which just wraps a byte array and that is passed to DataByteArrayInputStream. So in this case there's nothing to actually close, it will just be a no-op.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] [AMQ-9656] Cleanup kahadb compiler warnings [activemq]
Posted by "cshannon (via GitHub)" <gi...@apache.org>.
cshannon commented on code in PR #1386:
URL: https://github.com/apache/activemq/pull/1386#discussion_r1941567695
##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MultiKahaDBTransactionStore.java:
##########
@@ -427,15 +427,16 @@ private void recoverPendingLocalTransactions() throws IOException {
}
public JournalCommand<?> load(Location location) throws IOException {
- DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location));
- byte readByte = is.readByte();
- KahaEntryType type = KahaEntryType.valueOf(readByte);
- if (type == null) {
- throw new IOException("Could not load journal record. Invalid location: " + location);
- }
- JournalCommand<?> message = (JournalCommand<?>) type.createMessage();
- message.mergeFramed(is);
- return message;
+ try(DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location))) {
Review Comment:
Do we actually want to close this? We don't close it in regular KahadDB and the javadocs for DataByteArrayInputStream can be used more than once so I am wondering if there will be any unintentional side effects or if this should have always been closed after loading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] [AMQ-9656] Cleanup kahadb compiler warnings [activemq]
Posted by "cshannon (via GitHub)" <gi...@apache.org>.
cshannon commented on code in PR #1386:
URL: https://github.com/apache/activemq/pull/1386#discussion_r1941567695
##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MultiKahaDBTransactionStore.java:
##########
@@ -427,15 +427,16 @@ private void recoverPendingLocalTransactions() throws IOException {
}
public JournalCommand<?> load(Location location) throws IOException {
- DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location));
- byte readByte = is.readByte();
- KahaEntryType type = KahaEntryType.valueOf(readByte);
- if (type == null) {
- throw new IOException("Could not load journal record. Invalid location: " + location);
- }
- JournalCommand<?> message = (JournalCommand<?>) type.createMessage();
- message.mergeFramed(is);
- return message;
+ try(DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location))) {
Review Comment:
Do we actually want to close this? We don't close it in regular KahadDB and the javadocs for DataByteArrayInputStream say it can be used more than once so I am wondering if there will be any unintentional side effects or if this should have always been closed after loading.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] [AMQ-9656] Cleanup kahadb compiler warnings [activemq]
Posted by "mattrpav (via GitHub)" <gi...@apache.org>.
mattrpav merged PR #1386:
URL: https://github.com/apache/activemq/pull/1386
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact