[jboss-cvs] JBoss Messaging SVN: r5915 - in trunk: native/src and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 20 20:10:31 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-02-20 20:10:30 -0500 (Fri, 20 Feb 2009)
New Revision: 5915

Modified:
   trunk/native/bin/libJBMLibAIO64.so
   trunk/native/src/AIOException.h
   trunk/native/src/AsyncFile.cpp
   trunk/native/src/AsyncFile.h
   trunk/native/src/JavaUtilities.cpp
   trunk/native/src/JavaUtilities.h
   trunk/native/src/LibAIOController.cpp
   trunk/native/src/Version.h
   trunk/src/main/org/jboss/messaging/core/asyncio/AsynchronousFile.java
   trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java
   trunk/src/main/org/jboss/messaging/core/exception/MessagingException.java
   trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/AIOTestBase.java
   trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/SingleThreadWriteNativeTest.java
   trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java
Log:


Modified: trunk/native/bin/libJBMLibAIO64.so
===================================================================
(Binary files differ)

Modified: trunk/native/src/AIOException.h
===================================================================
--- trunk/native/src/AIOException.h	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/native/src/AIOException.h	2009-02-21 01:10:30 UTC (rev 5915)
@@ -25,6 +25,20 @@
 #include <exception>
 #include <string>
 
+
+#define NATIVE_ERROR_INTERNAL 200
+#define NATIVE_ERROR_INVALID_BUFFER 201
+#define NATIVE_ERROR_NOT_ALIGNED 202
+#define NATIVE_ERROR_CANT_INITIALIZE_AIO 203
+#define NATIVE_ERROR_CANT_RELEASE_AIO 204
+#define NATIVE_ERROR_CANT_OPEN_CLOSE_FILE 205
+#define NATIVE_ERROR_CANT_ALLOCATE_QUEUE 206
+#define NATIVE_ERROR_PREALLOCATE_FILE 208
+#define NATIVE_ERROR_ALLOCATE_MEMORY 209
+#define NATIVE_ERROR_IO 210
+#define NATIVE_ERROR_AIO_FULL 211
+
+
 class AIOException : public std::exception
 {
 private:

Modified: trunk/native/src/AsyncFile.cpp
===================================================================
--- trunk/native/src/AsyncFile.cpp	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/native/src/AsyncFile.cpp	2009-02-21 01:10:30 UTC (rev 5915)
@@ -67,14 +67,14 @@
 	fileName = _fileName;
 	if (io_queue_init(maxIO, &aioContext))
 	{
-		throw AIOException(1, "Can't initialize aio"); 
+		throw AIOException(NATIVE_ERROR_CANT_INITIALIZE_AIO, "Can't initialize aio"); 
 	}
 
 	fileHandle = ::open(fileName.data(),  O_RDWR | O_CREAT | O_DIRECT, 0666);
 	if (fileHandle < 0)
 	{
 		io_queue_release(aioContext);
-		throw AIOException(1, "Can't open file"); 
+		throw AIOException(NATIVE_ERROR_CANT_OPEN_CLOSE_FILE, "Can't open file"); 
 	}
 	
 #ifdef DEBUG
@@ -85,7 +85,7 @@
 	
 	if (events == 0)
 	{
-		throw AIOException (1, "Can't allocate ioEvents");
+		throw AIOException (NATIVE_ERROR_CANT_ALLOCATE_QUEUE, "Can't allocate ioEvents");
 	}
 
 }
