Class BuildAgentImpl

    • Field Detail

      • POST_PROCESSING_TASK_TIMEOUT

        public static final int POST_PROCESSING_TASK_TIMEOUT
    • Method Detail

      • setLogProxy

        public void setLogProxy​(@NotNull
                                AgentLogProxy logProxy)
      • stopBuild

        public boolean stopBuild()
        Description copied from interface: Agent
        Notifies currently running build to stop
        Specified by:
        stopBuild in interface Agent
        Returns:
        is ignored
      • upgrade

        public boolean upgrade​(Vector pluginNames)
        Description copied from interface: Agent
        Initiates build agent upgrade.
        Specified by:
        upgrade in interface Agent
        Parameters:
        pluginNames - plugin file names (i.e. antPlugin.zip)
        Returns:
        true if accepted
      • doUpgrade

        public boolean doUpgrade()
      • isAtLeastOneUpgradeStarted

        @TestOnly
        public boolean isAtLeastOneUpgradeStarted()
      • ping

        @Deprecated
        public boolean ping​(int agentId)
        Deprecated.
        is called only by old servers, new servers call ping2()
      • ping2

        public String ping2()
        Specified by:
        ping2 in interface Agent
        Returns:
        agent ping code
      • runBuild

        public String runBuild​(@NotNull
                               String serializedAgentBuild)
        Description copied from interface: Agent
        Starts a build on agent
        Specified by:
        runBuild in interface Agent
        Parameters:
        serializedAgentBuild - serialized AgentBuild
        Returns:
        serialized BuildAgentResult
      • isBuildFailing

        public boolean isBuildFailing​(String buildId)
                               throws InterruptedException
        Description copied from interface: AgentLogListener
        Checks for build status on the build server. The call is synchronous, it makes sure that previous logged messages are sent to the server.
        Specified by:
        isBuildFailing in interface AgentLogListener
        Returns:
        true if build status on the server is failing
        Throws:
        InterruptedException - if action was removed from the queue for some reason, and could not be completed (for instance, build is obsolete)
      • buildInterrupted

        public boolean buildInterrupted​(String buildId,
                                        String comment,
                                        boolean needRequeue)
        Specified by:
        buildInterrupted in interface AgentLogListener
        comment - a comment to interrupt the build with
        needRequeue - if true, build should be re-added to the build queue
        Returns:
        fake value, to conform XML-RPC requirements
      • buildFinished

        public boolean buildFinished​(String buildId,
                                     Date finishDate,
                                     boolean buildFailed)
        Method is synchronized to disallow situations when server receives buildFinished event and sends run build on this agent before method releaseBuildData is called.
        Specified by:
        buildFinished in interface AgentLogListener
        Parameters:
        buildId - - build id
        finishDate - - finish date
        buildFailed - - build failed sign
        Returns:
        - fake return type to conform XML-RPC requirements
      • buildDetachedFromAgent

        public boolean buildDetachedFromAgent​(String buildId,
                                              String lastStepId)
        Description copied from interface: AgentLogListener
        Indicates that the build tasks are finished on the agent but the build itself should continue until some external process finishes it
        Specified by:
        buildDetachedFromAgent in interface AgentLogListener
        Parameters:
        buildId - - build id
        lastStepId - - id of last step
        Returns:
        - fake return type to conform XML-RPC requirements
      • log

        public boolean log​(String buildId,
                           Vector messagesXml)
        Called from running subprocesses via xmlrpc. We should deserialize, run through BuildMessagesTranslators, serialize and send to server using AgentLogProxy
        Specified by:
        log in interface AgentLogListener
        Parameters:
        buildId - - build id
        messagesXml - - message in XML format
        Returns:
        - returns value which indicates, whether this message was accepted by server; if false, no other messages with given buildId should be sent for corresponding buildId
      • start

        public void start()
        Description copied from interface: BuildAgent
        starts agent
        Specified by:
        start in interface BuildAgent
      • applyConfigurationToAgent

        public void applyConfigurationToAgent()
        Description copied from interface: BuildAgentEx
        Applies provided parameters to the agent configuration (see {@link {@link BuildAgentConfiguration }}), including configuration parameters, system properties, environment variables. Existing parameters with the same names are not overwritten

        The method may reuse the previously probed parameters, or it will call plugins to provide their parameters.

        Specified by:
        applyConfigurationToAgent in interface BuildAgentEx
      • loadAgentUpdateInfo

        @Nullable
        public AgentUpdateInfo loadAgentUpdateInfo()
      • shutdown

        public boolean shutdown()
        Description copied from interface: BuildAgent
        immediate shutdown, running build will be terminated
        Specified by:
        shutdown in interface BuildAgent
        Returns:
        true
      • shutdownWaitForBuild

        public boolean shutdownWaitForBuild()
        Description copied from interface: BuildAgent
        shutdown after build has finished
        Specified by:
        shutdownWaitForBuild in interface BuildAgent
        Returns:
        true
      • shutdownAndWait

        public void shutdownAndWait()
      • isShutdownScheduled

        public boolean isShutdownScheduled()
      • isShutdownFinished

        public boolean isShutdownFinished()
      • shutdownInternal

        public void shutdownInternal​(boolean killBuild,
                                     boolean callSystemExit,
                                     @NotNull
                                     AgentExitCode exitCode)
      • shutdownAgentWebServer

        public void shutdownAgentWebServer()
      • isAgentWebServerRunning

        public boolean isAgentWebServerRunning()
      • parseCommandLineAndFillConfiguration

        public void parseCommandLineAndFillConfiguration​(AgentCommandlineArguments args)
      • startAgentWebServer

        public void startAgentWebServer()
      • isRegisterInProgress

        public boolean isRegisterInProgress()
      • runWithDisabledFileWatcher

        public void runWithDisabledFileWatcher​(@NotNull
                                               Runnable action)
      • isRunning

        public boolean isRunning()
        This method will take lock in AgentLogProxyImpl.PENDING_COMMANDS_LOCK
        Specified by:
        isRunning in interface BuildAgent
        Returns:
        true if build is running
      • ensureIdle

        public void ensureIdle()
        Description copied from interface: BuildAgent
        Blocks until currently running build finishes and all build messages are sent to the server
        Specified by:
        ensureIdle in interface Agent
        Specified by:
        ensureIdle in interface BuildAgent
      • _setId

        public void _setId​(@Nullable
                           Integer id)
      • _setRunBuildCommandListener

        @TestOnly
        public void _setRunBuildCommandListener​(Action<AgentBuild> action)
      • restart

        public void restart()
        Description copied from interface: BuildAgentEx
        Restarts build agent process.
        Specified by:
        restart in interface BuildAgentEx
      • restartOnError

        @Contract("_ -> exit")
        public void restartOnError​(@NotNull
                                   String logMessage,
                                   @NotNull
                                   Throwable error)
        Description copied from interface: BuildAgentEx
        Restarts build agent process due to critical error.
        Specified by:
        restartOnError in interface BuildAgentEx
      • checkPropertiesChanged

        public void checkPropertiesChanged()