[ https://issues.apache.org/jira/browse/GEODE-7864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17281971#comment-17281971 ]
ASF GitHub Bot commented on GEODE-7864: --------------------------------------- DonalEvans commented on a change in pull request #6007: URL: https://github.com/apache/geode/pull/6007#discussion_r573157049 ########## 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: See the comment from Darrel above. We were previously initializing `closed` to true, then setting it to false at the end of the constructor. Now we simply initialize it to false and don't have to re-set it to false in the constructor. ---------------------------------------------------------------- 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: us...@infra.apache.org > Code improvement refactoring > ---------------------------- > > Key: GEODE-7864 > URL: https://issues.apache.org/jira/browse/GEODE-7864 > Project: Geode > Issue Type: Improvement > Reporter: Nabarun Nag > Priority: Major > Labels: pull-request-available > Time Spent: 13h 10m > Remaining Estimate: 0h > > This is a placeholder ticket. > * this is used to do refactoring. > * this ticket number is used to number the commit message. > * this ticket will never be closed. > * it will be used to mark improvements like correcting spelling mistakes, > efficient java code, etc. -- This message was sent by Atlassian Jira (v8.3.4#803005)