[hornetq-commits] JBoss hornetq SVN: r8955 - trunk/src/main/org/hornetq/core/journal/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Mar 24 10:36:10 EDT 2010
Author: timfox
Date: 2010-03-24 10:36:08 -0400 (Wed, 24 Mar 2010)
New Revision: 8955
Modified:
trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
Log:
some sanity checking on TimedBuffer to prevent it being used when not started
Modified: trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java 2010-03-24 13:54:59 UTC (rev 8954)
+++ trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java 2010-03-24 14:36:08 UTC (rev 8955)
@@ -20,7 +20,6 @@
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Semaphore;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import org.hornetq.api.core.HornetQBuffer;
@@ -203,6 +202,11 @@
*/
public synchronized boolean checkSize(final int sizeChecked)
{
+ if (!started)
+ {
+ throw new IllegalStateException("TimedBuffer is not started");
+ }
+
if (sizeChecked > bufferSize)
{
throw new IllegalStateException("Can't write records bigger than the bufferSize(" + bufferSize +
@@ -250,6 +254,11 @@
public synchronized void addBytes(final EncodingSupport bytes, final boolean sync, final IOAsyncTask callback)
{
+ if (!started)
+ {
+ throw new IllegalStateException("TimedBuffer is not started");
+ }
+
delayFlush = false;
bytes.encode(buffer);
@@ -292,6 +301,11 @@
{
synchronized (this)
{
+ if (!started)
+ {
+ throw new IllegalStateException("TimedBuffer is not started");
+ }
+
if ((force || !delayFlush) && buffer.writerIndex() > 0)
{
int pos = buffer.writerIndex();
More information about the hornetq-commits
mailing list