@@ -94,11 +94,11 @@
 {
 	if (io_queue_release(aioContext))
 	{
-		throw AIOException(2,"Can't release aio");
+		throw AIOException(NATIVE_ERROR_CANT_RELEASE_AIO,"Can't release aio");
 	}
 	if (::close(fileHandle))
 	{
-		throw AIOException(2,"Can't close file");
+		throw AIOException(NATIVE_ERROR_CANT_OPEN_CLOSE_FILE,"Can't close file");
 	}
 	free(events);
 	::pthread_mutex_destroy(&fileMutex);
@@ -187,13 +187,13 @@
 
 	if (size % ALIGNMENT != 0)
 	{
-		throw AIOException (101, "You can only pre allocate files in multiples of 512");
+		throw AIOException (NATIVE_ERROR_PREALLOCATE_FILE, "You can only pre allocate files in multiples of 512");
 	}
 	
 	void * preAllocBuffer = 0;
 	if (posix_memalign(&preAllocBuffer, 512, size))
 	{
-		throw AIOException(10, "Error on posix_memalign");
+		throw AIOException(NATIVE_ERROR_ALLOCATE_MEMORY, "Error on posix_memalign");
 	}
 	
 	memset(preAllocBuffer, fillChar, size);
@@ -205,11 +205,11 @@
 	{
 		if (::write(fileHandle, preAllocBuffer, size)<0)
 		{
-			throw AIOException (12, "Error pre allocating the file");
+			throw AIOException (NATIVE_ERROR_PREALLOCATE_FILE, "Error pre allocating the file");
 		}
 	}
 	
-	if (::lseek (fileHandle, position, SEEK_SET) < 0) throw AIOException (11, "Error positioning the file");
+	if (::lseek (fileHandle, position, SEEK_SET) < 0) throw AIOException (NATIVE_ERROR_IO, "Error positioning the file");
 	
 	free (preAllocBuffer);
 }
@@ -243,7 +243,7 @@
 #ifdef DEBUG
 		    fprintf (stderr, "Error level on retries, throwing exception (retry=%d)\n", tries);
 #endif
-			throw AIOException(500, "Too many retries (500) waiting for a valid iocb block, please increase MAX_IO limit");
+			throw AIOException(NATIVE_ERROR_AIO_FULL, "Too many retries (500) waiting for a valid iocb block, please increase MAX_IO limit");
 		}
 		::usleep(WAIT_FOR_SPOT);
 	}
@@ -252,7 +252,7 @@
 	{
 		std::stringstream str;
 		str<< "Problem on submit block, errorCode=" << result;
-		throw AIOException (6, str.str());
+		throw AIOException (NATIVE_ERROR_IO, str.str());
 	}
 }
 
@@ -285,7 +285,7 @@
 #ifdef DEBUG
 		    fprintf (stderr, "Error level on retries, throwing exception (retry=%d)\n", tries);
 #endif
-			throw AIOException(500, "Too many retries (500) waiting for a valid iocb block, please increase MAX_IO limit");
+			throw AIOException(NATIVE_ERROR_AIO_FULL, "Too many retries (500) waiting for a valid iocb block, please increase MAX_IO limit");
 		}
 		::usleep(WAIT_FOR_SPOT);
 	}
@@ -294,7 +294,7 @@
 	{
 		std::stringstream str;
 		str<< "Problem on submit block, errorCode=" << result;
-		throw AIOException (6, str.str());
+		throw AIOException (NATIVE_ERROR_IO, str.str());
 	}
 }
 

Modified: trunk/native/src/AsyncFile.h
===================================================================
--- trunk/native/src/AsyncFile.h	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/native/src/AsyncFile.h	2009-02-21 01:10:30 UTC (rev 5915)
@@ -68,7 +68,7 @@
 		void * buffer = 0;
 		if (::posix_memalign(&buffer, 512, size))
 		{
-			throw AIOException(10, "Error on posix_memalign");
+			throw AIOException(NATIVE_ERROR_ALLOCATE_MEMORY, "Error on posix_memalign");
 		}
 		return buffer;
 		

Modified: trunk/native/src/JavaUtilities.cpp
===================================================================
--- trunk/native/src/JavaUtilities.cpp	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/native/src/JavaUtilities.cpp	2009-02-21 01:10:30 UTC (rev 5915)
@@ -22,21 +22,36 @@
 #include <string>
 #include "JavaUtilities.h"
 
