If you want to make sure (for test purposes) that an object has been garbage collected, have a look at qadevOOo/runner/util/WaitUnreachable.java.

I created issues in IZ for each of the issues at:

61377: Java filter implementation imports documents with modified = true
http://qa.openoffice.org/issues/show_bug.cgi?id=61377

61378: Java filter implementation reloads documents as 'readonly'
http://qa.openoffice.org/issues/show_bug.cgi?id=61378

The java filter implementation which is attached to bug 61378 demonstrates both problems. I added the WaitUnreachable code as suggested by sb, with the following slight changes:

   public void waitUnreachable( String sObjectName, int nCount ) {
       synchronized (this) {
           obj = null;
       }
maLogger.severe ( "Waiting for gc on object " + sObjectName + " of type: " + msObjectType );
       int i = 0;
       while (queue.poll() == null && i < nCount ) {
maLogger.severe ( i++ + ": Running gc on object " + sObjectName + " of type: " + msObjectType );
           System.gc();
           System.runFinalization();
           byte[] dummy = new byte[1024];
       }
maLogger.severe ( "Exiting wait on " + sObjectName + " of type: " + msObjectType );
   }

Then I call it with something like:

WaitUnreachable aWaiter = new WaitUnreachable ( xInputStream ); WaitUnreachable aWaiter2 = new WaitUnreachable ( aDescriptor[nInputStreamIndex].Value );
                   xInputStream = null;
                   aDescriptor[nInputStreamIndex].Value = null;
                   aDescriptor[nInputStreamIndex]= null;
                   aDescriptor = null;
aWaiter2.waitUnreachable( "aDescriptor[nInputStreamIndex].Value", 5);
                   aWaiter.waitUnreachable( "xInputStream", 5 );

Which generates:
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: Waiting for gc on object aDescriptor[nInputStreamIndex].Value of type: com.sun.star.uno.Any
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: 0: Running gc on object aDescriptor[nInputStreamIndex].Value of type: com.sun.star.uno.Any
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: Exiting wait on aDescriptor[nInputStreamIndex].Value of type: com.sun.star.uno.Any
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: Waiting for gc on object xInputStream of type: $Proxy19
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: 0: Running gc on object xInputStream of type: $Proxy19
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: 1: Running gc on object xInputStream of type: $Proxy19
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: 2: Running gc on object xInputStream of type: $Proxy19
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: 3: Running gc on object xInputStream of type: $Proxy19
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: 4: Running gc on object xInputStream of type: $Proxy19
Jan 30, 2006 4:57:51 PM LTSFilter.WaitUnreachable waitUnreachable
SEVERE: Exiting wait on xInputStream of type: $Proxy19

Without the limit, it loops forever. Anywhere I should look to see where else it is referenced? I've also intermittently seen behaviour where office will hang forever on the System.runFinalization() line, which perhaps is due to our old friend, the SolarMutex.

Thanks!

Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to