Class TeamCityNodesImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.TeamCityNodesImpl
-
- All Implemented Interfaces:
TeamCityNodes
public class TeamCityNodesImpl extends Object implements TeamCityNodes
-
-
Field Summary
Fields Modifier and Type Field Description static StringTEAMCITY_NODES_CONFIG_WATCHER_DELAY_PROPstatic StringUNKNOWN_URL
-
Constructor Summary
Constructors Constructor Description TeamCityNodesImpl(Heartbeat heartbeat, ServerPaths serverPaths, ServerResponsibility serverResponsibility)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(NodeConfigurationEventListener listener)TeamCityNodefindNodeById(String id)Searches for a node with given id (online or offline).TeamCityNodegetCurrentNode()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.booleanmainNodeRequiresExclusiveLock()voidremoveListener(NodeConfigurationEventListener listener)voidresetConfiguration(TeamCityNode node)Resets current configuration for the specified node.voidsetAuditLogFactory(AuditLogFactoryImpl auditLogFactory)voidsetEnabled(NodeResponsibility responsibility, TeamCityNode node, boolean enabled)Changes enabled status for a responsibility for the specified node.voidsetEventDispatcher(EventDispatcher<BuildServerListener> eventDispatcher)voidsetFileWatcherFactory(FileWatcherFactory fileWatcherFactory)voidsetResponsibilityProperty(TeamCityNode node, NodeResponsibility responsibility, String propertyName, String propertyValue)Sets the property of a given responsibilityvoidsetSecurityContext(SecurityContextEx securityContext)voidsetTimeService(TimeService timeService)
-
-
-
Field Detail
-
TEAMCITY_NODES_CONFIG_WATCHER_DELAY_PROP
public static final String TEAMCITY_NODES_CONFIG_WATCHER_DELAY_PROP
- See Also:
- Constant Field Values
-
UNKNOWN_URL
public static final String UNKNOWN_URL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TeamCityNodesImpl
public TeamCityNodesImpl(@NotNull Heartbeat heartbeat, @NotNull ServerPaths serverPaths, @NotNull ServerResponsibility serverResponsibility)
-
-
Method Detail
-
setSecurityContext
public void setSecurityContext(@NotNull SecurityContextEx securityContext)
-
setFileWatcherFactory
public void setFileWatcherFactory(@NotNull FileWatcherFactory fileWatcherFactory)
-
setEventDispatcher
public void setEventDispatcher(@NotNull EventDispatcher<BuildServerListener> eventDispatcher)
-
setAuditLogFactory
public void setAuditLogFactory(@NotNull AuditLogFactoryImpl auditLogFactory)
-
setTimeService
public void setTimeService(@NotNull TimeService timeService)
-
getOnlineNodes
@NotNull public List<TeamCityNode> getOnlineNodes()
Description copied from interface:TeamCityNodesReturns all nodes which are currently online. The returned list is never empty. The first node in the list always represents the current server.- Specified by:
getOnlineNodesin interfaceTeamCityNodes- Returns:
- see above
-
getOnlineNodes
@NotNull public List<TeamCityNode> getOnlineNodes(int activityTimeThresholdSeconds)
Description copied from interface:TeamCityNodesReturns 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.- Specified by:
getOnlineNodesin interfaceTeamCityNodes- 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
-
getNodes
@NotNull public List<TeamCityNode> getNodes()
- Specified by:
getNodesin interfaceTeamCityNodes- Returns:
- all, online and offline nodes
-
getCurrentNode
@NotNull public TeamCityNode getCurrentNode()
- Specified by:
getCurrentNodein interfaceTeamCityNodes- Returns:
- current node, same as getOnlineNodes().get(0)
-
findNodeById
@Nullable public TeamCityNode findNodeById(@NotNull String id)
Description copied from interface:TeamCityNodesSearches for a node with given id (online or offline).- Specified by:
findNodeByIdin interfaceTeamCityNodes- Parameters:
id- id of the node- Returns:
- found node or null
-
setEnabled
public void setEnabled(@NotNull NodeResponsibility responsibility, @NotNull TeamCityNode node, boolean enabled) throws ServerConfigPersistFailedExceptionDescription copied from interface:TeamCityNodesChanges enabled status for a responsibility for the specified node. Attempt to change status of main node will cause IllegalStateException- Specified by:
setEnabledin interfaceTeamCityNodes- Parameters:
responsibility- responsibility to enable or disablenode- TeamCity nodeenabled- true to enable, false to disable- Throws:
ServerConfigPersistFailedException
-
setResponsibilityProperty
public void setResponsibilityProperty(@NotNull TeamCityNode node, @NotNull NodeResponsibility responsibility, @NotNull String propertyName, @Nullable String propertyValue)Description copied from interface:TeamCityNodesSets the property of a given responsibility- Specified by:
setResponsibilityPropertyin interfaceTeamCityNodes- Parameters:
node-TeamCityNodeto set property inresponsibility-NodeResponsibilityto set property forpropertyName- name of the propertypropertyValue- value of the property. Providingnullvalue removes the property
-
resetConfiguration
public void resetConfiguration(@NotNull TeamCityNode node) throws ServerConfigPersistFailedExceptionDescription copied from interface:TeamCityNodesResets current configuration for the specified node. After that if node is offline, it will disappear from getNodes() list.- Specified by:
resetConfigurationin interfaceTeamCityNodes- Throws:
ServerConfigPersistFailedException
-
addListener
public void addListener(@NotNull NodeConfigurationEventListener listener)- Specified by:
addListenerin interfaceTeamCityNodes
-
removeListener
public void removeListener(@NotNull NodeConfigurationEventListener listener)- Specified by:
removeListenerin interfaceTeamCityNodes
-
mainNodeRequiresExclusiveLock
public boolean mainNodeRequiresExclusiveLock()
- Specified by:
mainNodeRequiresExclusiveLockin interfaceTeamCityNodes- Returns:
- true if main server tries to obtain an exclusive lock
-
-