org.objectweb.cjdbc.controller.virtualdatabase
Class DistributedVirtualDatabase

java.lang.Object
  extended byjavax.management.StandardMBean
      extended byorg.objectweb.cjdbc.controller.jmx.AbstractStandardMBean
          extended byorg.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase
              extended byorg.objectweb.cjdbc.controller.virtualdatabase.DistributedVirtualDatabase
All Implemented Interfaces:
javax.management.DynamicMBean, org.objectweb.tribe.gms.GroupMembershipListener, org.objectweb.tribe.messages.MessageListener, org.objectweb.tribe.adapters.MulticastRequestListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, VirtualDatabaseMBean, XmlComponent

public class DistributedVirtualDatabase
extends VirtualDatabase
implements org.objectweb.tribe.messages.MessageListener, org.objectweb.tribe.adapters.MulticastRequestListener, org.objectweb.tribe.gms.GroupMembershipListener

A DistributedVirtualDatabase is a virtual database hosted by several controllers. Communication between the controllers is achieved with reliable multicast provided by Javagroups.

Version:
1.0
Author:
Emmanuel Cecchet

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.virtualdatabase.VirtualDatabase
abort, acquireReadLockBackendLists, addBackend, addCurrentNbOfThread, addIdleThread, backupBackend, begin, checkAdminAuthentication, checkUserAuthentication, cleanMonitoringData, commit, deleteLogUpToCheckpoint, disableAllBackends, disableAllBackendsWithCheckpoint, disableBackendWithCheckpoint, enableAllBackends, enableAllBackendsFromCheckpoint, enableBackendFromCheckpoint, enableBackendFromCheckpoint, execReadRequest, execReadStoredProcedure, execWriteRequest, execWriteRequestWithKeys, execWriteStoredProcedure, forceDisableBackend, forceEnableAllBackendsFromCheckpoint, forceEnableBackend, getActiveThreads, getAllBackendNames, getAndCheckBackend, getAssociatedString, getAuthenticationManager, getAvailableDumps, getBackendInformation, getBackends, getBackendSchema, getBackendState, getBackendStatistics, getBackuperNames, getBlobFilter, getCurrentNbOfThreads, getDatabaseName, getDatabaseProductName, getDatabaseSchemaFromActiveBackends, getDatabaseSchemaFromActiveBackendsAndRefreshDatabaseProductNames, getDumpFormatForBackuper, getDynamicMetaData, getIdleThreads, getMaxNbOfConnections, getMaxNbOfThreads, getMaxThreadIdleTime, getMinNbOfThreads, getPendingConnections, getRequestManager, getSQLMonitor, getSQLShortFormLength, getStaticMetaData, getTotalOrderQueue, getVirtualDatabaseName, getXml, hasRecoveryLog, hasResultCache, isPoolConnectionThreads, isShuttingDown, releaseReadLockBackendLists, releaseSavepoint, removeBackend, removeCheckpoint, removeCurrentNbOfThread, removeDump, removeIdleThread, replicateBackend, restoreDumpOnBackend, retrieveBackendsData, rollback, rollback, setAuthenticationManager, setBackendLastKnownCheckpoint, setBlobFilter, setCheckpoint, setMaxNbOfConnections, setMaxNbOfThreads, setMaxThreadIdleTime, setMinNbOfThreads, setMonitoringToActive, setPoolConnectionThreads, setSavepoint, setSavepoint, setSQLMonitor, setStaticDatabaseSchema, setTotalOrderQueue, shutdown, storeBackendsInfo, updateDumpPath, viewAllClientNames, viewBackendInformation, viewCheckpointNames, viewOwningController
 
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

groupName

private java.lang.String groupName
Group name


controllersMap

private java.util.Hashtable controllersMap
Controller name mapping: Member --> controller JMX name


backendsPerController

private java.util.Hashtable backendsPerController
Tribe Member --> ArrayList[BackendInfo]


