ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/ConcurrentHashMapV8.java
(Generate patch)

Comparing jsr166/src/jsr166e/ConcurrentHashMapV8.java (file contents):
Revision 1.3 by jsr166, Tue Aug 30 07:18:46 2011 UTC vs.
Revision 1.4 by jsr166, Tue Aug 30 07:23:35 2011 UTC

# Line 339 | Line 339 | public class ConcurrentHashMapV8<K, V>
339      /* ---------------- Access and update operations -------------- */
340  
341      /** Implementation for get and containsKey **/
342 <   private final Object internalGet(Object k) {
342 >    private final Object internalGet(Object k) {
343          int h = spread(k.hashCode());
344          Node[] tab = table;
345          retry: while (tab != null) {
# Line 380 | Line 380 | public class ConcurrentHashMapV8<K, V>
380              else {
381                  boolean validated = false;
382                  boolean checkSize = false;
383 <                synchronized(e) {
383 >                synchronized (e) {
384                      Node first = e;
385                      for (;;) {
386                          Object ek, ev;
# Line 438 | Line 438 | public class ConcurrentHashMapV8<K, V>
438              else {
439                  boolean validated = false;
440                  boolean deleted = false;
441 <                synchronized(e) {
441 >                synchronized (e) {
442                      Node pred = null;
443                      Node first = e;
444                      for (;;) {
# Line 497 | Line 497 | public class ConcurrentHashMapV8<K, V>
497                  tab = grow(0);
498              else if ((e = tabAt(tab, i = (tab.length - 1) & h)) == null) {
499                  Node node = new Node(h, k, null, null);
500 <                synchronized(node) {
500 >                synchronized (node) {
501                      if (casTabAt(tab, i, null, node)) {
502                          validated = true;
503                          try {
# Line 517 | Line 517 | public class ConcurrentHashMapV8<K, V>
517                  tab = (Node[])e.key;
518              else {
519                  boolean checkSize = false;
520 <                synchronized(e) {
520 >                synchronized (e) {
521                      Node first = e;
522                      for (;;) {
523                          Object ek, ev;
# Line 586 | Line 586 | public class ConcurrentHashMapV8<K, V>
586                  }
587                  else {
588                      boolean validated = false;
589 <                    synchronized(e) {
589 >                    synchronized (e) {
590                          int idx = e.hash & mask;
591                          Node lastRun = e;
592                          for (Node p = e.next; p != null; p = p.next) {
# Line 677 | Line 677 | public class ConcurrentHashMapV8<K, V>
677       */
678      private final void internalPutAll(Map<? extends K, ? extends V> m) {
679          int s = m.size();
680 <        grow((s >= (MAXIMUM_CAPACITY >>> 1))? s : s + (s >>> 1));
680 >        grow((s >= (MAXIMUM_CAPACITY >>> 1)) ? s : s + (s >>> 1));
681          for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {
682              Object k = e.getKey();
683              Object v = e.getValue();
# Line 702 | Line 702 | public class ConcurrentHashMapV8<K, V>
702                  tab = (Node[])e.key;
703              else {
704                  boolean validated = false;
705 <                synchronized(e) {
705 >                synchronized (e) {
706                      if (tabAt(tab, i) == e) {
707                          validated = true;
708                          do {
# Line 983 | Line 983 | public class ConcurrentHashMapV8<K, V>
983       */
984      public int size() {
985          long n = counter.sum();
986 <        return n <= 0L? 0 : n >= Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)n;
986 >        return (n <= 0L) ? 0 :
987 >            (n >= Integer.MAX_VALUE) ? Integer.MAX_VALUE :
988 >            (int)n;
989      }
990  
991      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines