Author: clebert.suconic(a)jboss.com
Date: 2009-12-09 13:30:41 -0500 (Wed, 09 Dec 2009)
New Revision: 8645
Modified:
trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
Log:
remove non necessary synchronized block
Modified: trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java 2009-12-09 18:01:48 UTC
(rev 8644)
+++ trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java 2009-12-09 18:30:41 UTC
(rev 8645)
@@ -382,35 +382,26 @@
// Needs to be called within synchronized blocks on TimedBuffer
public void resumeSpin()
{
- synchronized (TimedBuffer.this)
- {
- if (!spinning)
- {
- spinning = true;
- spinLimiter.release();
- }
- }
+ spinning = true;
+ spinLimiter.release();
}
// Needs to be called within synchronized blocks on TimedBuffer
public void pauseSpin()
{
- synchronized (TimedBuffer.this)
+ if (spinning)
{
- if (spinning)
+ spinning = false;
+ try
{
- spinning = false;
- try
+ if (!spinLimiter.tryAcquire(60, TimeUnit.SECONDS))
{
- if (!spinLimiter.tryAcquire(60, TimeUnit.SECONDS))
- {
- throw new IllegalStateException("Internal error on TimedBuffer.
Can't stop spinning");
- }
+ throw new IllegalStateException("Internal error on TimedBuffer.
Can't stop spinning");
}
- catch (InterruptedException ignored)
- {
- }
}
+ catch (InterruptedException ignored)
+ {
+ }
}
}
Show replies by date