Solandra - make LucandraFieldCache optional #92

Closed
wants to merge 11 commits into
from
@@ -6,6 +6,9 @@ solandra.compression = false
#The consistency level of solandra reads and writes
solandra.consistency = ONE
+#use custom field cache implementation for solandra
+solandra.custom.fieldcache = false
+
#The number of milliseconds solandra will wait before
#checking to see if it's cache needs to be invalidated
#for a given index
@@ -88,23 +88,30 @@
.name()));
useCompression = Boolean.valueOf(properties.getProperty("solandra.compression", "true"));
-
- try
- {
- setFinalStatic(FieldCache.class.getDeclaredField("DEFAULT"), new org.apache.lucene.search.LucandraFieldCache());
- logger.info("Sucessfully Hijacked FieldCacheImpl");
- }
- catch (SecurityException e)
- {
- logger.info("Unable to hijack the FieldCache");
- }
- catch (NoSuchFieldException e)
- {
- throw new RuntimeException(e);
+
+ if(Boolean.valueOf(properties.getProperty("solandra.custom.fieldcache", "false")))
+ {
+ try
+ {
+ setFinalStatic(FieldCache.class.getDeclaredField("DEFAULT"), new org.apache.lucene.search.LucandraFieldCache());
+ logger.info("Sucessfully Hijacked FieldCacheImpl");
+ }
+ catch (SecurityException e)
+ {
+ logger.info("Unable to hijack the FieldCache");
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
}
- catch (Exception e)
+ else
{
- throw new RuntimeException(e);
+ logger.info("not using custom field cache")
}