|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ServiceProcessImpl | Line # 34 | 72 | 52 | 38.2% |
0.38235295
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(97) | |||
Result | |||
0.36764705
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration6
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqSetTheoryScript1
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_10
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testNegative04
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin4
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative02
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck6
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive04
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative08
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_06
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.latex.Qedeq2LatexTest.testQ2L001_v2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative06
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.latex.Qedeq2LatexTest.testQ2L001_v1
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.latex.Qedeq2LatexTest.testQ2L003
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testGeneration
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_04
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_02
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_10
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_09
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.QedeqBoFactoryTest.testCreateStringQedeq4
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.logic.QedeqBoFormalLogicCheckerTest.testCheckModule
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive03b
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck4
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive06
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_07
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive05
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative02
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck1
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind3
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqLogicScript2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative08
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3c
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_07
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.QedeqBoFactoryTest.testCreateStringQedeq6
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPluginFast
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative05
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative07
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative07
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_02
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqLogicScript1
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_11
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration1b
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.QedeqBoFactoryTest.testCreateStringQedeq5
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.heuristic.DynamicHeuristicCheckerPluginTest.testQedeqSampleScript1
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.xml.parser.CharsetParserTest.testParse1
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_13
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_03
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testGeneration
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive03
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.heuristic.HeuristicCheckerPluginTest.testQedeqSetTheoryScript2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_01
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin3
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration1
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_04
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_08
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_01
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration5
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_05
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative05
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3b
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative06
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.xml.parser.CharsetParserTest.testParse2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_12
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration4
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_09
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.QedeqBoFactoryTest.testCreateStringQedeq3
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_06
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.LoadRequiredModulesTest.testLoadRequiredModules_05
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive02
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_03
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.ModuleConstantsExistenceCheckerTest.testModuleConstantsExistenceChecker_08
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.latex.Qedeq2LatexTest.testQ2L002
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.service.control.QedeqBoFactoryTest.testCreateStringQedeq2
![]() |
1 PASS | |
0.36764705
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive01
![]() |
1 PASS | |
0.3529412
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative03
![]() |
1 PASS | |
0.3529412
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative04
![]() |
1 PASS | |
0.3529412
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative04
![]() |
1 PASS | |
0.3529412
|
org.qedeq.kernel.bo.latex.GenerateLatexTest.testNegative03
![]() |
1 PASS | |
0.30147058
|
org.qedeq.kernel.bo.service.control.QedeqBoFactoryTest.testCreateStringQedeq1
![]() |
1 PASS | |
0.30147058
|
org.qedeq.kernel.xml.dao.GenerateXmlTest.testGeneration
![]() |
1 PASS | |
0.25
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testNegative02
![]() |
1 PASS | |
0.25
|
org.qedeq.kernel.bo.service.logic.QedeqBoFormalLogicCheckerDirectTest.testNegative03
![]() |
1 PASS | |
0.25
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testNegative03
![]() |
1 PASS | |
0.25
|
org.qedeq.kernel.bo.service.logic.QedeqBoFormalLogicCheckerDirectTest.testNegative04
![]() |
1 PASS | |
0.25
|
org.qedeq.kernel.bo.service.logic.QedeqBoFormalLogicCheckerDirectTest.testNegative02
![]() |
1 PASS | |
1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org | |
2 | * | |
3 | * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>. | |
4 | * | |
5 | * "Hilbert II" is free software; you can redistribute | |
6 | * it and/or modify it under the terms of the GNU General Public | |
7 | * License as published by the Free Software Foundation; either | |
8 | * version 2 of the License, or (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | */ | |
15 | ||
16 | package org.qedeq.kernel.bo.service.control; | |
17 | ||
18 | import java.util.ArrayList; | |
19 | import java.util.List; | |
20 | ||
21 | import org.qedeq.base.trace.Trace; | |
22 | import org.qedeq.kernel.bo.common.QedeqBo; | |
23 | import org.qedeq.kernel.bo.common.QedeqBoSet; | |
24 | import org.qedeq.kernel.bo.common.ServiceCall; | |
25 | import org.qedeq.kernel.bo.common.ServiceProcess; | |
26 | import org.qedeq.kernel.bo.module.InternalServiceCall; | |
27 | import org.qedeq.kernel.bo.module.InternalServiceProcess; | |
28 | ||
29 | /** | |
30 | * Process info for a kernel service. | |
31 | * | |
32 | * @author Michael Meyling | |
33 | */ | |
34 | public class ServiceProcessImpl implements InternalServiceProcess { | |
35 | ||
36 | /** This class. */ | |
37 | private static final Class CLASS = ServiceProcessImpl.class; | |
38 | ||
39 | /** Counter for each service process. */ | |
40 | private static long globalCounter; | |
41 | ||
42 | /** The service call the process currently works for. */ | |
43 | private InternalServiceCall call; | |
44 | ||
45 | /** The thread the service is done within. */ | |
46 | private final Thread thread; | |
47 | ||
48 | /** Start time for process. */ | |
49 | private long start; | |
50 | ||
51 | /** End time for process. */ | |
52 | private long stop; | |
53 | ||
54 | /** State for process. 0 = running, 1 = success, -1 failure. */ | |
55 | private int state; | |
56 | ||
57 | /** Action name. */ | |
58 | private final String actionName; | |
59 | ||
60 | /** Percentage of currently running plugin execution. */ | |
61 | private double executionPercentage; | |
62 | ||
63 | /** Percentage of currently running plugin execution. */ | |
64 | private String executionActionDescription = "not yet started"; | |
65 | ||
66 | /** Is this process blocked? */ | |
67 | private boolean blocked; | |
68 | ||
69 | /** Process id. */ | |
70 | private final long id; | |
71 | ||
72 | /** This arbiter can lock and unlock modules. */ | |
73 | private ModuleArbiter arbiter; | |
74 | ||
75 | /** | |
76 | * A new service process within the current thread. | |
77 | * | |
78 | * @param arbiter Remember module arbiter. | |
79 | * @param actionName Main process purpose. | |
80 | */ | |
81 | 1049 |
![]() |
82 | 1049 | this.id = inc(); |
83 | 1049 | this.thread = Thread.currentThread(); |
84 | 1049 | this.call = null; |
85 | 1049 | this.arbiter = arbiter; |
86 | 1049 | this.actionName = actionName; |
87 | 1049 | start(); |
88 | } | |
89 | ||
90 | 1049 |
![]() |
91 | 1049 | return globalCounter++; |
92 | } | |
93 | ||
94 | 3463 |
![]() |
95 | 3463 | this.call = call; |
96 | } | |
97 | ||
98 | 2176 |
![]() |
99 | 2176 | return call; |
100 | } | |
101 | ||
102 | 1547 |
![]() |
103 | 1547 | return call; |
104 | } | |
105 | ||
106 | 2170 |
![]() |
107 | 2170 | return thread; |
108 | } | |
109 | ||
110 | 0 |
![]() |
111 | 0 | if (call != null) { |
112 | 0 | return call.getQedeq(); |
113 | } | |
114 | 0 | return null; |
115 | } | |
116 | ||
117 | 0 |
![]() |
118 | 0 | if (call != null) { |
119 | 0 | return call.getQedeq().getName(); |
120 | } | |
121 | 0 | return ""; |
122 | } | |
123 | ||
124 | 0 |
![]() |
125 | 0 | if (call != null) { |
126 | 0 | return call.getQedeq().getUrl(); |
127 | } | |
128 | 0 | return ""; |
129 | } | |
130 | ||
131 | 0 |
![]() |
132 | 0 | return start; |
133 | } | |
134 | ||
135 | 0 |
![]() |
136 | 0 | return stop; |
137 | } | |
138 | ||
139 | 1049 |
![]() |
140 | 1049 | start = System.currentTimeMillis(); |
141 | 1049 | executionActionDescription = "started"; |
142 | } | |
143 | ||
144 | 781 |
![]() |
145 | 781 | stop = System.currentTimeMillis(); |
146 | } | |
147 | ||
148 | 781 |
![]() |
149 | 781 | if (isRunning()) { |
150 | 781 | state = 1; |
151 | 781 | stop(); |
152 | 781 | executionActionDescription = "finished"; |
153 | 781 | executionPercentage = 100; |
154 | } | |
155 | } | |
156 | ||
157 | 0 |
![]() |
158 | 0 | if (isRunning()) { |
159 | 0 | state = -1; |
160 | 0 | stop(); |
161 | } | |
162 | } | |
163 | ||
164 | 4244 |
![]() |
165 | 4244 | if (state == 0) { |
166 | 4244 | if (!thread.isAlive()) { |
167 | 0 | Trace.fatal(CLASS, this, "isRunning()", "Thread has unexpectly died", |
168 | new RuntimeException()); | |
169 | 0 | state = -1; |
170 | 0 | stop(); |
171 | 0 | return false; |
172 | } | |
173 | 4244 | return true; |
174 | } | |
175 | 0 | return false; |
176 | } | |
177 | ||
178 | 0 |
![]() |
179 | 0 | if (isRunning()) { |
180 | 0 | return blocked; |
181 | } | |
182 | 0 | return false; |
183 | } | |
184 | ||
185 | 9922 |
![]() |
186 | 9922 | this.blocked = blocked; |
187 | } | |
188 | ||
189 | 0 |
![]() |
190 | 0 | return state == 1; |
191 | } | |
192 | ||
193 | 0 |
![]() |
194 | 0 | return state == -1; |
195 | } | |
196 | ||
197 | ||
198 | 1011 |
![]() |
199 | 1011 | thread.interrupt(); |
200 | } | |
201 | ||
202 | 0 |
![]() |
203 | 0 | if (isRunning() || isBlocked()) { |
204 | 0 | if (call != null) { |
205 | 0 | executionPercentage = call.getExecutionPercentage(); |
206 | } | |
207 | } | |
208 | 0 | return executionPercentage; |
209 | } | |
210 | ||
211 | 0 |
![]() |
212 | 0 | return actionName; |
213 | } | |
214 | ||
215 | 0 |
![]() |
216 | 0 | if (isRunning() || isBlocked()) { |
217 | 0 | if (call != null) { |
218 | 0 | executionActionDescription = call.getLocation(); |
219 | } | |
220 | } | |
221 | 0 | return executionActionDescription; |
222 | } | |
223 | ||
224 | 0 |
![]() |
225 | 0 | return arbiter.getBlockedModules(this); |
226 | } | |
227 | ||
228 | ||
229 | 11700 |
![]() |
230 | 11700 | return id; |
231 | } | |
232 | ||
233 | 0 |
![]() |
234 | 0 | return (int) id; |
235 | } | |
236 | ||
237 | 5716 |
![]() |
238 | 5716 | return 0 == compareTo(obj); |
239 | } | |
240 | ||
241 | 5716 |
![]() |
242 | 5716 | if (!(o instanceof ServiceProcess)) { |
243 | 2791 | return -1; |
244 | } | |
245 | 2925 | final ServiceProcess s = (ServiceProcess) o; |
246 | 2925 | return (getId() < s.getId() ? -1 : (getId() == s.getId() ? 0 : 1)); |
247 | } | |
248 | ||
249 | 0 |
![]() |
250 | 0 | final List result = new ArrayList(); |
251 | 0 | ServiceCall parent = call; |
252 | 0 | while (parent != null) { |
253 | 0 | if (parent.getQedeq() != null && (result.size() == 0 |
254 | || (result.size() > 0 && !parent.getQedeq().equals(result.get(0))))) { | |
255 | 0 | result.add(0, parent.getQedeq()); |
256 | } | |
257 | 0 | parent = parent.getParentServiceCall(); |
258 | } | |
259 | 0 | return (QedeqBo[]) result.toArray(new QedeqBo[]{}); |
260 | } | |
261 | ||
262 | } |
|