public <S extends Storable> void resync(Class<S> type,
                                            ResyncCapability.Listener<? super S> listener,
                                            double desiredSpeed,
                                            String filter,
                                            Object... filterValues)
        throws RepositoryException
    {
        ReplicationTrigger<S> replicationTrigger;
        if (storageFor(type) instanceof ReplicatedStorage) {
            replicationTrigger = ((ReplicatedStorage) storageFor(type)).getReplicationTrigger();
        } else {
            throw new UnsupportedTypeException("Storable type is not replicated", type);
        }

        Storage<S> replicaStorage, masterStorage;
        replicaStorage = mReplicaRepository.storageFor(type);
        masterStorage = mMasterRepository.storageFor(type);

        Query<S> replicaQuery, masterQuery;
        if (filter == null) {
            replicaQuery = replicaStorage.query();
            masterQuery = masterStorage.query();
        } else {
            replicaQuery = replicaStorage.query(filter).withValues(filterValues);
            masterQuery = masterStorage.query(filter).withValues(filterValues);
        }

        // Order both queries the same so that they can be run in parallel.
        // Favor natural order of replica, since cursors may be opened and
        // re-opened on it.
        String[] orderBy = selectNaturalOrder(mReplicaRepository, type, replicaQuery.getFilter());
        if (orderBy == null) {
            orderBy = selectNaturalOrder(mMasterRepository, type, masterQuery.getFilter());
            if (orderBy == null) {
                Set<String> pkSet =
                    StorableIntrospector.examine(type).getPrimaryKeyProperties().keySet();
                orderBy = pkSet.toArray(new String[pkSet.size()]);
            }
        }

        Comparator comparator = SortedCursor.createComparator(type, orderBy);

        replicaQuery = replicaQuery.orderBy(orderBy);
        masterQuery = masterQuery.orderBy(orderBy);

        Throttle throttle;
        if (desiredSpeed >= 1.0) {
            throttle = null;
        } else {
            if (desiredSpeed < 0.0) {
                desiredSpeed = 0.0;
            }
            // 50 samples
            throttle = new Throttle(50);
        }

        Transaction replicaTxn = mReplicaRepository.enterTransaction();
        try {
            replicaTxn.setForUpdate(true);

            resync(replicationTrigger,
                   replicaStorage, replicaQuery,
                   masterStorage, masterQuery,
                   listener,
                   throttle, desiredSpeed,
                   comparator, replicaTxn);

            replicaTxn.commit();
        } finally {
            replicaTxn.exit();
        }
    }
public < S extends Storable > void resync ( Class < S > type , ResyncCapability . Listener < ? super S > listener , double desiredSpeed , String filter , Object ... filterValues ) throws RepositoryException { ReplicationTrigger < S > replicationTrigger ; if ( storageFor ( type ) instanceof ReplicatedStorage ) { replicationTrigger = ( ( ReplicatedStorage ) storageFor ( type ) ) . getReplicationTrigger ( ) ; } else { throw new UnsupportedTypeException ( "Storable type is not replicated" , type ) ; } Storage < S > replicaStorage , masterStorage ; replicaStorage = mReplicaRepository . storageFor ( type ) ; masterStorage = mMasterRepository . storageFor ( type ) ; Query < S > replicaQuery , masterQuery ; if ( filter == null ) { replicaQuery = replicaStorage . query ( ) ; masterQuery = masterStorage . query ( ) ; } else { replicaQuery = replicaStorage . query ( filter ) . withValues ( filterValues ) ; masterQuery = masterStorage . query ( filter ) . withValues ( filterValues ) ; } String [ ] orderBy = selectNaturalOrder ( mReplicaRepository , type , replicaQuery . getFilter ( ) ) ; if ( orderBy == null ) { orderBy = selectNaturalOrder ( mMasterRepository , type , masterQuery . getFilter ( ) ) ; if ( orderBy == null ) { Set < String > pkSet = StorableIntrospector . examine ( type ) . getPrimaryKeyProperties ( ) . keySet ( ) ; orderBy = pkSet . toArray ( new String [ pkSet . size ( ) ] ) ; } } Comparator comparator = SortedCursor . createComparator ( type , orderBy ) ; replicaQuery = replicaQuery . orderBy ( orderBy ) ; masterQuery = masterQuery . orderBy ( orderBy ) ; Throttle throttle ; if ( desiredSpeed >= 1.0 ) { throttle = null ; } else { if ( desiredSpeed < 0.0 ) { desiredSpeed = 0.0 ; } throttle = new Throttle ( 50 ) ; } Transaction replicaTxn = mReplicaRepository . enterTransaction ( ) ; try { replicaTxn . setForUpdate ( true ) ; resync ( replicationTrigger , replicaStorage , replicaQuery , masterStorage , masterQuery , listener , throttle , desiredSpeed , comparator , replicaTxn ) ; replicaTxn . commit ( ) ; } finally { replicaTxn . exit ( ) ; } }
Repairs replicated storables by synchronizing the replica repository
against the master repository.

@param type type of storable to re-sync
@param listener optional listener which gets notified as storables are re-sync'd
@param desiredSpeed throttling parameter - 1.0 = full speed, 0.5 = half
speed, 0.1 = one-tenth speed, etc
@param filter optional query filter to limit which objects get re-sync'ed
@param filterValues filter values for optional filter
@since 1.2