[#5290] Internal Cache is not Serializable

This commit is contained in:
lukaseder 2016-05-24 11:06:00 +02:00
parent a3ac792176
commit e746abe61e

View File

@ -76,6 +76,7 @@ import static org.jooq.impl.Identifiers.QUOTE_END_DELIMITER_ESCAPED;
import static org.jooq.impl.Identifiers.QUOTE_START_DELIMITER;
import static org.jooq.tools.reflect.Reflect.accessible;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@ -2309,7 +2310,7 @@ final class Tools {
* @return The cached value or the outcome of the cached operation.
*/
@SuppressWarnings("unchecked")
static final <V> V run(Configuration configuration, CachedOperation<V> operation, String type, Object... keys) {
static final <V> V run(Configuration configuration, CachedOperation<V> operation, String type, Serializable... keys) {
// If no configuration is provided take the default configuration that loads the default Settings
if (configuration == null)
@ -2359,7 +2360,7 @@ final class Tools {
/**
* Create a single-value or multi-value key for caching.
*/
private static final Object key(final Object... key) {
private static final Object key(final Serializable... key) {
if (key == null || key.length == 0)
return key;
@ -2372,11 +2373,15 @@ final class Tools {
/**
* A multi-value key for caching.
*/
private static class Key {
private static class Key implements Serializable {
private final Object[] key;
/**
* Generated UID.
*/
private static final long serialVersionUID = 5822370287443922993L;
private final Serializable[] key;
Key(Object[] key) {
Key(Serializable[] key) {
this.key = key;
}