/** {@inheritDoc} */ @Override protected void start0() throws GridException { if (cctx.kernalContext().isDaemon() || !cctx.config().isEagerTtl()) return; cleanupWorker = new CleanupWorker(); }
/** {@inheritDoc} */ @Override public void addAttributes(Map<String, Object> attrs) throws GridException { if (ctx.isDaemon() || F.isEmpty(ctx.config().getCacheConfiguration())) return; GridCacheAttributes[] attrVals = new GridCacheAttributes[ctx.config().getCacheConfiguration().length]; Map<String, Boolean> attrPortable = new HashMap<>(); Collection<String> replicationCaches = new ArrayList<>(); Map<String, String> interceptors = new HashMap<>(); int i = 0; for (GridCacheConfiguration cfg : ctx.config().getCacheConfiguration()) { attrVals[i++] = new GridCacheAttributes(cfg); attrPortable.put(CU.mask(cfg.getName()), cfg.isPortableEnabled()); if (cfg.getDrSenderConfiguration() != null) replicationCaches.add(cfg.getName()); if (cfg.getInterceptor() != null) interceptors.put(cfg.getName(), cfg.getInterceptor().getClass().getName()); } attrs.put(ATTR_CACHE, attrVals); attrs.put(ATTR_CACHE_PORTABLE, attrPortable); attrs.put(ATTR_REPLICATION_CACHES, replicationCaches); if (!interceptors.isEmpty()) attrs.put(ATTR_CACHE_INTERCEPTORS, interceptors); }
/** {@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); }
/** * Saves task name metadata to utility cache. * * @param taskName Task name. */ private void saveTaskMetadata(String taskName) throws GridException { if (ctx.isDaemon()) return; assert ctx.security().enabled(); int nameHash = taskName.hashCode(); // 0 is reserved for no task. if (nameHash == 0) nameHash = 1; GridTaskNameHashKey key = new GridTaskNameHashKey(nameHash); String existingName = tasksMetaCache.get(key); if (existingName == null) existingName = tasksMetaCache.putIfAbsent(key, taskName); if (existingName != null && !F.eq(existingName, taskName)) throw new GridException("Task name hash collision for security-enabled node [taskName=" + taskName + ", existing taskName=" + existingName + ']'); }
isDaemon = ctx.isDaemon();
if (ctx.isDaemon()) return;
/** {@inheritDoc} */ @Override public void onDiscoveryDataReceived(Object obj) { DiscoveryData data = (DiscoveryData)obj; if (!ctx.isDaemon() && data != null) { for (DiscoveryDataItem item : data.items) { // Register handler only if local node passes projection predicate. if (item.prjPred == null || item.prjPred.apply(ctx.discovery().localNode())) { try { if (ctx.config().isPeerClassLoadingEnabled()) item.hnd.p2pUnmarshal(data.nodeId, ctx); if (registerHandler(data.nodeId, item.routineId, item.hnd, item.bufSize, item.interval, item.autoUnsubscribe, false)) item.hnd.onListenerRegistered(item.routineId, ctx); } catch (GridException e) { U.error(log, "Failed to register continuous handler.", e); } } } } }
if (ctx.isDaemon()) return;
isLocDaemon = ctx.isDaemon();