Class RegisteredAgent
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.Proxyfied<BuildAgentEx>
-
- jetbrains.buildServer.serverSide.impl.agent.AbstractBuildAgentContext
-
- jetbrains.buildServer.serverSide.impl.agent.AbstractBuildAgent
-
- jetbrains.buildServer.serverSide.impl.agent.RegisteredAgent
-
- All Implemented Interfaces:
Comparable<BuildAgent>,BuildAgent,Loggable,AgentBuildHistory,AgentDescription,BuildAgentEx,BuildAgentInit,SBuildAgent
public class RegisteredAgent extends AbstractBuildAgent
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.agent.AbstractBuildAgent
FAILED_TO_FIND_AGENT_TYPE_FOR_AGENT_MSG_PREFIX
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.agent.AbstractBuildAgentContext
myContext
-
Fields inherited from interface jetbrains.buildServer.BuildAgent
DEFAULT_POOL_ID, DEFAULT_POOL_NAME
-
-
Constructor Summary
Constructors Constructor Description RegisteredAgent(AgentContext context, AgentDescription agentDescription, RemoteAgentConnection connection, String host, int port, String agentName, String agentAuthorizationToken, String agentPingCode, String agentVersion, String pluginsSignature, CurrentAgentVersionProvider currentAgentVersionProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSpecialState(BuildAgentSpecialState specialState)Clears special state if set to the given valueStringgetCommunicationProtocolDescription()Returns short description of the protocol that is used to communicate with this agent.StringgetCommunicationProtocolType()Returns type (identifier) of the protocol that is used to communicate with this agent.RemoteAgentConnectiongetConnection()intgetPort()Port where agent is listening for server commands.DategetRegistrationTimestamp()Returns timestamp of this agent registration.<T> TgetRemoteInterface(Class<T> clazz)Extension point allowing to call custom methods on agent remotely.BuildAgentSpecialStategetSpecialState()Returns current special stateStringgetUnregistrationComment()If agent is not registered returns reason of its' unregistration.booleanisAccessible()Returns true if the agent is connected to the current node, otherwise returns false.voidisLocal(Action<Boolean> callback)Calls callback with true if this agent is local for sure (i.e.BooleanisLocalFast()Returns the result ofBuildAgentEx.isLocal(Action)if the operation is fast, null otherwisebooleanisRegistered()Returns true or false depending on whether this agent is currently registered on server or not.booleanping()Try to ping agent over networksvoidregister()Makes this agent registered.AgentBuildResultrunBuild(AgentBuild agentBuild)Send runBuild command to the Agent.voidsetId(int id)protected voidsetNameInternal(String name)voidsetTimeService(TimeService timeService)booleanstopBuild(SRunningBuild build)Sends stop build command to agent.StringtoString()booleantrySetSpecialState(BuildAgentSpecialState specialState)Tries atomically to set a certain special state on agent.voidunregister(String unregistrationReason)Makes this agent unregistered.booleanupgrade(Action<Boolean> callback)Sends upgrade command on agent-
Methods inherited from class jetbrains.buildServer.serverSide.impl.agent.AbstractBuildAgent
buildStartedOnAgent, canStartBuildIfAgentOutdated, compareTo, describe, generateUniqueAgentAuthorizationToken, getAgentPool, getAgentPoolId, getAgentStatusRestoringTimestamp, getAgentStatusToRestore, getAgentType, getAgentTypeId, getAuthorizationToken, getAuthorizeComment, getAvailableParameters, getAvailableParameterValue, getAvailableRunTypeIds, getAvailableRunTypes, getAvailableVcsPlugins, getBuildConfigurationsBuilt, getBuildHistory, getBuildParameters, getConfigurationParameters, getCpuBenchmarkIndex, getCpuCount, getCurrentAgentPluginsSignature, getCurrentAgentVersion, getDefinedParameters, getHostAddress, getHostName, getId, getIdleTime, getLastCommunicationTimestamp, getLastFinishedBuildDateOnAgent, getName, getOperatingSystemName, getParameterValue, getPingCode, getPluginsSignature, getRunningBuild, getStatusComment, getVersion, initAgentTypeId, initAuthorized, initEnabled, isAuthorized, isCaseInsensitiveEnvironment, isCloudAgent, isEnabled, isFakeAgent, isOutdated, isPluginsOutdated, isRemoved, isUpgrading, markAsRemoved, releaseSources, releaseSources, restoreAgent, setAgentTypeId, setAuthorizationToken, setAuthorized, setCommunicationTimestamp, setEnabled, setEnabled, setHostAddress, setHostAddress, setName, setPingCode, setPluginsSignature, setUpgrading, setVersion, setVersion, updateAgent, updateCommunicationTimestampInMemory
-
Methods inherited from class jetbrains.buildServer.serverSide.impl.agent.AbstractBuildAgentContext
getAgentDescription, setAgentDescription
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildAgentEx
setAgentDescription
-
-
-
-
Constructor Detail
-
RegisteredAgent
public RegisteredAgent(@NotNull AgentContext context, @NotNull AgentDescription agentDescription, @NotNull RemoteAgentConnection connection, @NotNull String host, int port, @NotNull String agentName, @NotNull String agentAuthorizationToken, @NotNull String agentPingCode, @NotNull String agentVersion, @NotNull String pluginsSignature, @NotNull CurrentAgentVersionProvider currentAgentVersionProvider)
-
-
Method Detail
-
setId
public void setId(int id)
- Specified by:
setIdin interfaceBuildAgentInit- Overrides:
setIdin classAbstractBuildAgent
-
setNameInternal
protected void setNameInternal(@NotNull String name)- Overrides:
setNameInternalin classAbstractBuildAgent
-
isLocal
public void isLocal(Action<Boolean> callback)
Description copied from interface:BuildAgentExCalls callback with true if this agent is local for sure (i.e. installed on the same machine as server).- Specified by:
isLocalin interfaceBuildAgentEx- Overrides:
isLocalin classAbstractBuildAgent
-
isLocalFast
@Nullable public Boolean isLocalFast()
Description copied from interface:BuildAgentExReturns the result ofBuildAgentEx.isLocal(Action)if the operation is fast, null otherwise- Specified by:
isLocalFastin interfaceBuildAgentEx- Overrides:
isLocalFastin classAbstractBuildAgent
-
runBuild
public AgentBuildResult runBuild(@NotNull AgentBuild agentBuild)
Description copied from interface:BuildAgentExSend runBuild command to the Agent.
-
stopBuild
public boolean stopBuild(@NotNull SRunningBuild build)Description copied from interface:BuildAgentExSends stop build command to agent.- Specified by:
stopBuildin interfaceBuildAgentEx- Overrides:
stopBuildin classAbstractBuildAgent- Returns:
- true if build was stopped on agent and false otherwise
-
upgrade
public boolean upgrade(Action<Boolean> callback)
Description copied from interface:BuildAgentExSends upgrade command on agent- Parameters:
callback- will be called with true if upgrade was accepted by agent.- Returns:
- true if upgrade is scheduled, false otherwise (for example if previous Upgrade call is still in progress).
-
ping
public boolean ping()
Description copied from interface:SBuildAgentTry to ping agent over networks- Returns:
- true if agent is reachable
-
getRemoteInterface
public <T> T getRemoteInterface(@NotNull Class<T> clazz)Description copied from interface:BuildAgentExExtension point allowing to call custom methods on agent remotely.- Specified by:
getRemoteInterfacein interfaceBuildAgentEx- Overrides:
getRemoteInterfacein classAbstractBuildAgent- Parameters:
clazz- should contain only simple methods - with simple parameters and return types (number and strings)
-
getCommunicationProtocolDescription
@NotNull public String getCommunicationProtocolDescription()
Description copied from interface:SBuildAgentReturns short description of the protocol that is used to communicate with this agent.
Examples: "unidirectional", "local".- Specified by:
getCommunicationProtocolDescriptionin interfaceSBuildAgent- Overrides:
getCommunicationProtocolDescriptionin classAbstractBuildAgent
-
getCommunicationProtocolType
@NotNull public String getCommunicationProtocolType()
Description copied from interface:SBuildAgentReturns type (identifier) of the protocol that is used to communicate with this agent. Opposite toSBuildAgent.getCommunicationProtocolDescription()this type is constant and will not change for the particular protocol in future.- Specified by:
getCommunicationProtocolTypein interfaceSBuildAgent- Overrides:
getCommunicationProtocolTypein classAbstractBuildAgent
-
getRegistrationTimestamp
@NotNull public Date getRegistrationTimestamp()
Description copied from interface:SBuildAgentReturns timestamp of this agent registration. If agent is not registered the returned timestamp is timestamp of last agent registration.- Returns:
- see above
-
register
public void register()
Description copied from interface:BuildAgentExMakes this agent registered.- Specified by:
registerin interfaceBuildAgentEx- Overrides:
registerin classAbstractBuildAgent
-
unregister
public void unregister(@NotNull String unregistrationReason)Description copied from interface:BuildAgentExMakes this agent unregistered.- Specified by:
unregisterin interfaceBuildAgentEx- Overrides:
unregisterin classAbstractBuildAgent- Parameters:
unregistrationReason- reason of the agent unregistration
-
isRegistered
public boolean isRegistered()
Description copied from interface:SBuildAgentReturns true or false depending on whether this agent is currently registered on server or not.- Returns:
- see above
-
getUnregistrationComment
public String getUnregistrationComment()
Description copied from interface:SBuildAgentIf agent is not registered returns reason of its' unregistration.- Returns:
- agent is not registered returns reason of its' unregistration.
-
getPort
public int getPort()
Description copied from interface:SBuildAgentPort where agent is listening for server commands.- Returns:
- see above
-
toString
public String toString()
- Overrides:
toStringin classAbstractBuildAgent
-
getConnection
@NotNull public RemoteAgentConnection getConnection()
-
trySetSpecialState
public boolean trySetSpecialState(BuildAgentSpecialState specialState)
Description copied from interface:BuildAgentExTries atomically to set a certain special state on agent. This operation is thread-safe- Returns:
- boolean if successful, false otherwise
-
clearSpecialState
public void clearSpecialState(BuildAgentSpecialState specialState)
Description copied from interface:BuildAgentExClears special state if set to the given value- Specified by:
clearSpecialStatein interfaceBuildAgentEx- Overrides:
clearSpecialStatein classAbstractBuildAgent
-
getSpecialState
public BuildAgentSpecialState getSpecialState()
Description copied from interface:BuildAgentExReturns current special state- Specified by:
getSpecialStatein interfaceBuildAgentEx- Overrides:
getSpecialStatein classAbstractBuildAgent- Returns:
- see above
-
isAccessible
public boolean isAccessible()
Description copied from interface:BuildAgentExReturns true if the agent is connected to the current node, otherwise returns false. For example on the read-only node always return false. The remote operations can be executed on the agent only if the method returns true.
-
setTimeService
public void setTimeService(TimeService timeService)
-
-