-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolved problems mentioned in last discussion with kryo serializer (#61
) * Fix unserialize bug when web application restart. The situation as as following: Start redis-server 1. Start web application. 2. Execute query and some objects are cached. -> Class is registered 3. Stop web application. 4. Start web application. 5. KryoSerializer is initialized and no Class is registered yet. 6. Execute theKryoSerializer#unserialize() is invoked, but it fails because Class is unknown. * Modify effection problem when switch between kryo serializer and jdk serializer in situation that certain class can not serialize with kryo serializer(very rare) * Abstract serializers to an interface in order to support various serialize methods. * Set kryo dependency to optional * Add serializer interface * Use JDKSerializer as fallback of KryoSerializer and add related testcases. * Make serializer configurable with redis.properties * Add test case of unserialize object from a file * Fix test NPE bug in JDK9 * Format java files and set default serializer to jdk. * Fix test case bug of unserialize with kyro from file.
- Loading branch information
Showing
11 changed files
with
296 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Copyright 2015-2018 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.mybatis.caches.redis; | ||
|
||
public interface Serializer { | ||
|
||
/** | ||
* Serialize method | ||
* @param object | ||
* @return serialized bytes | ||
*/ | ||
public byte[] serialize(Object object); | ||
|
||
/** | ||
* Unserialize method | ||
* @param bytes | ||
* @return unserialized object | ||
*/ | ||
public Object unserialize(byte[] bytes); | ||
|
||
} |
Oops, something went wrong.
@laddcn Is this import unused? I suspect it is. I can remove in another commit, just wanted to point it out.