diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2012-11-05 19:05:24 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2012-11-05 19:05:24 +0000 |
commit | fb4121548fcbd904db954f171989686a46291dab (patch) | |
tree | 280c4ec1ab789c5efee7a0aa1e7c6396df48c060 /src/main/java/com/amazon | |
parent | 742805682f6784ddd9c1b5b476305dbdcad6dd08 (diff) |
Use proper key for alt generation decoder.
Diffstat (limited to 'src/main/java/com/amazon')
-rw-r--r-- | src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java index 92a6473..e443f18 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java @@ -522,19 +522,16 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S Decoder<S> decoder = (Decoder<S>) decoders.get(generation);
if (decoder == null) {
synchronized (cCodecDecoders) {
- Object key = KeyFactory.createKey(new Object[] {mCodecKey, generation});
+ Object altLayoutKey = new LayoutKey(mLayout.getGeneration(generation));
+ Object key = KeyFactory.createKey
+ // Note: Generation is still required in the key
+ // because an equivalent layout (with different generation)
+ // might have been supplied by Layout.getGeneration.
+ (new Object[] {mCodecKey, generation, altLayoutKey});
decoder = (Decoder<S>) cCodecDecoders.get(key);
if (decoder == null) {
decoder = generateDecoder(generation);
cCodecDecoders.put(key, decoder);
- } else {
- // Confirm that layout still exists.
- try {
- mLayout.getGeneration(generation);
- } catch (FetchNoneException e) {
- cCodecDecoders.remove(key);
- throw e;
- }
}
}
mDecoders.put(generation, decoder);
|