|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.StandardMBean org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase org.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase
A DistributedVirtualDatabase
is a virtual database hosted by
several controllers. Communication between the controllers is achieved with
reliable multicast provided by Javagroups.
Nested Class Summary |
Nested classes inherited from class javax.management.StandardMBean |
|
Field Summary | |
private java.util.ArrayList |
allMemberButUs
|
private java.util.Hashtable |
backendsPerController
Tribe Member --> ArrayList[BackendInfo] |
private org.objectweb.tribe.channel.ReliableGroupChannelWithGms |
channel
JGroups channel |
private java.util.Hashtable |
controllersMap
Controller name mapping: Member --> controller JMX name |
private org.objectweb.tribe.common.Group |
currentGroup
|
private static Trace |
distributedRequestLogger
Logger for distributed request execution |
private DistributedRequestManager |
distributedRequestManager
Our view of the request manager, same as super.requestManager, only just typed properly. |
private java.lang.String |
groupName
Group name |
private static long |
INCOMPATIBLE_CONFIGURATION
|
private boolean |
isVirtualDatabaseStarted
|
private org.objectweb.tribe.adapters.MulticastRequestAdapter |
multicastRequestAdapter
MessageDispatcher to communicate with the group |
Fields inherited from class org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase |
authenticationManager, backends, CHECK_BACKEND_DISABLE, CHECK_BACKEND_ENABLE, controller, currentNbOfThreads, logger, maxNbOfConnections, maxNbOfThreads, maxThreadIdleTime, metadata, minNbOfThreads, name, NO_CHECK_BACKEND, poolConnectionThreads, requestLogger, requestManager, rwLock, totalOrderQueue |
Fields inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean |
|
Fields inherited from class javax.management.StandardMBean |
|
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent |
DOCTYPE_CONTROLLER, DOCTYPE_DB, XML_VERSION |
Constructor Summary | |
DistributedVirtualDatabase(Controller controller,
java.lang.String name,
java.lang.String groupName,
int maxConnections,
boolean pool,
int minThreads,
int maxThreads,
long maxThreadIdleTime,
int sqlShortFormLength,
AbstractBlobFilter blobFilter)
Creates a new DistributedVirtualDatabase instance. |
Method Summary | |
void |
addBackend(DatabaseBackend db)
Add a backend to this virtual database. |
void |
addRemoteController(org.objectweb.tribe.common.Member remoteControllerMembership,
java.lang.String remoteControllerJmxName)
Add a new controller name to the controllerMap list and refresh the group membership. |
private void |
broadcastBackendInformation(java.util.ArrayList dest)
Broadcast backend information among controllers. |
private long |
checkConfigurationCompatibilityAndReturnControllerId(java.util.ArrayList dest)
Send the configuration of this controller to remote controller. |
void |
copyDump(java.lang.String dumpName,
java.lang.String remoteControllerName)
What this method does is really initiating the copy. |
void |
copyLogFromCheckpoint(java.lang.String dumpName,
java.lang.String controllerName)
Copies a chunk of the local virtual database recovery log onto a remote controller's peer virtual database log. |
BackendInfo |
createBackendInfo(DatabaseBackend backend,
boolean useXml)
Create backend information object from a DatabaseBackend object. |
boolean |
equals(java.lang.Object other)
Two virtual databases are equal if they have the same name, login and password. |
void |
failedMember(org.objectweb.tribe.common.Member failed,
org.objectweb.tribe.common.GroupIdentifier gid,
org.objectweb.tribe.common.Member sender)
|
protected void |
finalize()
Disconnect the channel and close it. |
java.util.ArrayList |
getAllMemberButUs()
Returns the list of all members in the group except us. |
java.util.ArrayList |
getAllMembers()
Synchronized access to current group members. |
java.util.ArrayList |
getBackendsInfo(java.util.ArrayList backendsObject)
We have to convert the backends list from an array of DatabaseBackend object to an ArrayList of
BackendInfo objects. |
void |
getBackendStatus()
Get the status of all remote controllers |
org.objectweb.tribe.channel.ReliableGroupChannelWithGms |
getChannel()
Get the group channel used for group communications |
private org.objectweb.tribe.common.Member |
getControllerByName(java.lang.String controllerName)
Gets a Controller specified by its name as a Member object suitable for group communication. |
java.lang.String |
getControllerName()
Returns the controllerName value. |
org.objectweb.tribe.common.Group |
getCurrentGroup()
Returns the currentGroup value. |
protected java.lang.String |
getDistributionXml()
Get the XML dump of the Distribution element if any. |
java.lang.String |
getGroupName()
Returns the group name this virtual database belongs to. |
org.objectweb.tribe.adapters.MulticastRequestAdapter |
getMulticastRequestAdapter()
Return the group communication multicast request adapter. |
private RecoveryLog |
getRecoveryLog()
|
void |
groupComposition(org.objectweb.tribe.common.Group g,
org.objectweb.tribe.common.Address sender)
|
private void |
handleBackendStatus(BackendStatus msg,
org.objectweb.tribe.common.Member sender)
Handles BackendStatus messages. |
private java.io.Serializable |
handleBackendTransfer(BackendTransfer msg)
Handles BackendTransfer messages. |
private void |
handleCopyLogEntry(CopyLogEntry msg)
Handle CopyLogEntry messages. |
private void |
handleDisableBackend(DisableBackend msg,
org.objectweb.tribe.common.Member sender)
Handles DisableBackend messages. |
private void |
handleEnableBackend(EnableBackend msg,
org.objectweb.tribe.common.Member sender)
Handles EnableBackend messages. |
private void |
handleInitiateDumpCopy(InitiateDumpCopy msg)
|
java.io.Serializable |
handleMessageMultiThreaded(java.io.Serializable msg,
org.objectweb.tribe.common.Member sender,
java.lang.Object handleMessageSingleThreadedResult)
|
java.lang.Object |
handleMessageSingleThreaded(java.io.Serializable msg,
org.objectweb.tribe.common.Member sender)
This method handle the scheduling part of the queries to be sure that the query is scheduled in total order before letting other queries to execute. |
private void |
handleReplicateLogEntries(ReplicateLogEntries msg)
Handle ReplicateLogEntries messages. |
private java.io.Serializable |
handleVirtualDatabaseConfiguration(VirtualDatabaseConfiguration msg,
org.objectweb.tribe.common.Member sender)
Handles VirtualDatabaseConfiguration messages. |
boolean |
isCompatibleBackend(BackendInfo backend)
Check if the given backend definition is compatible with the backend definitions of this distributed virtual database. |
boolean |
isCompatibleDatabaseSchema(DatabaseSchema dbs)
Return true if the provided schema is compatible with the existing schema of this distributed virtual database. |
boolean |
isDistributed()
Is this virtual database distributed ? |
private boolean |
isLocalSender(org.objectweb.tribe.common.Member sender)
Returns true if the given member is ourselves. |
void |
joinGroup()
Makes this virtual database join a virtual database group. |
void |
joinMember(org.objectweb.tribe.common.Member m,
org.objectweb.tribe.common.GroupIdentifier gid)
|
private java.lang.String |
makeTransferCheckpointName(DatabaseBackend db,
org.objectweb.tribe.common.Member dest)
|
void |
quitChannel()
Terminate the multicast request adapter and quit the jgroups channel. |
void |
quitMember(org.objectweb.tribe.common.Member m,
org.objectweb.tribe.common.GroupIdentifier gid)
|
void |
receive(java.io.Serializable msg)
|
private void |
refreshGroupMembership()
Refresh the current group membership when someone has joined or left the group. |
void |
removeBackend(java.lang.String backend)
Remove a backend from the virtual database list. |
java.lang.String |
removeRemoteController(org.objectweb.tribe.common.Member remoteControllerMembership)
Remove a remote controller (usually because it has failed) from the controllerMap list and refresh the group membership. |
private void |
sendMessageToController(java.lang.String controllerName,
java.io.Serializable message)
Send a Message to a remote controller. |
private void |
setEventCheckpoint(java.lang.String name,
org.objectweb.tribe.common.Member m,
org.objectweb.tribe.common.GroupIdentifier gid)
|
void |
setGroupCheckpoint(java.lang.String checkpointName,
java.util.ArrayList groupMembers)
Atomically checkpoint across specified group members. |
void |
setGroupName(java.lang.String groupName)
Sets the group name used by the controllers hosting this virtual database. |
private java.lang.String |
setLogReplicationCheckpoint(java.lang.String controllerName)
Sets an atomic (group-wide) checkpoint on local & target controllers. |
void |
setRequestManager(RequestManager requestManager)
Sets a new distributed request manager for this database. |
void |
transferBackend(java.lang.String backend,
java.lang.String controllerDestination)
Transfer the backend to the destinated controller. |
void |
transferDump(java.lang.String dumpName,
java.lang.String remoteControllerName,
boolean noCopy)
Transfer specified dump over to specified vdb's controller, making it available for restore operation. |
java.lang.String[] |
viewControllerList()
Return the list of controllers defining this virtual database. |
java.util.Hashtable |
viewGroupBackends()
Returns a mapping of controller jmx names with their backends. |
Methods inherited from class org.objectweb.cjdbc.controller.jmx.AbstractStandardMBean |
addNotificationListener, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getNotificationInfo, getParameterName, getParameterName, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class javax.management.StandardMBean |
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, setAttribute, setAttributes, setImplementation |
Methods inherited from class java.lang.Object |
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String groupName
private java.util.Hashtable controllersMap
private java.util.Hashtable backendsPerController
ArrayList[BackendInfo]
private org.objectweb.tribe.channel.ReliableGroupChannelWithGms channel
private org.objectweb.tribe.adapters.MulticastRequestAdapter multicastRequestAdapter
private org.objectweb.tribe.common.Group currentGroup
private java.util.ArrayList allMemberButUs
private static final long INCOMPATIBLE_CONFIGURATION
private boolean isVirtualDatabaseStarted
private DistributedRequestManager distributedRequestManager
private static Trace distributedRequestLogger
Constructor Detail |
public DistributedVirtualDatabase(Controller controller, java.lang.String name, java.lang.String groupName, int maxConnections, boolean pool, int minThreads, int maxThreads, long maxThreadIdleTime, int sqlShortFormLength, AbstractBlobFilter blobFilter) throws javax.management.NotCompliantMBeanException, JmxException
DistributedVirtualDatabase
instance.
controller
- the controller we belong toname
- the virtual database namegroupName
- the virtual database group namemaxConnections
- maximum number of concurrent connections.pool
- should we use a pool of threads for handling connections?minThreads
- minimum number of threads in the poolmaxThreads
- maximum number of threads in the poolmaxThreadIdleTime
- maximum time a thread can remain idle before being
removed from the pool.sqlShortFormLength
- maximum number of characters of an SQL statement
to display in traces or exceptionsblobFilter
- encoding method for blobs
javax.management.NotCompliantMBeanException
- in case the bean does not comply with
jmx
JmxException
- the bean could not be registeredMethod Detail |
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
Object.finalize()
public void addBackend(DatabaseBackend db) throws VirtualDatabaseException
VirtualDatabase
addBackend
in class VirtualDatabase
db
- the database backend to add
VirtualDatabaseException
- if an error occursVirtualDatabase.addBackend(org.objectweb.cjdbc.controller.backend.DatabaseBackend)
public void quitChannel() throws org.objectweb.tribe.exceptions.ChannelException, org.objectweb.tribe.exceptions.NotConnectedException
org.objectweb.tribe.exceptions.NotConnectedException
- if the channel is not connected
org.objectweb.tribe.exceptions.ChannelException
- if an error occurred while closing the channelpublic java.lang.String getControllerName()
public java.lang.String getGroupName()
String
value. Returns null
if this
virtual database is standalonepublic void setGroupName(java.lang.String groupName)
groupName
- the group name to setpublic void setRequestManager(RequestManager requestManager)
setRequestManager
in class VirtualDatabase
requestManager
- the new request manager.public void joinGroup() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic java.util.ArrayList getAllMembers()
public java.util.ArrayList getAllMemberButUs()
public org.objectweb.tribe.channel.ReliableGroupChannelWithGms getChannel()
JChannel
public org.objectweb.tribe.common.Group getCurrentGroup()
public org.objectweb.tribe.adapters.MulticastRequestAdapter getMulticastRequestAdapter()
private long checkConfigurationCompatibilityAndReturnControllerId(java.util.ArrayList dest)
dest
- List of Address
to send the message to
private void broadcastBackendInformation(java.util.ArrayList dest) throws org.objectweb.tribe.exceptions.TimeoutException, org.objectweb.tribe.exceptions.ChannelException, org.objectweb.tribe.exceptions.NotConnectedException
dest
- List of Address
to send the message to
org.objectweb.tribe.exceptions.NotConnectedException
- if the channel is not connected
org.objectweb.tribe.exceptions.ChannelException
- if the channel reported an error
org.objectweb.tribe.exceptions.TimeoutException
- if a timeout occuredpublic boolean isCompatibleBackend(BackendInfo backend) throws VirtualDatabaseException
backend
- the backend to check
VirtualDatabaseException
- if locking the local backend list failspublic boolean isCompatibleDatabaseSchema(DatabaseSchema dbs)
dbs
- the database schema to compare with
public void receive(java.io.Serializable msg)
receive
in interface org.objectweb.tribe.messages.MessageListener
MessageListener.receive(java.io.Serializable)
public java.lang.Object handleMessageSingleThreaded(java.io.Serializable msg, org.objectweb.tribe.common.Member sender)
handleMessageSingleThreaded
in interface org.objectweb.tribe.adapters.MulticastRequestListener
MulticastRequestListener.handleMessageSingleThreaded(java.io.Serializable,
org.objectweb.tribe.common.Member)
public java.io.Serializable handleMessageMultiThreaded(java.io.Serializable msg, org.objectweb.tribe.common.Member sender, java.lang.Object handleMessageSingleThreadedResult)
handleMessageMultiThreaded
in interface org.objectweb.tribe.adapters.MulticastRequestListener
MulticastRequestListener.handleMessageMultiThreaded(Serializable,
Member, Object)
private RecoveryLog getRecoveryLog() throws VirtualDatabaseException
VirtualDatabaseException
private void handleInitiateDumpCopy(InitiateDumpCopy msg) throws VirtualDatabaseException, BackupException, java.io.IOException
VirtualDatabaseException
BackupException
java.io.IOException
private void handleCopyLogEntry(CopyLogEntry msg)
msg
- the CopyLogEntry message.private void handleReplicateLogEntries(ReplicateLogEntries msg) throws java.sql.SQLException
msg
- the ReplicateLogEntries message
java.sql.SQLException
- in case of error when resetting the recovery log.private void handleBackendStatus(BackendStatus msg, org.objectweb.tribe.common.Member sender)
msg
- the BackendStatus messagesender
- the message senderprivate java.io.Serializable handleBackendTransfer(BackendTransfer msg) throws javax.management.NotCompliantMBeanException, VirtualDatabaseException
msg
- the BackendTransfer message
javax.management.NotCompliantMBeanException
- if an error occurs while creating the
DatabaseBackend
VirtualDatabaseException
- if an error occurs while adding the new
backendprivate void handleDisableBackend(DisableBackend msg, org.objectweb.tribe.common.Member sender)
msg
- the DisableBackend messagesender
- the message senderprivate void handleEnableBackend(EnableBackend msg, org.objectweb.tribe.common.Member sender)
msg
- the EnableBackend messagesender
- the message senderprivate java.io.Serializable handleVirtualDatabaseConfiguration(VirtualDatabaseConfiguration msg, org.objectweb.tribe.common.Member sender) throws org.objectweb.tribe.exceptions.TimeoutException, org.objectweb.tribe.exceptions.ChannelException, org.objectweb.tribe.exceptions.NotConnectedException
msg
- the VirtualDatabaseConfiguration messagesender
- the membership of the message sender
org.objectweb.tribe.exceptions.TimeoutException
- if a group communication timeout occurs
org.objectweb.tribe.exceptions.ChannelException
- if the group communication fails
org.objectweb.tribe.exceptions.NotConnectedException
- if the group communication channel is not
conectedprivate boolean isLocalSender(org.objectweb.tribe.common.Member sender)
sender
- the sender
public void getBackendStatus() throws org.objectweb.tribe.exceptions.TimeoutException, org.objectweb.tribe.exceptions.ChannelException, org.objectweb.tribe.exceptions.NotConnectedException
org.objectweb.tribe.exceptions.NotConnectedException
- if the channel is not connected
org.objectweb.tribe.exceptions.ChannelException
- if the channel reported an error
org.objectweb.tribe.exceptions.TimeoutException
- if a timeout occuredpublic void addRemoteController(org.objectweb.tribe.common.Member remoteControllerMembership, java.lang.String remoteControllerJmxName)
remoteControllerMembership
- the membership identifying the remote
controllerremoteControllerJmxName
- the JMX name of the remote controllerpublic java.lang.String removeRemoteController(org.objectweb.tribe.common.Member remoteControllerMembership)
remoteControllerMembership
- the membership identifying the remote
controller
private void setEventCheckpoint(java.lang.String name, org.objectweb.tribe.common.Member m, org.objectweb.tribe.common.GroupIdentifier gid)
public void joinMember(org.objectweb.tribe.common.Member m, org.objectweb.tribe.common.GroupIdentifier gid)
joinMember
in interface org.objectweb.tribe.gms.GroupMembershipListener
GroupMembershipListener.joinMember(org.objectweb.tribe.common.Member,
org.objectweb.tribe.common.GroupIdentifier)
public void quitMember(org.objectweb.tribe.common.Member m, org.objectweb.tribe.common.GroupIdentifier gid)
quitMember
in interface org.objectweb.tribe.gms.GroupMembershipListener
GroupMembershipListener.quitMember(org.objectweb.tribe.common.Member,
org.objectweb.tribe.common.GroupIdentifier)
public void groupComposition(org.objectweb.tribe.common.Group g, org.objectweb.tribe.common.Address sender)
groupComposition
in interface org.objectweb.tribe.gms.GroupMembershipListener
GroupMembershipListener.groupComposition(org.objectweb.tribe.common.Group,
org.objectweb.tribe.common.Address)
public void failedMember(org.objectweb.tribe.common.Member failed, org.objectweb.tribe.common.GroupIdentifier gid, org.objectweb.tribe.common.Member sender)
failedMember
in interface org.objectweb.tribe.gms.GroupMembershipListener
GroupMembershipListener.failedMember(org.objectweb.tribe.common.Member,
org.objectweb.tribe.common.GroupIdentifier,
org.objectweb.tribe.common.Member)
private void refreshGroupMembership()
public boolean isDistributed()
isDistributed
in interface VirtualDatabaseMBean
isDistributed
in class VirtualDatabase
public boolean equals(java.lang.Object other)
equals
in class VirtualDatabase
other
- an object
boolean
valueprotected java.lang.String getDistributionXml()
getDistributionXml
in class VirtualDatabase
public java.lang.String[] viewControllerList()
VirtualDatabaseMBean
viewOwningController
otherwise returns an array of
controller configuring this DistributedVirtualDatabase
viewControllerList
in interface VirtualDatabaseMBean
viewControllerList
in class VirtualDatabase
VirtualDatabaseMBean.viewControllerList()
public java.util.Hashtable viewGroupBackends() throws VirtualDatabaseException
VirtualDatabaseMBean
viewGroupBackends
in interface VirtualDatabaseMBean
viewGroupBackends
in class VirtualDatabase
VirtualDatabaseException
VirtualDatabaseMBean.viewGroupBackends()
public java.util.ArrayList getBackendsInfo(java.util.ArrayList backendsObject)
DatabaseBackend
object to an ArrayList of
BackendInfo
objects. The DatabaseBackend objects cannot be
serialized because they are used as MBean and notification emitters, so we
want to extract the info out of them.
backendsObject
- the list of DatabaseBackend object
BackendInfo
public BackendInfo createBackendInfo(DatabaseBackend backend, boolean useXml)
backend
- the DatabaseBackend
object to get info fromuseXml
- should we add xml for extensive backend description
BackendInfo
public void removeBackend(java.lang.String backend) throws VirtualDatabaseException
VirtualDatabaseMBean
removeBackend
in interface VirtualDatabaseMBean
removeBackend
in class VirtualDatabase
VirtualDatabaseException
VirtualDatabaseMBean.removeBackend(java.lang.String)
public void transferBackend(java.lang.String backend, java.lang.String controllerDestination) throws VirtualDatabaseException
VirtualDatabaseMBean
transferBackend
in interface VirtualDatabaseMBean
transferBackend
in class VirtualDatabase
VirtualDatabaseException
VirtualDatabaseMBean.transferBackend(java.lang.String,
java.lang.String)
private org.objectweb.tribe.common.Member getControllerByName(java.lang.String controllerName) throws VirtualDatabaseException
controllerName
- the name of the target controller
VirtualDatabaseException
private java.lang.String makeTransferCheckpointName(DatabaseBackend db, org.objectweb.tribe.common.Member dest)
public void setGroupCheckpoint(java.lang.String checkpointName, java.util.ArrayList groupMembers) throws VirtualDatabaseException
checkpointName
- the name of the (transfer) checkpoint to creategroupMembers
- an ArrayList of target Members
VirtualDatabaseException
- in case of scheduler or recoveryLog
exceptionsVirtualDatabase.setCheckpoint(String)
,
handleMessageSingleThreaded(Serializable,
Member)
private java.lang.String setLogReplicationCheckpoint(java.lang.String controllerName) throws VirtualDatabaseException
controllerName
- the target remote controller
VirtualDatabaseException
- in case of error (whatever error, wraps
the underlying error)public void copyLogFromCheckpoint(java.lang.String dumpName, java.lang.String controllerName) throws VirtualDatabaseException
VirtualDatabaseMBean
copyLogFromCheckpoint
in interface VirtualDatabaseMBean
copyLogFromCheckpoint
in class VirtualDatabase
VirtualDatabaseException
VirtualDatabaseMBean.copyLogFromCheckpoint(java.lang.String,
java.lang.String)
private void sendMessageToController(java.lang.String controllerName, java.io.Serializable message) throws VirtualDatabaseException
controllerName
- name of the remote controllermessage
- the message to send (should be Serializable)
VirtualDatabaseException
- (wrapping error) in case of communication
failurepublic void copyDump(java.lang.String dumpName, java.lang.String remoteControllerName) throws VirtualDatabaseException
copyDump
in interface VirtualDatabaseMBean
copyDump
in class VirtualDatabase
dumpName
- the name of the dump to copy. Should exist locally, and not
remotely.remoteControllerName
- the remote controller to talk to.
VirtualDatabaseException
- in case of error.VirtualDatabaseMBean.copyDump(java.lang.String,
java.lang.String)
public void transferDump(java.lang.String dumpName, java.lang.String remoteControllerName, boolean noCopy) throws VirtualDatabaseException
VirtualDatabaseMBean
transferDump
in interface VirtualDatabaseMBean
transferDump
in class VirtualDatabase
VirtualDatabaseException
VirtualDatabaseMBean.transferDump(java.lang.String,
java.lang.String, boolean)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |