1 | package de.uka.ipd.sdq.simucomframework; |
2 | |
3 | import de.uka.ipd.sdq.probespec.framework.ISampleBlackboard; |
4 | import de.uka.ipd.sdq.probespec.framework.ProbeSetAndRequestContext; |
5 | import de.uka.ipd.sdq.probespec.framework.RequestContext; |
6 | import de.uka.ipd.sdq.probespec.framework.garbagecollection.RegionBasedGarbageCollector; |
7 | |
8 | /** |
9 | * A {@link RegionBasedGarbageCollector}, specialised to be used within SimuCom. |
10 | * It enables a {@link RequestContext} to be used as region identifier. More |
11 | * precisely, the specified {@link RequestContext} gets translated to the |
12 | * appropriate region identifier. |
13 | * |
14 | * @author Philipp Merkle |
15 | * |
16 | */ |
17 | public class SimuComGarbageCollector extends |
18 | RegionBasedGarbageCollector<RequestContext> { |
19 | |
20 | private ISampleBlackboard blackboard; |
21 | |
22 | public SimuComGarbageCollector(ISampleBlackboard blackboard) { |
23 | this.blackboard = blackboard; |
24 | } |
25 | |
26 | @Override |
27 | public void collectRegionSamples(RequestContext regionId) { |
28 | blackboard.deleteSamplesInRequestContext(regionId); |
29 | } |
30 | |
31 | @Override |
32 | public RequestContext obtainRegionId(ProbeSetAndRequestContext sampleId) { |
33 | return sampleId.getCtxID().rootContext(); |
34 | } |
35 | |
36 | } |