Search in sources :

Example 1 with ArtifactStoreUpdateType

use of org.commonjava.indy.change.event.ArtifactStoreUpdateType in project indy by Commonjava.

the class TimeoutEventListener method onStoreUpdate.

public void onStoreUpdate(@Observes final ArtifactStorePostUpdateEvent event) {
    final ArtifactStoreUpdateType eventType = event.getType();
    if (eventType == ArtifactStoreUpdateType.UPDATE) {
        for (final ArtifactStore store : event) {
            final StoreKey key = store.getKey();
            final StoreType type = key.getType();
            if (type == StoreType.hosted) {
                logger.info("[ADJUST TIMEOUTS] Adjusting snapshot expirations in: {}", store.getKey());
                try {
                    scheduleManager.rescheduleSnapshotTimeouts((HostedRepository) store);
                } catch (final IndySchedulerException e) {
                    logger.error("Failed to update snapshot timeouts in: " + store.getKey(), e);
                }
            } else if (type == StoreType.remote) {
                logger.info("[ADJUST TIMEOUTS] Adjusting proxied-file expirations in: {}", store.getKey());
                try {
                    scheduleManager.rescheduleProxyTimeouts((RemoteRepository) store);
                } catch (final IndySchedulerException e) {
                    logger.error("Failed to update proxy-cache timeouts in: " + store.getKey(), e);
                }
            }
        }
    }
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) ArtifactStoreUpdateType(org.commonjava.indy.change.event.ArtifactStoreUpdateType) StoreKey(org.commonjava.indy.model.core.StoreKey)

Aggregations

ArtifactStoreUpdateType (org.commonjava.indy.change.event.ArtifactStoreUpdateType)1 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)1 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)1 StoreKey (org.commonjava.indy.model.core.StoreKey)1 StoreType (org.commonjava.indy.model.core.StoreType)1