/** {@inheritDoc} */ @Nullable @Override public GridDeployment explicitDeploy(Class<?> cls, ClassLoader clsLdr) throws GridException { try { // Make sure not to deploy peer loaded tasks with non-local class loader, // if local one exists. if (clsLdr.getClass().equals(GridDeploymentClassLoader.class)) clsLdr = clsLdr.getParent(); spi.register(clsLdr, cls); GridDeployment dep = deployment(cls.getName()); if (dep == null) { GridDeploymentResource rsrc = spi.findResource(cls.getName()); if (rsrc != null && rsrc.getClassLoader() == clsLdr) dep = deploy(ctx.config().getDeploymentMode(), rsrc.getClassLoader(), rsrc.getResourceClass(), rsrc.getName(), true); } return dep; } catch (GridSpiException e) { recordDeployFailed(cls, clsLdr, true); // Avoid double wrapping. if (e.getCause() instanceof GridException) throw (GridException)e.getCause(); throw new GridDeploymentException("Failed to deploy class: " + cls.getName(), e); } }
/** {@inheritDoc} */ @Override public void start() throws GridException { if (ctx.isDaemon()) return; GridConfiguration cfg = ctx.config(); GridDeploymentMode depMode = cfg.getDeploymentMode(); if (cfg.isPeerClassLoadingEnabled() && (depMode == PRIVATE || depMode == ISOLATED) && !F.isEmpty(cfg.getServiceConfiguration())) throw new GridException("Cannot deploy services in PRIVATE or ISOLATED deployment mode: " + depMode); }
/** * @return First global deployment. */ @Nullable public GridDeploymentInfoBean globalDeploymentInfo() { assert depEnabled; if (locDepOwner) return null; // Do not return info if mode is CONTINUOUS. // In this case deployment info will be set by GridCacheMessage.prepareObject(). if (cctx.gridConfig().getDeploymentMode() == CONTINUOUS) return null; for (CachedDeploymentInfo<K, V> d : deps.values()) { if (cctx.discovery().node(d.senderId()) == null) // Sender has left. continue; // Participants map. Map<UUID, GridUuid> participants = d.participants(); if (participants != null) { for (UUID id : participants.keySet()) { if (cctx.discovery().node(id) != null) { // At least 1 participant is still in the grid. return new GridDeploymentInfoBean(d.loaderId(), d.userVersion(), d.mode(), participants, locDepOwner); } } } } return null; }
(ctx.config().getDeploymentMode() == SHARED || ctx.config().getDeploymentMode() == CONTINUOUS) && !U.hasAnnotation(cls, GridInternal.class)) throw new GridException("Attempt to deploy class loaded in ISOLATED or PRIVATE mode on node with " + "SHARED or CONTINUOUS deployment mode [cls=" + cls + ", clsDeployMode=" + ldr.deployMode() + ", localDeployMode=" + ctx.config().getDeploymentMode() + ']');
if (mode != cctx.gridConfig().getDeploymentMode()) { LT.warn(log, null, "Local and remote deployment mode mismatch (please fix configuration and restart) " + "[locDepMode=" + cctx.gridConfig().getDeploymentMode() + ", rmtDepMode=" + mode + ", rmtNodeId=" + sndId + ']');
/** * @param rsrcName Class name. * @return Grid cached task. */ @Nullable public GridDeployment getLocalDeployment(String rsrcName) { if (locDep != null) return locDep; String lambdaEnclosingClsName = U.lambdaEnclosingClassName(rsrcName); String clsName = lambdaEnclosingClsName == null ? rsrcName : lambdaEnclosingClsName; GridDeploymentMetadata meta = new GridDeploymentMetadata(); meta.record(true); meta.deploymentMode(ctx.config().getDeploymentMode()); meta.alias(rsrcName); meta.className(clsName); meta.senderNodeId(ctx.localNodeId()); return locStore.getDeployment(meta); }
/** * @param ctx Grid kernal context. */ public GridDeploymentManager(GridKernalContext ctx) { super(ctx, ctx.config().getDeploymentSpi()); if (!ctx.config().isPeerClassLoadingEnabled()) { GridDeploymentSpi spi = ctx.config().getDeploymentSpi(); GridIgnoreIfPeerClassLoadingDisabled ann = U.getAnnotation(spi.getClass(), GridIgnoreIfPeerClassLoadingDisabled.class); locDep = ann != null ? new LocalDeployment( ctx.config().getDeploymentMode(), U.gridClassLoader(), GridUuid.fromUuid(ctx.localNodeId()), ctx.userVersion(U.gridClassLoader()), String.class.getName()) : null; } else locDep = null; }
add(attrs, ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode()); add(attrs, ATTR_LANG_RUNTIME, getLanguage());
dep = deploy(ctx.config().getDeploymentMode(), rsrc.getClassLoader(), rsrc.getResourceClass(), alias, meta.record()); log.debug("Retrieved auto-loaded resource from spi: " + rsrc); dep = deploy(ctx.config().getDeploymentMode(), ldr, cls, meta.alias(), meta.record());
/** * Validates service configuration. * * @param c Service configuration. * @throws GridRuntimeException If validation failed. */ private void validate(GridServiceConfiguration c) throws GridRuntimeException { GridConfiguration cfg = ctx.config(); GridDeploymentMode depMode = cfg.getDeploymentMode(); if (cfg.isPeerClassLoadingEnabled() && (depMode == PRIVATE || depMode == ISOLATED)) throw new GridRuntimeException("Cannot deploy services in PRIVATE or ISOLATED deployment mode: " + depMode); ensure(c.getName() != null, "getName() != null", null); ensure(c.getTotalCount() >= 0, "getTotalCount() >= 0", c.getTotalCount()); ensure(c.getMaxPerNodeCount() >= 0, "getMaxPerNodeCount() >= 0", c.getMaxPerNodeCount()); ensure(c.getService() != null, "getService() != null", c.getService()); ensure(c.getTotalCount() > 0 || c.getMaxPerNodeCount() > 0, "c.getTotalCount() > 0 || c.getMaxPerNodeCount() > 0", null); }
cfg.nodeId(g.localNode().id()); cfg.marshaller(compactClass(c.getMarshaller())); cfg.deploymentMode(compactObject(c.getDeploymentMode())); cfg.daemon(boolValue(GG_DAEMON, c.isDaemon())); cfg.jmxRemote(g.isJmxRemoteEnabled());
/** {@inheritDoc} */ @Override public void start() throws GridException { GridProtocolHandler.registerDeploymentManager(this); assertParameter(ctx.config().getDeploymentMode() != null, "ctx.config().getDeploymentMode() != null"); if (ctx.config().isPeerClassLoadingEnabled()) assertParameter(ctx.config().getNetworkTimeout() > 0, "networkTimeout > 0"); startSpi(); comm = new GridDeploymentCommunication(ctx, log); comm.start(); locStore = new GridDeploymentLocalStore(getSpi(), ctx, comm); ldrStore = new GridDeploymentPerLoaderStore(getSpi(), ctx, comm); verStore = new GridDeploymentPerVersionStore(getSpi(), ctx, comm); locStore.start(); ldrStore.start(); verStore.start(); if (log.isDebugEnabled()) { log.debug("Local deployment: " + locDep); log.debug(startInfo()); } }
GridDhtTransactionalCacheAdapter.DHT_VERSION_IN_FINISH_RESPONSE_SINCE); GridDeploymentMode depMode = ctx.config().getDeploymentMode();
myCfg.setDeploymentMode(cfg.getDeploymentMode()); myCfg.setNetworkTimeout(cfg.getNetworkTimeout()); myCfg.setClockSyncSamples(cfg.getClockSyncSamples()); GridDeploymentMode depMode = GridDeploymentMode.valueOf(depModeName); if (myCfg.getDeploymentMode() != depMode) myCfg.setDeploymentMode(depMode);
GridDeploymentMode depMode = c.getDeploymentMode(); ctx.config().getDeploymentMode());
clockSyncSamples = cfg.getClockSyncSamples(); dataCenterId = cfg.getDataCenterId(); deployMode = cfg.getDeploymentMode(); discoStartupDelay = cfg.getDiscoveryStartupDelay(); drExecSvc = cfg.getDrExecutorService();
return; GridDeploymentMode locDepMode = ctx.config().getDeploymentMode(); GridDeploymentMode rmtDepMode = rmt.attribute(GridNodeAttributes.ATTR_DEPLOYMENT_MODE);