@Override public boolean hasService(Class<?> clazz) { Addons.waitUntilStarted(addon); Class<?> type; try { type = loadAddonClass(clazz); } catch (ClassNotFoundException e) { return false; } for (Class<?> service : services) { if (type.isAssignableFrom(service)) { return true; } } return false; }
removeRequest.perform(); AddonRegistry registry = SimpleContainer.getFurnace(getClass().getClassLoader()).getAddonRegistry(); Addons.waitUntilStopped(registry.getAddon(id)); InstallRequest installRequest = addonManager.install(id); installRequest.perform();
private void waitForDeploymentCompletion(Deployment deployment, final AddonId addonToDeploy, int quantity, TimeUnit unit) throws DeploymentException { AddonRegistry registry = runnable.getForge().getAddonRegistry(); Addon addon = registry.getAddon(addonToDeploy); try { Future<Void> future = addon.getFuture(); if (!future.isDone()) { future.get(); } Addons.waitUntilStartedOrMissing(addon, quantity, unit); } catch (Exception e) { deployment.deployedWithError(e); throw new DeploymentException("AddonDependency " + addonToDeploy + " failed to deploy.", e); } if (addon.getStatus().isFailed()) { DeploymentException e = new DeploymentException("AddonDependency " + addonToDeploy + " failed to deploy."); deployment.deployedWithError(e); throw new DeploymentException("AddonDependency " + addonToDeploy + " failed to deploy.", e); } }
if (addonToStop.getStatus().isLoaded()) ((MutableAddonRepository) addonToStop.getRepository()).disable(addonToUndeploy); Addons.waitUntilStopped(addonToStop);
RemoveRequest removeRequest = addonManager.remove(id); removeRequest.perform(); Addons.waitUntilStopped(registry.getAddon(id)); progressMonitor.worked(1);
Addons.waitUntilStarted(addon, 10, TimeUnit.SECONDS); final Class<T> requestedLoadedType; final Class<? extends T> actualLoadedType;
public <T> Set<ExportedInstance<T>> getExportedInstances(Class<T> requestedType) Addons.waitUntilStarted(addon); Set<ExportedInstance<T>> result = new HashSet<ExportedInstance<T>>();
Addons.waitUntilStarted(addon); return lock.performLocked(LockMode.READ, new Callable<ExportedInstance<T>>()