Thank You Pramod and Thomas for all your inputs.
Hi Pramod,
Jira https://issues.apache.org/jira/browse/APEXMALHAR-2526 that Thomas
referred seem to be the one inline with what you suggested as a possible
solution. I see there is new class KryoJavaSerializer.java (new in malhar
and not present with 3.7.0 version that I am using) which is doing the work,
though its not related to this particular issue
Regarding my statement of Kryo not working with LinkedHashMap, to put it
precisely,/ it doesn't work for a class that extends LinkedHashMap/. In my
case its LRUCache class. It does work with standard LinkedHashMap and I
could verified this with past few version of kryo. Below is the class i
tested with
public class KryoSerDeTest {
public static void main(String[] args) throws FileNotFoundException {
TestClass clazz = new TestClass();
clazz.getCache().put("ABC", "ABCDE");
clazz.getCache().put("GHI", "GHIJK");
Kryo kryo = new Kryo();
Output output = new Output(new FileOutputStream("file.bin"));
kryo.writeObject(output, clazz);
output.close();
Input input = new Input(new FileInputStream("file.bin"));
TestClass clazz1 = kryo.readObject(input, TestClass.class);
input.close();
System.out.println(clazz1.getCache().get("ABC"));
System.out.println(clazz1.getCache().get("GHI"));
}
}
class TestClass {
LRUCache<String, String> cache;
public TestClass() {
cache = new LRUCache<String, String>(10, false);
}
public LRUCache<String, String> getCache() {
return cache;
}
public void setCache(LRUCache<String, String> cache) {
this.cache = cache;
}
}
class LRUCache<K, V> extends LinkedHashMap<K, V> {
private static final long serialVersionUID = 1L;
public int capacity; // Maximum number of items in the cache.
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public LRUCache() {
super();
}
public LRUCache(int capacity, boolean accessOrder) {
super(capacity + 1, 1.0f, accessOrder); // Pass 'true' for accessOrder.
setCapacity(capacity);
}
@Override
public boolean removeEldestEntry(Map.Entry<K, V> entry) {
return (size() > getCapacity());
}
}
In the above example, if you replace all references of LRUCache from
TestClass with LinkedHashMap then everything works but not with LRUCache
I will update my workaround with your suggestion
Regards
Vivek
--
View this message in context:
http://apache-apex-users-list.78494.x6.nabble.com/How-the-application-recovery-works-when-its-started-with-originalAppId-tp1821p1834.html
Sent from the Apache Apex Users list mailing list archive at Nabble.com.