channel

private org.objectweb.tribe.channel.ReliableGroupChannelWithGms channel
JGroups channel


multicastRequestAdapter

private org.objectweb.tribe.adapters.MulticastRequestAdapter multicastRequestAdapter
MessageDispatcher to communicate with the group


currentGroup

private org.objectweb.tribe.common.Group currentGroup

allMemberButUs

private java.util.ArrayList allMemberButUs

INCOMPATIBLE_CONFIGURATION

private static final long INCOMPATIBLE_CONFIGURATION
See Also:
Constant Field Values

isVirtualDatabaseStarted

private boolean isVirtualDatabaseStarted

distributedRequestManager

private DistributedRequestManager distributedRequestManager
Our view of the request manager, same as super.requestManager, only just typed properly.


distributedRequestLogger

private static Trace distributedRequestLogger
Logger for distributed request execution

Constructor Detail

DistributedVirtualDatabase

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
Creates a new DistributedVirtualDatabase instance.

Parameters:
controller - the controller we belong to
name - the virtual database name
groupName - the virtual database group name
maxConnections - maximum number of concurrent connections.
pool - should we use a pool of threads for handling connections?
minThreads - minimum number of threads in the pool
maxThreads - maximum number of threads in the pool
maxThreadIdleTime - 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 exceptions
blobFilter - encoding method for blobs
Throws:
javax.management.NotCompliantMBeanException - in case the bean does not comply with jmx
JmxException - the bean could not be registered
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Disconnect the channel and close it.

Throws:
java.lang.Throwable
See Also:
Object.finalize()

addBackend

public void addBackend(DatabaseBackend db)
                throws VirtualDatabaseException
Description copied from class: VirtualDatabase
Add a backend to this virtual database.

Overrides:
addBackend in class VirtualDatabase
Parameters:
db - the database backend to add
Throws:
VirtualDatabaseException - if an error occurs
See Also:
VirtualDatabase.addBackend(org.objectweb.cjdbc.controller.backend.DatabaseBackend)

quitChannel

public void quitChannel()
                 throws org.objectweb.tribe.exceptions.ChannelException,
                        org.objectweb.tribe.exceptions.NotConnectedException
Terminate the multicast request adapter and quit the jgroups channel.

Throws:
org.objectweb.tribe.exceptions.NotConnectedException - if the channel is not connected
org.objectweb.tribe.exceptions.ChannelException - if an error occurred while closing the channel

getControllerName

public java.lang.String getControllerName()
Returns the controllerName value.

Returns:
Returns the controllerName.

getGroupName

public java.lang.String getGroupName()
Returns the group name this virtual database belongs to.

Returns:
a String value. Returns null if this virtual database is standalone

setGroupName

public void setGroupName(java.lang.String groupName)
Sets the group name used by the controllers hosting this virtual database.

Parameters:
groupName - the group name to set

setRequestManager

public void setRequestManager(RequestManager requestManager)
Sets a new distributed request manager for this database.

Overrides:
setRequestManager in class VirtualDatabase
Parameters:
requestManager - the new request manager.

joinGroup

public void joinGroup()
               throws java.lang.Exception
Makes this virtual database join a virtual database group. Those groups are mapped to JavaGroups groups.

Throws:
java.lang.Exception - if an error occurs

getAllMembers

public java.util.ArrayList getAllMembers()
Synchronized access to current group members.

Returns:
a clone of the list of all members (never null).

getAllMemberButUs

public java.util.ArrayList getAllMemberButUs()
Returns the list of all members in the group except us. Consider the value read-only (do not alter).

Returns:
the allMembersButUs field (never null).

getChannel

public org.objectweb.tribe.channel.ReliableGroupChannelWithGms getChannel()
Get the group channel used for group communications

Returns:
a JChannel

getCurrentGroup

public org.objectweb.tribe.common.Group getCurrentGroup()
Returns the currentGroup value.

