fix : Modifying the comment Format (#812)

pull/880/head
pizihao 3 years ago
parent 6051755fee
commit b377a87bd1

@ -24,7 +24,6 @@ import java.io.Closeable;
/** /**
* the client for RPC, Explain the role of the client in the request * the client for RPC, Explain the role of the client in the request
*
*/ */
public interface Client extends Closeable { public interface Client extends Closeable {

@ -23,7 +23,6 @@ import cn.hippo4j.config.rpc.response.Response;
/** /**
* Applicable to client connections * Applicable to client connections
*
*/ */
public interface ClientConnection extends Connection { public interface ClientConnection extends Connection {
@ -38,4 +37,9 @@ public interface ClientConnection extends Connection {
* Get timeout, ms * Get timeout, ms
*/ */
long timeout(); long timeout();
/**
* SET timeout, ms
*/
void setTimeout(long timeout);
} }

@ -42,10 +42,9 @@ import java.util.concurrent.locks.LockSupport;
@Slf4j @Slf4j
public class NettyClientConnection implements ClientConnection { public class NettyClientConnection implements ClientConnection {
// TODO InetAddress
String host; String host;
Integer port; Integer port;
// Obtain the connection timeout period. The default value is 3s // Obtain the connection timeout period. The default value is 30s
long timeout = 30000L; long timeout = 30000L;
Channel channel; Channel channel;
EventLoopGroup worker = new NioEventLoopGroup(); EventLoopGroup worker = new NioEventLoopGroup();
@ -97,6 +96,11 @@ public class NettyClientConnection implements ClientConnection {
return timeout; return timeout;
} }
@Override
public void setTimeout(long timeout) {
this.timeout = timeout;
}
@Override @Override
public void close() { public void close() {
if (this.channel == null) { if (this.channel == null) {

@ -24,7 +24,6 @@ import java.io.IOException;
/** /**
* The client, which provides a closing mechanism, maintains a persistent connection if not closed * The client, which provides a closing mechanism, maintains a persistent connection if not closed
*
*/ */
public class RPCClient implements Client { public class RPCClient implements Client {

@ -26,7 +26,6 @@ import io.netty.handler.codec.serialization.ObjectDecoder;
/** /**
* According to the decoder for java objects implemented by ObjectDecoder, * According to the decoder for java objects implemented by ObjectDecoder,
* it is necessary to ensure that the transmitted objects can be serialized * it is necessary to ensure that the transmitted objects can be serialized
*
*/ */
public class NettyDecoder extends ObjectDecoder { public class NettyDecoder extends ObjectDecoder {

@ -27,8 +27,8 @@ import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
/** /**
* this is a encoder * this is a encoder, For custom gluing and unpacking<br>
* * {@link io.netty.handler.codec.serialization.ObjectEncoder}
*/ */
public class NettyEncoder extends MessageToByteEncoder<Serializable> { public class NettyEncoder extends MessageToByteEncoder<Serializable> {

@ -22,7 +22,6 @@ import java.net.InetSocketAddress;
/** /**
* The adaptation layer of different service centers is used to know * The adaptation layer of different service centers is used to know
* the host of different services through the registration center * the host of different services through the registration center
*
*/ */
public interface DiscoveryAdapter { public interface DiscoveryAdapter {

@ -18,7 +18,8 @@
package cn.hippo4j.config.rpc.exception; package cn.hippo4j.config.rpc.exception;
/** /**
* * During decoding and encoding, if an exception occurs, an exception of type {@link CoderException} is thrown,
* which is not different from a {@link RuntimeException}, but is more explicit about the type of exception
*/ */
public class CoderException extends RuntimeException { public class CoderException extends RuntimeException {

@ -18,7 +18,9 @@
package cn.hippo4j.config.rpc.exception; package cn.hippo4j.config.rpc.exception;
/** /**
* * If an exception occurs during the connection between the server and the client, an exception of type
* {@link ConnectionException} is thrown, which is not different from {@link RuntimeException}, but is more explicit
* about the type of exception
*/ */
public class ConnectionException extends RuntimeException { public class ConnectionException extends RuntimeException {

@ -18,7 +18,8 @@
package cn.hippo4j.config.rpc.exception; package cn.hippo4j.config.rpc.exception;
/** /**
* * If there is a timeout between the server and the client, you will get a {@link TimeOutException},
* which is not different from {@link RuntimeException}, but it will be more explicit about the type of exception, right
*/ */
public class TimeOutException extends RuntimeException { public class TimeOutException extends RuntimeException {

@ -24,7 +24,6 @@ import cn.hippo4j.config.rpc.response.Response;
* The handler in each connection, where the specific behavior of the connection * The handler in each connection, where the specific behavior of the connection
* must be specified, such as serialization and parsing, requesting and receiving * must be specified, such as serialization and parsing, requesting and receiving
* requests, and so on * requests, and so on
*
*/ */
public interface ConnectHandler { public interface ConnectHandler {

@ -21,7 +21,6 @@ import java.io.Closeable;
/** /**
* Represents a network request connection and provides IO layer support * Represents a network request connection and provides IO layer support
*
*/ */
public interface Connection extends Closeable { public interface Connection extends Closeable {

@ -28,7 +28,6 @@ import lombok.extern.slf4j.Slf4j;
/** /**
* Processing by the client connection pool handler to clean the buffer and define new connection properties * Processing by the client connection pool handler to clean the buffer and define new connection properties
*
*/ */
@Slf4j @Slf4j
public class NettyClientPoolHandler implements ChannelPoolHandler { public class NettyClientPoolHandler implements ChannelPoolHandler {

@ -27,7 +27,6 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
/** /**
* Interconnect with the netty mediation layer * Interconnect with the netty mediation layer
*
*/ */
public class NettyClientTakeHandler extends ChannelInboundHandlerAdapter implements ConnectHandler { public class NettyClientTakeHandler extends ChannelInboundHandlerAdapter implements ConnectHandler {

@ -36,7 +36,6 @@ import java.util.List;
/** /**
* netty adaptation layer * netty adaptation layer
*
*/ */
public class NettyServerTakeHandler extends ChannelInboundHandlerAdapter implements ConnectHandler { public class NettyServerTakeHandler extends ChannelInboundHandlerAdapter implements ConnectHandler {

@ -22,7 +22,6 @@ import cn.hippo4j.config.rpc.response.Response;
/** /**
* Callback while the connection is in progress * Callback while the connection is in progress
*
*/ */
public interface ActivePostProcess { public interface ActivePostProcess {

@ -25,7 +25,6 @@ import java.util.Objects;
/** /**
* default request<br> * default request<br>
* Use the fully qualified name key of the interface and override equals and hashCode * Use the fully qualified name key of the interface and override equals and hashCode
*
*/ */
public final class DefaultRequest implements Request { public final class DefaultRequest implements Request {

@ -21,7 +21,6 @@ import java.io.Serializable;
/** /**
* request * request
*
*/ */
public interface Request extends Serializable { public interface Request extends Serializable {

@ -25,7 +25,6 @@ import java.util.Objects;
/** /**
* default request<br> * default request<br>
* Use the fully qualified name key of the interface and override equals and hashCode * Use the fully qualified name key of the interface and override equals and hashCode
*
*/ */
public class DefaultResponse implements Response { public class DefaultResponse implements Response {

@ -21,7 +21,6 @@ import java.io.IOException;
/** /**
* Server Implementation * Server Implementation
*
*/ */
public class RPCServer implements Server { public class RPCServer implements Server {

@ -21,7 +21,6 @@ import java.io.Closeable;
/** /**
* the service for RPC, Explain the role of the service in the request * the service for RPC, Explain the role of the service in the request
*
*/ */
public interface Server extends Closeable { public interface Server extends Closeable {

@ -21,7 +21,6 @@ import cn.hippo4j.config.rpc.handler.Connection;
/** /**
* This applies to server-side connections * This applies to server-side connections
*
*/ */
public interface ServerConnection extends Connection { public interface ServerConnection extends Connection {

@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap;
/** /**
* the registration center for Client and Server * the registration center for Client and Server
*
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ClassRegistry { public class ClassRegistry {

@ -23,7 +23,6 @@ import cn.hippo4j.common.web.exception.IllegalException;
/** /**
* Simply creating an instance of a class by its name and its specific type, * Simply creating an instance of a class by its name and its specific type,
* and then throwing an exception if it is an interface, is not elegant * and then throwing an exception if it is an interface, is not elegant
*
*/ */
public class DefaultInstance implements Instance { public class DefaultInstance implements Instance {

@ -19,7 +19,6 @@ package cn.hippo4j.config.rpc.support;
/** /**
* Instance interface to get an instance * Instance interface to get an instance
*
*/ */
public interface Instance { public interface Instance {

@ -34,7 +34,6 @@ import java.util.concurrent.TimeUnit;
/** /**
* This parameter applies only to the connection pool of netty * This parameter applies only to the connection pool of netty
*
*/ */
@Slf4j @Slf4j
public class NettyConnectPool { public class NettyConnectPool {

@ -29,15 +29,13 @@ import java.util.concurrent.ConcurrentHashMap;
/** /**
* To avoid creating multiple connection pools for the same host:port, save all connection pools of the client * To avoid creating multiple connection pools for the same host:port, save all connection pools of the client
*
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class NettyConnectPoolHolder { public class NettyConnectPoolHolder {
static int maxConnect = 64; static int maxConnect = 64;
// TODO InetSocketAddress static Map<String, NettyConnectPool> connectPoolMap = new ConcurrentHashMap<>();
static Map<String, NettyConnectPool> map = new ConcurrentHashMap<>();
private static NettyConnectPool initPool(String host, int port, private static NettyConnectPool initPool(String host, int port,
long timeout, EventLoopGroup worker) { long timeout, EventLoopGroup worker) {
@ -52,30 +50,30 @@ public class NettyConnectPoolHolder {
} }
/** /**
* The connection pool mapping may already exist before the connection pool * The connection pool connectPoolMapping may already exist before the connection pool
* mapping is established. In this case, the connection pool is directly overwritten * connectPoolMapping is established. In this case, the connection pool is directly overwritten
* *
* @param host the host * @param host the host
* @param port the port * @param port the port
* @param pool This parameter applies only to the connection pool of netty * @param pool This parameter applies only to the connection pool of netty
*/ */
public static void createPool(String host, int port, NettyConnectPool pool) { public static void createPool(String host, int port, NettyConnectPool pool) {
map.put(getKey(host, port), pool); connectPoolMap.put(getKey(host, port), pool);
} }
/** /**
* Gets a connection pool, or null if there is no corresponding mapping * Gets a connection pool, or null if there is no corresponding connectPoolMapping
* *
* @param host the host * @param host the host
* @param port the port * @param port the port
* @return Map to the connection pool * @return Map to the connection pool
*/ */
public static NettyConnectPool getPool(String host, int port) { public static NettyConnectPool getPool(String host, int port) {
return map.get(getKey(host, port)); return connectPoolMap.get(getKey(host, port));
} }
/** /**
* Gets a connection pool, and if there is no mapping, creates one with the values provided and joins the mapping * Gets a connection pool, and if there is no connectPoolMapping, creates one with the values provided and joins the connectPoolMapping
* *
* @param host the host * @param host the host
* @param port the port * @param port the port
@ -95,19 +93,19 @@ public class NettyConnectPoolHolder {
} }
/** /**
* Disconnect a connection mapping. This must take effect at the same time as the connection pool is closed * Disconnect a connection connectPoolMapping. This must take effect at the same time as the connection pool is closed
* *
* @param host host * @param host host
* @param port port * @param port port
*/ */
public static void remove(String host, int port) { public static void remove(String host, int port) {
map.remove(getKey(host, port)); connectPoolMap.remove(getKey(host, port));
} }
/** /**
* clear * clear
*/ */
public static void clear() { public static void clear() {
map.clear(); connectPoolMap.clear();
} }
} }

@ -33,11 +33,11 @@ import java.util.Map;
/** /**
* Add a proxy for the request, {@link Proxy} and {@link InvocationHandler} * Add a proxy for the request, {@link Proxy} and {@link InvocationHandler}
*
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class NettyProxyCenter { public class NettyProxyCenter {
// cache
static Map<Class<?>, Object> map = new HashMap<>(); static Map<Class<?>, Object> map = new HashMap<>();
/** /**

@ -31,7 +31,6 @@ import java.util.concurrent.locks.LockSupport;
* The unique remote call can be determined by the key of request and * The unique remote call can be determined by the key of request and
* response, and the result of the call is stored in the secondary cache, * response, and the result of the call is stored in the secondary cache,
* which is convenient for the client to use at any time. * which is convenient for the client to use at any time.
*
*/ */
@Slf4j @Slf4j
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)

@ -21,7 +21,6 @@ import cn.hippo4j.common.config.ApplicationContextHolder;
/** /**
* Adapter Spring, The requested object is managed by spring * Adapter Spring, The requested object is managed by spring
*
*/ */
public class SpringContextInstance implements Instance { public class SpringContextInstance implements Instance {

Loading…
Cancel
Save