|
xmlBlaster 2.2.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xmlBlaster.contrib.replication.ReplSlave
public class ReplSlave
ReplSlave Used Topics:
| Field Summary | |
|---|---|
private java.lang.String |
cascadedReplPrefix
|
private java.lang.String |
cascadedReplSlave
|
private long |
cbQueueEntries
The real amount of entries in the cb queue (not calculated) |
private static java.lang.String |
CONN_CONNECTED
|
private static java.lang.String |
CONN_DISCONNECTED
|
private static java.lang.String |
CONN_STALLED
|
private boolean |
connected
|
private boolean |
countSingleMessages
|
private java.lang.String |
dataTopic
|
private java.lang.String |
dbWatcherSessionName
|
private boolean |
dispatcherActive
|
private boolean |
doTransform
|
private long |
forcedCounter
|
private boolean |
forceSending
|
private Global |
global
|
private java.lang.String |
initialDataTopic
|
private java.lang.String |
initialFilesLocation
|
(package private) boolean |
initialized
|
private java.lang.Object |
initSync
we don't want to sync the check method because the jmx will synchronize on the object too |
private java.lang.String |
lastDispatcherException
|
private java.lang.String |
lastMessage
|
private java.lang.String |
lastMessageKey
|
private static java.util.logging.Logger |
log
|
private ReplManagerPlugin |
manager
|
private java.lang.String |
masterConn
|
private long |
maxChunkSize
|
private int |
maxNumOfEntries
|
private java.lang.String |
maxNumOfEntriesKey
|
private long |
maxReplKey
|
private java.lang.Object |
mbeanHandle
|
private long |
messageSeq
|
private long |
minReplKey
|
private java.lang.String |
name
|
private java.lang.String |
oldReplKeyPropertyName
|
private java.lang.String |
ownVersion
|
private I_Info |
persistentInfo
|
private long |
ptpQueueEntries
used for monitoring: to know how many entries are ptp (normally initial updates) |
private I_Queue |
queue
The queue associated to this slave. |
private long |
queueEntries
|
private java.lang.String |
replPrefix
|
private java.lang.String |
replPrefixGroup
|
private java.lang.String |
sessionName
|
private java.lang.String |
slaveSessionId
|
private java.lang.String |
sqlResponse
|
private java.lang.String |
srcVersion
|
private boolean |
stalled
|
private int |
status
|
private java.lang.String |
statusTopic
|
private int |
tmpStatus
These properties are used to transport the information from the check to the postCheck method. |
private long[] |
transactionSeq
|
private long |
transactionSeqVisible
|
| Fields inherited from interface org.xmlBlaster.contrib.replication.I_ReplSlave |
|---|
CASCADED_REPL_PREFIX, CASCADED_REPL_SLAVE, DBWATCHER_SESSION_NAME, STATUS_INCONSISTENT, STATUS_INITIAL, STATUS_NORMAL, STATUS_TRANSITION, STATUS_UNCONFIGURED |
| Fields inherited from interface org.xmlBlaster.contrib.ContribConstants |
|---|
FILE_DATE, FILENAME_ATTR, FILENAME_ATTR_OLD_FASHION, SUBDIR_ATTR, TIMESTAMP_ATTR, TOPIC_NAME |
| Constructor Summary | |
|---|---|
ReplSlave(Global global,
ReplManagerPlugin manager,
java.lang.String slaveSessionId,
ConnectQosData connQosData)
|
|
| Method Summary | |
|---|---|
void |
cancelInitialUpdate()
TODO fix this since it potentially could delete request from other slaves since the DbWatcher is serving several slaves. |
void |
cancelInitialUpdate(boolean async)
TODO fix this since it potentially could delete request from other slaves since the DbWatcher is serving several slaves. |
private void |
cancelUpdateAsyncPart()
The cancelUpdate is invoked asynchronously to avoid log blocking of the monitor when the cancel operation is going on. |
private void |
changeLastMessage(java.lang.String newMsg)
|
java.util.ArrayList |
check(java.util.List<I_Entry> entries,
I_Queue queue)
|
void |
checkStatus()
Checks on the backend data which has to be displayed on the MBean. |
void |
clearQueue()
|
private long |
clearQueueSync()
|
static byte[] |
decompressQueueEntryContent(ReferenceEntry entry)
|
void |
doContinue(boolean doPersist)
|
void |
doPause(boolean doPersist)
|
private void |
doTransform(MsgUnit msgUnit)
|
java.lang.String |
dumpEntries(int maxNum,
long maxSize,
java.lang.String fileName)
|
java.lang.String |
dumpFirstEntry()
|
private ReplSlave |
getCascaded()
Returns null if the manager is null or if the cascaded object does not exist. |
java.lang.String |
getCascadedConnection()
|
java.lang.String |
getCascadedMasterConnection()
|
long |
getCascadedQueueEntries()
|
java.lang.String |
getCascadedSessionName()
|
java.lang.String |
getCascadedStatus()
|
long |
getCascadedTransactionSeq()
|
java.lang.String |
getCascadedVersion()
|
java.lang.String |
getConnection()
Returns a string telling in which state the connection is. |
private ServerScope |
getEngineGlobal(Global glob)
|
java.lang.String |
getLastMessage()
|
java.lang.String |
getMasterConnection()
|
int |
getMaxNumOfEntries()
|
long |
getMaxReplKey()
|
long |
getMinReplKey()
|
long |
getQueueEntries()
Convenience method enforced by the MBean which returns the number of entries in the queue. |
java.lang.String |
getReplPrefix()
|
java.lang.String |
getReplPrefixGroup()
|
private I_AdminSession |
getSession()
|
java.lang.String |
getSessionName()
|
java.lang.String |
getSqlResponse()
|
java.lang.String |
getStatus()
|
int |
getStatusAsInt()
|
java.lang.String |
getTopic()
|
long |
getTransactionSeq()
|
java.util.Set |
getUsedPropertyKeys()
Gets all property keys which may be used by this object. |
java.lang.String |
getVersion()
|
void |
handleException(java.lang.Throwable ex)
Pauses the dispatcher. |
void |
incrementPtPEntries(long numOfTransactions)
Increments the amount of entries in the ptp counter queue |
void |
init(I_Info info)
The info comes as the client properties of the subscription Qos. |
private void |
initTransactionSequenceIfNeeded(java.lang.String warnText)
This method is needed since in some cases writing operations on the counters can occur before the init method has been invoked. |
boolean |
isActive()
Convenience method enforced by the MBean which returns true if the dispatcher of the slave session is active, false otherwise. |
boolean |
isCascadedActive()
|
boolean |
isCascadedConnected()
|
boolean |
isCascading()
|
boolean |
isConnected()
Convenience method enforced by the MBean which returns true if the real slave is connected or false otherwise. |
boolean |
isCountSingleMsg()
|
boolean |
isStalled()
Convenience method enforced by the MBean which returns true if the connection to the real slave is stalled or false otherwise. |
void |
kill()
|
void |
onDeadLetter(java.util.Map qosClientProperties)
Invoked by the ReplManagerPlugin when a deadMessage is published because an error |
void |
postCheck(MsgUnit[] processedMsgUnits)
|
void |
prepareForRequest(I_Info individualInfo)
This is the first step in the process of requesting the initial Data. |
void |
reactivateDestination(long minReplKey,
long maxReplKey)
6 This is received by the DbWatcher jvm. |
boolean |
reInitiate(I_Info info)
|
java.lang.String |
reInitiateReplication()
|
long |
removeQueueEntries(long entries)
|
void |
requestInitialData(java.lang.String dbWatcherSessionId,
boolean onlyRegister)
Sends a PtP message to the responsible for the initial update (which is the DbWatcher or an object running in the DbWatcher jvm) telling a new initial update has to be initiating. |
boolean |
run(I_Info info,
java.lang.String dbWatcherSessionId,
java.lang.String cascadeReplPrefix,
java.lang.String cascadeSlaveSessionName,
boolean onlyRegister)
Starts a replication |
private void |
sendStatusInformation(java.lang.String status)
|
void |
setCountSingleMsg(boolean countSingleMsg)
|
boolean |
setDispatcher(boolean status)
|
boolean |
setDispatcher(boolean status,
boolean doPersist)
|
void |
setMaxNumOfEntries(int maxNumOfEntries)
Sets the maximum number of entries to be sent in one single message. |
private void |
setMaxReplKey(long replKey,
long[] transKey,
long msgKey,
long minReplKey,
long ptpQueueEntries)
Note that the transKey shall not be the transactionSeq instance otherwise it will never detect a change |
void |
setSqlResponse(java.lang.String sqlResponse)
|
private void |
setStatus(int status)
|
void |
shutdown()
|
private void |
startCascadedAndChangeStatus()
|
private java.lang.String |
storeChunkLocally(ReferenceEntry entry,
ClientProperty location,
ClientProperty subDirProp)
Returns the name of the directory where the entries have been stored. |
boolean |
toggleActive()
Toggles the dispatcher from active to inactive or vice versa. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static java.util.logging.Logger log
private static final java.lang.String CONN_STALLED
private static final java.lang.String CONN_CONNECTED
private static final java.lang.String CONN_DISCONNECTED
private java.lang.String slaveSessionId
private java.lang.String name
private java.lang.String statusTopic
private java.lang.String dataTopic
private Global global
boolean initialized
private long minReplKey
private long maxReplKey
private int status
private java.lang.Object mbeanHandle
private java.lang.String sqlResponse
private boolean forceSending
private I_Info persistentInfo
private java.lang.String oldReplKeyPropertyName
private java.lang.String dbWatcherSessionName
private ReplManagerPlugin manager
private java.lang.String replPrefix
private java.lang.String replPrefixGroup
private java.lang.String cascadedReplSlave
private java.lang.String cascadedReplPrefix
private long forcedCounter
private java.lang.String ownVersion
private java.lang.String srcVersion
private boolean doTransform
private java.lang.String initialFilesLocation
private java.lang.String lastMessage
private java.lang.String lastDispatcherException
private boolean dispatcherActive
private long queueEntries
private boolean connected
private java.lang.String sessionName
private long[] transactionSeq
private long messageSeq
private long transactionSeqVisible
private int tmpStatus
private java.lang.String lastMessageKey
private long maxChunkSize
private java.lang.String masterConn
private java.lang.Object initSync
private I_Queue queue
private boolean stalled
private long ptpQueueEntries
private java.lang.String initialDataTopic
private long cbQueueEntries
private boolean countSingleMessages
private int maxNumOfEntries
private java.lang.String maxNumOfEntriesKey
| Constructor Detail |
|---|
public ReplSlave(Global global,
ReplManagerPlugin manager,
java.lang.String slaveSessionId,
ConnectQosData connQosData)
throws XmlBlasterException
XmlBlasterException| Method Detail |
|---|
public java.lang.String getTopic()
getTopic in interface ReplSlaveMBeanpublic long getMinReplKey()
getMinReplKey in interface ReplSlaveMBeanpublic long getMaxReplKey()
getMaxReplKey in interface ReplSlaveMBeanpublic int getStatusAsInt()
getStatusAsInt in interface I_ReplSlavepublic java.lang.String getStatus()
getStatus in interface I_ReplSlavegetStatus in interface ReplSlaveMBean
public void init(I_Info info)
throws java.lang.Exception
init in interface I_ContribPluginjava.lang.Exceptionprivate void initTransactionSequenceIfNeeded(java.lang.String warnText)
warnText - if null no warning will be written, otherwise the specified text will be output as a warning.private final void setStatus(int status)
private final void setMaxReplKey(long replKey,
long[] transKey,
long msgKey,
long minReplKey,
long ptpQueueEntries)
replKey - transKey - msgKey - minReplKey -
public boolean reInitiate(I_Info info)
throws java.lang.Exception
reInitiate in interface I_ReplSlavejava.lang.Exception
public boolean run(I_Info info,
java.lang.String dbWatcherSessionId,
java.lang.String cascadeReplPrefix,
java.lang.String cascadeSlaveSessionName,
boolean onlyRegister)
throws java.lang.Exception
I_ReplSlave
run in interface I_ReplSlaveinfo - dbWatcherSessionId - cascadeReplPrefix - cascadeSlaveSessionName - onlyRegister - if true it only registers for initial update but does not execute it yet.
It will wait for a further (common) start message.
java.lang.Exception
public void prepareForRequest(I_Info individualInfo)
throws java.lang.Exception
prepareForRequest in interface I_ReplSlavejava.lang.ExceptionI_ReplSlave.prepareForRequest(I_Info)
private void sendStatusInformation(java.lang.String status)
throws java.lang.Exception
java.lang.Exception
public void requestInitialData(java.lang.String dbWatcherSessionId,
boolean onlyRegister)
throws java.lang.Exception
requestInitialData in interface I_ReplSlavejava.lang.Exceptionorg.xmlBlaster.contrib.replication.I_ReplSlave#requestInitialData()private ServerScope getEngineGlobal(Global glob)
private I_AdminSession getSession()
throws java.lang.Exception
java.lang.Exception
public void reactivateDestination(long minReplKey,
long maxReplKey)
throws java.lang.Exception
I_ReplSlave
reactivateDestination in interface I_ReplSlaveminReplKey - the replication key taken before initiating the db side
operation on the master.maxReplKey - the replication key taken after initiating the db side
operation on the master.
java.lang.Exceptionorg.xmlBlaster.contrib.replication.I_ReplSlave#reactivateDestination()public void shutdown()
shutdown in interface I_ContribPluginorg.xmlBlaster.contrib.dbwriter.I_ContribPlugin#shutdown()
private final void doTransform(MsgUnit msgUnit)
throws java.lang.Exception
java.lang.Exception
private java.lang.String storeChunkLocally(ReferenceEntry entry,
ClientProperty location,
ClientProperty subDirProp)
throws java.lang.Exception
entry - The entry to add as a chunk.location - The location where to add it.subDirProp -
java.lang.Exceptionprivate void changeLastMessage(java.lang.String newMsg)
newMsg - If newMsg is null, it cleans the message otherwise the behaviour depens on doAdddoAdd - if true, the message is added to the current message, if false it is replaced.
public java.util.ArrayList check(java.util.List<I_Entry> entries,
I_Queue queue)
throws java.lang.Exception
check in interface I_ReplSlavejava.lang.Exception
private final void startCascadedAndChangeStatus()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getSqlResponse()
getSqlResponse in interface ReplSlaveMBeanpublic void setSqlResponse(java.lang.String sqlResponse)
setSqlResponse in interface I_ReplSlavesqlResponse - The sqlResponse to set.public java.util.Set getUsedPropertyKeys()
I_ContribPlugin
getUsedPropertyKeys in interface I_ContribPluginI_ContribPlugin.getUsedPropertyKeys()public boolean setDispatcher(boolean status)
setDispatcher in interface I_ReplSlave
public final boolean setDispatcher(boolean status,
boolean doPersist)
throws java.lang.Exception
setDispatcher in interface I_ReplSlavejava.lang.Exception
public void doContinue(boolean doPersist)
throws java.lang.Exception
java.lang.Exceptionorg.xmlBlaster.contrib.replication.ReplSlaveMBean#doContinue()
public void doPause(boolean doPersist)
throws java.lang.Exception
java.lang.Exceptionorg.xmlBlaster.contrib.replication.ReplSlaveMBean#doPause()public void handleException(java.lang.Throwable ex)
I_ReplSlave
handleException in interface I_ReplSlave
public boolean toggleActive()
throws java.lang.Exception
toggleActive in interface ReplSlaveMBeanjava.lang.ExceptionReplSlaveMBean.toggleActive()
public void cancelInitialUpdate(boolean async)
throws java.lang.Exception
cancelInitialUpdate in interface I_ReplSlavejava.lang.Exception
public void cancelInitialUpdate()
throws java.lang.Exception
cancelInitialUpdate in interface ReplSlaveMBeanjava.lang.Exceptionprivate void cancelUpdateAsyncPart()
private long clearQueueSync()
public void clearQueue()
throws java.lang.Exception
clearQueue in interface ReplSlaveMBeanjava.lang.Exception
public long removeQueueEntries(long entries)
throws java.lang.Exception
removeQueueEntries in interface ReplSlaveMBeanjava.lang.Exception
public void kill()
throws java.lang.Exception
kill in interface ReplSlaveMBeanjava.lang.Exception
public java.lang.String reInitiateReplication()
throws java.lang.Exception
reInitiateReplication in interface ReplSlaveMBeanjava.lang.Exceptionpublic java.lang.String getReplPrefix()
getReplPrefix in interface I_ReplSlavegetReplPrefix in interface ReplSlaveMBeanpublic java.lang.String getReplPrefixGroup()
getReplPrefixGroup in interface ReplSlaveMBeanpublic java.lang.String getVersion()
getVersion in interface ReplSlaveMBeanpublic boolean isActive()
isActive in interface ReplSlaveMBeanpublic long getQueueEntries()
getQueueEntries in interface ReplSlaveMBeanpublic boolean isConnected()
isConnected in interface ReplSlaveMBeanpublic boolean isStalled()
public java.lang.String getSessionName()
getSessionName in interface I_ReplSlavegetSessionName in interface ReplSlaveMBeanpublic java.lang.String getLastMessage()
getLastMessage in interface ReplSlaveMBeanpublic void checkStatus()
I_ReplSlave
checkStatus in interface I_ReplSlave
public void postCheck(MsgUnit[] processedMsgUnits)
throws java.lang.Exception
postCheck in interface I_ReplSlavejava.lang.Exceptionpublic long getTransactionSeq()
getTransactionSeq in interface ReplSlaveMBeanpublic static byte[] decompressQueueEntryContent(ReferenceEntry entry)
public java.lang.String dumpEntries(int maxNum,
long maxSize,
java.lang.String fileName)
dumpEntries in interface ReplSlaveMBeanpublic java.lang.String dumpFirstEntry()
dumpFirstEntry in interface ReplSlaveMBeanprivate ReplSlave getCascaded()
public boolean isCascading()
isCascading in interface ReplSlaveMBeanpublic java.lang.String getCascadedSessionName()
getCascadedSessionName in interface ReplSlaveMBeanpublic long getCascadedQueueEntries()
getCascadedQueueEntries in interface ReplSlaveMBeanpublic long getCascadedTransactionSeq()
getCascadedTransactionSeq in interface ReplSlaveMBeanpublic java.lang.String getCascadedStatus()
getCascadedStatus in interface ReplSlaveMBeanpublic boolean isCascadedActive()
isCascadedActive in interface ReplSlaveMBeanpublic boolean isCascadedConnected()
isCascadedConnected in interface ReplSlaveMBeanpublic java.lang.String getCascadedVersion()
getCascadedVersion in interface ReplSlaveMBeanpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getConnection()
getConnection in interface ReplSlaveMBeanpublic java.lang.String getMasterConnection()
getMasterConnection in interface ReplSlaveMBeanpublic java.lang.String getCascadedConnection()
getCascadedConnection in interface ReplSlaveMBeanpublic java.lang.String getCascadedMasterConnection()
getCascadedMasterConnection in interface ReplSlaveMBeanpublic void incrementPtPEntries(long numOfTransactions)
I_ReplSlave
incrementPtPEntries in interface I_ReplSlavepublic void setCountSingleMsg(boolean countSingleMsg)
setCountSingleMsg in interface ReplSlaveMBeanpublic boolean isCountSingleMsg()
isCountSingleMsg in interface ReplSlaveMBeanpublic int getMaxNumOfEntries()
getMaxNumOfEntries in interface I_ReplSlavegetMaxNumOfEntries in interface ReplSlaveMBeanpublic void setMaxNumOfEntries(int maxNumOfEntries)
setMaxNumOfEntries in interface ReplSlaveMBeanpublic void onDeadLetter(java.util.Map qosClientProperties)
I_ReplSlave
onDeadLetter in interface I_ReplSlave
|
xmlBlaster 2.2.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||