A few days ago I posted following problem to the OCF-Forum:
I've written an applet using OCF and the Java PlugIn. In the method start() 
I invoke SmartCard.start(). In the method destroy() I invoke 
SmartCard.shutdown().
If I start the browser an load the applet all works well. OCF is 
initialized and starts polling the reader. Now I move to another site and 
the method destroy is invoked and the 'shutdown' is completed without any 
exceptions. If I now return to the applet the OCF is initialized again 
without exceptions, but it does NOT start polling the reader.

Now I think I found the error and I think it is caused by not releasing all 
resources when doing SmartCard.shutdown().

In detail:
SmartCard.start() is getting the EventGenerator. The class eventGenerator 
has the static class-attribute 'Thread t' which references the polling thread.
Regrettably this attribute is NOT set to null when the polling-thread 
terminates or better at the time of shutdown. The static class-attribute 
'theGenerator' is also NOT set to 'null' at the time of shutdown. That 
causes two problems:

1. After shutdown the instance of  EventGenerator is still refrenced and 
can not be 'garbage collected'

2. When invoking SmartCard.start() again the EventGenerator's reference to 
the polling-thread is not null. That way no new thread is started ( that is 
only done if the reference to the polling-thread is 'null' ) but in fact 
the refrenced thread doesn't work. So the terminal/s is/are not polled.

In my opinion at the time of shutdown following is to do:
- stop / destroy the polling thread
- set the static refrences to 'null'
- evtl. force garbage collection

Possibly anybody can verify these problems  for a better future version of 
OCF!?

Kind regards
Gunnar Osterode



---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
!                           [EMAIL PROTECTED]
! containing the word
!                           unsubscribe 
! in the body.

Reply via email to