K
- 请求ID的数据类型, 例如HTTP协议请求标识为url,请求ID的数据类型就是StringC
- ContextR
- RequestP
- ResponseS
- Servletpublic abstract class Server<K extends java.io.Serializable,C extends Context,R extends Request<C>,P extends Response<C,R>,S extends Servlet<C,R,P>>
extends java.lang.Object
详情见: https://redkale.org
限定符和类型 | 字段和说明 |
---|---|
protected java.net.InetSocketAddress |
address |
protected int |
aliveTimeoutSeconds |
protected int |
backlog |
protected int |
bufferCapacity |
protected int |
bufferPoolSize |
protected java.nio.charset.Charset |
charset |
protected AnyValue |
config |
protected C |
context |
protected java.util.concurrent.ThreadPoolExecutor |
executor |
protected java.util.logging.Logger |
logger |
protected int |
maxbody |
protected int |
maxconns |
protected java.lang.String |
name |
protected PrepareServlet<K,C,R,P,S> |
prepare |
protected java.lang.String |
protocol |
protected int |
readTimeoutSeconds |
static java.lang.String |
RESNAME_SERVER_EXECUTOR |
static java.lang.String |
RESNAME_SERVER_RESFACTORY |
static java.lang.String |
RESNAME_SERVER_ROOT |
protected ResourceFactory |
resourceFactory |
protected int |
responsePoolSize |
protected ProtocolServer |
serverChannel |
protected RedkaleClassLoader |
serverClassLoader |
protected long |
serverStartTime |
protected javax.net.ssl.SSLContext |
sslContext |
protected int |
threads |
protected int |
writeTimeoutSeconds |
限定符 | 构造器和说明 |
---|---|
protected |
Server(long serverStartTime,
java.lang.String protocol,
ResourceFactory resourceFactory,
PrepareServlet<K,C,R,P,S> servlet) |
限定符和类型 | 方法和说明 |
---|---|
void |
addServlet(S servlet,
java.lang.Object attachment,
AnyValue conf,
K... mappings) |
void |
changeAddress(java.net.InetSocketAddress addr) |
void |
changeAliveTimeoutSeconds(int newAliveTimeoutSeconds) |
void |
changeCharset(java.nio.charset.Charset newcharset) |
void |
changeMaxbody(int newmaxbody) |
void |
changeMaxconns(int newmaxconns) |
void |
changeReadTimeoutSeconds(int newReadTimeoutSeconds) |
void |
changeWriteTimeoutSeconds(int newWriteTimeoutSeconds) |
<T extends Filter> |
containsFilter(java.lang.Class<T> filterClass)
判断是否存在Filter
|
<T extends Filter> |
containsFilter(java.lang.String filterClassName)
判断是否存在Filter
|
boolean |
containsServlet(java.lang.Class<? extends S> servletClass)
判断是否存在Servlet
|
boolean |
containsServlet(java.lang.String servletClassName)
判断是否存在Servlet
|
protected abstract ObjectPool<java.nio.ByteBuffer> |
createBufferPool(java.util.concurrent.atomic.AtomicLong createCounter,
java.util.concurrent.atomic.AtomicLong cycleCounter,
int bufferPoolSize) |
protected abstract C |
createContext() |
protected java.text.Format |
createFormat() |
protected abstract Creator<Response> |
createResponseCreator(ObjectPool<java.nio.ByteBuffer> bufferPool,
ObjectPool<Response> responsePool) |
protected abstract ObjectPool<Response> |
createResponsePool(java.util.concurrent.atomic.AtomicLong createCounter,
java.util.concurrent.atomic.AtomicLong cycleCounter,
int responsePoolSize) |
void |
destroy(AnyValue config) |
void |
destroyServlet(S servlet)
销毁Servlet
|
protected static java.lang.String |
formatLenth(long value) |
int |
getAliveTimeoutSeconds() |
int |
getBacklog() |
int |
getBufferCapacity() |
int |
getBufferPoolSize() |
java.nio.charset.Charset |
getCharset() |
long |
getClosedConnectionCount() |
C |
getContext() |
long |
getCreateConnectionCount() |
java.util.concurrent.ThreadPoolExecutor |
getExecutor() |
long |
getLivingConnectionCount() |
java.util.logging.Logger |
getLogger() |
int |
getMaxbody() |
int |
getMaxconns() |
java.lang.String |
getName() |
PrepareServlet<K,C,R,P,S> |
getPrepareServlet() |
java.lang.String |
getProtocol() |
int |
getReadTimeoutSeconds() |
ResourceFactory |
getResourceFactory() |
int |
getResponsePoolSize() |
RedkaleClassLoader |
getServerClassLoader() |
long |
getServerStartTime() |
java.net.InetSocketAddress |
getSocketAddress() |
int |
getThreads() |
int |
getWriteTimeoutSeconds() |
void |
init(AnyValue config) |
static java.net.URL[] |
loadLib(RedkaleClassLoader classLoader,
java.util.logging.Logger logger,
java.lang.String lib) |
protected static int |
parseLenth(java.lang.String value,
int defValue) |
protected static long |
parseLenth(java.lang.String value,
long defValue) |
protected void |
postStart() |
void |
setServerClassLoader(RedkaleClassLoader serverClassLoader) |
void |
setThreads(int threads) |
void |
shutdown() |
void |
start() |
public static final java.lang.String RESNAME_SERVER_ROOT
public static final java.lang.String RESNAME_SERVER_EXECUTOR
public static final java.lang.String RESNAME_SERVER_RESFACTORY
protected final java.util.logging.Logger logger
protected final long serverStartTime
protected java.lang.String name
protected final java.lang.String protocol
protected final ResourceFactory resourceFactory
protected final PrepareServlet<K extends java.io.Serializable,C extends Context,R extends Request<C>,P extends Response<C,R>,S extends Servlet<C,R,P>> prepare
protected RedkaleClassLoader serverClassLoader
protected javax.net.ssl.SSLContext sslContext
protected AnyValue config
protected java.nio.charset.Charset charset
protected java.net.InetSocketAddress address
protected int backlog
protected ProtocolServer serverChannel
protected int bufferCapacity
protected int threads
protected java.util.concurrent.ThreadPoolExecutor executor
protected int bufferPoolSize
protected int responsePoolSize
protected int maxconns
protected int maxbody
protected int aliveTimeoutSeconds
protected int readTimeoutSeconds
protected int writeTimeoutSeconds
protected Server(long serverStartTime, java.lang.String protocol, ResourceFactory resourceFactory, PrepareServlet<K,C,R,P,S> servlet)
public void init(AnyValue config) throws java.lang.Exception
java.lang.Exception
protected static int parseLenth(java.lang.String value, int defValue)
protected static long parseLenth(java.lang.String value, long defValue)
protected static java.lang.String formatLenth(long value)
public void destroy(AnyValue config) throws java.lang.Exception
java.lang.Exception
public ResourceFactory getResourceFactory()
public java.util.concurrent.ThreadPoolExecutor getExecutor()
public java.net.InetSocketAddress getSocketAddress()
public java.lang.String getName()
public java.lang.String getProtocol()
public java.util.logging.Logger getLogger()
public C getContext()
public long getServerStartTime()
public java.nio.charset.Charset getCharset()
public int getBacklog()
public int getBufferCapacity()
public int getThreads()
public int getBufferPoolSize()
public int getResponsePoolSize()
public int getMaxbody()
public int getAliveTimeoutSeconds()
public int getReadTimeoutSeconds()
public int getWriteTimeoutSeconds()
public int getMaxconns()
public void setThreads(int threads)
public void addServlet(S servlet, java.lang.Object attachment, AnyValue conf, K... mappings)
public void start() throws java.io.IOException
java.io.IOException
protected void postStart()
public void changeAddress(java.net.InetSocketAddress addr) throws java.io.IOException
java.io.IOException
public void changeMaxconns(int newmaxconns)
public void changeCharset(java.nio.charset.Charset newcharset)
public void changeMaxbody(int newmaxbody)
public void changeReadTimeoutSeconds(int newReadTimeoutSeconds)
public void changeWriteTimeoutSeconds(int newWriteTimeoutSeconds)
public void changeAliveTimeoutSeconds(int newAliveTimeoutSeconds)
protected abstract C createContext()
protected abstract ObjectPool<java.nio.ByteBuffer> createBufferPool(java.util.concurrent.atomic.AtomicLong createCounter, java.util.concurrent.atomic.AtomicLong cycleCounter, int bufferPoolSize)
protected abstract ObjectPool<Response> createResponsePool(java.util.concurrent.atomic.AtomicLong createCounter, java.util.concurrent.atomic.AtomicLong cycleCounter, int responsePoolSize)
protected abstract Creator<Response> createResponseCreator(ObjectPool<java.nio.ByteBuffer> bufferPool, ObjectPool<Response> responsePool)
public void shutdown() throws java.io.IOException
java.io.IOException
public RedkaleClassLoader getServerClassLoader()
public void setServerClassLoader(RedkaleClassLoader serverClassLoader)
public <T extends Filter> boolean containsFilter(java.lang.Class<T> filterClass)
T
- 泛型filterClass
- Filter类public <T extends Filter> boolean containsFilter(java.lang.String filterClassName)
T
- 泛型filterClassName
- Filter类public boolean containsServlet(java.lang.Class<? extends S> servletClass)
servletClass
- Servlet类public boolean containsServlet(java.lang.String servletClassName)
servletClassName
- Servlet类public void destroyServlet(S servlet)
servlet
- Servletpublic long getCreateConnectionCount()
public long getClosedConnectionCount()
public long getLivingConnectionCount()
protected java.text.Format createFormat()
public static java.net.URL[] loadLib(RedkaleClassLoader classLoader, java.util.logging.Logger logger, java.lang.String lib) throws java.lang.Exception
java.lang.Exception