代码优化
This commit is contained in:
@@ -212,7 +212,7 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
long totalTime = System.currentTimeMillis() - beginTime;
|
long totalTime = System.currentTimeMillis() - beginTime;
|
||||||
if (totalTime > 3000){
|
if (totalTime > 3000 && object != null){
|
||||||
logger.warn(object.getClass() + " unserialize time: " + TimeUtils.formatDateAgo(totalTime));
|
logger.warn(object.getClass() + " unserialize time: " + TimeUtils.formatDateAgo(totalTime));
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
@@ -255,7 +255,7 @@ public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
|
|||||||
long beginTime = System.currentTimeMillis();
|
long beginTime = System.currentTimeMillis();
|
||||||
Object object = fstConfiguration.get().asObject(bytes);
|
Object object = fstConfiguration.get().asObject(bytes);
|
||||||
long totalTime = System.currentTimeMillis() - beginTime;
|
long totalTime = System.currentTimeMillis() - beginTime;
|
||||||
if (totalTime > 3000){
|
if (totalTime > 3000 && object != null){
|
||||||
logger.warn(object.getClass() + " fst unserialize time: " + TimeUtils.formatDateAgo(totalTime));
|
logger.warn(object.getClass() + " fst unserialize time: " + TimeUtils.formatDateAgo(totalTime));
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
|
|||||||
@@ -288,7 +288,10 @@ abstract class VFS {
|
|||||||
|
|
||||||
// Try each implementation class until a valid one is found
|
// Try each implementation class until a valid one is found
|
||||||
VFS vfs = null;
|
VFS vfs = null;
|
||||||
for (int i = 0; vfs == null || !vfs.isValid(); i++) {
|
for (int i = 0; true; i++) {
|
||||||
|
if (!(vfs == null || !vfs.isValid())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
Class<? extends VFS> impl = impls.get(i);
|
Class<? extends VFS> impl = impls.get(i);
|
||||||
try {
|
try {
|
||||||
vfs = impl.getDeclaredConstructor().newInstance();
|
vfs = impl.getDeclaredConstructor().newInstance();
|
||||||
@@ -302,7 +305,7 @@ abstract class VFS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Using VFS adapter " + vfs.getClass().getName());
|
log.debug("Using VFS adapter " + vfs == null ? null : vfs.getClass().getName());
|
||||||
return VFS.instance = vfs;
|
return VFS.instance = vfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user