Re: Finalisation/cleanup of Java objects from SISC

"Scott G. Miller" <[email protected]> Mon, 27 Apr 2009 20:12:54 -0500
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
--===============7757749566727314769==
Content-Type: multipart/alternative; boundary=001e680f0b689cb42304689329b2

--001e680f0b689cb42304689329b2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Wed, Apr 22, 2009 at 12:10 PM, Norman Gray <[email protected]>wrote:

>
> Greetings.
>
> I'm working with Java objects which have associated open files
> (specifically, they're RDF models persisted using the Jena/TDB
> library).  These are (as usual) reclaimed by a call to the close()
> method on the associated Java object, but managing that requires the
> usual rather fiddly infrastructure, concerned with working out which
> part of the code is responsible for doing this cleanup.
>
> I can't help feeling that the garbage collector ought to be helping me
> more, somehow -- we're writing Scheme here, not Java, dammit!  Am I
> missing something?
>
> Having a finalize() method on the object, which calls close(), is one
> possibility, of course.  But such finalizers are generally deplored in
> Java style guides, broadly because the JVM GC makes no guarantees
> about when or if finalizers are called.
>

SISC provides no help with the GC, but you should be able to do something
via S2J and the Java reference classes:

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ref/package-summary.html

These are better supported than finalize, because they get called earlier by
the collector than when the object is actually reclaimed.
It should be possible to wrap some nice Schemely interface over it.

Scott

P.S.  Just returning from vacation and will be catching up on some of the
outstanding emails and issues.

--001e680f0b689cb42304689329b2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Wed, Apr 22, 2009 at 12:10 PM, Norman Gray <span dir=3D"ltr">&lt;<a href=
=3D"mailto:[email protected]">[email protected]</a>&gt;</span> wr=
ote:<br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; p=
adding-left: 1ex;">
<br>
Greetings.<br>
<br>
I&#39;m working with Java objects which have associated open files<br>
(specifically, they&#39;re RDF models persisted using the Jena/TDB<br>
library). =A0These are (as usual) reclaimed by a call to the close()<br>
method on the associated Java object, but managing that requires the<br>
usual rather fiddly infrastructure, concerned with working out which<br>
part of the code is responsible for doing this cleanup.<br>
<br>
I can&#39;t help feeling that the garbage collector ought to be helping me<=
br>
more, somehow -- we&#39;re writing Scheme here, not Java, dammit! =A0Am I<b=
r>
missing something?<br>
<br>
Having a finalize() method on the object, which calls close(), is one<br>
possibility, of course. =A0But such finalizers are generally deplored in<br=
>
Java style guides, broadly because the JVM GC makes no guarantees<br>
about when or if finalizers are called.<br>
</blockquote><div><br>SISC provides no help with the GC, but you should be =
able to do something via S2J and the Java reference classes:<br><br><a href=
=3D"http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ref/package-summary.h=
tml">http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ref/package-summary.=
html</a><br>
<br>These are better supported than finalize, because they get called earli=
er by the collector than when the object is actually reclaimed.<br>It shoul=
d be possible to wrap some nice Schemely interface over it.<br><br>Scott<br=
>
<br>P.S.=A0 Just returning from vacation and will be catching up on some of=
 the outstanding emails and issues.</div></div><br>

--001e680f0b689cb42304689329b2--


--===============7757749566727314769==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
--===============7757749566727314769==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Sisc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisc-users

--===============7757749566727314769==--