public abstract class AbstractWanPublisher extends Object implements com.hazelcast.wan.WanReplicationPublisher, WanReplicationEndpoint, com.hazelcast.spi.LiveOperationsTracker
| Modifier and Type | Field and Description |
|---|---|
protected WanConfigurationContext |
configurationContext |
protected PublisherQueueContainer |
eventQueueContainer |
protected long |
lastQueueFullLogTimeMs |
protected String |
localGroupName |
protected com.hazelcast.logging.ILogger |
logger |
protected com.hazelcast.instance.Node |
node |
protected boolean |
paused |
protected int |
queueCapacity |
protected com.hazelcast.config.WANQueueFullBehavior |
queueFullBehavior |
protected int |
queueLoggerTimePeriodMs |
protected boolean |
running |
protected BlockingQueue<com.hazelcast.wan.WanReplicationEvent> |
stagingQueue
Queue for multiplexed map/cache partition WAN events that are about to
be transmitted to the target cluster
|
protected WanSyncManager |
syncManager |
protected BlockingQueue<WanSyncEvent> |
syncRequests |
protected String |
targetGroupName |
protected String |
wanReplicationName |
| Constructor and Description |
|---|
AbstractWanPublisher() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCacheQueue(String name,
int partitionId,
WanReplicationEventQueue eventQueue) |
void |
addMapQueue(String name,
int partitionId,
WanReplicationEventQueue eventQueue) |
protected void |
afterShutdown() |
void |
checkWanReplicationQueues() |
void |
clearQueues() |
void |
collectAllServiceNamespaces(com.hazelcast.spi.PartitionReplicationEvent event,
Set<com.hazelcast.spi.ServiceNamespace> namespaces)
Collect the namespaces of all queues that should be replicated by the replication event.
|
void |
collectReplicationData(String wanReplicationName,
com.hazelcast.spi.PartitionReplicationEvent event,
Collection<com.hazelcast.spi.ServiceNamespace> namespaces,
EWRMigrationContainer migrationDataContainer)
Collect all replication data for the specific replication event and collection of namespaces being replicated.
|
protected void |
decrementWANQueueSize(int delta) |
int |
getCurrentBackupElementCount() |
int |
getCurrentElementCount()
Returns the count for the number of events currently in the WAN
map/cache partition queues for partitions owned by this node.
|
protected int |
getPartitionId(Object key) |
PublisherQueueContainer |
getPublisherQueueContainer() |
int |
getStagingQueueSize() |
com.hazelcast.monitor.LocalWanPublisherStats |
getStats()
Gathers statistics of related
WanReplicationEndpoint instance. |
String |
getTargetGroupName() |
void |
init(com.hazelcast.instance.Node node,
com.hazelcast.config.WanReplicationConfig wanReplicationConfig,
com.hazelcast.config.WanPublisherConfig publisherConfig)
Initializes the endpoint using the given arguments.
|
abstract boolean |
isConnected()
Tests is there is at least one alive connection to a configured
target cluster member over WAN.
|
void |
pause()
Calls to this method will pause WAN event queue polling.
|
void |
populate(com.hazelcast.spi.LiveOperations liveOperations) |
void |
publishReplicationEvent(String serviceName,
com.hazelcast.wan.ReplicationEventObject eventObject) |
void |
publishReplicationEvent(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent)
This implementation achieves ordering of keys in the same partition by
sending
EWRPutOperation to the partition owner. |
void |
publishReplicationEventBackup(String serviceName,
com.hazelcast.wan.ReplicationEventObject eventObject) |
void |
publishSyncEvent(WanSyncEvent event)
Publishes a wan sync event for all or a specific map and for all or some partitions.
|
void |
putBackup(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent) |
void |
removeBackup(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent)
Remove the oldest replication event from the replication queue and decrease the
backup event count.
|
void |
removeReplicationEvent(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent)
Updates the WAN statistics (remaining map sync events, synced partitions, queued event count, latencies, sent events)
and removes the backup events on the replicas.
|
void |
resume()
This method re-enables WAN event queue polling for a paused
WanReplicationEndpoint instance. |
void |
shutdown()
Closes the endpoint and its internal connections and shuts down other internal states.
|
protected volatile boolean running
protected volatile boolean paused
protected String targetGroupName
protected String localGroupName
protected String wanReplicationName
protected com.hazelcast.instance.Node node
protected WanSyncManager syncManager
protected int queueCapacity
protected com.hazelcast.config.WANQueueFullBehavior queueFullBehavior
protected volatile long lastQueueFullLogTimeMs
protected int queueLoggerTimePeriodMs
protected PublisherQueueContainer eventQueueContainer
protected BlockingQueue<com.hazelcast.wan.WanReplicationEvent> stagingQueue
protected BlockingQueue<WanSyncEvent> syncRequests
protected WanConfigurationContext configurationContext
protected com.hazelcast.logging.ILogger logger
public void init(com.hazelcast.instance.Node node,
com.hazelcast.config.WanReplicationConfig wanReplicationConfig,
com.hazelcast.config.WanPublisherConfig publisherConfig)
WanReplicationEndpointinit in interface WanReplicationEndpointnode - the current node that tries to connectwanReplicationConfig - WanReplicationConfig configpublisherConfig - this endpoint will be initialized using this WanPublisherConfig instancepublic int getStagingQueueSize()
protected int getPartitionId(Object key)
public void publishReplicationEvent(String serviceName, com.hazelcast.wan.ReplicationEventObject eventObject)
publishReplicationEvent in interface com.hazelcast.wan.WanReplicationPublisherpublic void publishReplicationEventBackup(String serviceName, com.hazelcast.wan.ReplicationEventObject eventObject)
publishReplicationEventBackup in interface com.hazelcast.wan.WanReplicationPublisherpublic void removeReplicationEvent(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent)
wanReplicationEvent - the completed replication eventcom.hazelcast.nio.serialization.HazelcastSerializationException - when the event fails to serializationprotected void decrementWANQueueSize(int delta)
public void removeBackup(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent)
WanReplicationEndpointwanReplicationEvent.removeBackup in interface WanReplicationEndpointwanReplicationEvent - the completed wan eventpublic void putBackup(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent)
putBackup in interface WanReplicationEndpointpublic PublisherQueueContainer getPublisherQueueContainer()
getPublisherQueueContainer in interface WanReplicationEndpointpublic void addMapQueue(String name, int partitionId, WanReplicationEventQueue eventQueue)
addMapQueue in interface WanReplicationEndpointpublic void addCacheQueue(String name, int partitionId, WanReplicationEventQueue eventQueue)
addCacheQueue in interface WanReplicationEndpointpublic final void shutdown()
WanReplicationEndpointshutdown in interface WanReplicationEndpointprotected void afterShutdown()
public void pause()
WanReplicationEndpointWanReplicationEndpoint instance.
WAN events will still be offered to WAN replication
queues but they won't be polled.
Calling this method on already paused WanReplicationEndpoint instances will have no effect.pause in interface WanReplicationEndpointpublic void resume()
WanReplicationEndpointWanReplicationEndpoint instance.
Calling this method on already running WanReplicationEndpoint instances will have no effect.resume in interface WanReplicationEndpointWanReplicationEndpoint.pause()public com.hazelcast.monitor.LocalWanPublisherStats getStats()
WanReplicationEndpointWanReplicationEndpoint instance. This method will always return the
same instance.getStats in interface WanReplicationEndpointLocalWanPublisherStatspublic abstract boolean isConnected()
true if there is at least one alive connection, false otherwisepublic void checkWanReplicationQueues()
checkWanReplicationQueues in interface WanReplicationEndpointcheckWanReplicationQueues in interface com.hazelcast.wan.WanReplicationPublisherpublic void publishReplicationEvent(com.hazelcast.wan.WanReplicationEvent wanReplicationEvent)
EWRPutOperation to the partition owner. The partition ID
is equal to the partition for the key contained in the wanReplicationEvent.publishReplicationEvent in interface com.hazelcast.wan.WanReplicationPublisherwanReplicationEvent - the WAN event to publishpublic String getTargetGroupName()
public void populate(com.hazelcast.spi.LiveOperations liveOperations)
populate in interface com.hazelcast.spi.LiveOperationsTrackerpublic void publishSyncEvent(WanSyncEvent event)
WanReplicationEndpointpublishSyncEvent in interface WanReplicationEndpointevent - the wan sync requestpublic void clearQueues()
clearQueues in interface WanReplicationEndpointpublic void collectAllServiceNamespaces(com.hazelcast.spi.PartitionReplicationEvent event,
Set<com.hazelcast.spi.ServiceNamespace> namespaces)
WanReplicationEndpointcollectAllServiceNamespaces in interface WanReplicationEndpointevent - the replication eventnamespaces - the set in which namespaces should be addedpublic void collectReplicationData(String wanReplicationName, com.hazelcast.spi.PartitionReplicationEvent event, Collection<com.hazelcast.spi.ServiceNamespace> namespaces, EWRMigrationContainer migrationDataContainer)
WanReplicationEndpointcollectReplicationData in interface WanReplicationEndpointwanReplicationName - the WAN replication name in the hazelcast configuration for this endpointevent - the replication eventnamespaces - the object namespaces which are being replicatedmigrationDataContainer - the container for the migration datapublic int getCurrentElementCount()
public int getCurrentBackupElementCount()
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.