陆续解决过很多生产问题,每次没有记录过一段时间就忘记了
服务启动的时候运行卡住了
服务内存溢出
watch com.xxx.NettyClientRequestInvoker invokeOnce "{params,returnObj}" 'params[0].serviceName equals("server1")' -x 2 -b
, 在请求调用前确实没有参数// com.google.gson.internal.bind.ReflectiveTypeAdapterFactory类内部代码
return new ReflectiveTypeAdapterFactory.BoundField(name, serialize, deserialize) {
void read(JsonReader reader, Object value) throws IOException, IllegalAccessException {
Object fieldValue = mapped.read(reader);
if (fieldValue != null || !isPrimitive) {
field.set(value, fieldValue); // gson反序列化时使用反射直接给变量赋值
}
}
thrift生成的类里面的StandardScheme会对基础类型变量判断是否设置过值isSetXXX
private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme<User> {
public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) { // 对于字符串等基础变量判断是否为null
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeString(struct.name);
oprot.writeFieldEnd();
}
if (struct.isSetAge()) { // 对于基础类型会判断isSetXXX
oprot.writeFieldBegin(AGE_FIELD_DESC);
oprot.writeI32(struct.age);
oprot.writeFieldEnd();
}
if (struct.address != null) { // 对于字符串等基础变量判断是否为null
if(struct.isSetAddress()) { // 如果字段是optioal的,还要判断isSetXXX,public boolean isSetAddress() { return this.address != null; // 这个方法其实还是判断的字符串是否为null}
oprot.writeFieldBegin(ADDRESS_FIELD_DESC);
oprot.writeString(struct.name);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}