Code example for Schema

Methods: newValidator

0
    @Override 
    public Validator getValidator(Schema schema) {
        /* 
         * this looks stupid but to avoid lock, and there is almost no cost for creating a ThreadLocal object 
         */ 
        validatorThreadLocalMap.putIfAbsent(schema, new ThreadLocal<Validator>());
        ThreadLocal<Validator> threadLocal = validatorThreadLocalMap.get(schema);
 
        Validator validator = threadLocal.get();
 
        if (validator == null) {
            validator = schema.newValidator();
            threadLocal.set(validator);
        } 
 
        return validator;
    } 
 
    @Override 
    public void clearValidators(Schema schema) {
Connect your IDE to all the code out there  Get Codota for Java