Package org.jobrunr.utils.resources
Class ClassPathResourceProvider
- java.lang.Object
-
- org.jobrunr.utils.resources.ClassPathResourceProvider
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ClassPathResourceProvider extends java.lang.Object implements java.lang.AutoCloseable
Class to be only used on startup to load all resources (SQL migrations and noSQL migrations) from the classpath. As Jar files need to be mounted as FileSystems which are static, this class uses explicit locking to ensure that only one consumer can access the resources at a time. It must thus always be used in a try-with-resources block.
-
-
Constructor Summary
Constructors Constructor Description ClassPathResourceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
java.util.stream.Stream<java.nio.file.Path>
listAllChildrenOnClasspath(java.lang.Class<?> clazz, java.lang.String... subFolder)
-
-
-
Method Detail
-
listAllChildrenOnClasspath
public java.util.stream.Stream<java.nio.file.Path> listAllChildrenOnClasspath(java.lang.Class<?> clazz, java.lang.String... subFolder)
-
close
public void close() throws java.lang.IllegalStateException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.IllegalStateException
-
-