Class AgentLogProxyImpl

  • All Implemented Interfaces:
    AgentLogProxy

    public class AgentLogProxyImpl
    extends Object
    implements AgentLogProxy
    Author:
    Kir This class collects messages obtained from executed build and translates them to the BuildServer. If server is not available, messages are cached. When server becomes available, messages are sent to it.
    • Field Detail

      • AGENT_RETRY_FAILED_COMMANDS_DURATION

        public static final String AGENT_RETRY_FAILED_COMMANDS_DURATION
        See Also:
        Constant Field Values
      • DEFAULT_RETRY_DURATION

        public static final long DEFAULT_RETRY_DURATION
    • Method Detail

      • setTimeService

        public void setTimeService​(TimeService timeService)
      • dispose

        public void dispose()
        Description copied from interface: AgentLogProxy
        Stop agent log proxy, after invocation no other messages will be sent to the server
        Specified by:
        dispose in interface AgentLogProxy
      • buildInterrupted

        public boolean buildInterrupted​(@NotNull
                                        String buildId,
                                        @NotNull
                                        String comment,
                                        boolean needRequeue)
        Specified by:
        buildInterrupted in interface AgentLogProxy
        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
      • isBuildFailing

        public boolean isBuildFailing​(String buildId)
                               throws InterruptedException
        Description copied from interface: AgentLogProxy
        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 AgentLogProxy
        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)
      • buildFinished

        public boolean buildFinished​(@NotNull
                                     String buildId,
                                     Date finishDate,
                                     boolean buildFailed)
        Specified by:
        buildFinished in interface AgentLogProxy
        Returns:
        fake value, to conform XML-RPC requirements
      • buildDetachedFromAgent

        public boolean buildDetachedFromAgent​(String buildId,
                                              String stepId)
        Description copied from interface: AgentLogProxy
        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 AgentLogProxy
      • runRemote

        public void runRemote​(@NotNull
                              String buildId,
                              @NotNull
                              RemoteAction action)
        Description copied from interface: AgentLogProxy
        Run remote action, which can be queued for later execution if server is not accessible
        Specified by:
        runRemote in interface AgentLogProxy
      • getBuildMessageSequence

        public int getBuildMessageSequence()
        Description copied from interface: AgentLogProxy
        Returns the current build message sequence number.

        The build message sequence number is an incrementing number attached to all log messages.

        Specified by:
        getBuildMessageSequence in interface AgentLogProxy
        Returns:
        see above
      • setBuildMessageSequence

        public void setBuildMessageSequence​(int buildMessageSequence)
        Description copied from interface: AgentLogProxy
        Setter for the build message sequence number.

        The build message sequence number is an incrementing number attached to all log messages.

        Specified by:
        setBuildMessageSequence in interface AgentLogProxy
        Parameters:
        buildMessageSequence - the new build message sequence number
      • getDirectoryForPersistedMessages

        @NotNull
        public File getDirectoryForPersistedMessages()
      • killAllPendingAndIgnore

        public void killAllPendingAndIgnore​(@Nullable
                                            String buildId)
        Description copied from interface: AgentLogProxy
        Cleanup queue of messages which should be sent to the server.
        Specified by:
        killAllPendingAndIgnore in interface AgentLogProxy
        Parameters:
        buildId - this buildId will be placed to stop list and other messages won't be accepted for this build
      • hasPendingCommands

        public boolean hasPendingCommands()
        Specified by:
        hasPendingCommands in interface AgentLogProxy
        Returns:
        true if there are unsent messages to the server
      • hasPendingBuildFinishedCommand

        public boolean hasPendingBuildFinishedCommand()
        Description copied from interface: AgentLogProxy
        Returns true if buildFinished command is waiting to be sent to the server
        Specified by:
        hasPendingBuildFinishedCommand in interface AgentLogProxy
        Returns:
        true if buildFinished command is pending
      • hasConnection2Server

        public boolean hasConnection2Server()
        Specified by:
        hasConnection2Server in interface AgentLogProxy
        Returns:
        true if build agent thinks that there is a valid connection to TeamCity server
      • wakeUpFlush

        public void wakeUpFlush()
        Description copied from interface: AgentLogProxy
        Wakes up flush thread if it is waiting to send messages to server
        Specified by:
        wakeUpFlush in interface AgentLogProxy
      • flush

        public void flush()
        Description copied from interface: AgentLogProxy
        Synchronously send queued messages to the server, if possible
        Specified by:
        flush in interface AgentLogProxy