protected boolean isTransactional() { if (info.getRuntimeMode() == RuntimeMode.CONTROLLER) { return true; } else if (info.getRuntimeMode() == RuntimeMode.VM) { return transactional; } return false; }
public void startContext(QName deployable) throws GroupInitializationException { if (RuntimeMode.PARTICIPANT == info.getRuntimeMode() && topologyService == null) { return; } else if (RuntimeMode.PARTICIPANT == info.getRuntimeMode() && !topologyService.isZoneLeader()) { // defer instantiation until this node becomes zone leader synchronized (deferredContexts) { deferredContexts.add(deployable); } return; } activated = true; super.startContext(deployable); }
protected boolean isLocal() { // classloader isolation check needed for webapp runtime return info.supportsClassLoaderIsolation() && RuntimeMode.CONTROLLER != info.getRuntimeMode(); }
/** * Performs a workaround to enable specifying the path for native libraries on a per-extension classloader basis. * * @param info the runtime info * @param monitor the monitor */ private void initializeSysPaths(HostInfo info, ClassLoaderBuilderMonitor monitor) { try { sysPathsField = ClassLoader.class.getDeclaredField("sys_paths"); sysPathsField.setAccessible(true); } catch (NoSuchFieldException e) { // fail silently since sys_paths may not be supported on all JVMs, e.g. J9 if (RuntimeMode.PARTICIPANT == info.getRuntimeMode()) { // only issue info if on participant since contribution loading will issue a warning as well. In VM mode where the two subsystems // are collocated, this would result in duplicate messages monitor.nativeLibrariesNotSupported(); } } }
public DeployMonitorListener(@Reference HostInfo info, @Monitor DomainMonitor monitor) { enabled = RuntimeMode.CONTROLLER == info.getRuntimeMode(); this.monitor = monitor; }
public Map<String, CompensatableCommand> generate(Map<String, List<Contribution>> contributions, List<LogicalComponent<?>> components, Map<String, List<CompensatableCommand>> deploymentCommands, GenerationType type) throws GenerationException { if (RuntimeMode.CONTROLLER != info.getRuntimeMode()) { // short circuit this unless running in distributed mode return null; } Map<String, CompensatableCommand> commands = new HashMap<String, CompensatableCommand>(); // evaluate contributions being provisioned for required capabilities evaluateContributions(contributions, commands, type); // evaluate components for required capabilities evaluateComponents(components, commands, type); // evaluate policies on wires evaluatePolicies(commands, contributions, deploymentCommands, type); if (commands.isEmpty()) { return null; } return commands; }
public List<Composite> getDeployables(Set<Contribution> contributions) { List<Composite> deployables = new ArrayList<Composite>(); for (Contribution contribution : contributions) { for (Resource resource : contribution.getResources()) { for (ResourceElement<?, ?> entry : resource.getResourceElements()) { if (!(entry.getValue() instanceof Composite)) { continue; } @SuppressWarnings({"unchecked"}) ResourceElement<QNameSymbol, Composite> element = (ResourceElement<QNameSymbol, Composite>) entry; QName name = element.getSymbol().getKey(); Composite composite = element.getValue(); for (Deployable deployable : contribution.getManifest().getDeployables()) { if (deployable.getName().equals(name)) { List<RuntimeMode> deployableModes = deployable.getRuntimeModes(); // only add deployables that are set to boot in the current runtime mode and where the environment matches if (deployableModes.contains(hostInfo.getRuntimeMode())) { List<String> environments = deployable.getEnvironments(); if (environments.isEmpty() || environments.contains(hostInfo.getEnvironment())) { deployables.add(composite); } } break; } } } } } return deployables; }
public void start() throws ComponentException { super.start(); if (Scope.DOMAIN.equals(scope)) { if (topologyService != null) { topologyService.register(this); } if (RuntimeMode.PARTICIPANT == info.getRuntimeMode() && !topologyService.isZoneLeader()) { // defer scheduling until this node becomes zone leader return; } } if (scheduleOnStart) { // only schedule on start if the runtime has started. If the runtime has not yet started, {@link #schedule} will be called externally on start. schedule(); } }
public void selectBindings(LogicalCompositeComponent domain) throws BindingSelectionException { if (RuntimeMode.CONTROLLER != info.getRuntimeMode() || disable) { // there are no remote wires when the domain is contained withing a single VM (including Participant mode, which has a runtime domain) return; } Collection<LogicalComponent<?>> components = domain.getComponents(); for (LogicalComponent<?> component : components) { if (component.getState() == LogicalState.NEW) { selectBindings(component); } } for (LogicalChannel channel : domain.getChannels()) { selectBinding(channel); } }
/** * Activates and optionally deploys definitions to a domain. * * @param uri the URI of the contribution containing the definitions to activate * @param recover true if recovery is being performed. If true and the runtime is in distributed (controller) mode, definitions will only be * activated. * @throws DeploymentException if there is an error activating definitions */ private synchronized void activateAndDeployDefinitions(URI uri, boolean recover) throws DeploymentException { Contribution contribution = metadataStore.find(uri); if (contribution == null) { throw new DeploymentException("Contribution not installed: " + uri); } if (ContributionState.INSTALLED != contribution.getState()) { throw new ContributionNotInstalledException("Contribution is not installed: " + uri); } Set<PolicySet> policySets = activateDefinitions(contribution); if (!policySets.isEmpty()) { if (!recover || RuntimeMode.VM == info.getRuntimeMode()) { deployPolicySets(policySets); } } }
DeploymentPlan plan; if (SYNTHETIC_PLAN_NAME.equals(planName)) { if (RuntimeMode.CONTROLLER == info.getRuntimeMode()) {
public DistributedDomain(@Reference(name = "store") MetaDataStore metaDataStore, @Reference(name = "logicalComponentManager") LogicalComponentManager logicalComponentManager, @Reference Generator generator, @Reference LogicalModelInstantiator logicalModelInstantiator, @Reference PolicyAttacher policyAttacher, @Reference BindingSelector bindingSelector, @Reference Deployer deployer, @Reference Collector collector, @Reference ContributionHelper contributionHelper, @Reference HostInfo info) { super(metaDataStore, logicalComponentManager, generator, logicalModelInstantiator, policyAttacher, deployer, collector, contributionHelper, info); generateFullDeployment = RuntimeMode.CONTROLLER == info.getRuntimeMode(); this.bindingSelector = bindingSelector; }
public synchronized void include(List<URI> uris) throws DeploymentException { Set<Contribution> contributions = contributionHelper.findContributions(uris); List<Composite> deployables = contributionHelper.getDeployables(contributions); if (RuntimeMode.CONTROLLER == info.getRuntimeMode() && !isLocal()) { Map<URI, DeploymentPlan> plans = new HashMap<URI, DeploymentPlan>(); for (Contribution contribution : contributions) {
public synchronized void include(QName deployable, String planName) throws DeploymentException { Composite wrapper = createWrapper(deployable); DeploymentPlan plan; if (planName == null) { if (RuntimeMode.CONTROLLER == info.getRuntimeMode() && !isLocal()) { plan = contributionHelper.findDefaultPlan(deployable); if (plan == null) { plan = SYNTHETIC_PLAN; } } else { plan = SYNTHETIC_PLAN; } } else { // plan specified plan = contributionHelper.findPlan(planName); if (plan == null) { throw new DeploymentPlanNotFoundException("Deployment plan not found: " + planName); } } for (DeployListener listener : listeners) { listener.onDeploy(deployable, plan.getName()); } instantiateAndDeploy(wrapper, plan, false); for (DeployListener listener : listeners) { listener.onDeployCompleted(deployable, plan.getName()); } }
if (!recover || RuntimeMode.VM == info.getRuntimeMode()) {