dschneider-pivotal commented on a change in pull request #6007:
URL: https://github.com/apache/geode/pull/6007#discussion_r572406437
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
##########
@@ -125,99 +123,99 @@ 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;
+ closed = false;
Review comment:
You got rid of "closed" being initialized to true so you should probably
get rid of this line also. I think the old logic was: "start it at true and
then at the end of the constructor set it to false (we must have had some code
that allowed "this" to escape the constructor). We then set it to true in
closed. But now its initial value is false so it does not make sense to reset
it to false at the end of the constructor. We do pass "this" into the
tempMonitors but those are just owned by this object so I don't see any real
escape of "this".
----------------------------------------------------------------
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:
[email protected]