mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
This commit is contained in:
parent
766816f600
commit
9159c87bf9
@ -41,22 +41,20 @@ public class InMemoryRichGaugeRepository implements RichGaugeRepository {
|
||||
|
||||
@Override
|
||||
public void set(Metric<?> metric) {
|
||||
|
||||
final String name = metric.getName();
|
||||
final double value = metric.getValue().doubleValue();
|
||||
this.repository.update(name, new Callback<RichGauge>() {
|
||||
|
||||
@Override
|
||||
public RichGauge modify(RichGauge current) {
|
||||
if (current == null) {
|
||||
current = new RichGauge(name, value);
|
||||
}
|
||||
else {
|
||||
current.set(value);
|
||||
return new RichGauge(name, value);
|
||||
}
|
||||
current.set(value);
|
||||
return current;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,7 +115,7 @@ public abstract class AbstractEmbeddedServletContainerFactory
|
||||
private File getCommonDocumentRoot() {
|
||||
for (String commonDocRoot : COMMON_DOC_ROOTS) {
|
||||
File root = new File(commonDocRoot);
|
||||
if (root != null && root.exists() && root.isDirectory()) {
|
||||
if (root.exists() && root.isDirectory()) {
|
||||
return root.getAbsoluteFile();
|
||||
}
|
||||
}
|
||||
|
@ -46,35 +46,28 @@ public class TomcatEmbeddedWebappClassLoader extends WebappClassLoader {
|
||||
@Override
|
||||
public synchronized Class<?> loadClass(String name, boolean resolve)
|
||||
throws ClassNotFoundException {
|
||||
Class<?> resultClass = null;
|
||||
|
||||
// Check local class caches
|
||||
resultClass = (resultClass == null ? findLoadedClass0(name) : resultClass);
|
||||
resultClass = (resultClass == null ? findLoadedClass(name) : resultClass);
|
||||
if (resultClass != null) {
|
||||
return resolveIfNecessary(resultClass, resolve);
|
||||
}
|
||||
|
||||
// Check security
|
||||
checkPackageAccess(name);
|
||||
|
||||
// Perform the actual load
|
||||
boolean delegateLoad = (this.delegate || filter(name, true));
|
||||
|
||||
if (delegateLoad) {
|
||||
resultClass = (resultClass == null ? loadFromParent(name) : resultClass);
|
||||
}
|
||||
resultClass = (resultClass == null ? findClassIgnoringNotFound(name)
|
||||
: resultClass);
|
||||
if (!delegateLoad) {
|
||||
resultClass = (resultClass == null ? loadFromParent(name) : resultClass);
|
||||
}
|
||||
|
||||
if (resultClass == null) {
|
||||
Class<?> result = findExistingLoadedClass(name);
|
||||
result = (result == null ? doLoadClass(name) : result);
|
||||
if (result == null) {
|
||||
throw new ClassNotFoundException(name);
|
||||
}
|
||||
return resolveIfNecessary(result, resolve);
|
||||
}
|
||||
|
||||
return resolveIfNecessary(resultClass, resolve);
|
||||
private Class<?> findExistingLoadedClass(String name) {
|
||||
Class<?> resultClass = findLoadedClass0(name);
|
||||
resultClass = (resultClass == null ? findLoadedClass(name) : resultClass);
|
||||
return resultClass;
|
||||
}
|
||||
|
||||
private Class<?> doLoadClass(String name) throws ClassNotFoundException {
|
||||
checkPackageAccess(name);
|
||||
if ((this.delegate || filter(name, true))) {
|
||||
Class<?> result = loadFromParent(name);
|
||||
return (result == null ? findClassIgnoringNotFound(name) : result);
|
||||
}
|
||||
Class<?> result = findClassIgnoringNotFound(name);
|
||||
return (result == null ? loadFromParent(name) : result);
|
||||
}
|
||||
|
||||
private Class<?> resolveIfNecessary(Class<?> resultClass, boolean resolve) {
|
||||
|
Loading…
Reference in New Issue
Block a user