Package electrostatic4j.snaploader
Class ConcurrentNativeBinaryLoader
java.lang.Object
electrostatic4j.snaploader.NativeBinaryLoader
electrostatic4j.snaploader.ConcurrentNativeBinaryLoader
A thread-safe implementation for the NativeBinaryLoader.
-
Field Summary
FieldsFields inherited from class electrostatic4j.snaploader.NativeBinaryLoader
libraryExtractionListener, libraryExtractor, libraryInfo, libraryLocalizingListener, maxNumberOfLoadingFailure, nativeBinaryLoadingListener, nativeDynamicLibrary, numberOfLoadingFailure, registeredLibraries, retryWithCleanExtraction, systemDetectionListener -
Constructor Summary
ConstructorsConstructorDescriptionConcurrentNativeBinaryLoader(List<NativeDynamicLibrary> registeredLibraries, LibraryInfo libraryInfo) Instantiates a thread-safeNativeBinaryLoaderobject. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanExtractBinary(NativeDynamicLibrary library) Cleanly extracts and loads the native binary to the current [user.dir].Initializes the platform-dependent native dynamic library.loadLibrary(LoadingCriterion criterion) Extracts and loads the system and the architecture-specific library from the output jar to a specified directory according to a loading criterion (incremental-load or clean-extract).Methods inherited from class electrostatic4j.snaploader.NativeBinaryLoader
getLibraryExtractionListener, getLibraryLocalizingListener, getNativeBinaryLoadingListener, getNativeDynamicLibrary, getRegisteredLibraries, getSystemDetectionListener, initializeLibraryExtractor, isRetryWithCleanExtraction, loadBinary, loadSystemBinary, preInitLibraryLocator, registerNativeLibraries, setLibraryExtractionListener, setLibraryLocalizingListener, setLoggingEnabled, setMaxNumberOfLoadingFailure, setNativeBinaryLoadingListener, setRetryWithCleanExtraction, setSystemDetectionListener
-
Field Details
-
lock
The monitor object.
-
-
Constructor Details
-
ConcurrentNativeBinaryLoader
public ConcurrentNativeBinaryLoader(List<NativeDynamicLibrary> registeredLibraries, LibraryInfo libraryInfo) Instantiates a thread-safeNativeBinaryLoaderobject.- Parameters:
libraryInfo- a data structure object holding the platform independent data for the library to load
-
-
Method Details
-
initPlatformLibrary
Description copied from class:NativeBinaryLoaderInitializes the platform-dependent native dynamic library.- Overrides:
initPlatformLibraryin classNativeBinaryLoader- Returns:
- this instance for chained invocations
- Throws:
UnSupportedSystemError- if the OS is not supported by jSnapLoader
-
loadLibrary
Description copied from class:NativeBinaryLoaderExtracts and loads the system and the architecture-specific library from the output jar to a specified directory according to a loading criterion (incremental-load or clean-extract). The directory is determined by the selectedNativeDynamicLibraryfrom the registered platform libraries.Note: The default loading action for Android Systems is loading the libraries from the System directories (i.e., /lib/ABI inside the APK packages), while the default loading action for other desktop systems is determined by the user through this parameterized function.
Fallback loading routines can be implemented as needed via
NativeBinaryLoadingListener.onLoadingFailure(NativeBinaryLoader, CallingStackMetaData)and are left for the user applications.- Overrides:
loadLibraryin classNativeBinaryLoader- Parameters:
criterion- the initial loading criterion, eitherLoadingCriterion.INCREMENTAL_LOADING,LoadingCriterion.CLEAN_EXTRACTIONorLoadingCriterion.SYSTEM_LOADfor loading native dlls from system directories.- Returns:
- this instance for chained invocations
- Throws:
IOException- if the library to extract is not present in the jar filesystemException
-
cleanExtractBinary
Description copied from class:NativeBinaryLoaderCleanly extracts and loads the native binary to the current [user.dir].- Overrides:
cleanExtractBinaryin classNativeBinaryLoader- Parameters:
library- the platform-specific library to extract and load- Throws:
IOException- in case the binary to be extracted is not found on the specified jar, or an interrupted I/O operation has occurredException
-