-void throwException(JNIEnv * env,const char * clazz, const char * message)
+
+void throwRuntimeException(JNIEnv * env, const char * message)
 {
-  jclass exceptionClass = env->FindClass(clazz);
+  jclass exceptionClass = env->FindClass("java/lang/RuntimeException");
+  env->ThrowNew(exceptionClass,message);
+  
+}
+
+void throwException(JNIEnv * env, const int code, const char * message)
+{
+  jclass exceptionClass = env->FindClass("org/jboss/messaging/core/exception/MessagingException");
   if (exceptionClass==NULL) 
   {
-     exceptionClass = env->FindClass("java/lang/RuntimeException");
-     if (exceptionClass==NULL) 
-     {
-    	std::cerr << "Couldn't throw exception " << clazz << " message:= " << message << "\n";
-        return;
-     }
+     std::cerr << "Couldn't throw exception message:= " << message << "\n";
+     throwRuntimeException (env, "Can't find Exception class");
+     return;
   }
+
+  jmethodID constructor = env->GetMethodID(exceptionClass, "<init>", "(ILjava/lang/String;)V");
+  if (constructor == NULL)
+  {
+       std::cerr << "Couldn't find the constructor ***";
+       throwRuntimeException (env, "Can't find Constructor for Exception");
+       return;
+  }
+
+  jstring strError = env->NewStringUTF(message);
+  jthrowable ex = (jthrowable)env->NewObject(exceptionClass, constructor, code, strError);
+  env->Throw(ex);
   
-  env->ThrowNew(exceptionClass,message);
-  
 }
 
 std::string convertJavaString(JNIEnv * env, jstring& jstr)

Modified: trunk/native/src/JavaUtilities.h
===================================================================
--- trunk/native/src/JavaUtilities.h	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/native/src/JavaUtilities.h	2009-02-21 01:10:30 UTC (rev 5915)
@@ -22,7 +22,7 @@
 #include <string>
 #include <jni.h>
 
-void throwException(JNIEnv * env,const char * clazz, const char * message);
+void throwException(JNIEnv * env, const int code, const char * message);
 std::string convertJavaString(JNIEnv * env, jstring& jstr);
 
 #endif /*JAVAUTILITIES_H_*/

Modified: trunk/native/src/LibAIOController.cpp
===================================================================
--- trunk/native/src/LibAIOController.cpp	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/native/src/LibAIOController.cpp	2009-02-21 01:10:30 UTC (rev 5915)
@@ -75,7 +75,7 @@
 		{
 			delete controller;
 		}
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 		return 0;
 	}
 }
@@ -90,13 +90,13 @@
 		
 		if (buffer == 0)
 		{
-			throwException(env, "java/lang/IllegalStateException", "Invalid Direct Buffer used");
+			throwException(env, NATIVE_ERROR_INVALID_BUFFER, "Invalid Direct Buffer used");
 			return;
 		}
 		
 		if (((long)buffer) % 512)
 		{
-			throwException(env, "java/lang/IllegalStateException", "Buffer not aligned for use with DMA");
+			throwException(env, NATIVE_ERROR_NOT_ALIGNED, "Buffer not aligned for use with DMA");
 			return;
 		}
 		
@@ -106,7 +106,7 @@
 	}
 	catch (AIOException& e)
 	{
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 	}
 }
 
@@ -117,7 +117,7 @@
 	
 	if (buffer == 0)
 	{
-		throwException(env, "java/lang/IllegalStateException", "Invalid Direct Buffer used");
+		throwException(env, NATIVE_ERROR_INVALID_BUFFER, "Invalid Direct Buffer used");
 		return;
 	}
 	
@@ -136,7 +136,7 @@
 		void * buffer = env->GetDirectBufferAddress(jbuffer);
 		if (buffer == 0)
 		{
-			throwException(env, "java/lang/IllegalStateException", "Invalid Direct Buffer used");
+			throwException(env, NATIVE_ERROR_INVALID_BUFFER, "Invalid Direct Buffer used");
 			return;
 		}
 		
@@ -146,7 +146,7 @@
 	}
 	catch (AIOException& e)
 	{
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 	}
 }
 
@@ -162,7 +162,7 @@
 	}
 	catch (AIOException& e)
 	{
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 	}
 }
 
@@ -176,7 +176,7 @@
 	}
 	catch (AIOException& e)
 	{
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 	}
 }
 
@@ -194,7 +194,7 @@
 	}
 	catch (AIOException& e)
 	{
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 	}
 }
 
