You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/02/09 18:11:22 UTC

[GitHub] [geode] mhansonp commented on a change in pull request #6007: GEODE-7864: Clean up InternalResourceManager

mhansonp commented on a change in pull request #6007:
URL: https://github.com/apache/geode/pull/6007#discussion_r573118422



##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
##########
@@ -125,99 +123,97 @@ public static InternalResourceManager createResourceManager(final InternalCache
 
   private InternalResourceManager(InternalCache cache) {
     this.cache = cache;
-    this.resourceAdvisor = (ResourceAdvisor) cache.getDistributionAdvisor();
-    this.stats = new ResourceManagerStats(cache.getDistributedSystem());
+    resourceAdvisor = (ResourceAdvisor) cache.getDistributionAdvisor();
+    stats = new ResourceManagerStats(cache.getDistributedSystem());
 
     // Create a new executor that other classes may use for handling resource
     // related tasks
-    this.scheduledExecutor = LoggingExecutors
+    scheduledExecutor = LoggingExecutors
         .newScheduledThreadPool(MAX_RESOURCE_MANAGER_EXE_THREADS, "ResourceManagerRecoveryThread ");
 
     // Initialize the load probe
     try {
-      Class loadProbeClass = ClassPathLoader.getLatest().forName(PR_LOAD_PROBE_CLASS);
-      this.loadProbe = (LoadProbe) loadProbeClass.newInstance();
+      Class<?> loadProbeClass = ClassPathLoader.getLatest().forName(PR_LOAD_PROBE_CLASS);
+      loadProbe = (LoadProbe) loadProbeClass.newInstance();
     } catch (Exception e) {
       throw new InternalGemFireError("Unable to instantiate " + PR_LOAD_PROBE_CLASS, e);
     }
 
     // Create a new executor the resource manager and the monitors it creates
     // can use to handle dispatching of notifications.
-    this.notifyExecutor =
+    notifyExecutor =
         CoreLoggingExecutors.newSerialThreadPoolWithFeedStatistics(0,
-            this.stats.getResourceEventQueueStatHelper(), "Notification Handler",
+            stats.getResourceEventQueueStatHelper(), "Notification Handler",
             thread -> thread.setPriority(Thread.MAX_PRIORITY), null,
-            this.stats.getResourceEventPoolStatHelper(), getThreadMonitorObj());
+            stats.getResourceEventPoolStatHelper(), getThreadMonitorObj());
 
     // Create the monitors
-    Map<ResourceType, ResourceMonitor> tempMonitors = new HashMap<ResourceType, ResourceMonitor>();
-    tempMonitors.put(ResourceType.HEAP_MEMORY, new HeapMemoryMonitor(this, cache, this.stats));
+    Map<ResourceType, ResourceMonitor> tempMonitors = new HashMap<>();
+    tempMonitors.put(ResourceType.HEAP_MEMORY, new HeapMemoryMonitor(this, cache, stats));
     tempMonitors.put(ResourceType.OFFHEAP_MEMORY,
-        new OffHeapMemoryMonitor(this, cache, cache.getOffHeapStore(), this.stats));
-    this.resourceMonitors = Collections.unmodifiableMap(tempMonitors);
+        new OffHeapMemoryMonitor(this, cache, cache.getOffHeapStore(), stats));
+    resourceMonitors = Collections.unmodifiableMap(tempMonitors);
 
     // Initialize the listener sets so that it only needs to be done once
     for (ResourceType resourceType : new ResourceType[] {ResourceType.HEAP_MEMORY,
         ResourceType.OFFHEAP_MEMORY}) {
-      Set<ResourceListener> emptySet = new CopyOnWriteArraySet<ResourceListener>();
-      this.listeners.put(resourceType, emptySet);
+      Set<ResourceListener<?>> emptySet = new CopyOnWriteArraySet<>();
+      listeners.put(resourceType, emptySet);
     }
-
-    this.closed = false;

Review comment:
       Why did this go away? It seems necessary off the cuff..




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org