public synchronized void close() throws IOException { if (!closed) { if (referenceCount > 0 && isMruListClosing()) { // there are some opened streams to this BundleFile still; // wait for them all to close because this is being closed by the MRUBundleFileList try { wait(1000); // timeout after 1 second } catch (InterruptedException e) { // do nothing for now ... } if (referenceCount != 0 || closed) // either another thread closed the bundle file or we timed waiting for all the reference inputstreams to close // If the referenceCount did not reach zero then this bundle file will remain open until the // bundle file is closed explicitly (i.e. bundle is updated/uninstalled or framework is shutdown) return; } closed = true; zipFile.close(); mruListRemove(); } }
public synchronized void close() throws IOException { if (!closed) { if (referenceCount > 0 && isMruListClosing()) { // there are some opened streams to this BundleFile still; // wait for them all to close because this is being closed by the MRUBundleFileList try { wait(1000); // timeout after 1 second } catch (InterruptedException e) { // do nothing for now ... } if (referenceCount != 0 || closed) // either another thread closed the bundle file or we timed waiting for all the reference inputstreams to close // If the referenceCount did not reach zero then this bundle file will remain open until the // bundle file is closed explicitly (i.e. bundle is updated/uninstalled or framework is shutdown) return; } closed = true; zipFile.close(); mruListRemove(); } }
public synchronized void close() throws IOException { if (!closed) { if (referenceCount > 0 && isMruListClosing()) { // there are some opened streams to this BundleFile still; // wait for them all to close because this is being closed by the MRUBundleFileList try { wait(1000); // timeout after 1 second } catch (InterruptedException e) { // do nothing for now ... } if (referenceCount != 0 || closed) // either another thread closed the bundle file or we timed waiting for all the reference inputstreams to close // If the referenceCount did not reach zero then this bundle file will remain open until the // bundle file is closed explicitly (i.e. bundle is updated/uninstalled or framework is shutdown) return; } closed = true; zipFile.close(); mruListRemove(); } }
public synchronized void close() throws IOException { if (!closed) { if (referenceCount > 0 && isMruListClosing()) { // there are some opened streams to this BundleFile still; // wait for them all to close because this is being closed by the MRUBundleFileList try { wait(1000); // timeout after 1 second } catch (InterruptedException e) { // do nothing for now ... } if (referenceCount != 0 || closed) // either another thread closed the bundle file or we timed waiting for all the reference inputstreams to close // If the referenceCount did not reach zero then this bundle file will remain open until the // bundle file is closed explicitly (i.e. bundle is updated/uninstalled or framework is shutdown) return; } closed = true; zipFile.close(); mruListRemove(); } }
public void close() throws IOException { openLock.lock(); try { if (!closed) { if (referenceCount > 0 && isMruListClosing()) { // there are some opened streams to this BundleFile still; // wait for them all to close because this is being closed by the MRUBundleFileList try { refCondition.await(1000, TimeUnit.MICROSECONDS); // timeout after 1 second } catch (InterruptedException e) { // do nothing for now ... } if (referenceCount != 0 || closed) // either another thread closed the bundle file or we timed waiting for all the reference inputstreams to close // If the referenceCount did not reach zero then this bundle file will remain open until the // bundle file is closed explicitly (i.e. bundle is updated/uninstalled or framework is shutdown) return; } closed = true; zipFile.close(); mruListRemove(); zipFile = null; } } finally { openLock.unlock(); } }
public void close() throws IOException { openLock.lock(); try { if (!closed) { if (referenceCount > 0 && isMruListClosing()) { // there are some opened streams to this BundleFile still; // wait for them all to close because this is being closed by the MRUBundleFileList try { refCondition.await(1000, TimeUnit.MICROSECONDS); // timeout after 1 second } catch (InterruptedException e) { // do nothing for now ... } if (referenceCount != 0 || closed) // either another thread closed the bundle file or we timed waiting for all the reference inputstreams to close // If the referenceCount did not reach zero then this bundle file will remain open until the // bundle file is closed explicitly (i.e. bundle is updated/uninstalled or framework is shutdown) return; } closed = true; zipFile.close(); mruListRemove(); zipFile = null; } } finally { openLock.unlock(); } }