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 String
TEAMCITY_NODES_CONFIG_WATCHER_DELAY_PROP
static String
UNKNOWN_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 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
setAuditLogFactory(AuditLogFactoryImpl auditLogFactory)
void
setEnabled(NodeResponsibility responsibility, TeamCityNode node, boolean enabled)
Changes enabled status for a responsibility for the specified node.void
setEventDispatcher(EventDispatcher<BuildServerListener> eventDispatcher)
void
setFileWatcherFactory(FileWatcherFactory fileWatcherFactory)
void
setResponsibilityProperty(TeamCityNode node, NodeResponsibility responsibility, String propertyName, String propertyValue)
Sets the property of a given responsibilityvoid
setSecurityContext(SecurityContextEx securityContext)
void
setTimeService(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:TeamCityNodes
Returns 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:
getOnlineNodes
in interfaceTeamCityNodes
- Returns:
- see above
-
getOnlineNodes
@NotNull public List<TeamCityNode> getOnlineNodes(int activityTimeThresholdSeconds)
Description copied from interface:TeamCityNodes
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.- Specified by:
getOnlineNodes
in 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:
getNodes
in interfaceTeamCityNodes
- Returns:
- all, online and offline nodes
-
getCurrentNode
@NotNull public TeamCityNode getCurrentNode()
- Specified by:
getCurrentNode
in interfaceTeamCityNodes
- Returns:
- current node, same as getOnlineNodes().get(0)
-
findNodeById
@Nullable public TeamCityNode findNodeById(@NotNull String id)
Description copied from interface:TeamCityNodes
Searches for a node with given id (online or offline).- Specified by:
findNodeById
in 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 ServerConfigPersistFailedException
Description copied from interface:TeamCityNodes
Changes enabled status for a responsibility for the specified node. Attempt to change status of main node will cause IllegalStateException- Specified by:
setEnabled
in 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:TeamCityNodes
Sets the property of a given responsibility- Specified by:
setResponsibilityProperty
in interfaceTeamCityNodes
- 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
-
resetConfiguration
public void resetConfiguration(@NotNull TeamCityNode node) throws ServerConfigPersistFailedException
Description copied from interface:TeamCityNodes
Resets current configuration for the specified node. After that if node is offline, it will disappear from getNodes() list.- Specified by:
resetConfiguration
in interfaceTeamCityNodes
- Throws:
ServerConfigPersistFailedException
-
addListener
public void addListener(@NotNull NodeConfigurationEventListener listener)
- Specified by:
addListener
in interfaceTeamCityNodes
-
removeListener
public void removeListener(@NotNull NodeConfigurationEventListener listener)
- Specified by:
removeListener
in interfaceTeamCityNodes
-
mainNodeRequiresExclusiveLock
public boolean mainNodeRequiresExclusiveLock()
- Specified by:
mainNodeRequiresExclusiveLock
in interfaceTeamCityNodes
- Returns:
- true if main server tries to obtain an exclusive lock
-
-