Package hudson.remoting
Class JarCacheSupport
java.lang.Object
hudson.remoting.JarCache
hudson.remoting.JarCacheSupport
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
FileSystemJarCache
Default partial implementation of
JarCache.- Since:
- 2.24
- Author:
- Kohsuke Kawaguchi
-
Field Summary
Fields inherited from class hudson.remoting.JarCache
DEFAULT_NOWS_JAR_CACHE_LOCATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected JarLoadergetJarLoader(Channel channel) protected abstract URLlookInCache(Channel channel, long sum1, long sum2) Look up the local cache and return URL if found.Looks up the jar in cache, and if not found, useJarLoaderto retrieve it from the other side.protected abstract URLRetrieve the jar file from the givenJarLoader, store it, then return the URL to that jar.
-
Constructor Details
-
JarCacheSupport
public JarCacheSupport()
-
-
Method Details
-
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:
IOExceptionInterruptedException
-
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:
IOExceptionInterruptedException
-
resolve
@NonNull public CompletableFuture<URL> resolve(@NonNull Channel channel, long sum1, long sum2) throws IOException, InterruptedException Description copied from class:JarCacheLooks up the jar in cache, and if not found, useJarLoaderto retrieve it from the other side.This method must be concurrency-safe.
- Specified by:
resolvein classJarCache- Parameters:
channel- Channel that needs this jar file.- Returns:
- URL of the jar file.
- Throws:
IOExceptionInterruptedException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getJarLoader
- Throws:
InterruptedException
-