CVS update: JGroups/src/org/jgroups/util CreditMap.java
"Bela Ban" <[email protected]>
| Newsgroups | gmane.comp.java.javagroups.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: belaban
Date: 10/09/13 09:27:04
Modified: src/org/jgroups/util CreditMap.java
Log:
ns
Revision Changes Path
1.11 +8 -9 JGroups/src/org/jgroups/util/CreditMap.java
Index: CreditMap.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/util/CreditMap.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- CreditMap.java 10 Sep 2010 10:53:32 -0000 1.10
+++ CreditMap.java 13 Sep 2010 09:27:04 -0000 1.11
@@ -12,7 +12,7 @@
/**
* Maintains credits for senders, when credits fall below 0, a sender blocks until new credits have been received.
* @author Bela Ban
- * @version $Id: CreditMap.java,v 1.10 2010/09/10 10:53:32 belaban Exp $
+ * @version $Id: CreditMap.java,v 1.11 2010/09/13 09:27:04 belaban Exp $
*/
public class CreditMap {
protected final long max_credits;
@@ -153,19 +153,18 @@
if(timeout <= 0)
return false;
+ long start=System.currentTimeMillis();
try {
- num_blockings++;
- long start=System.currentTimeMillis();
credits_available.await(timeout, TimeUnit.MILLISECONDS);
- long diff=System.currentTimeMillis() - start;
- if(diff > 0)
- total_block_time+=diff;
- if(decrement(credits))
- return true;
}
catch(InterruptedException e) {
}
- return false;
+ finally {
+ total_block_time+=System.currentTimeMillis() - start;
+ num_blockings++;
+ }
+
+ return decrement(credits);
}
finally {
lock.unlock();
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev