Minor: fixed NPE on profile
@@ -25,7 +25,6 @@ import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -34,12 +33,9 @@ import static com.orientechnologies.orient.core.config.OGlobalConfiguration.PROF
public class OProfilerStub extends OAbstractProfiler {
- protected ConcurrentMap<String, Long> counters = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(
- PROFILER_MAXVALUES.getValueAsInteger()).build();
- private ConcurrentLinkedHashMap<String, AtomicInteger> tips = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(
- PROFILER_MAXVALUES.getValueAsInteger()).build();
- private ConcurrentLinkedHashMap<String, Long> tipsTimestamp = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(
- PROFILER_MAXVALUES.getValueAsInteger()).build();
+ protected ConcurrentMap<String, Long> counters;
+ private ConcurrentLinkedHashMap<String, AtomicInteger> tips;
+ private ConcurrentLinkedHashMap<String, Long> tipsTimestamp;
public OProfilerStub() {
}
@@ -48,6 +44,22 @@ public class OProfilerStub extends OAbstractProfiler {
super(profiler);
}
+ @Override
+ public void startup() {
+ counters = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
+ tips = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
+ tipsTimestamp = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
+ super.startup();
+ }
+
+ @Override
+ public void shutdown() {
+ counters.clear();
+ tips.clear();
+ tipsTimestamp.clear();
+ super.shutdown();
+ }
+
@Override
protected void setTip(final String iMessage, final AtomicInteger counter) {
tips.put(iMessage, counter);
@@ -75,12 +87,9 @@ public class OProfilerStub extends OAbstractProfiler {
}
public boolean startRecording() {
- counters = new ConcurrentLinkedHashMap.Builder()
- .maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
- tips = new ConcurrentLinkedHashMap.Builder()
- .maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
- tipsTimestamp = new ConcurrentLinkedHashMap.Builder()
- .maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
+ counters = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
+ tips = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
+ tipsTimestamp = new ConcurrentLinkedHashMap.Builder().maximumWeightedCapacity(PROFILER_MAXVALUES.getValueAsInteger()).build();
if (super.startRecording()) {
counters.clear();
