Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1256#discussion_r115269333
--- Diff:
artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
---
@@ -293,14 +296,49 @@ private void internalWrite(final ByteBuffer bytes,
private void doInternalWrite(final ByteBuffer bytes,
final boolean sync,
final IOCallback callback) throws
IOException {
- channel.write(bytes);
+ try {
+ channel.write(bytes);
+
+ if (sync) {
+ sync();
+ }
- if (sync) {
- sync();
+ if (callback != null) {
+ callback.done();
+ }
+ } finally {
+ //release it to recycle the write buffer if big enough
+ this.factory.releaseBuffer(bytes);
}
+ }
- if (callback != null) {
- callback.done();
+ @Override
+ public void copyTo(SequentialFile dstFile) throws IOException {
+ ActiveMQJournalLogger.LOGGER.debug("Copying " + this + " as " +
dstFile);
--- End diff --
If you make a change here make it:
```
if (logger.isDebugEnabled()) {
logger.debug(.....);
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---