| Modifier and Type | Field and Description |
|---|---|
| private static final boolean | |
| private File | |
| private boolean | |
| private static boolean | |
| private static final File | |
| private static final String | |
| private static File | |
| pack-priv static final String | |
| private static String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private static void | deleteOldTempDirs()
Called by the Reaper thread to delete old temp directories Only one of these threads will run per JVM invocation. |
| public void | |
| public File | |
| public File | |
| public File | |
| public static boolean | Returns: true is static initialization was successfulDocumented way to kick off static initialization |
| private static void | initTmpRoot()
This method is called by the static initializer to create / initialize the temp root directory that will hold the temp directories for this instance of the JVM. |
| public boolean | |
| private static void |
| DEBUG | back to summary |
|---|---|
| private static final boolean DEBUG | |
| individualTmpDir | back to summary |
|---|---|
| private File individualTmpDir | |
| initError | back to summary |
|---|---|
| private boolean initError | |
| staticInitError | back to summary |
|---|---|
| private static boolean staticInitError | |
| tmpBaseDir | back to summary |
|---|---|
| private static final File tmpBaseDir | |
| tmpDirPrefix | back to summary |
|---|---|
| private static final String tmpDirPrefix | |
| tmpRootDir | back to summary |
|---|---|
| private static File tmpRootDir | |
| tmpRootPropName | back to summary |
|---|---|
| pack-priv static final String tmpRootPropName | |
| tmpRootPropValue | back to summary |
|---|---|
| private static String tmpRootPropValue | |
| TempFileCache | back to summary |
|---|---|
| public TempFileCache() Create the | |
| createTmpDir | back to summary |
|---|---|
| private void createTmpDir() throws IOException Create the temp directory in tmpRootDir. To do this, we create a temp file with a ".tmp" extension, and then create a directory of the same name but without the ".tmp". The temp file, directory, and all files in the directory will be reaped the next time this is started. We avoid deleteOnExit, because it doesn't work reliably. | |
| deleteOldTempDirs | back to summary |
|---|---|
| private static void deleteOldTempDirs() Called by the Reaper thread to delete old temp directories Only one of these threads will run per JVM invocation. | |
| destroy | back to summary |
|---|---|
| public void destroy() Delete the | |
| getBaseDir | back to summary |
|---|---|
| public File getBaseDir() Base temp directory used by TempFileCache. Lifecycle: For one user's JVMs, ClassLoader and time. This is set to:
${java.io.tmpdir}/tmpDirPrefix
| |
| getRootDir | back to summary |
|---|---|
| public File getRootDir() Root temp directory for this JVM instance. Used to store individual directories. Lifecycle: For one user's concurrently running JVMs and ClassLoader tmpBaseDir/tmpRootPropValue Use Case: Per ClassLoader files, eg. native libraries. Old temp directories are cleaned up the next time a JVM is launched that uses TempFileCache. | |
| getTempDir | back to summary |
|---|---|
| public File getTempDir() Temporary directory for individual files (eg. native libraries of one ClassLoader instance). The directory name is: Lifecycle: Within each JVM .. use case dependent, ie. per ClassLoader tmpRootDir/jlnMMMMMwhere jlnMMMMM is the unique filename created by File.createTempFile() without the ".tmp" extension. | |
| initSingleton | back to summary |
|---|---|
| public static boolean initSingleton() Documented way to kick off static initialization
| |
| initTmpRoot | back to summary |
|---|---|
| private static void initTmpRoot() throws IOException This method is called by the static initializer to create / initialize the temp root directory that will hold the temp directories for this instance of the JVM. This is done as follows: 1. Synchronize on a global lock. Note that for this purpose we will use System.out in the absence of a true global lock facility. We are careful not to hold this lock too long. The global lock is claimed in the static initializer block, calling this method! 2. Check for the existence of the "jnlp.jogamp.tmp.cache.root" system property. a. If set, then some other thread in a different ClassLoader has already created the tmpRootDir, so we just need to use it. The remaining steps are skipped. However, we check the existence of the tmpRootDir and if non existent, we assume a new launch and continue. b. If not set, then we are the first thread in this JVM to run, and we need to create the the tmpRootDir. 3. Create the tmpRootDir, along with the appropriate locks. Note that we perform the operations in the following order, prior to creating tmpRootDir itself, to work around the fact that the file creation and file lock steps are not atomic, and we need to ensure that a newly-created tmpRootDir isn't reaped by a concurrently running JVM. create jlnNNNN.tmp using File.createTempFile() lock jlnNNNN.tmp create jlnNNNN.lck while holding the lock on the .tmp file lock jlnNNNN.lck Since the Reaper thread will enumerate the list of *.lck files before starting, we can guarantee that if there exists a *.lck file for an active process, then the corresponding *.tmp file is locked by that active process. This guarantee lets us avoid reaping an active process' files. 4. Set the "jnlp.jogamp.tmp.cache.root" system property. 5. Add a shutdown hook to cleanup jlnNNNN.lck and jlnNNNN.tmp. We don't actually expect that this shutdown hook will ever be called, but the act of doing this, ensures that the locks never get garbage-collected, which is necessary for correct behavior when the first ClassLoader is later unloaded, while subsequent Applets are still running. 6. Start the Reaper thread to cleanup old installations. | |
| isValid | back to summary |
|---|---|
public boolean isValid()
| |
| removeAll | back to summary |
|---|---|
| private static void removeAll(final File path) Remove the specified file or directory. If "path" is a directory, then recursively remove all entries, then remove the directory itself. | |