Issue #229 moving caches into the caveData directory
Change-Id: I3d502ef858939738adf1835d2292f55e2b3edc44 Former-commit-id: a499df61044947aaf40ac118e1476f41736419b0
This commit is contained in:
parent
13a99abe7b
commit
b3da2a3429
3 changed files with 15 additions and 2 deletions
|
@ -230,12 +230,17 @@ public class CachingDataStore implements IDataStore {
|
|||
long t0 = System.currentTimeMillis();
|
||||
if (result != null) {
|
||||
try {
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
FileOutputStream fout = new FileOutputStream(file);
|
||||
DynamicSerializationManager
|
||||
.getManager(SerializationType.Thrift).serialize(result,
|
||||
fout);
|
||||
fout.close();
|
||||
LRUCacheFS.poll(file);
|
||||
file.setReadable(true, false);
|
||||
file.setWritable(true, false);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error storing object to file: "
|
||||
+ e.getLocalizedMessage());
|
||||
|
|
|
@ -63,6 +63,9 @@ public class ThinClientCacheManager implements IPropertyChangeListener {
|
|||
// We'll always store the cache data to the file system
|
||||
long t0 = System.currentTimeMillis();
|
||||
File thinClientCacheDir = this.thinClientCacheDir;
|
||||
if (!thinClientCacheDir.exists()) {
|
||||
thinClientCacheDir.mkdirs();
|
||||
}
|
||||
for (AbstractCachePersistance persistance : persistors) {
|
||||
String fileName = persistance.getFileName();
|
||||
File cacheFile = new File(thinClientCacheDir, fileName);
|
||||
|
@ -71,6 +74,8 @@ public class ThinClientCacheManager implements IPropertyChangeListener {
|
|||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
cacheFile.setReadable(true, false);
|
||||
cacheFile.setWritable(true, false);
|
||||
}
|
||||
System.out.println("Time to store thin client caches: "
|
||||
+ (System.currentTimeMillis() - t0) + "ms");
|
||||
|
|
|
@ -19,9 +19,12 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.thinclient.preferences;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.thinclient.Activator;
|
||||
|
||||
/**
|
||||
|
@ -53,8 +56,8 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
|||
public void initializeDefaultPreferences() {
|
||||
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
|
||||
// Set Defaults for cache directory and cache settings
|
||||
store.setDefault(ThinClientPreferenceConstants.P_CACHE_DIR,
|
||||
System.getProperty("java.io.tmpdir", ""));
|
||||
store.setDefault(ThinClientPreferenceConstants.P_CACHE_DIR, new File(
|
||||
LocalizationManager.getUserDir(), "cache").getAbsolutePath());
|
||||
store.setDefault(ThinClientPreferenceConstants.P_CACHE_WEATHER, true);
|
||||
store.setDefault(ThinClientPreferenceConstants.P_CACHE_LOCALIZATION,
|
||||
true);
|
||||
|
|
Loading…
Add table
Reference in a new issue