Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-1163

RefCountingMap is not thread-safe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • metrics
    • None

    Description

      • The refCount field in RefCountingMap.Payload is not thread-safe.
        //RefCountingMap.Payload
            private int refCount;
        
      • Also, there are a few javac warnings in ratis-metrics.
        [WARNING] /Users/tszwosze/ratis/apache-ratis/ratis-metrics/src/main/java/org/apache/ratis/metrics/impl/RefCountingMap.java:[51,15] [unchecked] unchecked call to Payload(V) as a member of the raw type Payload
          where V is a type-variable:
            V extends Object declared in class Payload
        [WARNING] /Users/tszwosze/ratis/apache-ratis/ratis-metrics/src/main/java/org/apache/ratis/metrics/impl/RefCountingMap.java:[46,35] [unchecked] unchecked method invocation: method compute in class ConcurrentHashMap is applied to given types
          required: K#1,BiFunction<? super K#1,? super V#1,? extends V#1>
          found: K#2,BiFunction<K#2,Payload<V#2>,Payload<V#2>>
          where K#1,V#1,K#2,V#2 are type-variables:
            K#1 extends Object declared in class ConcurrentHashMap
            V#1 extends Object declared in class ConcurrentHashMap
            K#2 extends Object declared in class RefCountingMap
            V#2 extends Object declared in class RefCountingMap
        [WARNING] /Users/tszwosze/ratis/apache-ratis/ratis-metrics/src/main/java/org/apache/ratis/metrics/impl/RefCountingMap.java:[46,35] [unchecked] unchecked cast
          required: Payload<V>
          found:    Payload
          where V is a type-variable:
            V extends Object declared in class RefCountingMap
        [WARNING] /Users/tszwosze/ratis/apache-ratis/ratis-metrics/src/main/java/org/apache/ratis/metrics/MetricRegistriesLoader.java:[68,81] [unchecked] unchecked cast
          required: Class<MetricRegistries>
          found:    Class<CAP#1>
          where CAP#1 is a fresh type-variable:
            CAP#1 extends Object from capture of ?
        [INFO] 
        

      Attachments

        Issue Links

          Activity

            People

              szetszwo Tsz-wo Sze
              szetszwo Tsz-wo Sze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m