Package org.apache.derby.impl.store.replication.net

Examples of org.apache.derby.impl.store.replication.net.ReplicationMessage


                    (SQLState.REPLICATION_NOT_IN_MASTER_MODE);
        }

        //acknowledgment returned from the slave containing
        //the status of the failover performed.
        ReplicationMessage ack = null;
       
        //A failover stops the master controller and shuts down
        //the master database.
        active = false;
       
        //freeze the database to stop clients when this command is received
        rawStoreFactory.freeze();
       
        try {
            //Flush the log buffer of any remaining log records.
            logShipper.flushBuffer();
           
            //Send the failover message to the slave and wait for
            //acknowledgement.
            ReplicationMessage mesg = new ReplicationMessage(
                        ReplicationMessage.TYPE_FAILOVER, null);
            ack = transmitter.sendMessageWaitForReply(mesg);
        } catch (IOException ioe) {
            handleFailoverFailure(ioe);
        } catch (StandardException se) {
View Full Code Here


            logShipper.stopLogShipment();
        }

        if (transmitter != null) {
            try {
                ReplicationMessage mesg =
                    new ReplicationMessage(ReplicationMessage.TYPE_STOP, null);
                transmitter.sendMessage(mesg);
            } catch (IOException ioe) {}
            try {
                transmitter.tearDown();
            } catch (IOException ioe) {}
View Full Code Here

     *         false if no log records were shipped because log buffer is empty.
     */
    private synchronized boolean shipALogChunk()
    throws IOException, StandardException {
        byte [] logRecords = null;
        ReplicationMessage mesg = null;
        try {
            //Check to see if a previous log record exists that needs
            //to be re-transmitted. If there is then transmit that
            //log record and then transmit the next log record in the
            //log buffer.
            if (failedChunk != null) {
                transmitter.sendMessage(failedChunk);
                highestShippedInstant = failedChunkHighestInstant;
                failedChunk = null;
            }
            //transmit the log record that is at the head of
            //the log buffer.
            if (logBuffer.next()) {
                logRecords = logBuffer.getData();
               
                mesg = new ReplicationMessage(
                    ReplicationMessage.TYPE_LOG, logRecords);
               
                transmitter.sendMessage(mesg);
                highestShippedInstant = logBuffer.getLastInstant();
                lastShippingTime = System.currentTimeMillis();
View Full Code Here

                    (SQLState.REPLICATION_NOT_IN_MASTER_MODE);
        }

        //acknowledgment returned from the slave containing
        //the status of the failover performed.
        ReplicationMessage ack = null;
       
        //A failover stops the master controller and shuts down
        //the master database.
        active = false;
       
        //freeze the database to stop clients when this command is received
        rawStoreFactory.freeze();
       
        try {
            //Flush the log buffer of any remaining log records.
            logShipper.flushBuffer();
           
            //Send the failover message to the slave and wait for
            //acknowledgement.
            ReplicationMessage mesg = new ReplicationMessage(
                        ReplicationMessage.TYPE_FAILOVER, null);
            ack = transmitter.sendMessageWaitForReply(mesg);
        } catch (IOException ioe) {
            handleFailoverFailure(ioe);
        } catch (StandardException se) {
View Full Code Here

            logShipper.stopLogShipment();
        }

        if (transmitter != null) {
            try {
                ReplicationMessage mesg =
                    new ReplicationMessage(ReplicationMessage.TYPE_STOP, null);
                transmitter.sendMessage(mesg);
            } catch (IOException ioe) {}
            try {
                transmitter.tearDown();
            } catch (IOException ioe) {}
View Full Code Here

     *         false if no log records were shipped because log buffer is empty.
     */
    private synchronized boolean shipALogChunk()
    throws IOException, StandardException {
        byte [] logRecords = null;
        ReplicationMessage mesg = null;
        try {
            //Check to see if a previous log record exists that needs
            //to be re-transmitted. If there is then transmit that
            //log record and then transmit the next log record in the
            //log buffer.
            if (failedChunk != null) {
                transmitter.sendMessage(failedChunk);
                highestShippedInstant = failedChunkHighestInstant;
                failedChunk = null;
            }
            //transmit the log record that is at the head of
            //the log buffer.
            if (logBuffer.next()) {
                logRecords = logBuffer.getData();
               
                mesg = new ReplicationMessage(
                    ReplicationMessage.TYPE_LOG, logRecords);
               
                transmitter.sendMessage(mesg);
                highestShippedInstant = logBuffer.getLastInstant();
                lastShippingTime = System.currentTimeMillis();
View Full Code Here

            super("derby.slave.logger-" + dbname);
        }
       
        public void run() {
            try {
                ReplicationMessage message;
                while (inReplicationSlaveMode) {
                    message = receiver.readMessage();

                    switch (message.getType()){
                    case ReplicationMessage.TYPE_LOG:
                        byte[] logChunk = (byte[])message.getMessage();
                        handleLogChunk(logChunk);
                        break;
                    case ReplicationMessage.TYPE_FAILOVER:
                        doFailover();
                        ReplicationMessage ack = new ReplicationMessage
                            (ReplicationMessage.TYPE_ACK, "failover succeeded");
                        receiver.sendMessage(ack);
                        teardownNetwork();
                        break;
                    case ReplicationMessage.TYPE_STOP:
View Full Code Here

                    (SQLState.REPLICATION_NOT_IN_MASTER_MODE);
        }

        //acknowledgment returned from the slave containing
        //the status of the failover performed.
        ReplicationMessage ack = null;
       
        //A failover stops the master controller and shuts down
        //the master database.
        active = false;
       
        //freeze the database to stop clients when this command is received
        rawStoreFactory.freeze();
       
        try {
            //Flush the log buffer of any remaining log records.
            logShipper.flushBuffer();
           
            //Send the failover message to the slave and wait for
            //acknowledgement.
            ReplicationMessage mesg = new ReplicationMessage(
                        ReplicationMessage.TYPE_FAILOVER, null);
            ack = transmitter.sendMessageWaitForReply(mesg);
        } catch (IOException ioe) {
            handleFailoverFailure(ioe);
        } catch (StandardException se) {
View Full Code Here

            logShipper.stopLogShipment();
        }

        if (transmitter != null) {
            try {
                ReplicationMessage mesg =
                    new ReplicationMessage(ReplicationMessage.TYPE_STOP, null);
                transmitter.sendMessage(mesg);
            } catch (IOException ioe) {}
            try {
                transmitter.tearDown();
            } catch (IOException ioe) {}
View Full Code Here

     *         false if no log records were shipped because log buffer is empty.
     */
    private synchronized boolean shipALogChunk()
    throws IOException, StandardException {
        byte [] logRecords = null;
        ReplicationMessage mesg = null;
        try {
            //Check to see if a previous log record exists that needs
            //to be re-transmitted. If there is then transmit that
            //log record and then transmit the next log record in the
            //log buffer.
            if (failedChunk != null) {
                transmitter.sendMessage(failedChunk);
                highestShippedInstant = failedChunkHighestInstant;
                failedChunk = null;
            }
            //transmit the log record that is at the head of
            //the log buffer.
            if (logBuffer.next()) {
                logRecords = logBuffer.getData();
               
                mesg = new ReplicationMessage(
                    ReplicationMessage.TYPE_LOG, logRecords);
               
                transmitter.sendMessage(mesg);
                highestShippedInstant = logBuffer.getLastInstant();
                lastShippingTime = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of org.apache.derby.impl.store.replication.net.ReplicationMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.