Returns:
Returns the currentGroup.

getMulticastRequestAdapter

public org.objectweb.tribe.adapters.MulticastRequestAdapter getMulticastRequestAdapter()
Return the group communication multicast request adapter.

Returns:
the group communication multicast request adapter

checkConfigurationCompatibilityAndReturnControllerId

private long checkConfigurationCompatibilityAndReturnControllerId(java.util.ArrayList dest)
Send the configuration of this controller to remote controller. All remote controllers must agree on the compatibility of the local controller configuration with their own configuration. Compatibility checking include Authentication Manager, Scheduler and Load Balancer settings.

Parameters:
dest - List of Address to send the message to
Returns:
INCOMPATIBLE_CONFIGURATION if the configuration is not compatible with other controllers or the controller id to use otherwise.

broadcastBackendInformation

private void broadcastBackendInformation(java.util.ArrayList dest)
                                  throws org.objectweb.tribe.exceptions.TimeoutException,
                                         org.objectweb.tribe.exceptions.ChannelException,
                                         org.objectweb.tribe.exceptions.NotConnectedException
Broadcast backend information among controllers.

Parameters:
dest - List of Address to send the message to
Throws:
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 occured

isCompatibleBackend

public boolean isCompatibleBackend(BackendInfo backend)
                            throws VirtualDatabaseException
Check if the given backend definition is compatible with the backend definitions of this distributed virtual database. Not that if the given backend does not exist in the current configuration, it is considered as compatible. Incompatibility results from 2 backends with the same JDBC URL.

Parameters:
backend - the backend to check
Returns:
true if the backend is compatible with the local definition
Throws:
VirtualDatabaseException - if locking the local backend list fails

isCompatibleDatabaseSchema

public boolean isCompatibleDatabaseSchema(DatabaseSchema dbs)
Return true if the provided schema is compatible with the existing schema of this distributed virtual database. Note that if the given schema is null, this function returns true.

Parameters:
dbs - the database schema to compare with
Returns:
true if dbs is compatible with the current schema (according to RAIDb level)

receive

public void receive(java.io.Serializable msg)
Specified by:
receive in interface org.objectweb.tribe.messages.MessageListener
See Also:
MessageListener.receive(java.io.Serializable)

handleMessageSingleThreaded

public 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.

Specified by:
handleMessageSingleThreaded in interface org.objectweb.tribe.adapters.MulticastRequestListener
See Also:
MulticastRequestListener.handleMessageSingleThreaded(java.io.Serializable, org.objectweb.tribe.common.Member)

handleMessageMultiThreaded

public java.io.Serializable handleMessageMultiThreaded(java.io.Serializable msg,
                                                       org.objectweb.tribe.common.Member sender,
                                                       java.lang.Object handleMessageSingleThreadedResult)
Specified by:
handleMessageMultiThreaded in interface org.objectweb.tribe.adapters.MulticastRequestListener
See Also:
MulticastRequestListener.handleMessageMultiThreaded(Serializable, Member, Object)

getRecoveryLog

private RecoveryLog getRecoveryLog()
                            throws VirtualDatabaseException
Throws:
VirtualDatabaseException

handleInitiateDumpCopy

private void handleInitiateDumpCopy(InitiateDumpCopy msg)
                             throws VirtualDatabaseException,
                                    BackupException,
                                    java.io.IOException
Throws:
VirtualDatabaseException
BackupException
java.io.IOException

handleCopyLogEntry

private void handleCopyLogEntry(CopyLogEntry msg)
Handle CopyLogEntry messages.

Parameters:
msg - the CopyLogEntry message.

handleReplicateLogEntries

private void handleReplicateLogEntries(ReplicateLogEntries msg)
                                throws java.sql.SQLException
Handle ReplicateLogEntries messages. There are two cases: initialization and termination of the replication process. Initialization asynchronously and ato,ically wipes-out the recovery log entries before the 'now' checkpointand. Termination sets the dump checkpoint name, thus making it available so that a recovery can be executed.

