Skip to content

Commit

Permalink
Solve some generics warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
anistor authored and ryanemerson committed May 26, 2017
1 parent 2f5358e commit 3da90e2
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -79,7 +79,7 @@ public abstract class AbstractComponentRegistry implements Lifecycle, Cloneable
* errors generated by the component factory.
*/
public static final boolean DEBUG_DEPENDENCIES = Boolean.getBoolean(DEPENDENCIES_ENABLE_JVMOPTION);
private Stack<String> debugStack = DEBUG_DEPENDENCIES ? new Stack<String>() : null;
private Stack<String> debugStack = DEBUG_DEPENDENCIES ? new Stack<>() : null;

/**
* Contains class definitions of component factories that can be used to construct certain components
Expand All @@ -89,7 +89,7 @@ public abstract class AbstractComponentRegistry implements Lifecycle, Cloneable
private static final Object NULL_COMPONENT = new Object();

// component and method containers
private final ConcurrentMap<String, Component> componentLookup = new ConcurrentHashMap<String, AbstractComponentRegistry.Component>(1);
private final ConcurrentMap<String, Component> componentLookup = new ConcurrentHashMap<>(1);

protected volatile ComponentStatus state = ComponentStatus.INSTANTIATED;

Expand Down Expand Up @@ -466,7 +466,7 @@ protected ClassLoader registerDefaultClassLoader(ClassLoader loader) {
*/
public void rewire() {
// need to re-inject everything again.
for (Component c : new HashSet<Component>(componentLookup.values())) {
for (Component c : new HashSet<>(componentLookup.values())) {
// inject dependencies for this component
c.injectDependencies();
}
Expand Down Expand Up @@ -523,7 +523,7 @@ private void populateLifeCycleMethods(Component c) {
public synchronized void resetVolatileComponents() {
// destroy all components to clean up resources
getLog().tracef("Resetting volatile components");
for (Component c : new HashSet<Component>(componentLookup.values())) {
for (Component c : new HashSet<>(componentLookup.values())) {
// the component is volatile!!
if (!c.metadata.isSurvivesRestarts()) {
getLog().tracef("Removing volatile component %s", c.name);
Expand Down Expand Up @@ -611,7 +611,7 @@ private void internalStart() throws CacheException, IllegalArgumentException {
// first cache all start, stop and destroy methods.
populateLifecycleMethods();

List<PrioritizedMethod> startMethods = new ArrayList<PrioritizedMethod>(componentLookup.size());
List<PrioritizedMethod> startMethods = new ArrayList<>(componentLookup.size());
for (Component c : componentLookup.values()) {
Collections.addAll(startMethods, c.startMethods);
}
Expand Down Expand Up @@ -651,7 +651,7 @@ private void internalStop() {
state = ComponentStatus.STOPPING;
removeShutdownHook();

List<PrioritizedMethod> stopMethods = new ArrayList<PrioritizedMethod>(componentLookup.size());
List<PrioritizedMethod> stopMethods = new ArrayList<>(componentLookup.size());
for (Component c : componentLookup.values()) {
// if one of the components threw an exception during startup
// the stop methods list may not have been initialized
Expand Down Expand Up @@ -743,7 +743,7 @@ private void blockUntilCacheStarts() throws InterruptedException, IllegalStateEx
* @return a set of components
*/
public Set<Component> getRegisteredComponents() {
HashSet<Component> defensiveCopy = new HashSet<Component>(componentLookup.values());
HashSet<Component> defensiveCopy = new HashSet<>(componentLookup.values());
return Collections.unmodifiableSet(defensiveCopy);
}

Expand Down

0 comments on commit 3da90e2

Please sign in to comment.