You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jt...@apache.org on 2002/02/16 23:26:08 UTC
cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/utils/locking ReadWriteLock.java
jtaylor 02/02/16 14:26:08
Modified: src/java/org/apache/stratum/jcs/utils/locking
ReadWriteLock.java
Log:
Removed waiting for console input in error condition (if debug enabled)
from ReadWriteLock. More could be done, but it might be better to make
this a wrapper to FIFOReadWriteLock from util.concurrent. Thoughts?
Revision Changes Path
1.2 +5 -17 jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/utils/locking/ReadWriteLock.java
Index: ReadWriteLock.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/utils/locking/ReadWriteLock.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReadWriteLock.java 16 Feb 2002 19:06:35 -0000 1.1
+++ ReadWriteLock.java 16 Feb 2002 22:26:08 -0000 1.2
@@ -189,30 +189,18 @@
writeLockedThread = null;
if ( waitingForReadLock > 0 )
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "writeLock released and notify all read lock waiting threads." );
- }
+ log.debug( "writeLock released, notified waiting readers" );
+
notifyAll();
}
- else if ( log.isDebugEnabled() )
+ else
{
- log.debug( "writeLock released without fuss." );
+ log.debug( "writeLock released, no readers waiting" );
}
}
return;
}
- //////////////// debug MUST BE SET TO false in production! ///////////////////
- if ( log.isDebugEnabled() )
- {
- try
- {
- System.in.read();
- }
- catch ( java.io.IOException ignore )
- {
- }
- }
+
throw new IllegalStateException( "Thread does not have lock" );
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/utils/locking ReadWriteLock.java
Posted by Aaron Smuts <aa...@verizon.net>.
The locking needs to be re-examined. It is mainly used for the group
cache where a list of items needs to be maintained. I had it working
nicely, then sort of screwed it up, then sort of fixed it . . . It
shouldn't deadlock, but there might be a few cases where we could have
concurrency issues.
Also, I was trying to sue a hashmap instead of a hashtable and apply a
very fine grained locking.
Another performance sensitive area. . .
Take a look.
Aaron
> -----Original Message-----
> From: jtaylor@apache.org [mailto:jtaylor@apache.org]
> Sent: Saturday, February 16, 2002 5:26 PM
> To: jakarta-turbine-stratum-cvs@apache.org
> Subject: cvs commit: jakarta-turbine-
> stratum/src/java/org/apache/stratum/jcs/utils/locking
ReadWriteLock.java
>
> jtaylor 02/02/16 14:26:08
>
> Modified: src/java/org/apache/stratum/jcs/utils/locking
> ReadWriteLock.java
> Log:
> Removed waiting for console input in error condition (if debug
enabled)
> from ReadWriteLock. More could be done, but it might be better to
make
> this a wrapper to FIFOReadWriteLock from util.concurrent. Thoughts?
>
> Revision Changes Path
> 1.2 +5 -17 jakarta-turbine-
>
stratum/src/java/org/apache/stratum/jcs/utils/locking/ReadWriteLock.java
>
> Index: ReadWriteLock.java
> ===================================================================
> RCS file: /home/cvs/jakarta-turbine-
>
stratum/src/java/org/apache/stratum/jcs/utils/locking/ReadWriteLock.java
,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- ReadWriteLock.java 16 Feb 2002 19:06:35 -0000 1.1
> +++ ReadWriteLock.java 16 Feb 2002 22:26:08 -0000 1.2
> @@ -189,30 +189,18 @@
> writeLockedThread = null;
> if ( waitingForReadLock > 0 )
> {
> - if ( log.isDebugEnabled() )
> - {
> - log.debug( "writeLock released and notify
all
> read lock waiting threads." );
> - }
> + log.debug( "writeLock released, notified
waiting
> readers" );
> +
> notifyAll();
> }
> - else if ( log.isDebugEnabled() )
> + else
> {
> - log.debug( "writeLock released without fuss."
);
> + log.debug( "writeLock released, no readers
waiting"
> );
> }
> }
> return;
> }
> - //////////////// debug MUST BE SET TO false in production!
> ///////////////////
> - if ( log.isDebugEnabled() )
> - {
> - try
> - {
> - System.in.read();
> - }
> - catch ( java.io.IOException ignore )
> - {
> - }
> - }
> +
> throw new IllegalStateException( "Thread does not have
lock" );
> }
> }
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:turbine-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-dev-
> help@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>