activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/2] activemq-artemis git commit: improving fallocate check on libaio
Date Mon, 01 Aug 2016 21:21:04 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master b2a8cb22d -> 4cecc9575


improving fallocate check on libaio


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/30a3bfb2
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/30a3bfb2
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/30a3bfb2

Branch: refs/heads/master
Commit: 30a3bfb2a4b99086697f5b659f1c6e2204387982
Parents: b2a8cb2
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Aug 1 17:12:08 2016 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Aug 1 17:17:43 2016 -0400

----------------------------------------------------------------------
 .../activemq/artemis/jlibaio/LibaioFile.java    |  2 +-
 .../artemis/jlibaio/test/LibaioTest.java        | 22 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/30a3bfb2/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioFile.java
----------------------------------------------------------------------
diff --git a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioFile.java
b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioFile.java
index b1520d0..b8134b9 100644
--- a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioFile.java
+++ b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioFile.java
@@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
 /**
  * This is an extension to use libaio.
  */
-public final class LibaioFile<Callback extends SubmitInfo> {
+public final class LibaioFile<Callback extends SubmitInfo> implements AutoCloseable
{
 
    protected boolean open;
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/30a3bfb2/artemis-native/src/test/java/org/apache/activemq/artemis/jlibaio/test/LibaioTest.java
----------------------------------------------------------------------
diff --git a/artemis-native/src/test/java/org/apache/activemq/artemis/jlibaio/test/LibaioTest.java
b/artemis-native/src/test/java/org/apache/activemq/artemis/jlibaio/test/LibaioTest.java
index 71f7516..fec742c 100644
--- a/artemis-native/src/test/java/org/apache/activemq/artemis/jlibaio/test/LibaioTest.java
+++ b/artemis-native/src/test/java/org/apache/activemq/artemis/jlibaio/test/LibaioTest.java
@@ -46,6 +46,28 @@ public class LibaioTest {
    @BeforeClass
    public static void testAIO() {
       Assume.assumeTrue(LibaioContext.isLoaded());
+
+      File parent = new File("./target");
+      File file = new File(parent, "testFile");
+
+      try {
+         parent.mkdirs();
+
+
+         boolean failed = false;
+         try (LibaioContext control = new LibaioContext<>(1, true); LibaioFile fileDescriptor
= control.openFile(file, true)) {
+            fileDescriptor.fallocate(4 * 1024);
+         }
+         catch (Exception e) {
+            e.printStackTrace();
+            failed = true;
+         }
+
+         Assume.assumeFalse("There is not enough support to libaio", failed);
+      }
+      finally {
+         file.delete();
+      }
    }
 
    /**


Mime
View raw message