Documentation of 'org.apache.derby.impl.store.replication.slave.SlaveController' Java class
SlaveController
org.apache.derby.impl.store.replication.slave

Class SlaveController

  • All Implemented Interfaces:
    ModuleControl, ModuleSupportable, SlaveFactory


    public class SlaveController
    extends java.lang.Object
    implements SlaveFactory, ModuleControl, ModuleSupportable

    This is an implementation of the replication slave controller service. The service is booted when this instance of Derby will have the replication slave role for this database.

    Note: The current version of the class is far from complete. Code to control the replication slave behavior will be added as more parts of the replication functionality is added to Derby.

    See Also:
    SlaveFactory
    • Constructor Summary

      Constructors 
      Constructor and Description
      SlaveController()
      Empty constructor required by Monitor.bootServiceModule
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void boot(boolean create, java.util.Properties properties)
      Used by Monitor.bootServiceModule to start the service.
      boolean canSupport(java.util.Properties startParams)
      Used by Monitor.bootServiceModule to check if this class is usable for replication.
      void failover()
      Used to turn this slave instance of the database into a normal instance that clients can connect to, assuming that the connection with the master is down.
      boolean isStarted()
      Check whether or not slave replication mode has been successfully started.
      void startSlave(RawStoreFactory rawStore, LogFactory logFac)
      Start slave replication.
      void stop()
      Will tear down the replication slave service.
      void stopSlave(boolean forcedStop)
      Stop replication slave mode.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SlaveController

        public SlaveController()
        Empty constructor required by Monitor.bootServiceModule
    • Method Detail

      • boot

        public void boot(boolean create,
                         java.util.Properties properties)
                  throws StandardException
        Used by Monitor.bootServiceModule to start the service. It will set up basic variables
        Specified by:
        boot in interface ModuleControl
        Parameters:
        create - Currently ignored
        properties - Properties used to start the service in the correct mode
        Throws:
        StandardException - Standard Derby exception policy, thrown on error.
        See Also:
        Monitor, ModuleFactory
      • canSupport

        public boolean canSupport(java.util.Properties startParams)
        Used by Monitor.bootServiceModule to check if this class is usable for replication. To be usable, we require that slave replication mode is specified in startParams by checking that a property with key SlaveFactory.REPLICATION_MODE has the value SlaveFactory.SLAVE_MODE.
        Specified by:
        canSupport in interface ModuleSupportable
        Parameters:
        startParams - The properties used to start replication
        Returns:
        true if slave repliation is specified, meaning that this MasterController is a suitable implementation for the SlaveFactory service. False otherwise.
        See Also:
        ModuleSupportable.canSupport(java.util.Properties)
      • startSlave

        public void startSlave(RawStoreFactory rawStore,
                               LogFactory logFac)
                        throws StandardException
        Start slave replication. This method establishes a network connection with the associated replication master and starts a thread that applies operations received from the master (in the form of log records) to the local slave database.
        Specified by:
        startSlave in interface SlaveFactory
        Parameters:
        rawStore - The RawStoreFactory for the database
        logFac - The LogFactory ensuring recoverability for this database
        Throws:
        StandardException - Thrown if the slave could not be started.
      • stopSlave

        public void stopSlave(boolean forcedStop)
                       throws StandardException
        Description copied from interface: SlaveFactory
        Stop replication slave mode. Causes the database to abort the boot process, and should only be used when shutting down this database. If forcedStop is false, the method will fail with an exception if connected with the master. If forcedStop is true, the slave will be shut down even if connected to the master. A forcedStop value of true should only be used by system shutdown.
        Specified by:
        stopSlave in interface SlaveFactory
        Parameters:
        forcedStop - Determines whether or not an exception should be thrown when this method is called while the network connection to the master is up.
        Throws:
        StandardException - Thrown if slave is connected with master and forcedStop is false.
        See Also:
        SlaveFactory.stopSlave(boolean)
      • failover

        public void failover()
                      throws StandardException
        Description copied from interface: SlaveFactory

        Used to turn this slave instance of the database into a normal instance that clients can connect to, assuming that the connection with the master is down. This is typically done in cases where a fatal error has happened on the master instance of the database, or when the master database is unreachable due to network problems.

        By calling failover, this slave instance of the database will be recovered so that all committed operations that have been received from the master are reflected here. On the other hand, operations from transactions where the commit log record has not been received from the master will not be reflected.

        Note that even though an operation has been executed (and even committed) on the master, it is not neccessarily reflected in the slave instance of the database. This depends on the replication strategy used by the MasterFactory.

        Specified by:
        failover in interface SlaveFactory
        Throws:
        StandardException - Thrown if slave is connected with master
        See Also:
        MasterFactory, MasterController.flushedTo(long)
      • isStarted

        public boolean isStarted()
        Description copied from interface: SlaveFactory
        Check whether or not slave replication mode has been successfully started.
        Specified by:
        isStarted in interface SlaveFactory
        Returns:
        true if slave replication mode has started successfully, false if slave mode startup is not yet confirmed
        See Also:
        SlaveFactory.isStarted()

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.