Skip to content

Commit

Permalink
# IGNITE-187 Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuznetsov-gridgain committed Feb 25, 2015
1 parent 2dd4456 commit 502b4a6
Showing 1 changed file with 47 additions and 55 deletions.
Expand Up @@ -682,7 +682,7 @@ public void start(final IgniteConfiguration cfg,


scheduler = new IgniteSchedulerImpl(ctx); scheduler = new IgniteSchedulerImpl(ctx);


startProcessor(ctx, rsrcProc); startProcessor(rsrcProc);


// Inject resources into lifecycle beans. // Inject resources into lifecycle beans.
if (!cfg.isDaemon() && cfg.getLifecycleBeans() != null) { if (!cfg.isDaemon() && cfg.getLifecycleBeans() != null) {
Expand All @@ -698,65 +698,65 @@ public void start(final IgniteConfiguration cfg,
// Starts lifecycle aware components. // Starts lifecycle aware components.
U.startLifecycleAware(lifecycleAwares(cfg)); U.startLifecycleAware(lifecycleAwares(cfg));


addHelper(ctx, IGFS_HELPER.create(F.isEmpty(cfg.getIgfsConfiguration()))); addHelper(IGFS_HELPER.create(F.isEmpty(cfg.getIgfsConfiguration())));


startProcessor(ctx, new IgnitePluginProcessor(ctx, cfg)); startProcessor(new IgnitePluginProcessor(ctx, cfg));


// Off-heap processor has no dependencies. // Off-heap processor has no dependencies.
startProcessor(ctx, new GridOffHeapProcessor(ctx)); startProcessor(new GridOffHeapProcessor(ctx));


// Closure processor should be started before all others // Closure processor should be started before all others
// (except for resource processor), as many components can depend on it. // (except for resource processor), as many components can depend on it.
startProcessor(ctx, new GridClosureProcessor(ctx)); startProcessor(new GridClosureProcessor(ctx));


// Start some other processors (order & place is important). // Start some other processors (order & place is important).
startProcessor(ctx, new GridPortProcessor(ctx)); startProcessor(new GridPortProcessor(ctx));
startProcessor(ctx, new GridJobMetricsProcessor(ctx)); startProcessor(new GridJobMetricsProcessor(ctx));


// Timeout processor needs to be started before managers, // Timeout processor needs to be started before managers,
// as managers may depend on it. // as managers may depend on it.
startProcessor(ctx, new GridTimeoutProcessor(ctx)); startProcessor(new GridTimeoutProcessor(ctx));


// Start security processors. // Start security processors.
startProcessor(ctx, createComponent(GridSecurityProcessor.class, ctx)); startProcessor(createComponent(GridSecurityProcessor.class, ctx));


// Start SPI managers. // Start SPI managers.
// NOTE: that order matters as there are dependencies between managers. // NOTE: that order matters as there are dependencies between managers.
startManager(ctx, new GridIoManager(ctx)); startManager(new GridIoManager(ctx));
startManager(ctx, new GridCheckpointManager(ctx)); startManager(new GridCheckpointManager(ctx));


startManager(ctx, new GridEventStorageManager(ctx)); startManager(new GridEventStorageManager(ctx));
startManager(ctx, new GridDeploymentManager(ctx)); startManager(new GridDeploymentManager(ctx));
startManager(ctx, new GridLoadBalancerManager(ctx)); startManager(new GridLoadBalancerManager(ctx));
startManager(ctx, new GridFailoverManager(ctx)); startManager(new GridFailoverManager(ctx));
startManager(ctx, new GridCollisionManager(ctx)); startManager(new GridCollisionManager(ctx));
startManager(ctx, new GridSwapSpaceManager(ctx)); startManager(new GridSwapSpaceManager(ctx));
startManager(ctx, new GridIndexingManager(ctx)); startManager(new GridIndexingManager(ctx));


ackSecurity(ctx); ackSecurity();


// Start processors before discovery manager, so they will // Start processors before discovery manager, so they will
// be able to start receiving messages once discovery completes. // be able to start receiving messages once discovery completes.
startProcessor(ctx, new GridClockSyncProcessor(ctx)); startProcessor(new GridClockSyncProcessor(ctx));
startProcessor(ctx, new GridAffinityProcessor(ctx)); startProcessor(new GridAffinityProcessor(ctx));
startProcessor(ctx, createComponent(GridSegmentationProcessor.class, ctx)); startProcessor(createComponent(GridSegmentationProcessor.class, ctx));
startProcessor(ctx, createComponent(GridPortableProcessor.class, ctx)); startProcessor(createComponent(GridPortableProcessor.class, ctx));
startProcessor(ctx, new GridQueryProcessor(ctx)); startProcessor(new GridQueryProcessor(ctx));
startProcessor(ctx, new GridCacheProcessor(ctx)); startProcessor(new GridCacheProcessor(ctx));
startProcessor(ctx, new GridTaskSessionProcessor(ctx)); startProcessor(new GridTaskSessionProcessor(ctx));
startProcessor(ctx, new GridJobProcessor(ctx)); startProcessor(new GridJobProcessor(ctx));
startProcessor(ctx, new GridTaskProcessor(ctx)); startProcessor(new GridTaskProcessor(ctx));
startProcessor(ctx, (GridProcessor)SCHEDULE.createOptional(ctx)); startProcessor((GridProcessor)SCHEDULE.createOptional(ctx));
startProcessor(ctx, new GridRestProcessor(ctx)); startProcessor(new GridRestProcessor(ctx));
startProcessor(ctx, new GridDataLoaderProcessor(ctx)); startProcessor(new GridDataLoaderProcessor(ctx));
startProcessor(ctx, new GridStreamProcessor(ctx)); startProcessor(new GridStreamProcessor(ctx));
startProcessor(ctx, (GridProcessor) IGFS.create(ctx, F.isEmpty(cfg.getIgfsConfiguration()))); startProcessor((GridProcessor) IGFS.create(ctx, F.isEmpty(cfg.getIgfsConfiguration())));
startProcessor(ctx, new GridContinuousProcessor(ctx)); startProcessor(new GridContinuousProcessor(ctx));
startProcessor(ctx, (GridProcessor)(cfg.isPeerClassLoadingEnabled() ? startProcessor((GridProcessor)(cfg.isPeerClassLoadingEnabled() ?
IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading is enabled. IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading is enabled.
IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null))); IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null)));
startProcessor(ctx, new GridServiceProcessor(ctx)); startProcessor(new GridServiceProcessor(ctx));
startProcessor(ctx, new DataStructuresProcessor(ctx)); startProcessor(new DataStructuresProcessor(ctx));


// Start plugins. // Start plugins.
for (PluginProvider provider : ctx.plugins().allProviders()) { for (PluginProvider provider : ctx.plugins().allProviders()) {
Expand All @@ -771,7 +771,7 @@ public void start(final IgniteConfiguration cfg,
gw.setState(STARTED); gw.setState(STARTED);


// Start discovery manager last to make sure that grid is fully initialized. // Start discovery manager last to make sure that grid is fully initialized.
startManager(ctx, new GridDiscoveryManager(ctx)); startManager(new GridDiscoveryManager(ctx));
} }
finally { finally {
gw.writeUnlock(); gw.writeUnlock();
Expand All @@ -781,7 +781,7 @@ public void start(final IgniteConfiguration cfg,
checkPhysicalRam(); checkPhysicalRam();


// Suggest configuration optimizations. // Suggest configuration optimizations.
suggestOptimizations(ctx, cfg); suggestOptimizations(cfg);


// Notify discovery manager the first to make sure that topology is discovered. // Notify discovery manager the first to make sure that topology is discovered.
ctx.discovery().onKernalStart(); ctx.discovery().onKernalStart();
Expand Down Expand Up @@ -1061,10 +1061,9 @@ private void checkPhysicalRam() {
} }


/** /**
* @param ctx Context.
* @param cfg Configuration to check for possible performance issues. * @param cfg Configuration to check for possible performance issues.
*/ */
private void suggestOptimizations(GridKernalContext ctx, IgniteConfiguration cfg) { private void suggestOptimizations(IgniteConfiguration cfg) {
GridPerformanceSuggestions perf = ctx.performance(); GridPerformanceSuggestions perf = ctx.performance();


if (ctx.collision().enabled()) if (ctx.collision().enabled())
Expand Down Expand Up @@ -1366,12 +1365,10 @@ private boolean unregisterMBean(@Nullable ObjectName mbean) {
} }


/** /**
* @param ctx Kernal context.
* @param mgr Manager to start. * @param mgr Manager to start.
* @throws IgniteCheckedException Throw in case of any errors. * @throws IgniteCheckedException Throw in case of any errors.
*/ */
private void startManager(GridKernalContextImpl ctx, GridManager mgr) private void startManager(GridManager mgr) throws IgniteCheckedException {
throws IgniteCheckedException {
mgr.addSpiAttributes(); mgr.addSpiAttributes();


// Set all node attributes into discovery manager, // Set all node attributes into discovery manager,
Expand All @@ -1393,12 +1390,10 @@ private void startManager(GridKernalContextImpl ctx, GridManager mgr)
} }


/** /**
* @param ctx Kernal context.
* @param proc Processor to start. * @param proc Processor to start.
* @throws IgniteCheckedException Thrown in case of any error. * @throws IgniteCheckedException Thrown in case of any error.
*/ */
private void startProcessor(GridKernalContextImpl ctx, GridProcessor proc) private void startProcessor(GridProcessor proc) throws IgniteCheckedException {
throws IgniteCheckedException {
ctx.add(proc); ctx.add(proc);


try { try {
Expand All @@ -1412,10 +1407,9 @@ private void startProcessor(GridKernalContextImpl ctx, GridProcessor proc)
/** /**
* Add helper. * Add helper.
* *
* @param ctx Context.
* @param helper Helper. * @param helper Helper.
*/ */
private void addHelper(GridKernalContextImpl ctx, Object helper) { private void addHelper(Object helper) {
ctx.addHelper(helper); ctx.addHelper(helper);
} }


Expand Down Expand Up @@ -2062,10 +2056,8 @@ private void ackP2pConfiguration() {


/** /**
* Prints security status. * Prints security status.
*
* @param ctx Kernal context.
*/ */
private void ackSecurity(GridKernalContext ctx) { private void ackSecurity() {
assert log != null; assert log != null;


if (log.isInfoEnabled()) if (log.isInfoEnabled())
Expand Down Expand Up @@ -2515,9 +2507,9 @@ public <K, V> GridCache<K, V> cache(@Nullable String name) {
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
@Nullable @Override public <T, S> IgniteAtomicStamped<T, S> atomicStamped(String name, @Nullable @Override public <V, T> IgniteAtomicStamped<V, T> atomicStamped(String name,
@Nullable T initVal, @Nullable V initVal,
@Nullable S initStamp, @Nullable T initStamp,
boolean create) boolean create)
{ {
guard(); guard();
Expand Down

0 comments on commit 502b4a6

Please sign in to comment.