Browse Source

fix bug and code style

pull/3/MERGE
CalvinKirs 4 years ago
parent
commit
967ab641dd
  1. 15
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/serialize/ProtoStuffUtils.java
  2. 1
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/client/IRpcClient.java
  3. 1
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/client/RpcRequestTable.java
  4. 9
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/codec/NettyDecoder.java
  5. 7
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/codec/NettyEncoder.java
  6. 1
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/config/ServiceBean.java
  7. 4
      dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/remote/NettyServer.java

15
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/serialize/ProtoStuffUtils.java

@ -17,14 +17,14 @@
package org.apache.dolphinscheduler.remote.serialize;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import io.protostuff.LinkedBuffer;
import io.protostuff.ProtostuffIOUtil;
import io.protostuff.Schema;
import io.protostuff.runtime.RuntimeSchema;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* ProtoStuffUtils
*/
@ -49,14 +49,7 @@ public class ProtoStuffUtils {
@SuppressWarnings("unchecked")
private static <T> Schema<T> getSchema(Class<T> clazz) {
Schema<T> schema = (Schema<T>) schemaCache.get(clazz);
if (schema == null) {
schema = RuntimeSchema.getSchema(clazz);
if (schema != null) {
schemaCache.put(clazz, schema);
}
}
return schema;
return (Schema<T>) schemaCache.computeIfAbsent(clazz, RuntimeSchema::createFrom);
}
public static <T> T deserialize(byte[] bytes, Class<T> clazz) {

1
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/client/IRpcClient.java

@ -24,7 +24,6 @@ import org.apache.dolphinscheduler.remote.utils.Host;
*/
public interface IRpcClient {
<T> T create(Class<T> clazz, Host host) throws Exception;
}

1
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/client/RpcRequestTable.java

@ -24,7 +24,6 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class RpcRequestTable {
private static ConcurrentHashMap<String, RpcRequestCache> requestMap = new ConcurrentHashMap<>();
public static void put(String requestId, RpcRequestCache rpcRequestCache) {

9
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/codec/NettyDecoder.java

@ -17,14 +17,14 @@
package org.apache.dolphinscheduler.rpc.codec;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import org.apache.dolphinscheduler.remote.serialize.ProtoStuffUtils;
import java.util.List;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
/**
* NettyDecoder
*/
@ -32,7 +32,6 @@ public class NettyDecoder extends ByteToMessageDecoder {
private Class<?> genericClass;
public NettyDecoder(Class<?> genericClass) {
this.genericClass = genericClass;
}

7
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/codec/NettyEncoder.java

@ -17,15 +17,14 @@
package org.apache.dolphinscheduler.rpc.codec;
import org.apache.dolphinscheduler.remote.serialize.ProtoStuffUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import org.apache.dolphinscheduler.remote.serialize.ProtoStuffUtils;
/**
* @author jiangli
* @date 2021-01-12 18:52
* NettyEncoder
*/
public class NettyEncoder extends MessageToByteEncoder {

1
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/config/ServiceBean.java

@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

4
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/rpc/remote/NettyServer.java

@ -18,10 +18,10 @@
package org.apache.dolphinscheduler.rpc.remote;
import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
import org.apache.dolphinscheduler.rpc.codec.NettyDecoder;
import org.apache.dolphinscheduler.rpc.codec.NettyEncoder;
import org.apache.dolphinscheduler.remote.utils.Constants;
import org.apache.dolphinscheduler.remote.utils.NettyUtils;
import org.apache.dolphinscheduler.rpc.codec.NettyDecoder;
import org.apache.dolphinscheduler.rpc.codec.NettyEncoder;
import org.apache.dolphinscheduler.rpc.common.RpcRequest;
import org.apache.dolphinscheduler.rpc.common.RpcResponse;

Loading…
Cancel
Save