If customer deserializers are registered programatically, gemfire wan hangs and causes issues like max-connection reached and will stop accepting new client connections.
public class MyCustomSerializer extends com.gemstone.gemfire.DataSerializer{
static {
DataSerializer.register(MyCustomSerializer.class);
}
public JodaTimeDataSerializer() {
}
@Override
public Class<?>[] getSupportedClasses() {
return new Class<?>[] {DateTime.class};
}
@Override
public boolean toData(Object o, DataOutput dataOutput) throws IOException {
if (o instanceof DateTime) {
//custom implementation
}
return false;
}
@Override
public Object fromData(DataInput dataInput) throws IOException, ClassNotFoundException {
// custom implementation
}
@Override
public int getId() {
return 987234234;
}
}
The solution is basically to the custom deserializer is use <serialization-registration> tag instead of programatically registering it. This is the recommended approach.
<serialization-registration> <serializer> <class-name>com.sample.MyCustomDataSerializerclass-name> </serializer> </serialization-registration>