Author: clebert.suconic(a)jboss.com
Date: 2009-11-12 11:13:22 -0500 (Thu, 12 Nov 2009)
New Revision: 8276
Added:
trunk/src/main/org/hornetq/core/journal/IOCompletion.java
Removed:
trunk/src/main/org/hornetq/core/journal/IOCallback.java
Modified:
trunk/src/main/org/hornetq/core/asyncio/AsynchronousFile.java
trunk/src/main/org/hornetq/core/journal/SequentialFile.java
trunk/src/main/org/hornetq/core/journal/impl/AIOSequentialFile.java
trunk/src/main/org/hornetq/core/journal/impl/AbstractSequentialFile.java
trunk/src/main/org/hornetq/core/journal/impl/DummyCallback.java
trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
trunk/src/main/org/hornetq/core/journal/impl/NIOSequentialFile.java
trunk/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java
trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
trunk/src/main/org/hornetq/core/journal/impl/TimedBufferObserver.java
trunk/src/main/org/hornetq/core/journal/impl/TransactionCallback.java
trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/TimedBufferTest.java
trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
Log:
Simply renaming journal.IOCallback to IOCompletion to better distinct it from AIOCallback
Modified: trunk/src/main/org/hornetq/core/asyncio/AsynchronousFile.java
===================================================================
--- trunk/src/main/org/hornetq/core/asyncio/AsynchronousFile.java 2009-11-12 15:57:34 UTC
(rev 8275)
+++ trunk/src/main/org/hornetq/core/asyncio/AsynchronousFile.java 2009-11-12 16:13:22 UTC
(rev 8276)
@@ -30,7 +30,7 @@
*
* Note: If you are using a native Linux implementation, maxIO can't be higher
than what's defined on /proc/sys/fs/aio-max-nr, or you would get an error
* @param fileName
- * @param maxIO The number of max concurrent asynchrnous IO operations. It has to be
balanced between the size of your writes and the capacity of your disk.
+ * @param maxIO The number of max concurrent asynchronous IO operations. It has to be
balanced between the size of your writes and the capacity of your disk.
* @throws HornetQException
*/
void open(String fileName, int maxIO) throws HornetQException;
Deleted: trunk/src/main/org/hornetq/core/journal/IOCallback.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/IOCallback.java 2009-11-12 15:57:34 UTC (rev
8275)
+++ trunk/src/main/org/hornetq/core/journal/IOCallback.java 2009-11-12 16:13:22 UTC (rev
8276)
@@ -1,29 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.journal;
-
-import org.hornetq.core.asyncio.AIOCallback;
-
-/**
- *
- * This class is just a direct extension of AIOCallback.
- * Just to avoid the direct dependency of org.hornetq.core.asynciio.AIOCallback from the
journal.
- *
- * @author <a href="mailto:clebert.suconic@jboss.com">Clebert
Suconic</a>
- *
- */
-public interface IOCallback extends AIOCallback
-{
- void waitCompletion() throws Exception;
-}
Copied: trunk/src/main/org/hornetq/core/journal/IOCompletion.java (from rev 8274,
trunk/src/main/org/hornetq/core/journal/IOCallback.java)
===================================================================
--- trunk/src/main/org/hornetq/core/journal/IOCompletion.java (rev
0)
+++ trunk/src/main/org/hornetq/core/journal/IOCompletion.java 2009-11-12 16:13:22 UTC (rev
8276)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.journal;
+
+import org.hornetq.core.asyncio.AIOCallback;
+
+/**
+ *
+ * This class is just a direct extension of AIOCallback.
+ * Just to avoid the direct dependency of org.hornetq.core.asynciio.AIOCallback from the
journal.
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.com">Clebert
Suconic</a>
+ *
+ */
+public interface IOCompletion extends AIOCallback
+{
+ void waitCompletion() throws Exception;
+}
Modified: trunk/src/main/org/hornetq/core/journal/SequentialFile.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/SequentialFile.java 2009-11-12 15:57:34 UTC
(rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/SequentialFile.java 2009-11-12 16:13:22 UTC
(rev 8276)
@@ -56,17 +56,17 @@
void delete() throws Exception;
- void write(HornetQBuffer bytes, boolean sync, IOCallback callback) throws Exception;
+ void write(HornetQBuffer bytes, boolean sync, IOCompletion callback) throws
Exception;
void write(HornetQBuffer bytes, boolean sync) throws Exception;
/** Write directly to the file without using any buffer */
- void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback);
+ void writeDirect(ByteBuffer bytes, boolean sync, IOCompletion callback);
/** Write directly to the file without using any buffer */
void writeDirect(ByteBuffer bytes, boolean sync) throws Exception;
- int read(ByteBuffer bytes, IOCallback callback) throws Exception;
+ int read(ByteBuffer bytes, IOCompletion callback) throws Exception;
int read(ByteBuffer bytes) throws Exception;
Modified: trunk/src/main/org/hornetq/core/journal/impl/AIOSequentialFile.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/AIOSequentialFile.java 2009-11-12
15:57:34 UTC (rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/AIOSequentialFile.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -25,7 +25,7 @@
import org.hornetq.core.asyncio.AsynchronousFile;
import org.hornetq.core.asyncio.BufferCallback;
import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.logging.Logger;
@@ -214,7 +214,7 @@
aioFile.setBufferCallback(callback);
}
- public int read(final ByteBuffer bytes, final IOCallback callback) throws Exception
+ public int read(final ByteBuffer bytes, final IOCompletion callback) throws Exception
{
int bytesToRead = bytes.limit();
@@ -229,7 +229,7 @@
public int read(final ByteBuffer bytes) throws Exception
{
- IOCallback waitCompletion = SimpleWaitIOCallback.getInstance();
+ IOCompletion waitCompletion = SimpleWaitIOCallback.getInstance();
int bytesRead = read(bytes, waitCompletion);
@@ -281,7 +281,7 @@
{
if (sync)
{
- IOCallback completion = SimpleWaitIOCallback.getInstance();
+ IOCompletion completion = SimpleWaitIOCallback.getInstance();
writeDirect(bytes, true, completion);
@@ -298,7 +298,7 @@
*
* @param sync Not used on AIO
* */
- public void writeDirect(final ByteBuffer bytes, final boolean sync, IOCallback
callback)
+ public void writeDirect(final ByteBuffer bytes, final boolean sync, IOCompletion
callback)
{
final int bytesToWrite = factory.calculateBlockSize(bytes.limit());
Modified: trunk/src/main/org/hornetq/core/journal/impl/AbstractSequentialFile.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/AbstractSequentialFile.java 2009-11-12
15:57:34 UTC (rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/AbstractSequentialFile.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -18,7 +18,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.logging.Logger;
@@ -166,7 +166,7 @@
}
- public void write(final HornetQBuffer bytes, final boolean sync, final IOCallback
callback) throws Exception
+ public void write(final HornetQBuffer bytes, final boolean sync, final IOCompletion
callback) throws Exception
{
if (timedBuffer != null)
{
@@ -185,7 +185,7 @@
{
if (sync)
{
- IOCallback completion = SimpleWaitIOCallback.getInstance();
+ IOCompletion completion = SimpleWaitIOCallback.getInstance();
write(bytes, true, completion);
@@ -213,18 +213,18 @@
// Inner classes -------------------------------------------------
- protected static class DelegateCallback implements IOCallback
+ protected static class DelegateCallback implements IOCompletion
{
- final List<IOCallback> delegates;
+ final List<IOCompletion> delegates;
- DelegateCallback(List<IOCallback> delegates)
+ DelegateCallback(List<IOCompletion> delegates)
{
this.delegates = delegates;
}
public void done()
{
- for (IOCallback callback : delegates)
+ for (IOCompletion callback : delegates)
{
try
{
@@ -239,7 +239,7 @@
public void onError(int errorCode, String errorMessage)
{
- for (IOCallback callback : delegates)
+ for (IOCompletion callback : delegates)
{
try
{
@@ -259,7 +259,7 @@
protected class LocalBufferObserver implements TimedBufferObserver
{
- public void flushBuffer(ByteBuffer buffer, List<IOCallback> callbacks)
+ public void flushBuffer(ByteBuffer buffer, List<IOCompletion> callbacks)
{
buffer.flip();
Modified: trunk/src/main/org/hornetq/core/journal/impl/DummyCallback.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/DummyCallback.java 2009-11-12 15:57:34
UTC (rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/DummyCallback.java 2009-11-12 16:13:22
UTC (rev 8276)
@@ -14,7 +14,7 @@
package org.hornetq.core.journal.impl;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.logging.Logger;
/**
@@ -24,13 +24,13 @@
*
*
*/
-public class DummyCallback implements IOCallback
+public class DummyCallback implements IOCompletion
{
private static DummyCallback instance = new DummyCallback();
private static final Logger log = Logger.getLogger(SimpleWaitIOCallback.class);
- public static IOCallback getInstance()
+ public static IOCompletion getInstance()
{
return instance;
}
Modified: trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2009-11-12 15:57:34 UTC
(rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2009-11-12 16:13:22 UTC
(rev 8276)
@@ -44,7 +44,7 @@
import org.hornetq.core.buffers.ChannelBuffer;
import org.hornetq.core.buffers.ChannelBuffers;
import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.journal.JournalLoadInformation;
import org.hornetq.core.journal.LoaderCallback;
import org.hornetq.core.journal.PreparedTransactionInfo;
@@ -852,7 +852,7 @@
throw new IllegalStateException("Journal must be loaded first");
}
- IOCallback callback = null;
+ IOCompletion callback = null;
compactingLock.readLock().lock();
@@ -901,7 +901,7 @@
throw new IllegalStateException("Journal must be loaded first");
}
- IOCallback callback = null;
+ IOCompletion callback = null;
compactingLock.readLock().lock();
@@ -967,7 +967,7 @@
compactingLock.readLock().lock();
- IOCallback callback = null;
+ IOCompletion callback = null;
try
{
@@ -2833,7 +2833,7 @@
final boolean completeTransaction,
final boolean sync,
final JournalTransaction tx,
- IOCallback callback) throws Exception
+ IOCompletion callback) throws Exception
{
try
{
@@ -3233,7 +3233,7 @@
return tx;
}
- private IOCallback getSyncCallback(final boolean sync)
+ private IOCompletion getSyncCallback(final boolean sync)
{
if (fileFactory.isSupportsCallbacks())
{
Modified: trunk/src/main/org/hornetq/core/journal/impl/NIOSequentialFile.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/NIOSequentialFile.java 2009-11-12
15:57:34 UTC (rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/NIOSequentialFile.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -19,7 +19,7 @@
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.logging.Logger;
@@ -133,7 +133,7 @@
return read(bytes, null);
}
- public int read(final ByteBuffer bytes, final IOCallback callback) throws Exception
+ public int read(final ByteBuffer bytes, final IOCompletion callback) throws Exception
{
try
{
@@ -197,7 +197,7 @@
return new NIOSequentialFile(factory, getFile());
}
- public void writeDirect(final ByteBuffer bytes, final boolean sync, final IOCallback
callback)
+ public void writeDirect(final ByteBuffer bytes, final boolean sync, final IOCompletion
callback)
{
if (callback == null)
{
@@ -226,7 +226,7 @@
* @throws IOException
* @throws Exception
*/
- private void internalWrite(final ByteBuffer bytes, final boolean sync, final
IOCallback callback) throws Exception
+ private void internalWrite(final ByteBuffer bytes, final boolean sync, final
IOCompletion callback) throws Exception
{
position.addAndGet(bytes.limit());
Modified: trunk/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java 2009-11-12
15:57:34 UTC (rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -16,7 +16,7 @@
import java.util.concurrent.CountDownLatch;
import org.hornetq.core.exception.HornetQException;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.logging.Logger;
/**
@@ -26,7 +26,7 @@
*
*
*/
-public class SimpleWaitIOCallback implements IOCallback
+public class SimpleWaitIOCallback implements IOCompletion
{
private static final Logger log = Logger.getLogger(SimpleWaitIOCallback.class);
@@ -37,7 +37,7 @@
private volatile int errorCode = 0;
- public static IOCallback getInstance()
+ public static IOCompletion getInstance()
{
return new SimpleWaitIOCallback();
}
Modified: trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java 2009-11-12 15:57:34 UTC
(rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java 2009-11-12 16:13:22 UTC
(rev 8276)
@@ -22,7 +22,7 @@
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.hornetq.core.buffers.ChannelBuffers;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.spi.HornetQBuffer;
import org.hornetq.utils.VariableLatch;
@@ -56,7 +56,7 @@
private int bufferLimit = 0;
- private List<IOCallback> callbacks;
+ private List<IOCompletion> callbacks;
private final Lock lock = new ReentrantReadWriteLock().writeLock();
@@ -106,7 +106,7 @@
buffer.clear();
bufferLimit = 0;
- callbacks = new ArrayList<IOCallback>();
+ callbacks = new ArrayList<IOCompletion>();
this.flushOnSync = flushOnSync;
latchTimer.up();
this.timeout = timeout;
@@ -225,7 +225,7 @@
}
}
- public synchronized void addBytes(final byte[] bytes, final boolean sync, final
IOCallback callback)
+ public synchronized void addBytes(final byte[] bytes, final boolean sync, final
IOCompletion callback)
{
if (buffer.writerIndex() == 0)
{
@@ -283,7 +283,7 @@
bufferObserver.flushBuffer(directBuffer, callbacks);
- callbacks = new ArrayList<IOCallback>();
+ callbacks = new ArrayList<IOCompletion>();
active = false;
pendingSync = false;
Modified: trunk/src/main/org/hornetq/core/journal/impl/TimedBufferObserver.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/TimedBufferObserver.java 2009-11-12
15:57:34 UTC (rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/TimedBufferObserver.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -17,7 +17,7 @@
import java.nio.ByteBuffer;
import java.util.List;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
/**
* A TimedBufferObserver
@@ -39,7 +39,7 @@
// Public --------------------------------------------------------
- public void flushBuffer(ByteBuffer buffer, List<IOCallback> callbacks);
+ public void flushBuffer(ByteBuffer buffer, List<IOCompletion> callbacks);
/** Return the number of remaining bytes that still fit on the observer (file) */
Modified: trunk/src/main/org/hornetq/core/journal/impl/TransactionCallback.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/TransactionCallback.java 2009-11-12
15:57:34 UTC (rev 8275)
+++ trunk/src/main/org/hornetq/core/journal/impl/TransactionCallback.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -14,7 +14,7 @@
package org.hornetq.core.journal.impl;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.utils.VariableLatch;
/**
@@ -24,7 +24,7 @@
*
*
*/
-public class TransactionCallback implements IOCallback
+public class TransactionCallback implements IOCompletion
{
private final VariableLatch countLatch = new VariableLatch();
Modified: trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/TimedBufferTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/TimedBufferTest.java 2009-11-12
15:57:34 UTC (rev 8275)
+++
trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/TimedBufferTest.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -18,7 +18,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.journal.impl.TimedBuffer;
import org.hornetq.core.journal.impl.TimedBufferObserver;
import org.hornetq.tests.util.UnitTestCase;
@@ -42,7 +42,7 @@
// Public --------------------------------------------------------
- IOCallback dummyCallback = new IOCallback()
+ IOCompletion dummyCallback = new IOCompletion()
{
public void done()
@@ -64,7 +64,7 @@
final AtomicInteger flushTimes = new AtomicInteger(0);
class TestObserver implements TimedBufferObserver
{
- public void flushBuffer(final ByteBuffer buffer, final List<IOCallback>
callbacks)
+ public void flushBuffer(final ByteBuffer buffer, final List<IOCompletion>
callbacks)
{
buffers.add(buffer);
flushTimes.incrementAndGet();
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java 2009-11-12
15:57:34 UTC (rev 8275)
+++
trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java 2009-11-12
16:13:22 UTC (rev 8276)
@@ -20,7 +20,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.hornetq.core.asyncio.BufferCallback;
-import org.hornetq.core.journal.IOCallback;
+import org.hornetq.core.journal.IOCompletion;
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.journal.SequentialFileFactory;
import org.hornetq.core.journal.impl.TimedBuffer;
@@ -241,11 +241,11 @@
final ByteBuffer bytes;
- final IOCallback callback;
+ final IOCompletion callback;
volatile boolean sendError;
- CallbackRunnable(final FakeSequentialFile file, final ByteBuffer bytes, final
IOCallback callback)
+ CallbackRunnable(final FakeSequentialFile file, final ByteBuffer bytes, final
IOCompletion callback)
{
this.file = file;
this.bytes = bytes;
@@ -399,7 +399,7 @@
return read(bytes, null);
}
- public int read(final ByteBuffer bytes, final IOCallback callback) throws
Exception
+ public int read(final ByteBuffer bytes, final IOCompletion callback) throws
Exception
{
if (!open)
{
@@ -439,7 +439,7 @@
return data.position();
}
- public synchronized void writeDirect(final ByteBuffer bytes, final boolean sync,
final IOCallback callback)
+ public synchronized void writeDirect(final ByteBuffer bytes, final boolean sync,
final IOCompletion callback)
{
if (!open)
{
@@ -605,7 +605,7 @@
/* (non-Javadoc)
* @see
org.hornetq.core.journal.SequentialFile#write(org.hornetq.core.remoting.spi.HornetQBuffer,
boolean, org.hornetq.core.journal.IOCallback)
*/
- public void write(HornetQBuffer bytes, boolean sync, IOCallback callback) throws
Exception
+ public void write(HornetQBuffer bytes, boolean sync, IOCompletion callback) throws
Exception
{
writeDirect(ByteBuffer.wrap(bytes.array()), sync, callback);