Permalink
Browse files

made field cache optional

  • Loading branch information...
1 parent 6b791b4 commit 2841f52eb9f6336f4472fbda98cbcef7b2de2e7d @ceocoder committed May 19, 2011
Showing with 25 additions and 15 deletions.
  1. +3 −0 resources/solandra.properties
  2. +22 −15 src/lucandra/CassandraUtils.java
@@ -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")
}

0 comments on commit 2841f52

Please sign in to comment.