@@ -211,7 +211,7 @@
 	}
 	catch (AIOException& e)
 	{
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 	}
 }
 
@@ -236,14 +236,14 @@
 		long size = controller->fileOutput.getSize();
 		if (size < 0)
 		{
-			throwException(env, "java/lang/RuntimeException", "native method size failed");
+			throwException(env, NATIVE_ERROR_INTERNAL, "InternalError on Native Layer: method size failed");
 			return -1l;
 		}
 		return size;
 	}
 	catch (AIOException& e)
 	{
-		throwException(env, "java/lang/RuntimeException", e.what());
+		throwException(env, e.getErrorCode(), e.what());
 		return -1l;
 	}
 	

Modified: trunk/native/src/Version.h
===================================================================
--- trunk/native/src/Version.h	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/native/src/Version.h	2009-02-21 01:10:30 UTC (rev 5915)
@@ -1,5 +1,5 @@
 
 #ifndef _VERSION_NATIVE_AIO
-#define _VERSION_NATIVE_AIO 16
+#define _VERSION_NATIVE_AIO 17
 #endif
 

Modified: trunk/src/main/org/jboss/messaging/core/asyncio/AsynchronousFile.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/asyncio/AsynchronousFile.java	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/src/main/org/jboss/messaging/core/asyncio/AsynchronousFile.java	2009-02-21 01:10:30 UTC (rev 5915)
@@ -24,6 +24,8 @@
 
 import java.nio.ByteBuffer;
 
+import org.jboss.messaging.core.exception.MessagingException;
+
 /**
  * 
  * @author clebert.suconic at jboss.com
@@ -43,14 +45,15 @@
 
    /** 
     * Warning: This function will perform a synchronous IO, probably translating to a fstat call
+    * @throws MessagingException 
     * */
-   long size();
+   long size() throws MessagingException;
 
-   void write(long position, long size, ByteBuffer directByteBuffer, AIOCallback aioPackage);
+   void write(long position, long size, ByteBuffer directByteBuffer, AIOCallback aioPackage) throws MessagingException;
 
-   void read(long position, long size, ByteBuffer directByteBuffer, AIOCallback aioPackage);
+   void read(long position, long size, ByteBuffer directByteBuffer, AIOCallback aioPackage) throws MessagingException;
 
-   void fill(long position, int blocks, long size, byte fillChar);
+   void fill(long position, int blocks, long size, byte fillChar) throws MessagingException;
 
    ByteBuffer newBuffer(int size);
 

Modified: trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/src/main/org/jboss/messaging/core/asyncio/impl/AsynchronousFileImpl.java	2009-02-21 01:10:30 UTC (rev 5915)
@@ -32,6 +32,7 @@
 import org.jboss.messaging.core.asyncio.AIOCallback;
 import org.jboss.messaging.core.asyncio.AsynchronousFile;
 import org.jboss.messaging.core.asyncio.BufferCallback;
+import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 
 /**
@@ -53,7 +54,7 @@
 
    private static boolean loaded = false;
 
-   private static int EXPECTED_NATIVE_VERSION = 16;
+   private static int EXPECTED_NATIVE_VERSION = 17;
 
    static void addMax(final int io)
    {
@@ -209,7 +210,7 @@
    public void write(final long position,
                      final long size,
                      final ByteBuffer directByteBuffer,
-                     final AIOCallback aioPackage)
+                     final AIOCallback aioPackage) throws MessagingException
    {
       checkOpened();
       if (poller == null)
@@ -221,8 +222,15 @@
       {
          write(handler, position, size, directByteBuffer, aioPackage);
       }
+      catch (MessagingException e)
+      {
+         // Release only if an exception happened
+         writeSemaphore.release();
+         throw e;
+      }
       catch (RuntimeException e)
       {
+         // Release only if an exception happened
          writeSemaphore.release();
          throw e;
       }
@@ -232,7 +240,7 @@
    public void read(final long position,
                     final long size,
                     final ByteBuffer directByteBuffer,
-                    final AIOCallback aioPackage)
+                    final AIOCallback aioPackage) throws MessagingException
    {
       checkOpened();
       if (poller == null)
@@ -244,20 +252,27 @@
       {
          read(handler, position, size, directByteBuffer, aioPackage);
       }
+      catch (MessagingException e)
+      {
+         // Release only if an exception happened
+         writeSemaphore.release();
+         throw e;
+      }
       catch (RuntimeException e)
       {
+         // Release only if an exception happened
          writeSemaphore.release();
          throw e;
       }
    }
 
-   public long size()
+   public long size() throws MessagingException
    {
       checkOpened();
       return size0(handler);
    }
 
-   public void fill(final long position, final int blocks, final long size, final byte fillChar)
+   public void fill(final long position, final int blocks, final long size, final byte fillChar) throws MessagingException
    {
       checkOpened();
       fill(handler, position, blocks, size, fillChar);
@@ -295,7 +310,7 @@
    /** The JNI layer will call this method, so we could use it to unlock readWriteLocks held in the java layer */
    @SuppressWarnings("unused")
    // Called by the JNI layer.. just ignore the
