Module com.aoapps.appcluster.core
Package com.aoapps.appcluster
Class Resource<R extends Resource<R,RN>,RN extends ResourceNode<R,RN>>
- java.lang.Object
-
- com.aoapps.appcluster.Resource<R,RN>
-
- Direct Known Subclasses:
CronResource
public abstract class Resource<R extends Resource<R,RN>,RN extends ResourceNode<R,RN>> extends Object
Monitors the status of a resource by monitoring its role based on DNS entries and synchronizing the resource on an as-needed and/or scheduled basis.- Author:
- AO Industries, Inc.
- See Also:
ResourceDnsMonitor
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedResource(AppCluster cluster, ResourceConfiguration<R,RN> resourceConfiguration, Collection<? extends ResourceNode<?,?>> resourceNodes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)abstract booleangetAllowMultiMaster()Gets if this resource allows multiple master servers.AppClustergetCluster()Gets the cluster this resource is part of.StringgetDisplay()Gets the display name of this resource.ResourceDnsMonitorgetDnsMonitor()Gets the DNS monitor for this resource.Set<? extends Nameserver>getEnabledNameservers()Gets the set of all nameservers used by all enabled nodes.StringgetId()The unique ID of this resource.Set<? extends Name>getMasterRecords()Gets the set of master records that must all by the same.intgetMasterRecordsTtl()Gets the expected TTL value for the master record.Set<? extends RN>getResourceNodes()ResourceStatusgetStatus()Gets the status of this resource based on disabled, last monitoring results, and synchronization state.Map<Node,ResourceSynchronizer<R,RN>>getSynchronizerMap()Gets a map-view of the resource synchronizers keyed on remote node.Collection<ResourceSynchronizer<R,RN>>getSynchronizers()Gets the set of resource synchronizers.StringgetType()Gets the replication type of this resource.inthashCode()booleanisEnabled()Determines if both the cluster and this resource are enabled.protected abstract ResourceSynchronizer<R,RN>newResourceSynchronizer(RN localResourceNode, RN remoteResourceNode, ResourceConfiguration<R,RN> resourceConfiguration)Creates the resource synchronizer for this specific type of resource ornullif never performs any synchronization between these two nodes.StringtoString()
-
-
-
Constructor Detail
-
Resource
protected Resource(AppCluster cluster, ResourceConfiguration<R,RN> resourceConfiguration, Collection<? extends ResourceNode<?,?>> resourceNodes) throws AppClusterConfigurationException
- Throws:
AppClusterConfigurationException
-
-
Method Detail
-
getCluster
public AppCluster getCluster()
Gets the cluster this resource is part of.
-
getId
public String getId()
The unique ID of this resource.
-
isEnabled
public boolean isEnabled()
Determines if both the cluster and this resource are enabled.
-
getDisplay
public String getDisplay()
Gets the display name of this resource.
-
getMasterRecords
public Set<? extends Name> getMasterRecords()
Gets the set of master records that must all by the same. The master node is determined by matching these records against the resource node configuration's node records.
-
getMasterRecordsTtl
public int getMasterRecordsTtl()
Gets the expected TTL value for the master record.
-
getEnabledNameservers
public Set<? extends Nameserver> getEnabledNameservers()
Gets the set of all nameservers used by all enabled nodes.
-
getDnsMonitor
public ResourceDnsMonitor getDnsMonitor()
Gets the DNS monitor for this resource.
-
getStatus
public ResourceStatus getStatus()
Gets the status of this resource based on disabled, last monitoring results, and synchronization state.
-
getAllowMultiMaster
public abstract boolean getAllowMultiMaster()
Gets if this resource allows multiple master servers.
-
getType
public String getType()
Gets the replication type of this resource.
-
newResourceSynchronizer
protected abstract ResourceSynchronizer<R,RN> newResourceSynchronizer(RN localResourceNode, RN remoteResourceNode, ResourceConfiguration<R,RN> resourceConfiguration) throws AppClusterConfigurationException
Creates the resource synchronizer for this specific type of resource ornullif never performs any synchronization between these two nodes.- Throws:
AppClusterConfigurationException
-
getSynchronizers
public Collection<ResourceSynchronizer<R,RN>> getSynchronizers()
Gets the set of resource synchronizers.
-
getSynchronizerMap
public Map<Node,ResourceSynchronizer<R,RN>> getSynchronizerMap()
Gets a map-view of the resource synchronizers keyed on remote node. If the local node is not part of the resource nodes, returns an empty map.
-
-