Package hudson.remoting
Class JarCacheSupport
- java.lang.Object
-
- hudson.remoting.JarCache
-
- hudson.remoting.JarCacheSupport
-
- Direct Known Subclasses:
FileSystemJarCache
public abstract class JarCacheSupport extends JarCache
Default partial implementation ofJarCache
.- Since:
- 2.24
- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
-
Fields inherited from class hudson.remoting.JarCache
DEFAULT_NOWS_JAR_CACHE_LOCATION
-
-
Constructor Summary
Constructors Constructor Description JarCacheSupport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected JarLoader
getJarLoader(Channel channel)
protected abstract URL
lookInCache(Channel channel, long sum1, long sum2)
Look up the local cache and return URL if found.CompletableFuture<URL>
resolve(Channel channel, long sum1, long sum2)
Looks up the jar in cache, and if not found, useJarLoader
to retrieve it from the other side.protected abstract URL
retrieve(Channel channel, long sum1, long sum2)
Retrieve the jar file from the givenJarLoader
, store it, then return the URL to that jar.
-
-
-
Method Detail
-
lookInCache
protected abstract URL lookInCache(Channel channel, long sum1, long sum2) throws IOException, InterruptedException
Look up the local cache and return URL if found. Otherwise null (which will trigger a remote retrieval.)- Throws:
IOException
InterruptedException
-
retrieve
protected abstract URL retrieve(Channel channel, long sum1, long sum2) throws IOException, InterruptedException
Retrieve the jar file from the givenJarLoader
, store it, then return the URL to that jar.- Returns:
- must not be null
- Throws:
IOException
InterruptedException
-
resolve
@NonNull public CompletableFuture<URL> resolve(@NonNull Channel channel, long sum1, long sum2) throws IOException, InterruptedException
Description copied from class:JarCache
Looks up the jar in cache, and if not found, useJarLoader
to retrieve it from the other side.This method must be concurrency-safe.
- Specified by:
resolve
in classJarCache
- Parameters:
channel
- Channel that needs this jar file.- Returns:
- URL of the jar file.
- Throws:
IOException
InterruptedException
-
getJarLoader
protected JarLoader getJarLoader(Channel channel) throws InterruptedException
- Throws:
InterruptedException
-
-