Search in sources :

Example 1 with ResourceIdManager

use of org.apache.asterix.app.cc.ResourceIdManager in project asterixdb by apache.

the class CCApplication method start.

@Override
public void start(IServiceContext serviceCtx, String[] args) throws Exception {
    if (args.length > 0) {
        throw new IllegalArgumentException("Unrecognized argument(s): " + Arrays.toString(args));
    }
    final ClusterControllerService controllerService = (ClusterControllerService) serviceCtx.getControllerService();
    this.ccServiceCtx = (ICCServiceContext) serviceCtx;
    ccServiceCtx.setMessageBroker(new CCMessageBroker(controllerService));
    configureLoggingLevel(ccServiceCtx.getAppConfig().getLoggingLevel(ExternalProperties.Option.LOG_LEVEL));
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Starting Asterix cluster controller");
    }
    ccServiceCtx.setThreadFactory(new AsterixThreadFactory(ccServiceCtx.getThreadFactory(), new LifeCycleComponentManager()));
    ILibraryManager libraryManager = new ExternalLibraryManager();
    ResourceIdManager resourceIdManager = new ResourceIdManager();
    IReplicationStrategy repStrategy = ClusterProperties.INSTANCE.getReplicationStrategy();
    IFaultToleranceStrategy ftStrategy = FaultToleranceStrategyFactory.create(ClusterProperties.INSTANCE.getCluster(), repStrategy, ccServiceCtx);
    ExternalLibraryUtils.setUpExternaLibraries(libraryManager, false);
    componentProvider = new StorageComponentProvider();
    GlobalRecoveryManager.instantiate(ccServiceCtx, getHcc(), componentProvider);
    statementExecutorCtx = new StatementExecutorContext();
    appCtx = new CcApplicationContext(ccServiceCtx, getHcc(), libraryManager, resourceIdManager, () -> MetadataManager.INSTANCE, GlobalRecoveryManager.instance(), ftStrategy, new ActiveLifecycleListener(), componentProvider);
    ClusterStateManager.INSTANCE.setCcAppCtx(appCtx);
    ccExtensionManager = new CCExtensionManager(getExtensions());
    appCtx.setExtensionManager(ccExtensionManager);
    final CCConfig ccConfig = controllerService.getCCConfig();
    if (System.getProperty("java.rmi.server.hostname") == null) {
        System.setProperty("java.rmi.server.hostname", ccConfig.getClusterListenAddress());
    }
    MetadataProperties metadataProperties = appCtx.getMetadataProperties();
    setAsterixStateProxy(AsterixStateProxy.registerRemoteObject(metadataProperties.getMetadataCallbackPort()));
    ccServiceCtx.setDistributedState(proxy);
    MetadataManager.initialize(proxy, metadataProperties);
    ccServiceCtx.addJobLifecycleListener(appCtx.getActiveLifecycleListener());
    // create event loop groups
    webManager = new WebManager();
    configureServers();
    webManager.start();
    ClusterManagerProvider.getClusterManager().registerSubscriber(GlobalRecoveryManager.instance());
    ccServiceCtx.addClusterLifecycleListener(new ClusterLifecycleListener(appCtx));
    jobCapacityController = new JobCapacityController(controllerService.getResourceManager());
}
Also used : IStatementExecutorContext(org.apache.asterix.translator.IStatementExecutorContext) StatementExecutorContext(org.apache.asterix.api.http.ctx.StatementExecutorContext) ILibraryManager(org.apache.asterix.common.library.ILibraryManager) CCMessageBroker(org.apache.asterix.messaging.CCMessageBroker) IStorageComponentProvider(org.apache.asterix.common.context.IStorageComponentProvider) StorageComponentProvider(org.apache.asterix.file.StorageComponentProvider) MetadataProperties(org.apache.asterix.common.config.MetadataProperties) AsterixThreadFactory(org.apache.asterix.common.api.AsterixThreadFactory) IFaultToleranceStrategy(org.apache.asterix.common.replication.IFaultToleranceStrategy) ResourceIdManager(org.apache.asterix.app.cc.ResourceIdManager) CCExtensionManager(org.apache.asterix.app.cc.CCExtensionManager) CcApplicationContext(org.apache.asterix.runtime.utils.CcApplicationContext) ActiveLifecycleListener(org.apache.asterix.active.ActiveLifecycleListener) WebManager(org.apache.hyracks.http.server.WebManager) IJobCapacityController(org.apache.hyracks.api.job.resource.IJobCapacityController) JobCapacityController(org.apache.asterix.runtime.job.resource.JobCapacityController) CCConfig(org.apache.hyracks.control.common.controllers.CCConfig) IReplicationStrategy(org.apache.asterix.common.replication.IReplicationStrategy) LifeCycleComponentManager(org.apache.hyracks.api.lifecycle.LifeCycleComponentManager) ExternalLibraryManager(org.apache.asterix.external.library.ExternalLibraryManager) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService)

Aggregations

ActiveLifecycleListener (org.apache.asterix.active.ActiveLifecycleListener)1 StatementExecutorContext (org.apache.asterix.api.http.ctx.StatementExecutorContext)1 CCExtensionManager (org.apache.asterix.app.cc.CCExtensionManager)1 ResourceIdManager (org.apache.asterix.app.cc.ResourceIdManager)1 AsterixThreadFactory (org.apache.asterix.common.api.AsterixThreadFactory)1 MetadataProperties (org.apache.asterix.common.config.MetadataProperties)1 IStorageComponentProvider (org.apache.asterix.common.context.IStorageComponentProvider)1 ILibraryManager (org.apache.asterix.common.library.ILibraryManager)1 IFaultToleranceStrategy (org.apache.asterix.common.replication.IFaultToleranceStrategy)1 IReplicationStrategy (org.apache.asterix.common.replication.IReplicationStrategy)1 ExternalLibraryManager (org.apache.asterix.external.library.ExternalLibraryManager)1 StorageComponentProvider (org.apache.asterix.file.StorageComponentProvider)1 CCMessageBroker (org.apache.asterix.messaging.CCMessageBroker)1 JobCapacityController (org.apache.asterix.runtime.job.resource.JobCapacityController)1 CcApplicationContext (org.apache.asterix.runtime.utils.CcApplicationContext)1 IStatementExecutorContext (org.apache.asterix.translator.IStatementExecutorContext)1 IJobCapacityController (org.apache.hyracks.api.job.resource.IJobCapacityController)1 LifeCycleComponentManager (org.apache.hyracks.api.lifecycle.LifeCycleComponentManager)1 ClusterControllerService (org.apache.hyracks.control.cc.ClusterControllerService)1 CCConfig (org.apache.hyracks.control.common.controllers.CCConfig)1