Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Copyright (c) 2006, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.internal.hooks;
import java.security.AccessController;
import java.util.*;
import org.eclipse.osgi.container.*;
import org.eclipse.osgi.container.Module.StartOptions;
import org.eclipse.osgi.container.Module.State;
import org.eclipse.osgi.container.namespaces.EquinoxModuleDataNamespace;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.internal.framework.EquinoxContainer;
import org.eclipse.osgi.internal.hookregistry.ClassLoaderHook;
import org.eclipse.osgi.internal.loader.classpath.ClasspathManager;
import org.eclipse.osgi.internal.messages.Msg;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
public class EclipseLazyStarter extends ClassLoaderHook {
private static final EnumSet alreadyActive = EnumSet.of(State.ACTIVE, State.STOPPING, State.UNINSTALLED);
private static final SecureAction secureAction = AccessController.doPrivileged(SecureAction.createSecureAction());
// holds the current activation trigger class and the ClasspathManagers that need to be activated
private final ThreadLocal> activationStack = new ThreadLocal>();
// used to store exceptions that occurred while activating a bundle
// keyed by ClasspathManager->Exception
// WeakHashMap is used to prevent pinning the ClasspathManager objects.
private final Map errors = Collections.synchronizedMap(new WeakHashMap());
private final EquinoxContainer container;
public EclipseLazyStarter(EquinoxContainer container) {
this.container = container;
}
@Override
public void preFindLocalClass(String name, ClasspathManager manager) throws ClassNotFoundException {
ModuleRevision revision = manager.getGeneration().getRevision();
Module module = revision.getRevisions().getModule();
// If the bundle is active, uninstalled or stopping then the bundle has already
// been initialized (though it may have been destroyed) so just return the class.
if (alreadyActive.contains(module.getState()))
return;
// The bundle is not active and does not require activation, just return the class
if (!shouldActivateFor(name, module, revision, manager))
return;
List