Parameters:
msg - the ReplicateLogEntries message
Throws:
java.sql.SQLException - in case of error when resetting the recovery log.

handleBackendStatus

private void handleBackendStatus(BackendStatus msg,
                                 org.objectweb.tribe.common.Member sender)
Handles BackendStatus messages.

Parameters:
msg - the BackendStatus message
sender - the message sender

handleBackendTransfer

private java.io.Serializable handleBackendTransfer(BackendTransfer msg)
                                            throws javax.management.NotCompliantMBeanException,
                                                   VirtualDatabaseException
Handles BackendTransfer messages.

Parameters:
msg - the BackendTransfer message
Returns:
true on success
Throws:
javax.management.NotCompliantMBeanException - if an error occurs while creating the DatabaseBackend
VirtualDatabaseException - if an error occurs while adding the new backend

handleDisableBackend

private void handleDisableBackend(DisableBackend msg,
                                  org.objectweb.tribe.common.Member sender)
Handles DisableBackend messages.

Parameters:
msg - the DisableBackend message
sender - the message sender

handleEnableBackend

private void handleEnableBackend(EnableBackend msg,
                                 org.objectweb.tribe.common.Member sender)
Handles EnableBackend messages.

Parameters:
msg - the EnableBackend message
sender - the message sender

handleVirtualDatabaseConfiguration

private 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
Handles VirtualDatabaseConfiguration messages.

Parameters:
msg - the VirtualDatabaseConfiguration message
sender - the membership of the message sender
Returns:
a long, controllerId on success, INCOMPATIBLE_CONFIGURATION on error
Throws:
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 conected

isLocalSender

private boolean isLocalSender(org.objectweb.tribe.common.Member sender)
Returns true if the given member is ourselves.

Parameters:
sender - the sender
Returns:
true if we are the sender, false otherwise

getBackendStatus

public void getBackendStatus()
                      throws org.objectweb.tribe.exceptions.TimeoutException,
                             org.objectweb.tribe.exceptions.ChannelException,
                             org.objectweb.tribe.exceptions.NotConnectedException
Get the status of all remote controllers

Throws:
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 occured

addRemoteController

public 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.

Parameters:
remoteControllerMembership - the membership identifying the remote controller
remoteControllerJmxName - the JMX name of the remote controller

removeRemoteController

public 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.

Parameters:
remoteControllerMembership - the membership identifying the remote controller
Returns:
the JMX name of the removed controller (or null if this controller was not in the list)

setEventCheckpoint

private void setEventCheckpoint(java.lang.String name,
                                org.objectweb.tribe.common.Member m,
                                org.objectweb.tribe.common.GroupIdentifier gid)

joinMember

public void joinMember(org.objectweb.tribe.common.Member m,
                       org.objectweb.tribe.common.GroupIdentifier gid)
Specified by:
joinMember in interface org.objectweb.tribe.gms.GroupMembershipListener
See Also:
GroupMembershipListener.joinMember(org.objectweb.tribe.common.Member, org.objectweb.tribe.common.GroupIdentifier)

quitMember

public void quitMember(org.objectweb.tribe.common.Member m,
                       org.objectweb.tribe.common.GroupIdentifier gid)
Specified by:
quitMember in interface org.objectweb.tribe.gms.GroupMembershipListener
See Also:
GroupMembershipListener.quitMember(org.objectweb.tribe.common.Member, org.objectweb.tribe.common.GroupIdentifier)

groupComposition

public void groupComposition(org.objectweb.tribe.common.Group g,
                             org.objectweb.tribe.common.Address sender)
Specified by:
groupComposition in interface org.objectweb.tribe.gms.GroupMembershipListener
See Also:
GroupMembershipListener.groupComposition(org.objectweb.tribe.common.Group, org.objectweb.tribe.common.Address)

