Package jetbrains.buildServer.serverSide
Interface TeamCityNodes
-
- All Known Implementing Classes:
TeamCityNodesImpl
public interface TeamCityNodes
A service which provides access to TeamCity nodes and allows changing their configuration.- Since:
- 2022.04
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(NodeConfigurationEventListener listener)
TeamCityNode
findNodeById(String id)
Searches for a node with given id (online or offline).TeamCityNode
getCurrentNode()
List<TeamCityNode>
getNodes()
List<TeamCityNode>
getOnlineNodes()
Returns all nodes which are currently online.List<TeamCityNode>
getOnlineNodes(int activityTimeThresholdSeconds)
Returns all online nodes which have been active within the specified activity threshold in seconds.boolean
mainNodeRequiresExclusiveLock()
void
removeListener(NodeConfigurationEventListener listener)
void
resetConfiguration(TeamCityNode node)
Resets current configuration for the specified node.void
setEnabled(NodeResponsibility responsibility, TeamCityNode node, boolean enabled)
Changes enabled status for a responsibility for the specified node.void
setResponsibilityProperty(TeamCityNode node, NodeResponsibility responsibility, String propertyName, String propertyValue)
Sets the property of a given responsibility
-
-
-
Method Detail
-
getOnlineNodes
@NotNull List<TeamCityNode> getOnlineNodes()
Returns all nodes which are currently online. The returned list is never empty. The first node in the list always represents the current server.- Returns:
- see above
-
getOnlineNodes
@NotNull List<TeamCityNode> getOnlineNodes(int activityTimeThresholdSeconds)
Returns all online nodes which have been active within the specified activity threshold in seconds. The returned list always includes the current node. The returned list does not include nodes which are currently stopping even if their activity satisfies the threshold.- Parameters:
activityTimeThresholdSeconds
- time in seconds since the last node activity, if set to -1 then all the online nodes despite their activity will be returned.- Returns:
- see above
- Since:
- 2022.10
-
getNodes
@NotNull List<TeamCityNode> getNodes()
- Returns:
- all, online and offline nodes
-
getCurrentNode
@NotNull TeamCityNode getCurrentNode()
- Returns:
- current node, same as getOnlineNodes().get(0)
-
findNodeById
@Nullable TeamCityNode findNodeById(@NotNull String id)
Searches for a node with given id (online or offline).- Parameters:
id
- id of the node- Returns:
- found node or null
- Since:
- 2024.12
-
setEnabled
void setEnabled(@NotNull NodeResponsibility responsibility, @NotNull TeamCityNode node, boolean enabled) throws ServerConfigPersistFailedException
Changes enabled status for a responsibility for the specified node. Attempt to change status of main node will cause IllegalStateException- Parameters:
responsibility
- responsibility to enable or disablenode
- TeamCity nodeenabled
- true to enable, false to disable- Throws:
ServerConfigPersistFailedException
-
resetConfiguration
void resetConfiguration(@NotNull TeamCityNode node) throws ServerConfigPersistFailedException
Resets current configuration for the specified node. After that if node is offline, it will disappear from getNodes() list.- Parameters:
node
-- Throws:
ServerConfigPersistFailedException
-
addListener
void addListener(@NotNull NodeConfigurationEventListener listener)
-
removeListener
void removeListener(@NotNull NodeConfigurationEventListener listener)
-
mainNodeRequiresExclusiveLock
boolean mainNodeRequiresExclusiveLock()
- Returns:
- true if main server tries to obtain an exclusive lock
-
setResponsibilityProperty
void setResponsibilityProperty(@NotNull TeamCityNode node, @NotNull NodeResponsibility responsibility, @NotNull String propertyName, @Nullable String propertyValue)
Sets the property of a given responsibility- Parameters:
node
-TeamCityNode
to set property inresponsibility
-NodeResponsibility
to set property forpropertyName
- name of the propertypropertyValue
- value of the property. Providingnull
value removes the property- Since:
- 2021.1
-
-