public PooledTaskBroker()

in src/main/java/com/revo/deployr/client/broker/engine/PooledTaskBroker.java [35:89]


    public PooledTaskBroker(PooledBrokerConfig brokerConfig)
            throws RClientException,
            RSecurityException,
            RDataException,
            RGridException,
            RBrokerException {

        super((RBrokerConfig) brokerConfig);

        this.rClient =
                RClientFactory.createClient(brokerConfig.deployrEndpoint,
                                            brokerConfig.allowSelfSignedSSLCert);

        if (brokerConfig.userCredentials != null) {
            this.rUser =
                    rClient.login(brokerConfig.userCredentials);
        } else {
            throw new RClientException("Broker failed to initialize, " +
                    "user credentials required.");
        }

        if (brokerConfig.poolCreationOptions != null &&
                brokerConfig.poolCreationOptions.releaseGridResources) {
            this.rUser.releaseProjects();
        }

        ProjectCreationOptions options =
                ROptionsTranslator.translate(brokerConfig.poolCreationOptions);

        List<RProject> deployrProjectPool =
                rUser.createProjectPool(brokerConfig.maxConcurrentTaskLimit,
                        options);

        /*
         * Prep the base RBrokerEngine.
         */

        initEngine(deployrProjectPool.size());

        /*
         * Initialize the resourceTokenPool with RProject.
         */
        for (RProject rProject : deployrProjectPool) {
            resourceTokenPool.add(rProject);
        }

        try {
            brokerEngineExecutor.execute(new HTTPKeepAliveManager(rUser));
        } catch (RejectedExecutionException rex) {
            shutdown();
            throw new RBrokerException("Broker failed " +
                    "to start HTTP keep-alive manager, cause: " + rex);
        }

    }