failedMember

public void failedMember(org.objectweb.tribe.common.Member failed,
                         org.objectweb.tribe.common.GroupIdentifier gid,
                         org.objectweb.tribe.common.Member sender)
Specified by:
failedMember in interface org.objectweb.tribe.gms.GroupMembershipListener
See Also:
GroupMembershipListener.failedMember(org.objectweb.tribe.common.Member, org.objectweb.tribe.common.GroupIdentifier, org.objectweb.tribe.common.Member)

refreshGroupMembership

private void refreshGroupMembership()
Refresh the current group membership when someone has joined or left the group.


isDistributed

public boolean isDistributed()
Is this virtual database distributed ?

Specified by:
isDistributed in interface VirtualDatabaseMBean
Overrides:
isDistributed in class VirtualDatabase
Returns:
true

equals

public boolean equals(java.lang.Object other)
Two virtual databases are equal if they have the same name, login and password.

Overrides:
equals in class VirtualDatabase
Parameters:
other - an object
Returns:
a boolean value

getDistributionXml

protected java.lang.String getDistributionXml()
Get the XML dump of the Distribution element if any.

Overrides:
getDistributionXml in class VirtualDatabase
Returns:
XML dump of the Distribution element

viewControllerList

public java.lang.String[] viewControllerList()
Description copied from interface: VirtualDatabaseMBean
Return the list of controllers defining this virtual database. If the database is not distributed this returns the same as viewOwningController otherwise returns an array of controller configuring this DistributedVirtualDatabase

Specified by:
viewControllerList in interface VirtualDatabaseMBean
Overrides:
viewControllerList in class VirtualDatabase
See Also:
VirtualDatabaseMBean.viewControllerList()

viewGroupBackends

public java.util.Hashtable viewGroupBackends()
                                      throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Returns a mapping of controller jmx names with their backends. Note the method is only useful in distributed environment

Specified by:
viewGroupBackends in interface VirtualDatabaseMBean
Overrides:
viewGroupBackends in class VirtualDatabase
Throws:
VirtualDatabaseException
See Also:
VirtualDatabaseMBean.viewGroupBackends()

getBackendsInfo

public 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. 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.

Parameters:
backendsObject - the list of DatabaseBackend object
Returns:
a list of BackendInfo objects
See Also:
BackendInfo

createBackendInfo

public BackendInfo createBackendInfo(DatabaseBackend backend,
                                     boolean useXml)
Create backend information object from a DatabaseBackend object. This will get only static information.

Parameters:
backend - the DatabaseBackend object to get info from
useXml - should we add xml for extensive backend description
Returns:
BackendInfo

removeBackend

public void removeBackend(java.lang.String backend)
                   throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Remove a backend from the virtual database list. Do not check whether it is enabled or not, and do not perform backup operation

Specified by:
removeBackend in interface VirtualDatabaseMBean
Overrides:
removeBackend in class VirtualDatabase
Throws:
VirtualDatabaseException
See Also:
VirtualDatabaseMBean.removeBackend(java.lang.String)

transferBackend

public void transferBackend(java.lang.String backend,
                            java.lang.String controllerDestination)
                     throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Transfer the backend to the destinated controller. Note that this does nothing in a non-distributed environment

Specified by:
transferBackend in interface VirtualDatabaseMBean
Overrides:
transferBackend in class VirtualDatabase
Throws:
VirtualDatabaseException
See Also:
VirtualDatabaseMBean.transferBackend(java.lang.String, java.lang.String)

getControllerByName

private org.objectweb.tribe.common.Member getControllerByName(java.lang.String controllerName)
                                                       throws VirtualDatabaseException
Gets a Controller specified by its name as a Member object suitable for group communication.

Parameters:
controllerName - the name of the target controller
Returns:
a Member representing the target controller
Throws:
VirtualDatabaseException

makeTransferCheckpointName

