static public void closeBundleLoader(BundleLoaderProxy proxy) { if (proxy == null) return; // First close the BundleLoader BundleLoader loader = proxy.getBasicBundleLoader(); if (loader != null) loader.close(); proxy.setStale(); // if proxy is not null then make sure to unset user object // associated with the proxy in the state BundleDescription description = proxy.getBundleDescription(); // must set it back to the bundle object; not null // need to make sure the user object is a BundleReference description.setUserObject(proxy.getBundleData()); } }
static public void closeBundleLoader(BundleLoaderProxy proxy) { if (proxy == null) return; // First close the BundleLoader BundleLoader loader = proxy.getBasicBundleLoader(); if (loader != null) loader.close(); proxy.setStale(); // if proxy is not null then make sure to unset user object // associated with the proxy in the state BundleDescription description = proxy.getBundleDescription(); // must set it back to the bundle object; not null // need to make sure the user object is a BundleReference description.setUserObject(proxy.getBundleData()); } }
private void cleanRemovalPendings(State systemState, BundleDescription[] removalPendings) { if (removalPendings.length == 0) return; systemState.resolve(removalPendings); for (int i = 0; i < removalPendings.length; i++) { Object userObject = removalPendings[i].getUserObject(); if (userObject instanceof BundleLoaderProxy) { BundleLoader.closeBundleLoader((BundleLoaderProxy) userObject); try { ((BundleLoaderProxy) userObject).getBundleData().close(); } catch (IOException e) { // ignore } } else if (userObject instanceof BundleData) { try { ((BundleData) userObject).close(); } catch (IOException e) { // ignore } } } }
private void cleanRemovalPendings(State systemState, BundleDescription[] removalPendings) { if (removalPendings.length == 0) return; systemState.resolve(removalPendings); for (int i = 0; i < removalPendings.length; i++) { Object userObject = removalPendings[i].getUserObject(); if (userObject instanceof BundleLoaderProxy) { BundleLoader.closeBundleLoader((BundleLoaderProxy) userObject); try { ((BundleLoaderProxy) userObject).getBundleData().close(); } catch (IOException e) { // ignore } } else if (userObject instanceof BundleData) { try { ((BundleData) userObject).close(); } catch (IOException e) { // ignore } } } }
private void applyRemovalPending(BundleDelta bundleDelta) throws BundleException { if ((bundleDelta.getType() & BundleDelta.REMOVAL_COMPLETE) != 0) { BundleDescription bundle = bundleDelta.getBundle(); if (bundle.getDependents() != null && bundle.getDependents().length > 0) { /* Reaching here is an internal error */ if (Debug.DEBUG_PACKAGEADMIN) { Debug.println("Bundles still depend on removed bundle! " + bundle); //$NON-NLS-1$ Debug.printStackTrace(new Exception("Stack trace")); //$NON-NLS-1$ } throw new BundleException(Msg.OSGI_INTERNAL_ERROR); } Object userObject = bundle.getUserObject(); if (userObject instanceof BundleLoaderProxy) { BundleLoader.closeBundleLoader((BundleLoaderProxy) userObject); try { ((BundleLoaderProxy) userObject).getBundleData().close(); } catch (IOException e) { // ignore } } else if (userObject instanceof BundleData) { try { ((BundleData) userObject).close(); } catch (IOException e) { // ignore } } } }
private void applyRemovalPending(BundleDelta bundleDelta) throws BundleException { if ((bundleDelta.getType() & BundleDelta.REMOVAL_COMPLETE) != 0) { BundleDescription bundle = bundleDelta.getBundle(); if (bundle.getDependents() != null && bundle.getDependents().length > 0) { /* Reaching here is an internal error */ if (Debug.DEBUG_PACKAGEADMIN) { Debug.println("Bundles still depend on removed bundle! " + bundle); //$NON-NLS-1$ Debug.printStackTrace(new Exception("Stack trace")); //$NON-NLS-1$ } throw new BundleException(Msg.OSGI_INTERNAL_ERROR); } Object userObject = bundle.getUserObject(); if (userObject instanceof BundleLoaderProxy) { BundleLoader.closeBundleLoader((BundleLoaderProxy) userObject); try { ((BundleLoaderProxy) userObject).getBundleData().close(); } catch (IOException e) { // ignore } } else if (userObject instanceof BundleData) { try { ((BundleData) userObject).close(); } catch (IOException e) { // ignore } } } }