fix : Modify some comments and code structure

pull/986/head
pizihao 3 years ago
parent 6ad9752f61
commit c762adb39d

@ -44,6 +44,8 @@ import java.io.Closeable;
* *
* <b>The client implements Closeable and supports automatic shutdown, However, you can manually * <b>The client implements Closeable and supports automatic shutdown, However, you can manually
* disable it when you want to use it</b> * disable it when you want to use it</b>
*
* @since 1.5.1
*/ */
public interface Client extends Closeable { public interface Client extends Closeable {

@ -23,6 +23,8 @@ import cn.hippo4j.rpc.model.Response;
/** /**
* Applicable to client connections<br> * Applicable to client connections<br>
*
* @since 1.5.1
*/ */
public interface ClientConnection extends Connection { public interface ClientConnection extends Connection {

@ -42,6 +42,8 @@ import java.util.concurrent.locks.LockSupport;
/** /**
* Client implemented using netty * Client implemented using netty
*
* @since 1.5.1
*/ */
@Slf4j @Slf4j
public class NettyClientConnection implements ClientConnection { public class NettyClientConnection implements ClientConnection {

@ -25,6 +25,8 @@ import java.io.IOException;
/** /**
* The client, which provides a closing mechanism, maintains a persistent connection if not closed<br> * The client, which provides a closing mechanism, maintains a persistent connection if not closed<br>
* Delegate the method to the {@link ClientConnection} for implementation * Delegate the method to the {@link ClientConnection} for implementation
*
* @since 1.5.1
*/ */
public class RPCClient implements Client { public class RPCClient implements Client {

@ -24,6 +24,8 @@ import java.io.OutputStream;
/** /**
* object OutputStream * object OutputStream
*
* @since 1.5.1
*/ */
public class CompactObjectOutputStream extends ObjectOutputStream { public class CompactObjectOutputStream extends ObjectOutputStream {

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

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

@ -27,6 +27,8 @@ import java.util.ServiceLoader;
* You simply create an instance of a class based on its name and specific type. * You simply create an instance of a class based on its name and specific type.
* Load through the ServiceLoader first. If the load fails, load directly through the instantiation. * Load through the ServiceLoader first. If the load fails, load directly through the instantiation.
* If it is an interface, throw an exception. This is not elegant implementation * If it is an interface, throw an exception. This is not elegant implementation
*
* @since 1.5.1
*/ */
public class DefaultInstance implements Instance { public class DefaultInstance implements Instance {

@ -22,6 +22,8 @@ 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
*
* @since 1.5.1
*/ */
public interface DiscoveryAdapter { public interface DiscoveryAdapter {

@ -19,6 +19,8 @@ package cn.hippo4j.rpc.discovery;
/** /**
* Instance interface to get an instance * Instance interface to get an instance
*
* @since 1.5.1
*/ */
public interface Instance { public interface Instance {

@ -19,6 +19,8 @@ package cn.hippo4j.rpc.discovery;
/** /**
* Gets the top-level interface of the instance port * Gets the top-level interface of the instance port
*
* @since 1.5.1
*/ */
@FunctionalInterface @FunctionalInterface
public interface ServerPort { public interface ServerPort {

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

@ -20,6 +20,8 @@ package cn.hippo4j.rpc.exception;
/** /**
* During decoding and encoding, if an exception occurs, an exception of type {@link CoderException} is thrown, * 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 * which is not different from a {@link RuntimeException}, but is more explicit about the type of exception
*
* @since 1.5.1
*/ */
public class CoderException extends RuntimeException { public class CoderException extends RuntimeException {

@ -21,6 +21,8 @@ package cn.hippo4j.rpc.exception;
* If an exception occurs during the connection between the server and the client, an exception of type * 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 * {@link ConnectionException} is thrown, which is not different from {@link RuntimeException}, but is more explicit
* about the type of exception * about the type of exception
*
* @since 1.5.1
*/ */
public class ConnectionException extends RuntimeException { public class ConnectionException extends RuntimeException {

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

@ -26,6 +26,8 @@ import java.util.stream.Collectors;
/** /**
* Processor manager for ChannelHandler in netty * Processor manager for ChannelHandler in netty
*
* @since 1.5.1
*/ */
public abstract class AbstractNettyHandlerManager implements HandlerManager<ChannelHandler> { public abstract class AbstractNettyHandlerManager implements HandlerManager<ChannelHandler> {

@ -28,6 +28,8 @@ import java.util.Optional;
/** /**
* the abstract base of {@link ConnectHandler} and {@link ChannelInboundHandlerAdapter} * the abstract base of {@link ConnectHandler} and {@link ChannelInboundHandlerAdapter}
*
* @since 1.5.1
*/ */
public abstract class AbstractNettyTakeHandler extends ChannelInboundHandlerAdapter implements ConnectHandler { public abstract class AbstractNettyTakeHandler extends ChannelInboundHandlerAdapter implements ConnectHandler {

@ -25,6 +25,7 @@ import cn.hippo4j.rpc.model.Response;
* 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<br> * requests, and so on<br>
* *
* @since 1.5.1
*/ */
public interface ConnectHandler { public interface ConnectHandler {

@ -26,6 +26,8 @@ import java.io.Closeable;
* operations that should be done in the connection. It is more like integrating the * operations that should be done in the connection. It is more like integrating the
* connection and the connection channel together, so creating {@link Connection} is * connection and the connection channel together, so creating {@link Connection} is
* very resource intensive, for which caching is recommended * very resource intensive, for which caching is recommended
*
* @since 1.5.1
*/ */
public interface Connection extends Closeable { public interface Connection extends Closeable {

@ -25,6 +25,8 @@ import lombok.Getter;
/** /**
* Manage the Handler used in the processing.<br> * Manage the Handler used in the processing.<br>
* The Handler must be able to exist multiple times and be invoked once in a single execution * The Handler must be able to exist multiple times and be invoked once in a single execution
*
* @since 1.5.1
*/ */
public interface HandlerManager<T> { public interface HandlerManager<T> {

@ -32,6 +32,8 @@ import java.util.List;
/** /**
* 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
*
* @since 1.5.1
*/ */
@Slf4j @Slf4j
public class NettyClientPoolHandler extends AbstractNettyHandlerManager implements ChannelPoolHandler { public class NettyClientPoolHandler extends AbstractNettyHandlerManager implements ChannelPoolHandler {

@ -24,6 +24,8 @@ import io.netty.channel.ChannelHandlerContext;
/** /**
* Interconnect with the netty mediation layer * Interconnect with the netty mediation layer
*
* @since 1.5.1
*/ */
@ChannelHandler.Sharable @ChannelHandler.Sharable
public class NettyClientTakeHandler extends AbstractNettyTakeHandler implements ConnectHandler { public class NettyClientTakeHandler extends AbstractNettyTakeHandler implements ConnectHandler {

@ -35,6 +35,8 @@ import java.util.List;
/** /**
* netty adaptation layer * netty adaptation layer
*
* @since 1.5.1
*/ */
@ChannelHandler.Sharable @ChannelHandler.Sharable
public class NettyServerTakeHandler extends AbstractNettyTakeHandler implements ConnectHandler { public class NettyServerTakeHandler extends AbstractNettyTakeHandler implements ConnectHandler {

@ -25,6 +25,8 @@ 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
*
* @since 1.5.1
*/ */
public final class DefaultRequest implements Request { public final class DefaultRequest implements Request {

@ -25,6 +25,8 @@ 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
*
* @since 1.5.1
*/ */
public class DefaultResponse implements Response { public class DefaultResponse implements Response {

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

@ -21,6 +21,8 @@ import java.io.Serializable;
/** /**
* Response * Response
*
* @since 1.5.1
*/ */
public interface Response extends Serializable { public interface Response extends Serializable {

@ -22,6 +22,8 @@ import cn.hippo4j.rpc.model.Response;
/** /**
* Callback while the connection is in progress * Callback while the connection is in progress
*
* @since 1.5.1
*/ */
public interface ActivePostProcess { public interface ActivePostProcess {

@ -30,6 +30,7 @@ import java.util.List;
* reference resources: spring HandlerExecutionChain * reference resources: spring HandlerExecutionChain
* *
* @see ActivePostProcess * @see ActivePostProcess
* @since 1.5.1
*/ */
@Slf4j @Slf4j
public final class ActiveProcessChain { public final class ActiveProcessChain {

@ -37,6 +37,8 @@ import java.util.List;
/** /**
* adapter to the netty server * adapter to the netty server
*
* @since 1.5.1
*/ */
@Slf4j @Slf4j
public class NettyServerConnection extends AbstractNettyHandlerManager implements ServerConnection { public class NettyServerConnection extends AbstractNettyHandlerManager implements ServerConnection {

@ -25,6 +25,8 @@ import java.util.concurrent.CompletableFuture;
/** /**
* Server Implementation * Server Implementation
*
* @since 1.5.1
*/ */
public class RPCServer implements Server { public class RPCServer implements Server {

@ -21,6 +21,8 @@ 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
*
* @since 1.5.1
*/ */
public interface Server extends Closeable { public interface Server extends Closeable {

@ -22,6 +22,8 @@ import cn.hippo4j.rpc.handler.Connection;
/** /**
* This applies to server-side connections * This applies to server-side connections
*
* @since 1.5.1
*/ */
public interface ServerConnection extends Connection { public interface ServerConnection extends Connection {

@ -54,6 +54,7 @@ import java.util.Optional;
* <li>{@link DisposableBean}</li> * <li>{@link DisposableBean}</li>
* </ul> * </ul>
* *
* @since 1.5.1
* @deprecated With {@link cn.hippo4j.config.service.ThreadPoolAdapterService} structure, FactoryBean is not the best choice * @deprecated With {@link cn.hippo4j.config.service.ThreadPoolAdapterService} structure, FactoryBean is not the best choice
*/ */
@Deprecated @Deprecated

@ -52,6 +52,7 @@ import java.util.concurrent.ConcurrentHashMap;
* @see cn.hippo4j.rpc.client.NettyClientConnection * @see cn.hippo4j.rpc.client.NettyClientConnection
* @see NettyServerSupport * @see NettyServerSupport
* @see ClientFactoryBean * @see ClientFactoryBean
* @since 1.5.1
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class NettyClientSupport { public final class NettyClientSupport {

@ -35,6 +35,8 @@ 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
*
* @since 1.5.1
*/ */
@Slf4j @Slf4j
public class NettyConnectPool { public class NettyConnectPool {

@ -31,6 +31,8 @@ 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
*
* @since 1.5.1
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class NettyConnectPoolHolder { public class NettyConnectPoolHolder {

@ -36,6 +36,8 @@ import java.util.concurrent.ConcurrentHashMap;
/** /**
* Add a proxy for the request, {@link Proxy} and {@link InvocationHandler} * Add a proxy for the request, {@link Proxy} and {@link InvocationHandler}
*
* @since 1.5.1
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class NettyProxyCenter { public class NettyProxyCenter {

@ -40,6 +40,7 @@ import java.util.List;
* @see RPCServer * @see RPCServer
* @see NettyServerConnection * @see NettyServerConnection
* @see NettyClientSupport * @see NettyClientSupport
* @since 1.5.1
*/ */
public class NettyServerSupport implements Server { public class NettyServerSupport implements Server {

@ -31,6 +31,8 @@ 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.
*
* @since 1.5.1
*/ */
@Slf4j @Slf4j
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)

Loading…
Cancel
Save