private java.lang.String makeTransferCheckpointName(DatabaseBackend db,
                                                    org.objectweb.tribe.common.Member dest)

setGroupCheckpoint

public void setGroupCheckpoint(java.lang.String checkpointName,
                               java.util.ArrayList groupMembers)
                        throws VirtualDatabaseException
Atomically checkpoint across specified group members. Group-wide atomicity is (and can only be) achieved with a globally ordered message, possibly also sent to ourselves. The local operation must block writes group-wide (in scheduler), to allow a clean write of the checkpoint mark. TODO CHECK this requirement (group-wide lock).

Parameters:
checkpointName - the name of the (transfer) checkpoint to create
groupMembers - an ArrayList of target Members
Throws:
VirtualDatabaseException - in case of scheduler or recoveryLog exceptions
See Also:
VirtualDatabase.setCheckpoint(String), handleMessageSingleThreaded(Serializable, Member)

setLogReplicationCheckpoint

private java.lang.String setLogReplicationCheckpoint(java.lang.String controllerName)
                                              throws VirtualDatabaseException
Sets an atomic (group-wide) checkpoint on local & target controllers.

Parameters:
controllerName - the target remote controller
Returns:
the 'now' checkpoint name.
Throws:
VirtualDatabaseException - in case of error (whatever error, wraps the underlying error)

copyLogFromCheckpoint

public void copyLogFromCheckpoint(java.lang.String dumpName,
                                  java.lang.String controllerName)
                           throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Copies a chunk of the local virtual database recovery log onto a remote controller's peer virtual database log. The copy is performed from the checkpoint associated to the specified dump uptil 'now' (a new global checkpoint). The copy is sent to the specified remote node.

Specified by:
copyLogFromCheckpoint in interface VirtualDatabaseMBean
Overrides:
copyLogFromCheckpoint in class VirtualDatabase
Throws:
VirtualDatabaseException
See Also:
VirtualDatabaseMBean.copyLogFromCheckpoint(java.lang.String, java.lang.String)

sendMessageToController

private void sendMessageToController(java.lang.String controllerName,
                                     java.io.Serializable message)
                              throws VirtualDatabaseException
Send a Message to a remote controller. This sends a point-to-point message, fifo. No total order is specifically required.

Parameters:
controllerName - name of the remote controller
message - the message to send (should be Serializable)
Throws:
VirtualDatabaseException - (wrapping error) in case of communication failure

copyDump

public void copyDump(java.lang.String dumpName,
                     java.lang.String remoteControllerName)
              throws VirtualDatabaseException
What this method does is really initiating the copy. It is the remote controller's vdb that performs the actual copy, fetching the dump from this vdb's local backuper.

Specified by:
copyDump in interface VirtualDatabaseMBean
Overrides:
copyDump in class VirtualDatabase
Parameters:
dumpName - the name of the dump to copy. Should exist locally, and not remotely.
remoteControllerName - the remote controller to talk to.
Throws:
VirtualDatabaseException - in case of error.
See Also:
VirtualDatabaseMBean.copyDump(java.lang.String, java.lang.String)

transferDump

public void transferDump(java.lang.String dumpName,
                         java.lang.String remoteControllerName,
                         boolean noCopy)
                  throws VirtualDatabaseException
Description copied from interface: VirtualDatabaseMBean
Transfer specified dump over to specified vdb's controller, making it available for restore operation. The local dump is not deleted and still available for local restore operations. This operation wants a recovery log to be enabled for the vdb (stores dump info, and meaning less otherwize as no restore is possible without a recovery log). It is pointless (and an error) to use this on a non-distributed virtual db.

Specified by:
transferDump in interface VirtualDatabaseMBean
Overrides:
transferDump in class VirtualDatabase
Throws:
VirtualDatabaseException
See Also:
VirtualDatabaseMBean.transferDump(java.lang.String, java.lang.String, boolean)


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.