Package org.xtreemfs.babudb.replication.service.accounting

Examples of org.xtreemfs.babudb.replication.service.accounting.ReplicateResponse


                LSN assignedByDiskLogger = localFuture.getAssignedLSN();
                LogEntry le = new LogEntry(payload, new ListenerWrapper(future, result),
                                           PAYLOAD_TYPE_TRANSACTION);
                le.assignId(assignedByDiskLogger.getViewId(), assignedByDiskLogger.getSequenceNo());
               
                ReplicateResponse rp = replMan.replicate(le);
                if (!rp.hasFailed()) {
                    replMan.subscribeListener(rp);
                }
               
                le.free();
            }
View Full Code Here


        // replicate the entry at the slaves
        List<SlaveClient> slaves;
        try {
            slaves = participantsStates.getAvailableParticipants();
        } catch (Exception e) {
            return new ReplicateResponse(le, e);
       
        final ReplicateResponse result = new ReplicateResponse(le,
                slaves.size() - participantsStates.getLocalSyncN());
       
        // make the replicate call at the clients
        if (slaves.size() == 0) {
            Logging.logMessage(Logging.LEVEL_DEBUG, this,
                    "There are no slaves available anymore! " +
                    "BabuDB runs if it would be in non-replicated mode.");
        } else {
           
            // serialize the LogEntry
            ReusableBuffer payload = null;
            synchronized(checksum) {
                CRC32 csumAlgo = checksum.get();
                try {
                    payload = le.serialize(csumAlgo);
                } finally {
                    csumAlgo.reset();
                }
            }
           
            // send the LogEntry to the other servers
            for (final SlaveClient slave : slaves) {
                slave.replicate(le.getLSN(), payload.createViewBuffer()).registerListener(
                        new ClientResponseAvailableListener<Object>() {
               
                    @Override
                    public void responseAvailable(Object r) {
                       
                        // evaluate the response
                        participantsStates.requestFinished(slave);
                    }

                    @Override
                    public void requestFailed(Exception e) {
                       
                        participantsStates.markAsDead(slave);
                        result.decrementPermittedFailures();
                       
                        Logging.logMessage(Logging.LEVEL_INFO, this,
                                "'%s' was marked as dead, because %s",
                                slave.getDefaultServerAddress().toString(),
                                e.getMessage());
View Full Code Here

                "Agreed to synchronize to %s before the next view.", beforeCP.toString());
       
        // wait for the slaves to recognize the master-change and for at least N servers to
        // establish a stable state
        LSN syncState = babuDB.getState();
        final ReplicateResponse result = new ReplicateResponse(syncState, listener,
                slaves.size() - localSyncN);
       
        subscribeListener(result);
       
        for (ConditionClient slave : slaves) {
            slave.synchronize(beforeCP, port).registerListener(
                    new ClientResponseAvailableListener<Object>() {

                        @Override
                        public void responseAvailable(Object r) { /* ignored */ }

                        @Override
                        public void requestFailed(Exception e) {
                            result.decrementPermittedFailures();
                        }
            });
        }
       
        Logging.logMessage(Logging.LEVEL_INFO, this,
View Full Code Here

TOP

Related Classes of org.xtreemfs.babudb.replication.service.accounting.ReplicateResponse

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.