services/src/main/java/org/keycloak/services/managers/UsersSyncManager.java
// Update interval of last sync for given UserFederationProviderModel. Do it in separate transaction
Update interval of last sync for given UserFederationProviderModel. Do it in separate transaction
Update interval of last sync for given UserFederationProviderModel . Do it in separate transaction
private void updateLastSyncInterval(final KeycloakSessionFactory sessionFactory, final UserFederationProviderModel fedProvider, final String realmId) {
        KeycloakModelUtils.runJobInTransaction(sessionFactory, new KeycloakSessionTask() {
            @Override
            public void run(KeycloakSession session) {
                RealmModel persistentRealm = session.realms().getRealm(realmId);
                List<UserFederationProviderModel> persistentFedProviders = persistentRealm.getUserFederationProviders();
                for (UserFederationProviderModel persistentFedProvider : persistentFedProviders) {
                    if (fedProvider.getId().equals(persistentFedProvider.getId())) {
                        int lastSync = Time.currentTime();
                        persistentFedProvider.setLastSync(lastSync);
                        persistentRealm.updateUserFederationProvider(persistentFedProvider);
                        fedProvider.setLastSync(lastSync);
                    }
                }
            }
        });
    }
private void updateLastSyncInterval ( final KeycloakSessionFactory sessionFactory , final UserFederationProviderModel fedProvider , final String realmId ) { KeycloakModelUtils . runJobInTransaction ( sessionFactory , new KeycloakSessionTask ( ) { @ Override public void run ( KeycloakSession session ) { RealmModel persistentRealm = session . realms ( ) . getRealm ( realmId ) ; List < UserFederationProviderModel > persistentFedProviders = persistentRealm . getUserFederationProviders ( ) ; for ( UserFederationProviderModel persistentFedProvider : persistentFedProviders ) { if ( fedProvider . getId ( ) . equals ( persistentFedProvider . getId ( ) ) ) { int lastSync = Time . currentTime ( ) ; persistentFedProvider . setLastSync ( lastSync ) ; persistentRealm . updateUserFederationProvider ( persistentFedProvider ) ; fedProvider . setLastSync ( lastSync ) ; } } } } ) ; }
Update interval of last sync for given UserFederationProviderModel.
Update interval of last sync for given UserFederationProviderModel .
// Update persistent provider in DB // Update "cached" reference