/** * Performs garbage collection based on remaining profiles. Should be called to avoid * having PDE's bundle pool area grow unbounded. */ public static void garbageCollect() { try { IProfile[] profiles = getProfileRegistry().getProfiles(); for (int i = 0; i < profiles.length; i++) { if (profiles[i].getProfileId().startsWith(PROFILE_ID_PREFIX)) { getGarbageCollector().runGC(profiles[i]); } } } catch (CoreException e) { // XXX likely should log something here. return; } }
public Object start(IApplicationContext context) throws Exception { Map<?, ?> allArgs = context.getArguments(); String[] args = (String[]) allArgs.get(IApplicationContext.APPLICATION_ARGS); processArguments(args); // if the user didn't give us a profile id, then use the default SDK one if (profileId == null) profileId = IProfileRegistry.SELF; initializeServices(); IProfile profile = getProfile(profileId); if (profile == null) throw new IllegalArgumentException("\"" + profileId + "\" is not a valid profile identifier."); //$NON-NLS-1$//$NON-NLS-2$ GarbageCollector gc = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME); gc.runGC(profile); agent.stop(); return null; }
public Object start(IApplicationContext context) throws Exception { Map<?, ?> allArgs = context.getArguments(); String[] args = (String[]) allArgs.get(IApplicationContext.APPLICATION_ARGS); processArguments(args); // if the user didn't give us a profile id, then use the default SDK one if (profileId == null) profileId = DEFAULT_PROFILE_ID; initializeServices(); IProfile profile = getProfile(profileId); if (profile == null) throw new IllegalArgumentException("\"" + profileId + "\" is not a valid profile identifier."); //$NON-NLS-1$//$NON-NLS-2$ GarbageCollector gc = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME); gc.runGC(profile); agent.stop(); return null; }
public Object start(IApplicationContext context) throws Exception { Map<?, ?> allArgs = context.getArguments(); String[] args = (String[]) allArgs.get(IApplicationContext.APPLICATION_ARGS); processArguments(args); // if the user didn't give us a profile id, then use the default SDK one if (profileId == null) profileId = IProfileRegistry.SELF; initializeServices(); IProfile profile = getProfile(profileId); if (profile == null) throw new IllegalArgumentException("\"" + profileId + "\" is not a valid profile identifier."); //$NON-NLS-1$//$NON-NLS-2$ GarbageCollector gc = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME); gc.runGC(profile); agent.stop(); return null; }
@Override public Object start(IApplicationContext context) throws Exception { Map<?, ?> allArgs = context.getArguments(); String[] args = (String[]) allArgs.get(IApplicationContext.APPLICATION_ARGS); processArguments(args); // if the user didn't give us a profile id, then use the default SDK one if (profileId == null) profileId = IProfileRegistry.SELF; initializeServices(); IProfile profile = getProfile(profileId); if (profile == null) throw new IllegalArgumentException("\"" + profileId + "\" is not a valid profile identifier."); //$NON-NLS-1$//$NON-NLS-2$ GarbageCollector gc = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME); gc.runGC(profile); agent.stop(); return null; }
public void notify(EventObject o) { if (o instanceof InstallableUnitEvent) { InstallableUnitEvent event = (InstallableUnitEvent) o; if (event.isUninstall() && event.isPost()) { uninstallEventProfileId = event.getProfile().getProfileId(); } } else if (o instanceof CommitOperationEvent) { if (uninstallEventProfileId != null) { CommitOperationEvent event = (CommitOperationEvent) o; if (uninstallEventProfileId.equals(event.getProfile().getProfileId()) && getBooleanPreference(GCActivator.GC_ENABLED, true)) runGC(event.getProfile()); uninstallEventProfileId = null; } } else if (o instanceof RollbackOperationEvent) { if (uninstallEventProfileId != null && uninstallEventProfileId.equals(((RollbackOperationEvent) o).getProfile().getProfileId())) uninstallEventProfileId = null; } }
public void notify(EventObject o) { if (o instanceof InstallableUnitEvent) { InstallableUnitEvent event = (InstallableUnitEvent) o; if (event.isUninstall() && event.isPost()) { uninstallEventProfileId = event.getProfile().getProfileId(); } } else if (o instanceof CommitOperationEvent) { if (uninstallEventProfileId != null) { CommitOperationEvent event = (CommitOperationEvent) o; if (uninstallEventProfileId.equals(event.getProfile().getProfileId()) && getBooleanPreference(GCActivator.GC_ENABLED, true)) runGC(event.getProfile()); uninstallEventProfileId = null; } } else if (o instanceof RollbackOperationEvent) { if (uninstallEventProfileId != null && uninstallEventProfileId.equals(((RollbackOperationEvent) o).getProfile().getProfileId())) uninstallEventProfileId = null; } }
@Override public void notify(EventObject o) { if (o instanceof InstallableUnitEvent) { InstallableUnitEvent event = (InstallableUnitEvent) o; if (event.isUninstall() && event.isPost()) { uninstallEventProfileId = event.getProfile().getProfileId(); } } else if (o instanceof CommitOperationEvent) { if (uninstallEventProfileId != null) { CommitOperationEvent event = (CommitOperationEvent) o; if (uninstallEventProfileId.equals(event.getProfile().getProfileId()) && getBooleanPreference(GCActivator.GC_ENABLED, true)) runGC(event.getProfile()); uninstallEventProfileId = null; } } else if (o instanceof RollbackOperationEvent) { if (uninstallEventProfileId != null && uninstallEventProfileId.equals(((RollbackOperationEvent) o).getProfile().getProfileId())) uninstallEventProfileId = null; } }
public void notify(EventObject o) { if (o instanceof InstallableUnitEvent) { InstallableUnitEvent event = (InstallableUnitEvent) o; if (event.isUninstall() && event.isPost()) { uninstallEventProfileId = event.getProfile().getProfileId(); } } else if (o instanceof CommitOperationEvent) { if (uninstallEventProfileId != null) { CommitOperationEvent event = (CommitOperationEvent) o; if (uninstallEventProfileId.equals(event.getProfile().getProfileId()) && getBooleanPreference(GCActivator.GC_ENABLED, true)) runGC(event.getProfile()); uninstallEventProfileId = null; } } else if (o instanceof RollbackOperationEvent) { if (uninstallEventProfileId != null && uninstallEventProfileId.equals(((RollbackOperationEvent) o).getProfile().getProfileId())) uninstallEventProfileId = null; } }
/** * Invokes the garbage collector to discard unused plugins, if specified by a * corresponding preference. */ private void garbageCollect() { // Nothing to do if we don't know what profile we are checking if (profileId == null) return; //check if gc is enabled IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore(); if (!pref.getBoolean(PreferenceConstants.PREF_GC_ON_STARTUP)) return; IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.SERVICE_NAME); GarbageCollector collector = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME); if (collector == null) return; IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); if (registry == null) return; IProfile profile = registry.getProfile(profileId); if (profile == null) return; collector.runGC(profile); }