author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 02 Jan 2013 16:10:11 +0100 | |
branch | development |
changeset 1919 | d2f931428d34 |
parent 1864 | 60a8dc26c8c6 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
1548 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
3 |
||
4 |
New code and modifications done at SWING Research Group [1]: |
|
5 |
||
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
16 |
[1] Code written at SWING Research Group contains a signature |
|
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
19 |
as of 1.9.2010 |
|
20 |
" |
|
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Object subclass:#JavaFinalizationRegistry |
|
1612 | 24 |
instanceVariableNames:'accessLock finalizationSemaphore finalizationProcess lastCGCcount |
1613 | 25 |
lastIGCcount skippedCycles' |
26 |
classVariableNames:'SkipCycleLimit' |
|
1548 | 27 |
poolDictionaries:'' |
28 |
category:'Languages-Java-Support' |
|
29 |
! |
|
30 |
||
31 |
!JavaFinalizationRegistry class methodsFor:'documentation'! |
|
32 |
||
33 |
copyright |
|
34 |
" |
|
35 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
36 |
||
37 |
New code and modifications done at SWING Research Group [1]: |
|
38 |
||
39 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
40 |
SWING Research Group, Czech Technical University in Prague |
|
41 |
||
42 |
This software is furnished under a license and may be used |
|
43 |
only in accordance with the terms of that license and with the |
|
44 |
inclusion of the above copyright notice. This software may not |
|
45 |
be provided or otherwise made available to, or used by, any |
|
46 |
other person. No title to or ownership of the software is |
|
47 |
hereby transferred. |
|
48 |
||
49 |
[1] Code written at SWING Research Group contains a signature |
|
50 |
of one of the above copright owners. For exact set of such code, |
|
51 |
see the differences between this version and version stx:libjava |
|
52 |
as of 1.9.2010 |
|
53 |
||
54 |
" |
|
55 |
! |
|
56 |
||
57 |
documentation |
|
58 |
" |
|
59 |
A tricky class that implements Java-style finalization. |
|
60 |
Future versions may involve some C / VM optimization, |
|
61 |
if this algorithm prooves usefull |
|
62 |
||
63 |
[author:] |
|
64 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
65 |
||
66 |
[instance variables:] |
|
67 |
||
68 |
[class variables:] |
|
69 |
||
70 |
[see also:] |
|
71 |
||
72 |
" |
|
73 |
! ! |
|
74 |
||
1613 | 75 |
!JavaFinalizationRegistry class methodsFor:'initialization'! |
76 |
||
77 |
initialize |
|
78 |
"Invoked at system start or when the class is dynamically loaded." |
|
79 |
||
80 |
"/ please change as required (and remove this comment) |
|
81 |
||
82 |
SkipCycleLimit := 10. |
|
83 |
||
84 |
"Modified: / 16-08-2012 / 18:17:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
85 |
! ! |
|
86 |
||
1548 | 87 |
!JavaFinalizationRegistry class methodsFor:'instance creation'! |
88 |
||
89 |
new |
|
90 |
"return an initialized instance" |
|
91 |
||
92 |
^ self basicNew initialize. |
|
93 |
! ! |
|
94 |
||
1551 | 95 |
!JavaFinalizationRegistry methodsFor:'finalization'! |
1548 | 96 |
|
1551 | 97 |
finalizationCycle |
1548 | 98 |
|
1608 | 99 |
| java_lang_ref_Finalizer ref refs objs living firstPendingReference lastPendingReference finished | |
100 |
||
101 |
||
1613 | 102 |
skippedCycles < SkipCycleLimit ifTrue:[ |
103 |
lastCGCcount == ObjectMemory garbageCollectCount ifTrue:[ skippedCycles := skippedCycles + 1. ^ self ]. |
|
104 |
lastIGCcount == ObjectMemory incrementalGCCount ifTrue:[ skippedCycles := skippedCycles + 1. ^ self ]. |
|
105 |
]. |
|
106 |
skippedCycles := 0. |
|
1612 | 107 |
|
1608 | 108 |
java_lang_ref_Finalizer := JavaVM classNamed:'java.lang.ref.Finalizer'. |
109 |
java_lang_ref_Finalizer isNil ifTrue:[ ^ self ]. |
|
1553
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
110 |
|
1608 | 111 |
refs := OrderedCollection new. |
112 |
ref := java_lang_ref_Finalizer instVarNamed: #unfinalized. |
|
113 |
[ ref notNil ] whileTrue:[ |
|
114 |
refs add: ref. |
|
115 |
ref := ref instVarAt: 5. "/Second next field!!!!!!" |
|
116 |
]. |
|
1612 | 117 |
refs isEmpty ifTrue:[ ^ self ]. |
1608 | 118 |
refs := refs asArray. |
119 |
objs := refs collect:[:each|each instVarAt:1"referent"]. |
|
120 |
living := Array new: refs size. |
|
121 |
||
1548 | 122 |
firstPendingReference := nil. |
1563 | 123 |
finished := self allObjectsIncludingContextsDo:[:o| |
1608 | 124 |
self scan: o forReferenceToAnyOf: objs living: living finalizers: refs |
1548 | 125 |
]. |
1563 | 126 |
finished ifFalse:[ ^ self ]. |
1608 | 127 |
|
1548 | 128 |
living withIndexDo:[:each :index| |
1549 | 129 |
each isNil ifTrue:[ |
1608 | 130 |
ref := refs at: index. |
131 |
firstPendingReference isNil ifTrue:[ |
|
132 |
firstPendingReference := lastPendingReference := ref |
|
1548 | 133 |
] ifFalse:[ |
1608 | 134 |
self setNextOf: lastPendingReference to: ref. |
135 |
lastPendingReference := ref. |
|
136 |
]. |
|
137 |
self setNextOf: lastPendingReference to: lastPendingReference |
|
1548 | 138 |
]. |
139 |
]. |
|
1612 | 140 |
self informReferenceHandler: firstPendingReference. |
141 |
||
142 |
lastCGCcount := ObjectMemory garbageCollectCount. |
|
143 |
lastIGCcount := ObjectMemory incrementalGCCount. |
|
1548 | 144 |
|
1551 | 145 |
"Created: / 24-07-2012 / 15:14:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1548 | 146 |
! |
147 |
||
1551 | 148 |
finalizationLoop |
149 |
||
150 |
[ |
|
1612 | 151 |
finalizationSemaphore waitWithTimeoutMs: 60"sec" * 1000. |
1551 | 152 |
self finalizationCycle |
153 |
] loop |
|
154 |
||
155 |
"Created: / 24-07-2012 / 15:16:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
156 |
! ! |
|
157 |
||
158 |
!JavaFinalizationRegistry methodsFor:'initialization'! |
|
159 |
||
160 |
initialize |
|
161 |
"Invoked when a new instance is created." |
|
162 |
||
163 |
"/ please change as required (and remove this comment) |
|
1563 | 164 |
|
1553
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
165 |
accessLock := RecursionLock new. |
1612 | 166 |
lastCGCcount := ObjectMemory garbageCollectCount. |
167 |
lastIGCcount := ObjectMemory incrementalGCCount. |
|
1613 | 168 |
skippedCycles := 0. |
169 |
||
1612 | 170 |
|
1551 | 171 |
"/ super initialize. -- commented since inherited method does nothing |
172 |
||
1613 | 173 |
"Modified: / 16-08-2012 / 18:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1551 | 174 |
! ! |
175 |
||
176 |
!JavaFinalizationRegistry methodsFor:'private'! |
|
177 |
||
1563 | 178 |
allObjectsIncludingContextsDo:aBlock |
179 |
||
1564 | 180 |
| wasBlocked | |
181 |
||
182 |
wasBlocked := OperatingSystem blockInterrupts. |
|
183 |
||
184 |
(ObjectMemory allObjectsDo:aBlock) ifFalse:[ |
|
185 |
wasBlocked ifTrue:[ |
|
186 |
OperatingSystem unblockInterrupts. |
|
187 |
]. |
|
188 |
^false |
|
189 |
]. |
|
1563 | 190 |
ProcessorScheduler knownProcesses do:[:p | |
191 |
|con| |
|
192 |
||
193 |
con := p suspendedContext. |
|
194 |
[con notNil] whileTrue:[ |
|
195 |
aBlock value:con. |
|
196 |
con := con sender. |
|
1548 | 197 |
]. |
198 |
]. |
|
1564 | 199 |
wasBlocked ifTrue:[ |
200 |
OperatingSystem unblockInterrupts. |
|
201 |
]. |
|
202 |
||
1563 | 203 |
^ true |
1548 | 204 |
|
1563 | 205 |
"Created: / 28-07-2012 / 02:14:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1548 | 206 |
! |
207 |
||
1550
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
208 |
getNextOf: reference |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
209 |
|
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
210 |
^reference instVarAt: 3 |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
211 |
|
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
212 |
"Created: / 24-07-2012 / 11:22:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
213 |
! |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
214 |
|
1563 | 215 |
grow: array |
216 |
^self grow: array min: 30 |
|
1548 | 217 |
|
1563 | 218 |
"Created: / 28-07-2012 / 01:14:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
219 |
! |
|
1553
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
220 |
|
1563 | 221 |
grow: array min: min |
222 |
| grown | |
|
1548 | 223 |
|
1563 | 224 |
grown := Array new: ((array size * 2) max: min). |
225 |
grown replaceFrom: 1 with: array. |
|
226 |
^grown |
|
227 |
||
228 |
"Created: / 28-07-2012 / 01:27:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1548 | 229 |
! |
230 |
||
1549 | 231 |
informReferenceHandler: reference |
232 |
| referenceClass lock | |
|
233 |
||
234 |
reference isNil ifTrue:[ ^ self ]. |
|
235 |
||
236 |
referenceClass := Java classForName: 'java.lang.ref.Reference'. |
|
1691 | 237 |
lock := (referenceClass instVarNamed:#lock) getJavaMonitor |
1550
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
238 |
|
1549 | 239 |
|
1550
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
240 |
lock enter. |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
241 |
[ |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
242 |
referenceClass instVarNamed: #pending put: reference. |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
243 |
lock notify. |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
244 |
] ensure:[ |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
245 |
lock exit. |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
246 |
]. |
1549 | 247 |
|
248 |
"Created: / 24-07-2012 / 03:42:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
249 |
! |
|
250 |
||
1608 | 251 |
scan: object forReferenceToAnyOf: referents living: living finalizers: finalizers |
252 |
||
253 |
"Scans given object for references to any of referees. Returns self |
|
254 |
||
255 |
If the object is not referents array itself not finalizers array itself |
|
256 |
AND |
|
257 |
If the object refers any of the referents, then store 1 (SmallInteger) |
|
258 |
into living object index corresponding to the index of referent |
|
259 |
(in referents array). 1 is stored because it is immediate so no |
|
260 |
__STORE() have to be called. |
|
261 |
" |
|
1548 | 262 |
|
1549 | 263 |
%{ |
264 |
OBJ cls, flags; |
|
265 |
int nInsts, inst; |
|
266 |
if (! __isNonNilObject(object)) { |
|
1608 | 267 |
RETURN ( self ); |
268 |
} |
|
269 |
if (object == referents) { |
|
270 |
RETURN ( self ); |
|
1549 | 271 |
} |
272 |
||
1608 | 273 |
if (__isArrayLike(referents)) { |
274 |
int nObjs = __arraySize(referents); |
|
1563 | 275 |
char *minAddr = 0, *maxAddr = 0; |
1549 | 276 |
|
277 |
if (nObjs == 0) { |
|
1608 | 278 |
RETURN ( self ); |
1549 | 279 |
} |
280 |
||
281 |
/* |
|
282 |
* a little optimization: use the fact that all old objects |
|
283 |
* refering to a new object are on the remSet; if I am not, |
|
284 |
* a trivial reject is possible, if all objects are newbees. |
|
285 |
* as a side effect, gather min/max addresses |
|
286 |
*/ |
|
287 |
if ((__qSpace(object) <= OLDSPACE) && !__isRemembered(object)) { |
|
288 |
int allNewBees = 1; |
|
289 |
int i; |
|
290 |
||
1608 | 291 |
minAddr = (char *)(__ArrayInstPtr(referents)->a_element[0]); |
1549 | 292 |
maxAddr = minAddr; |
293 |
||
294 |
for (i=0; i<nObjs; i++) { |
|
295 |
OBJ anObject; |
|
296 |
||
1608 | 297 |
anObject = __ArrayInstPtr(referents)->a_element[i]; |
1549 | 298 |
|
299 |
if (__isNonNilObject(anObject)) { |
|
300 |
int spc; |
|
301 |
||
302 |
if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) { |
|
303 |
allNewBees = 0; |
|
304 |
} |
|
305 |
} |
|
306 |
||
307 |
if ((char *)anObject < minAddr) { |
|
308 |
minAddr = (char *)anObject; |
|
309 |
} else if ((char *)anObject > maxAddr) { |
|
310 |
maxAddr = (char *)anObject; |
|
311 |
} |
|
312 |
} |
|
313 |
if (allNewBees) { |
|
1608 | 314 |
RETURN ( self ); |
1549 | 315 |
} |
316 |
} |
|
317 |
||
318 |
/* |
|
319 |
* fetch min/max in searchList (if not already done) |
|
320 |
*/ |
|
321 |
if (minAddr == 0) { |
|
322 |
int i; |
|
1548 | 323 |
|
1549 | 324 |
for (i=0; i<nObjs; i++) { |
325 |
OBJ anObject; |
|
326 |
||
1608 | 327 |
anObject = __ArrayInstPtr(referents)->a_element[i]; |
1549 | 328 |
if ((char *)anObject < minAddr) { |
329 |
minAddr = (char *)anObject; |
|
330 |
} else if ((char *)anObject > maxAddr) { |
|
331 |
maxAddr = (char *)anObject; |
|
332 |
} |
|
333 |
} |
|
334 |
} |
|
335 |
||
336 |
cls = __qClass(object); |
|
337 |
flags = __ClassInstPtr(cls)->c_flags; |
|
338 |
if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) { |
|
339 |
nInsts = __BYTES2OBJS__(__qSize(object) - OHDR_SIZE); |
|
340 |
} else { |
|
341 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
|
342 |
} |
|
343 |
if (! nInsts) { |
|
1608 | 344 |
RETURN ( self ); |
1549 | 345 |
} |
346 |
||
347 |
for (inst=0; inst<nInsts; inst++) { |
|
348 |
OBJ instVar = __InstPtr(object)->i_instvars[inst]; |
|
349 |
int i; |
|
350 |
||
351 |
if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) { |
|
1608 | 352 |
for (i=0; i < nObjs; i++) { |
1549 | 353 |
OBJ anObject; |
354 |
||
1608 | 355 |
anObject = __ArrayInstPtr(referents)->a_element[i]; |
1549 | 356 |
if (instVar == anObject) { |
1608 | 357 |
/* Found a reference */ |
358 |
if (object != __ArrayInstPtr(finalizers)->a_element[i]) { |
|
359 |
__ArrayInstPtr(living)->a_element[i] = __MKINT(1); |
|
360 |
} |
|
1549 | 361 |
} |
362 |
} |
|
363 |
} |
|
364 |
} |
|
1608 | 365 |
RETURN ( self ); |
1549 | 366 |
} |
367 |
%}. |
|
368 |
||
1608 | 369 |
self primitiveFailed. |
1548 | 370 |
|
1608 | 371 |
"Created: / 16-08-2012 / 10:01:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1550
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
372 |
! |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
373 |
|
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
374 |
setNextOf: reference to: value |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
375 |
|
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
376 |
^reference instVarAt: 3 put: value |
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
377 |
|
fde50161f2b4
- more finalization stuff. The only missing bit is periodical call to collectionCycle...
vranyj1
parents:
1549
diff
changeset
|
378 |
"Created: / 24-07-2012 / 11:22:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1548 | 379 |
! ! |
380 |
||
381 |
!JavaFinalizationRegistry methodsFor:'registering objects'! |
|
382 |
||
383 |
register: object |
|
384 |
"Register an object for being finalized" |
|
385 |
||
1608 | 386 |
| finalizedClass | |
1553
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
387 |
|
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
388 |
accessLock critical:[ |
1563 | 389 |
finalizedClass := Java classForName:'java.lang.ref.Finalizer'. |
390 |
finalizedClass classInit. |
|
391 |
(finalizedClass methodDictionary at: #'register(Ljava/lang/Object;)V') |
|
392 |
valueWithReceiver: finalizedClass arguments: (Array with: object). |
|
1553
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
393 |
]. |
ee3e63c04778
JavaVM: increased initial old space allocation, create huge LockTable to prevent its realloction
vranyj1
parents:
1552
diff
changeset
|
394 |
|
1548 | 395 |
"Created: / 24-07-2012 / 01:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1551 | 396 |
! |
397 |
||
398 |
registerChange: anObject |
|
399 |
"/Nothing to do, to be polymprph with Registry" |
|
400 |
||
401 |
"Created: / 24-07-2012 / 03:31:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
402 |
! ! |
|
403 |
||
404 |
!JavaFinalizationRegistry methodsFor:'start & stop'! |
|
405 |
||
1565 | 406 |
resumeFinalizationProcess |
407 |
"stop the background finalizer" |
|
408 |
||
409 |
finalizationProcess notNil ifTrue:[ |
|
410 |
finalizationProcess resume. |
|
411 |
] ifFalse:[ |
|
412 |
self startFinalizationProcessAt: 5 |
|
413 |
]. |
|
414 |
||
415 |
"Created: / 28-07-2012 / 10:53:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
416 |
! |
|
417 |
||
1551 | 418 |
startFinalizationProcessAt:aPriority |
419 |
||
420 |
|p| |
|
421 |
||
422 |
finalizationProcess notNil ifTrue:[ |
|
423 |
finalizationProcess priority:aPriority. |
|
424 |
^ self |
|
425 |
]. |
|
426 |
||
427 |
finalizationSemaphore := Semaphore new name:'FinalizationSemaphore (Java)'. |
|
428 |
||
429 |
p := |
|
430 |
[ |
|
431 |
[ |
|
432 |
self finalizationLoop |
|
433 |
] ifCurtailed:[ |
|
434 |
finalizationProcess := nil. |
|
435 |
finalizationSemaphore := nil |
|
436 |
] |
|
437 |
] newProcess. |
|
438 |
p name:'background finalizer (Java)'. |
|
439 |
p priority:aPriority. |
|
440 |
p restartable:true. |
|
1599 | 441 |
"/ p beSystemProcess. |
1551 | 442 |
p resume. |
443 |
finalizationProcess := p |
|
444 |
||
445 |
"Created: / 24-07-2012 / 15:25:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
446 |
! |
|
447 |
||
448 |
stopFinalizationProcess |
|
449 |
"stop the background finalizer" |
|
450 |
||
451 |
finalizationProcess notNil ifTrue:[ |
|
452 |
finalizationProcess terminate. |
|
453 |
finalizationProcess := nil |
|
454 |
]. |
|
455 |
||
456 |
"Created: / 24-07-2012 / 15:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1565 | 457 |
! |
458 |
||
459 |
suspendFinalizationProcess |
|
460 |
"stop the background finalizer" |
|
461 |
||
462 |
finalizationProcess notNil ifTrue:[ |
|
463 |
finalizationProcess suspend. |
|
464 |
]. |
|
465 |
||
466 |
"Created: / 28-07-2012 / 10:53:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1551 | 467 |
! ! |
468 |
||
469 |
!JavaFinalizationRegistry methodsFor:'utilities'! |
|
470 |
||
471 |
finalizeNow |
|
472 |
"Force finalization to run now" |
|
1617 | 473 |
skippedCycles := SkipCycleLimit. |
1564 | 474 |
finalizationSemaphore signal. |
1551 | 475 |
|
476 |
"Created: / 24-07-2012 / 15:28:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1548 | 477 |
! ! |
478 |
||
479 |
!JavaFinalizationRegistry class methodsFor:'documentation'! |
|
480 |
||
1864 | 481 |
version_HG |
482 |
||
483 |
^ '$Changeset: <not expanded> $' |
|
484 |
! |
|
485 |
||
1548 | 486 |
version_SVN |
1864 | 487 |
^ '§Id:: §' |
1548 | 488 |
! ! |
1613 | 489 |
|
490 |
JavaFinalizationRegistry initialize! |