-                                 // warning
+   // warning
    private void callbackDone(final AIOCallback callback, final ByteBuffer buffer)
    {
       writeSemaphore.release();
@@ -308,7 +323,7 @@
 
    @SuppressWarnings("unused")
    // Called by the JNI layer.. just ignore the
-                                 // warning
+   // warning
    private void callbackError(final AIOCallback callback, final int errorCode, final String errorMessage)
    {
       log.warn("CallbackError: " + errorMessage);
@@ -366,17 +381,17 @@
 
    private static native long init(String fileName, int maxIO, Logger logger);
 
-   private native long size0(long handle);
+   private native long size0(long handle) throws MessagingException;
 
-   private native void write(long handle, long position, long size, ByteBuffer buffer, AIOCallback aioPackage);
+   private native void write(long handle, long position, long size, ByteBuffer buffer, AIOCallback aioPackage) throws MessagingException;
 
-   private native void read(long handle, long position, long size, ByteBuffer buffer, AIOCallback aioPackage);
+   private native void read(long handle, long position, long size, ByteBuffer buffer, AIOCallback aioPackage) throws MessagingException;
 
-   private static native void fill(long handle, long position, int blocks, long size, byte fillChar);
+   private static native void fill(long handle, long position, int blocks, long size, byte fillChar) throws MessagingException;
 
-   private static native void closeInternal(long handler);
+   private static native void closeInternal(long handler) throws MessagingException;
 
-   private static native void stopPoller(long handler);
+   private static native void stopPoller(long handler) throws MessagingException;
 
    /** A native method that does nothing, and just validate if the ELF dependencies are loaded and on the correct platform as this binary format */
    private static native int getNativeVersion();

Modified: trunk/src/main/org/jboss/messaging/core/exception/MessagingException.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/exception/MessagingException.java	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/src/main/org/jboss/messaging/core/exception/MessagingException.java	2009-02-21 01:10:30 UTC (rev 5915)
@@ -18,7 +18,7 @@
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
+ */
 
 package org.jboss.messaging.core.exception;
 
@@ -32,70 +32,96 @@
 public class MessagingException extends Exception
 {
    private static final long serialVersionUID = -4802014152804997417L;
-   
+
    // Error codes -------------------------------------------------
-            
+
    public static final int INTERNAL_ERROR = 000;
-   
+
    public static final int UNSUPPORTED_PACKET = 001;
-   
+
    public static final int NOT_CONNECTED = 002;
-   
+
    public static final int CONNECTION_TIMEDOUT = 003;
-   
+
    public static final int INTERRUPTED = 004;
 
-   
    public static final int QUEUE_DOES_NOT_EXIST = 100;
-   
+
    public static final int QUEUE_EXISTS = 101;
-   
+
    public static final int OBJECT_CLOSED = 102;
-   
+
    public static final int INVALID_FILTER_EXPRESSION = 103;
-   
+
    public static final int ILLEGAL_STATE = 104;
-   
+
    public static final int SECURITY_EXCEPTION = 105;
-   
+
    public static final int ADDRESS_DOES_NOT_EXIST = 106;
-   
+
    public static final int ADDRESS_EXISTS = 107;
 
    public static final int INCOMPATIBLE_CLIENT_SERVER_VERSIONS = 108;
-   
+
    public static final int SESSION_EXISTS = 109;
+
    
+   // Native Error codes ----------------------------------------------
+   
+   public static final int NATIVE_ERROR_INTERNAL = 200;
+
+   public static final int NATIVE_ERROR_INVALID_BUFFER = 201;
+
+   public static final int NATIVE_ERROR_NOT_ALIGNED = 202;
+
+   public static final int NATIVE_ERROR_CANT_INITIALIZE_AIO = 203;
+
+   public static final int NATIVE_ERROR_CANT_RELEASE_AIO = 204;
+
+   public static final int NATIVE_ERROR_CANT_OPEN_CLOSE_FILE = 205;
+
+   public static final int NATIVE_ERROR_CANT_ALLOCATE_QUEUE = 206;
+
+   public static final int NATIVE_ERROR_PREALLOCATE_FILE = 208;
+
+   public static final int NATIVE_ERROR_ALLOCATE_MEMORY = 209;
+
+   public static final int NATIVE_ERROR_IO = 210;
+
+   public static final int NATIVE_ERROR_AIO_FULL = 211;
+   
+   
+
    private int code;
-   
+
    public MessagingException()
-   {      
+   {
    }
-   
+
    public MessagingException(int code)
    {
       this.code = code;
    }
-   
+
    public MessagingException(int code, String msg)
    {
       super(msg);
-      
+
       this.code = code;
    }
-   
+
    public MessagingException(int code, String msg, Throwable cause)
    {
       super(msg, cause);
-      
+
       this.code = code;
    }
-   
+
    public int getCode()
    {
       return code;
    }
-   
+
    public String toString()
    {
       return "MessagingException[errorCode=" + code + " message=" + getMessage() + "]";

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/AIOTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/AIOTestBase.java	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/AIOTestBase.java	2009-02-21 01:10:30 UTC (rev 5915)
@@ -29,6 +29,7 @@
 
 import org.jboss.messaging.core.asyncio.AIOCallback;
 import org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl;
+import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
 /**
@@ -83,7 +84,7 @@
 
    }
 
-   protected void preAlloc(final AsynchronousFileImpl controller, final long size)
+   protected void preAlloc(final AsynchronousFileImpl controller, final long size) throws MessagingException
    {
       controller.fill(0l, 1, size, (byte)0);
    }

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/SingleThreadWriteNativeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/SingleThreadWriteNativeTest.java	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/asyncio/SingleThreadWriteNativeTest.java	2009-02-21 01:10:30 UTC (rev 5915)
@@ -33,6 +33,7 @@
 import org.jboss.messaging.core.asyncio.AIOCallback;
 import org.jboss.messaging.core.asyncio.BufferCallback;
 import org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl;
+import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 
 /**
@@ -312,7 +313,7 @@
 
             fail("An exception was supposed to be thrown");
          }
-         catch (Exception ignored)
+         catch (MessagingException ignored)
          {
          }
 
@@ -340,7 +341,7 @@
          {
             controller.close();
          }
-         catch (Throwable ignored)
+         catch (MessagingException ignored)
          {
          }
 

Modified: trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java	2009-02-20 22:49:21 UTC (rev 5914)
+++ trunk/tests/src/org/jboss/messaging/tests/timing/util/UTF8Test.java	2009-02-21 01:10:30 UTC (rev 5915)
@@ -30,16 +30,10 @@
 public class UTF8Test extends TestCase
 {
 
-   private final String str = "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5" + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"
-                              + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"
-                              + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"
-                              + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"
-                              + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"
-                              + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"
-                              + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"
-                              + "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5";
+   private final String str = "This is a standard size string";
 
    final int TIMES = 5;
+
    final long numberOfIteractions = 1000000;
 
    // Attributes ----------------------------------------------------
@@ -50,7 +44,6 @@
 
    // Public --------------------------------------------------------
 
-
    public void testValidateUTF() throws Exception
    {
       ChannelBufferWrapper buffer = new ChannelBufferWrapper(10 * 1024);




More information about the jboss-cvs-commits mailing list