Class AMQPFederationPolicyManager
java.lang.Object
org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederationPolicyManager
- Direct Known Subclasses:
AMQPFederationLocalPolicyManager, AMQPFederationRemotePolicyManager
Base Federation policy manager that declares some common APIs that address or queue policy managers must provide
implementations for.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final AMQPFederationprotected final AMQPFederationMetricsprotected final Stringprotected final FederationTypeprotected final org.apache.activemq.artemis.core.server.ActiveMQServerprotected AMQPSessionContextprotected AMQPFederationPolicyManager.State -
Constructor Summary
ConstructorsConstructorDescriptionAMQPFederationPolicyManager(AMQPFederation federation, AMQPFederationMetrics metrics, String policyName, FederationType policyType) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidCalled by the parent federation instance when the connection has failed and this federation should tear down any active resources and await a reconnect if one is allowed.final voidCalled by the parent federation instance when the connection has been established and this policy manager should build up its active state based on the configuration.protected final voidChecks if shut down already and throws anIllegalStateExceptionif so.Returns theAMQPFederationinstance that owns this policy manager.Returns the metrics instance tied to this federation policy manager instance.final StringReturns the assigned name of the policy that is being managed.final FederationTypeReturns the federation type this policy manager implements.protected abstract voidOn connection interrupted a federation policy manager needs to perform any specific actions to pause of cleanup current resources based on the connection being closed.protected abstract voidOn connection restoration a federation policy manager needs to perform any specific actions to resume service based on a new connection having been established.protected abstract voidOn initialize a federation policy manager needs to perform any specific initialization actions it requires to begin tracking broker resources.protected abstract voidOn shutdown a federation policy manager needs to perform any specific shutdown actions it requires to cease tracking broker resources.protected abstract voidOn start a federation policy manager needs to perform any specific startup actions it requires to begin tracking broker resources.protected abstract voidOn stop a federation policy manager needs to perform any specific stopped actions it requires to cease tracking broker resources and cleanup.final voidprotected final booleanisActive()This method must always be called under lock to ensure the state returned is accurate.protected final booleanThis method must be called under lock to ensure the returned state is accurate.final booleanReturnstrueif the policy is started at the time this method was called.final voidshutdown()Shutdown the manager and cleanup any in use resources.final voidstart()Start the federation policy manager which will initiate a scan of all broker bindings and create and matching remote receivers.final voidstop()Stops the queue policy manager which will close any open remote receivers that are active for local queue demand.
-
Field Details
-
metrics
-
server
protected final org.apache.activemq.artemis.core.server.ActiveMQServer server -
federation
-
policyName
-
policyType
-
state
-
connected
protected boolean connected -
session
-
-
Constructor Details
-
AMQPFederationPolicyManager
public AMQPFederationPolicyManager(AMQPFederation federation, AMQPFederationMetrics metrics, String policyName, FederationType policyType)
-
-
Method Details
-
initialize
public final void initialize() -
start
public final void start()Start the federation policy manager which will initiate a scan of all broker bindings and create and matching remote receivers. Start on a policy manager should only be called after its parentFederationis started and the federation connection has been established. -
stop
public final void stop()Stops the queue policy manager which will close any open remote receivers that are active for local queue demand. Stop should generally be called whenever the parentFederationloses its connection to the remote. -
shutdown
public final void shutdown()Shutdown the manager and cleanup any in use resources. -
isStarted
public final boolean isStarted()Returnstrueif the policy is started at the time this method was called.- Returns:
trueif the policy is started at the time this method was called
-
getMetrics
Returns the metrics instance tied to this federation policy manager instance.- Returns:
- the metrics instance tied to this federation policy manager instance
-
getPolicyType
Returns the federation type this policy manager implements.- Returns:
- the federation type this policy manager implements
-
getPolicyName
Returns the assigned name of the policy that is being managed.- Returns:
- the assigned name of the policy that is being managed
-
getFederation
Returns theAMQPFederationinstance that owns this policy manager.- Returns:
- the
AMQPFederationinstance that owns this policy manager
-
connectionInterrupted
public final void connectionInterrupted()Called by the parent federation instance when the connection has failed and this federation should tear down any active resources and await a reconnect if one is allowed. -
connectionRestored
public final void connectionRestored()Called by the parent federation instance when the connection has been established and this policy manager should build up its active state based on the configuration. -
failIfShutdown
Checks if shut down already and throws anIllegalStateExceptionif so.- Throws:
IllegalStateException
-
isActive
protected final boolean isActive()This method must always be called under lock to ensure the state returned is accurate.- Returns:
trueif the policy manager is both started and the connected state istrue
-
isConnected
protected final boolean isConnected()This method must be called under lock to ensure the returned state is accurate.- Returns:
- the state of the connected flag based on the last update from the connection APIs
-
handleManagerInitialized
protected abstract void handleManagerInitialized()On initialize a federation policy manager needs to perform any specific initialization actions it requires to begin tracking broker resources. -
handleManagerStarted
protected abstract void handleManagerStarted()On start a federation policy manager needs to perform any specific startup actions it requires to begin tracking broker resources. -
handleManagerStopped
protected abstract void handleManagerStopped()On stop a federation policy manager needs to perform any specific stopped actions it requires to cease tracking broker resources and cleanup. -
handleManagerShutdown
protected abstract void handleManagerShutdown()On shutdown a federation policy manager needs to perform any specific shutdown actions it requires to cease tracking broker resources. -
handleConnectionInterrupted
protected abstract void handleConnectionInterrupted()On connection interrupted a federation policy manager needs to perform any specific actions to pause of cleanup current resources based on the connection being closed. -
handleConnectionRestored
protected abstract void handleConnectionRestored()On connection restoration a federation policy manager needs to perform any specific actions to resume service based on a new connection having been established.
-