37
37
import com .github .fge .jsonschema .processors .data .SchemaContext ;
38
38
import com .github .fge .jsonschema .processors .data .ValidatorList ;
39
39
import com .github .fge .msgsimple .bundle .MessageBundle ;
40
- import com .google .common .cache .CacheBuilder ;
41
40
import com .google .common .cache .CacheLoader ;
42
- import com .google .common .cache .LoadingCache ;
43
41
import com .google .common .collect .Lists ;
44
42
45
43
import java .util .Collections ;
@@ -54,8 +52,6 @@ public final class ValidationProcessor
54
52
private final MessageBundle syntaxMessages ;
55
53
private final MessageBundle validationMessages ;
56
54
private final Processor <SchemaContext , ValidatorList > processor ;
57
- private final LoadingCache <JsonNode , ArraySchemaSelector > arrayCache ;
58
- private final LoadingCache <JsonNode , ObjectSchemaSelector > objectCache ;
59
55
60
56
public ValidationProcessor (final ValidationConfiguration cfg ,
61
57
final Processor <SchemaContext , ValidatorList > processor )
@@ -65,8 +61,6 @@ public ValidationProcessor(final ValidationConfiguration cfg,
65
61
this .processor = new CachingProcessor <SchemaContext , ValidatorList >(
66
62
processor , SchemaContextEquivalence .getInstance ()
67
63
);
68
- arrayCache = CacheBuilder .newBuilder ().build (arrayLoader ());
69
- objectCache = CacheBuilder .newBuilder ().build (objectLoader ());
70
64
}
71
65
72
66
@ Override
@@ -155,7 +149,7 @@ private void processArray(final ProcessingReport report,
155
149
final JsonNode node = instance .getNode ();
156
150
157
151
final JsonNode digest = ArraySchemaDigester .getInstance ().digest (schema );
158
- final ArraySchemaSelector selector = arrayCache . getUnchecked (digest );
152
+ final ArraySchemaSelector selector = new ArraySchemaSelector (digest );
159
153
160
154
final int size = node .size ();
161
155
@@ -184,7 +178,7 @@ private void processObject(final ProcessingReport report,
184
178
185
179
final JsonNode digest = ObjectSchemaDigester .getInstance ()
186
180
.digest (schema );
187
- final ObjectSchemaSelector selector = objectCache . getUnchecked (digest );
181
+ final ObjectSchemaSelector selector = new ObjectSchemaSelector (digest );
188
182
189
183
final List <String > fields = Lists .newArrayList (node .fieldNames ());
190
184
Collections .sort (fields );
0 commit comments