ctx.collision().onCollision(
ctx.collision().unsetCollisionExternalListener();
/** {@inheritDoc} */ @Override public void start() throws GridException { if (metricsUpdateFreq < -1) throw new GridException("Invalid value for 'metricsUpdateFrequency' configuration property " + "(should be greater than or equals to -1): " + metricsUpdateFreq); if (metricsUpdateFreq == -1) U.warn(log, "Job metrics are disabled (use with caution)."); if (!jobAlwaysActivate) ctx.collision().setCollisionExternalListener(new CollisionExternalListener()); GridIoManager ioMgr = ctx.io(); ioMgr.addMessageListener(TOPIC_JOB_CANCEL, cancelLsnr); ioMgr.addMessageListener(TOPIC_JOB, jobExecLsnr); ctx.event().addLocalEventListener(discoLsnr, EVT_NODE_FAILED, EVT_NODE_LEFT, EVT_NODE_METRICS_UPDATED); if (log.isDebugEnabled()) log.debug("Job processor started."); }
/** * @param ctx Context. * @param cfg Configuration to check for possible performance issues. */ private void suggestOptimizations(GridKernalContext ctx, GridConfiguration cfg) { GridPerformanceSuggestions perf = ctx.performance(); if (ctx.collision().enabled()) perf.add("Disable collision resolution (remove 'collisionSpi' from configuration)"); if (ctx.checkpoint().enabled()) perf.add("Disable checkpoints (remove 'checkpointSpi' from configuration)"); if (cfg.isPeerClassLoadingEnabled()) perf.add("Disable peer class loading (set 'peerClassLoadingEnabled' to false)"); if (cfg.isMarshalLocalJobs()) perf.add("Disable local jobs marshalling (set 'marshalLocalJobs' to false)"); if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0) perf.add("Disable grid events (remove 'includeEventTypes' from configuration)"); if (GridOptimizedMarshaller.available() && !(cfg.getMarshaller() instanceof GridOptimizedMarshaller)) perf.add("Enable optimized marshaller (set 'marshaller' to " + GridOptimizedMarshaller.class.getSimpleName() + ')'); }
/** * @param ctx Kernal context. */ public GridJobProcessor(GridKernalContext ctx) { super(ctx); marsh = ctx.config().getMarshaller(); // Collision manager is already started and is fully functional. jobAlwaysActivate = !ctx.collision().enabled(); metricsUpdateFreq = ctx.config().getMetricsUpdateFrequency(); activeJobs = jobAlwaysActivate ? new ConcurrentHashMap8<GridUuid, GridJobWorker>() : new JobsMap(1024, 0.75f, 256); passiveJobs = jobAlwaysActivate ? null : new JobsMap(1024, 0.75f, 256); evtLsnr = new JobEventListener(); cancelLsnr = new JobCancelListener(); jobExecLsnr = new JobExecutionListener(); discoLsnr = new JobDiscoveryListener(); }