Polishing

This commit is contained in:
Marius Bogoevici
2017-03-08 16:09:55 -05:00
parent 4cd9b0c3ec
commit 21cc1e9b58
6 changed files with 15 additions and 14 deletions

View File

@@ -61,7 +61,6 @@
<goals>
<goal>schema</goal>
</goals>
</execution>
</executions>
<configuration>

View File

@@ -19,12 +19,15 @@ package org.springframework.cloud.stream.schema;
import org.apache.avro.Schema;
/**
* This class exists to avoid unnecessary parsing of schema textual representation,
* as well as calls to {@link org.apache.avro.Schema} toString method which is very expensive
* due the utilization of {@link com.fasterxml.jackson.databind.ObjectMapper} to output a JSON representation of the schema.
* Stores a {@link Schema} together with its String representation.
*
* Helps to avoid unnecessary parsing of schema textual representation,
* as well as calls to {@link org.apache.avro.Schema} toString method which is very
* expensive due the utilization of {@link com.fasterxml.jackson.databind.ObjectMapper}
* to output a JSON representation of the schema.
*
* Once a schema is found for any Class, be it a POJO or a {@link org.apache.avro.generic.GenericContainer},
* both textual representation as well as the {@link org.apache.avro.Schema} will be stored within this class
* both textual representation as well as the {@link org.apache.avro.Schema} will be stored within this class.
*
* @author Vinicius Carvalho
*

View File

@@ -21,17 +21,18 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cloud.stream.schema.SchemaReference;
import org.springframework.cloud.stream.schema.SchemaRegistrationResponse;
import org.springframework.util.Assert;
/**
* @author Vinicius Carvalho
*/
public class CachingRegistryClient implements SchemaRegistryClient {
protected static final String CACHE_PREFIX = "org.springframework.cloud.stream.schema.client";
private static final String CACHE_PREFIX = "org.springframework.cloud.stream.schema.client";
protected static final String ID_CACHE = CACHE_PREFIX + ".schemaByIdCache";
private static final String ID_CACHE = CACHE_PREFIX + ".schemaByIdCache";
protected static final String REF_CACHE = CACHE_PREFIX + ".schemaByReferenceCache";
private static final String REF_CACHE = CACHE_PREFIX + ".schemaByReferenceCache";
private SchemaRegistryClient delegate;
@@ -39,6 +40,7 @@ public class CachingRegistryClient implements SchemaRegistryClient {
private CacheManager cacheManager;
public CachingRegistryClient(SchemaRegistryClient delegate) {
Assert.notNull(delegate, "The delegate cannot be null");
this.delegate = delegate;
}
@@ -62,7 +64,4 @@ public class CachingRegistryClient implements SchemaRegistryClient {
return delegate.fetch(id);
}
public void setDelegate(SchemaRegistryClient delegate) {
this.delegate = delegate;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -7,4 +7,4 @@
{"name": "favoriteColor", "type": ["string", "null"]}
]
}
}