|
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 ReplSlaveMBean
public long getMinReplKey()
getMinReplKey
in interface ReplSlaveMBean
public long getMaxReplKey()
getMaxReplKey
in interface ReplSlaveMBean
public int getStatusAsInt()
getStatusAsInt
in interface I_ReplSlave
public java.lang.String getStatus()
getStatus
in interface I_ReplSlave
getStatus
in interface ReplSlaveMBean
public void init(I_Info info) throws java.lang.Exception
init
in interface I_ContribPlugin
java.lang.Exception
private 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_ReplSlave
java.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_ReplSlave
info
- 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_ReplSlave
java.lang.Exception
I_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_ReplSlave
java.lang.Exception
org.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_ReplSlave
minReplKey
- 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.Exception
org.xmlBlaster.contrib.replication.I_ReplSlave#reactivateDestination()
public void shutdown()
shutdown
in interface I_ContribPlugin
org.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.Exception
private 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_ReplSlave
java.lang.Exception
private final void startCascadedAndChangeStatus() throws java.lang.Exception
java.lang.Exception
public java.lang.String getSqlResponse()
getSqlResponse
in interface ReplSlaveMBean
public void setSqlResponse(java.lang.String sqlResponse)
setSqlResponse
in interface I_ReplSlave
sqlResponse
- The sqlResponse to set.public java.util.Set getUsedPropertyKeys()
I_ContribPlugin
getUsedPropertyKeys
in interface I_ContribPlugin
I_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_ReplSlave
java.lang.Exception
public void doContinue(boolean doPersist) throws java.lang.Exception
java.lang.Exception
org.xmlBlaster.contrib.replication.ReplSlaveMBean#doContinue()
public void doPause(boolean doPersist) throws java.lang.Exception
java.lang.Exception
org.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 ReplSlaveMBean
java.lang.Exception
ReplSlaveMBean.toggleActive()
public void cancelInitialUpdate(boolean async) throws java.lang.Exception
cancelInitialUpdate
in interface I_ReplSlave
java.lang.Exception
public void cancelInitialUpdate() throws java.lang.Exception
cancelInitialUpdate
in interface ReplSlaveMBean
java.lang.Exception
private void cancelUpdateAsyncPart()
private long clearQueueSync()
public void clearQueue() throws java.lang.Exception
clearQueue
in interface ReplSlaveMBean
java.lang.Exception
public long removeQueueEntries(long entries) throws java.lang.Exception
removeQueueEntries
in interface ReplSlaveMBean
java.lang.Exception
public void kill() throws java.lang.Exception
kill
in interface ReplSlaveMBean
java.lang.Exception
public java.lang.String reInitiateReplication() throws java.lang.Exception
reInitiateReplication
in interface ReplSlaveMBean
java.lang.Exception
public java.lang.String getReplPrefix()
getReplPrefix
in interface I_ReplSlave
getReplPrefix
in interface ReplSlaveMBean
public java.lang.String getReplPrefixGroup()
getReplPrefixGroup
in interface ReplSlaveMBean
public java.lang.String getVersion()
getVersion
in interface ReplSlaveMBean
public boolean isActive()
isActive
in interface ReplSlaveMBean
public long getQueueEntries()
getQueueEntries
in interface ReplSlaveMBean
public boolean isConnected()
isConnected
in interface ReplSlaveMBean
public boolean isStalled()
public java.lang.String getSessionName()
getSessionName
in interface I_ReplSlave
getSessionName
in interface ReplSlaveMBean
public java.lang.String getLastMessage()
getLastMessage
in interface ReplSlaveMBean
public void checkStatus()
I_ReplSlave
checkStatus
in interface I_ReplSlave
public void postCheck(MsgUnit[] processedMsgUnits) throws java.lang.Exception
postCheck
in interface I_ReplSlave
java.lang.Exception
public long getTransactionSeq()
getTransactionSeq
in interface ReplSlaveMBean
public static byte[] decompressQueueEntryContent(ReferenceEntry entry)
public java.lang.String dumpEntries(int maxNum, long maxSize, java.lang.String fileName)
dumpEntries
in interface ReplSlaveMBean
public java.lang.String dumpFirstEntry()
dumpFirstEntry
in interface ReplSlaveMBean
private ReplSlave getCascaded()
public boolean isCascading()
isCascading
in interface ReplSlaveMBean
public java.lang.String getCascadedSessionName()
getCascadedSessionName
in interface ReplSlaveMBean
public long getCascadedQueueEntries()
getCascadedQueueEntries
in interface ReplSlaveMBean
public long getCascadedTransactionSeq()
getCascadedTransactionSeq
in interface ReplSlaveMBean
public java.lang.String getCascadedStatus()
getCascadedStatus
in interface ReplSlaveMBean
public boolean isCascadedActive()
isCascadedActive
in interface ReplSlaveMBean
public boolean isCascadedConnected()
isCascadedConnected
in interface ReplSlaveMBean
public java.lang.String getCascadedVersion()
getCascadedVersion
in interface ReplSlaveMBean
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getConnection()
getConnection
in interface ReplSlaveMBean
public java.lang.String getMasterConnection()
getMasterConnection
in interface ReplSlaveMBean
public java.lang.String getCascadedConnection()
getCascadedConnection
in interface ReplSlaveMBean
public java.lang.String getCascadedMasterConnection()
getCascadedMasterConnection
in interface ReplSlaveMBean
public void incrementPtPEntries(long numOfTransactions)
I_ReplSlave
incrementPtPEntries
in interface I_ReplSlave
public void setCountSingleMsg(boolean countSingleMsg)
setCountSingleMsg
in interface ReplSlaveMBean
public boolean isCountSingleMsg()
isCountSingleMsg
in interface ReplSlaveMBean
public int getMaxNumOfEntries()
getMaxNumOfEntries
in interface I_ReplSlave
getMaxNumOfEntries
in interface ReplSlaveMBean
public void setMaxNumOfEntries(int maxNumOfEntries)
setMaxNumOfEntries
in interface ReplSlaveMBean
public 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 |