模块 org.redkale
程序包 org.redkale.net

类 Server<K extends Serializable,​C extends Context,​R extends Request<C>,​P extends Response<C,​R>,​S extends Servlet<C,​R,​P>>

  • 类型参数:
    K - 请求ID的数据类型, 例如HTTP协议请求标识为url,请求ID的数据类型就是String
    C - Context
    R - Request
    P - Response
    S - Servlet
    直接已知子类:
    HttpServer, SncpServer

    public abstract class Server<K extends Serializable,​C extends Context,​R extends Request<C>,​P extends Response<C,​R>,​S extends Servlet<C,​R,​P>>
    extends Object
    详情见: https://redkale.org
    作者:
    zhangjx
    • 字段详细资料

      • logger

        protected final Logger logger
      • serverStartTime

        protected final long serverStartTime
      • netprotocol

        protected final String netprotocol
      • context

        protected C extends Context context
      • charset

        protected Charset charset
      • backlog

        protected int backlog
      • bufferCapacity

        protected int bufferCapacity
      • bufferPoolSize

        protected int bufferPoolSize
      • responsePoolSize

        protected int responsePoolSize
      • maxConns

        protected int maxConns
      • maxHeader

        protected int maxHeader
      • maxBody

        protected int maxBody
      • aliveTimeoutSeconds

        protected int aliveTimeoutSeconds
      • readTimeoutSeconds

        protected int readTimeoutSeconds
      • writeTimeoutSeconds

        protected int writeTimeoutSeconds
    • 方法详细资料

      • getConfBufferCapacity

        public static int getConfBufferCapacity​(AnyValue config,
                                                String netprotocol)
      • getConfBufferPoolSize

        public static int getConfBufferPoolSize​(AnyValue config)
      • getConfNetprotocol

        public static String getConfNetprotocol​(AnyValue config)
      • parseLenth

        protected static int parseLenth​(String value,
                                        int defValue)
      • parseLenth

        protected static long parseLenth​(String value,
                                         long defValue)
      • formatLenth

        protected static String formatLenth​(long value)
      • getName

        public String getName()
      • getNetprotocol

        public String getNetprotocol()
      • getLogger

        public Logger getLogger()
      • getContext

        public C getContext()
      • getServerStartTime

        public long getServerStartTime()
      • getCharset

        public Charset getCharset()
      • getBacklog

        public int getBacklog()
      • getBufferCapacity

        public int getBufferCapacity()
      • getBufferPoolSize

        public int getBufferPoolSize()
      • getResponsePoolSize

        public int getResponsePoolSize()
      • getAliveTimeoutSeconds

        public int getAliveTimeoutSeconds()
      • getReadTimeoutSeconds

        public int getReadTimeoutSeconds()
      • getWriteTimeoutSeconds

        public int getWriteTimeoutSeconds()
      • getMaxConns

        public int getMaxConns()
      • getMaxHeader

        public int getMaxHeader()
      • getMaxBody

        public int getMaxBody()
      • addServlet

        public void addServlet​(S servlet,
                               Object attachment,
                               AnyValue conf,
                               K... mappings)
      • startExtLog

        protected String startExtLog()
      • postPrepareInit

        protected void postPrepareInit()
      • postStart

        protected void postStart()
      • changeCharset

        public void changeCharset​(Charset newCharset)
      • changeMaxconns

        public void changeMaxconns​(int newMaxConns)
      • changeMaxHeader

        public void changeMaxHeader​(int newMaxHeader)
      • changeMaxBody

        public void changeMaxBody​(int newMaxBody)
      • changeReadTimeoutSeconds

        public void changeReadTimeoutSeconds​(int newReadTimeoutSeconds)
      • changeWriteTimeoutSeconds

        public void changeWriteTimeoutSeconds​(int newWriteTimeoutSeconds)
      • changeAliveTimeoutSeconds

        public void changeAliveTimeoutSeconds​(int newAliveTimeoutSeconds)
      • createContext

        protected abstract C createContext()
      • createSafeResponsePool

        protected abstract ObjectPool<P> createSafeResponsePool​(LongAdder createCounter,
                                                                LongAdder cycleCounter,
                                                                int responsePoolSize)
      • setServerClassLoader

        public void setServerClassLoader​(RedkaleClassLoader serverClassLoader)
      • getAsyncGroup

        public AsyncGroup getAsyncGroup()
      • containsFilter

        public <T extends Filter> boolean containsFilter​(Class<T> filterClass)
        判断是否存在Filter
        类型参数:
        T - 泛型
        参数:
        filterClass - Filter类
        返回:
        boolean
      • containsFilter

        public boolean containsFilter​(String filterClassName)
        判断是否存在Filter
        参数:
        filterClassName - Filter类
        返回:
        boolean
      • destroyFilter

        public <T extends Filter> void destroyFilter​(T filter)
        销毁Servlet
        类型参数:
        T - 泛型
        参数:
        filter - Filter
      • containsServlet

        public boolean containsServlet​(Class<? extends S> servletClass)
        判断是否存在Servlet
        参数:
        servletClass - Servlet类
        返回:
        boolean
      • containsServlet

        public boolean containsServlet​(String servletClassName)
        判断是否存在Servlet
        参数:
        servletClassName - Servlet类
        返回:
        boolean
      • destroyServlet

        public void destroyServlet​(S servlet)
        销毁Servlet
        参数:
        servlet - Servlet
      • getCreateConnectionCount

        public long getCreateConnectionCount()
      • getClosedConnectionCount

        public long getClosedConnectionCount()
      • getLivingConnectionCount

        public long getLivingConnectionCount()