diff src/luan/modules/lucene/SupplementingConfig.java @ 1578:c922446f53aa

immutable threading
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 08 Feb 2021 14:16:19 -0700
parents 8fbcc4747091
children 46cf5137cb6b
line wrap: on
line diff
--- a/src/luan/modules/lucene/SupplementingConfig.java	Sun Jan 31 16:04:39 2021 -0700
+++ b/src/luan/modules/lucene/SupplementingConfig.java	Mon Feb 08 14:16:19 2021 -0700
@@ -13,7 +13,7 @@
 import luan.Luan;
 import luan.LuanFunction;
 import luan.LuanTable;
-import luan.LuanCloner;
+import luan.LuanMutable;
 import luan.LuanException;
 import luan.LuanRuntimeException;
 
@@ -22,11 +22,11 @@
 	private final Luan luan;
 	private final LuanFunction supplementer;
 
-	SupplementingConfig(Version luceneVersion,MultiFieldParser mfp,Luan luan,LuanFunction supplementer) {
+	SupplementingConfig(Version luceneVersion,MultiFieldParser mfp,Luan luan,LuanFunction supplementer) throws LuanException {
 		super(luceneVersion,mfp);
-		LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE);
-		this.luan = (Luan)cloner.get(luan);
-		this.supplementer = (LuanFunction)cloner.get(supplementer);
+		this.luan = new Luan(luan);
+		LuanMutable.makeImmutable(supplementer);
+		this.supplementer = supplementer;
 	}
 
 	@Override public IndexWriterConfig newLuceneConfig() {
@@ -41,7 +41,9 @@
 			return super.getMoreFieldInfo(storedFields);
 		try {
 			LuanTable tbl = toTable(storedFields);
-			tbl = (LuanTable)supplementer.call(luan,tbl);
+			synchronized(luan) {
+				tbl = (LuanTable)supplementer.call(luan,tbl);
+			}
 			if( tbl == null ) {
 				return super.getMoreFieldInfo(storedFields);
 			} else {