Glide Executor


GlideExecutor 类

缓存 DiskCache ,newDiskCacheExecutor() 方法

public static GlideExecutor newDiskCacheExecutor(
      int threadCount, String name, UncaughtThrowableStrategy uncaughtThrowableStrategy) {
    return new GlideExecutor(
        new ThreadPoolExecutor(
            threadCount /* corePoolSize */,
            threadCount /* maximumPoolSize */,
            0 /* keepAliveTime */,
            TimeUnit.MILLISECONDS,
            new PriorityBlockingQueue(),
            new DefaultThreadFactory(name, uncaughtThrowableStrategy, true)));
}

数据源 Source,newSourceExecutor() 方法

public static GlideExecutor newSourceExecutor(
      int threadCount, String name, UncaughtThrowableStrategy uncaughtThrowableStrategy) {
    return new GlideExecutor(
        new ThreadPoolExecutor(
            threadCount /* corePoolSize */,
            threadCount /* maximumPoolSize */,
            0 /* keepAliveTime */,
            TimeUnit.MILLISECONDS,
            new PriorityBlockingQueue(),
            new DefaultThreadFactory(name, uncaughtThrowableStrategy, false)));
}

数据源 Source ,不限制 ,newUnlimitedSourceExecutor() 方法,

public static GlideExecutor newUnlimitedSourceExecutor() {
    return new GlideExecutor(new ThreadPoolExecutor(
        0,
        Integer.MAX_VALUE,
        KEEP_ALIVE_TIME_MS,
        TimeUnit.MILLISECONDS,
        new SynchronousQueue(),
        new DefaultThreadFactory(
            SOURCE_UNLIMITED_EXECUTOR_NAME,
            UncaughtThrowableStrategy.DEFAULT,
            false)));
}

动画 ,加载 GifDrawable,newAnimationExecutor() 方法。

public static GlideExecutor newAnimationExecutor(
      int threadCount, UncaughtThrowableStrategy uncaughtThrowableStrategy) {
     return new GlideExecutor(
        new ThreadPoolExecutor(
            0 /* corePoolSize */,
            threadCount,
            KEEP_ALIVE_TIME_MS,
            TimeUnit.MILLISECONDS,
            new PriorityBlockingQueue(),
            new DefaultThreadFactory(
                ANIMATION_EXECUTOR_NAME,
                uncaughtThrowableStrategy,
                true)));
}


任重而道远

你可能感兴趣的:(Glide Executor)