增加部分package-info
This commit is contained in:
4
src/main/java/org/redkale/annotation/package-info.java
Normal file
4
src/main/java/org/redkale/annotation/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 提供基础注解包
|
||||||
|
*/
|
||||||
|
package org.redkale.annotation;
|
||||||
4
src/main/java/org/redkale/boot/watch/package-info.java
Normal file
4
src/main/java/org/redkale/boot/watch/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 提供系统默认监控包
|
||||||
|
*/
|
||||||
|
package org.redkale.boot.watch;
|
||||||
4
src/main/java/org/redkale/cluster/package-info.java
Normal file
4
src/main/java/org/redkale/cluster/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 提供注册服务与发现服务包
|
||||||
|
*/
|
||||||
|
package org.redkale.cluster;
|
||||||
4
src/main/java/org/redkale/mq/package-info.java
Normal file
4
src/main/java/org/redkale/mq/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* MQ服务包
|
||||||
|
*/
|
||||||
|
package org.redkale.mq;
|
||||||
@@ -61,7 +61,7 @@ public class AsyncIOGroup extends AsyncGroup {
|
|||||||
private ScheduledThreadPoolExecutor timeoutExecutor;
|
private ScheduledThreadPoolExecutor timeoutExecutor;
|
||||||
|
|
||||||
public AsyncIOGroup(final int bufferCapacity, final int bufferPoolSize) {
|
public AsyncIOGroup(final int bufferCapacity, final int bufferPoolSize) {
|
||||||
this(true, null, null, bufferCapacity, bufferPoolSize);
|
this(true, "Redkale-AnonymousClient-IOThread-%s", null, bufferCapacity, bufferPoolSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsyncIOGroup(boolean client, String threadNameFormat, final ExecutorService workExecutor, final int bufferCapacity, final int bufferPoolSize) {
|
public AsyncIOGroup(boolean client, String threadNameFormat, final ExecutorService workExecutor, final int bufferCapacity, final int bufferPoolSize) {
|
||||||
|
|||||||
@@ -72,14 +72,14 @@ public class Context {
|
|||||||
protected int writeTimeoutSeconds;
|
protected int writeTimeoutSeconds;
|
||||||
|
|
||||||
//服务的监听地址
|
//服务的监听地址
|
||||||
protected InetSocketAddress address;
|
protected InetSocketAddress serverAddress;
|
||||||
|
|
||||||
//字符集
|
//字符集
|
||||||
protected Charset charset;
|
protected Charset charset;
|
||||||
|
|
||||||
public Context(ContextConfig config) {
|
public Context(ContextConfig config) {
|
||||||
this(config.serverStartTime, config.logger, config.workExecutor, config.sslBuilder, config.sslContext,
|
this(config.serverStartTime, config.logger, config.workExecutor, config.sslBuilder, config.sslContext,
|
||||||
config.bufferCapacity, config.maxconns, config.maxbody, config.charset, config.address, config.resourceFactory,
|
config.bufferCapacity, config.maxconns, config.maxbody, config.charset, config.serverAddress, config.resourceFactory,
|
||||||
config.prepare, config.aliveTimeoutSeconds, config.readTimeoutSeconds, config.writeTimeoutSeconds);
|
config.prepare, config.aliveTimeoutSeconds, config.readTimeoutSeconds, config.writeTimeoutSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public class Context {
|
|||||||
this.maxconns = maxconns;
|
this.maxconns = maxconns;
|
||||||
this.maxbody = maxbody;
|
this.maxbody = maxbody;
|
||||||
this.charset = StandardCharsets.UTF_8.equals(charset) ? null : charset;
|
this.charset = StandardCharsets.UTF_8.equals(charset) ? null : charset;
|
||||||
this.address = address;
|
this.serverAddress = address;
|
||||||
this.prepare = prepare;
|
this.prepare = prepare;
|
||||||
this.resourceFactory = resourceFactory;
|
this.resourceFactory = resourceFactory;
|
||||||
this.aliveTimeoutSeconds = aliveTimeoutSeconds;
|
this.aliveTimeoutSeconds = aliveTimeoutSeconds;
|
||||||
@@ -180,7 +180,7 @@ public class Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InetSocketAddress getServerAddress() {
|
public InetSocketAddress getServerAddress() {
|
||||||
return address;
|
return serverAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getServerStartTime() {
|
public long getServerStartTime() {
|
||||||
@@ -240,7 +240,7 @@ public class Context {
|
|||||||
public DispatcherServlet prepare;
|
public DispatcherServlet prepare;
|
||||||
|
|
||||||
//服务的监听地址
|
//服务的监听地址
|
||||||
public InetSocketAddress address;
|
public InetSocketAddress serverAddress;
|
||||||
|
|
||||||
//字符集
|
//字符集
|
||||||
public Charset charset;
|
public Charset charset;
|
||||||
|
|||||||
@@ -322,9 +322,9 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
|
|||||||
public void changeAddress(Application application, final InetSocketAddress addr) throws IOException {
|
public void changeAddress(Application application, final InetSocketAddress addr) throws IOException {
|
||||||
long s = System.currentTimeMillis();
|
long s = System.currentTimeMillis();
|
||||||
Objects.requireNonNull(addr);
|
Objects.requireNonNull(addr);
|
||||||
final InetSocketAddress oldAddress = context.address;
|
final InetSocketAddress oldAddress = context.serverAddress;
|
||||||
final ProtocolServer oldServerChannel = this.serverChannel;
|
final ProtocolServer oldServerChannel = this.serverChannel;
|
||||||
context.address = addr;
|
context.serverAddress = addr;
|
||||||
ProtocolServer newServerChannel = null;
|
ProtocolServer newServerChannel = null;
|
||||||
try {
|
try {
|
||||||
newServerChannel = ProtocolServer.create(this.netprotocol, context, this.serverClassLoader);
|
newServerChannel = ProtocolServer.create(this.netprotocol, context, this.serverClassLoader);
|
||||||
@@ -332,10 +332,10 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
|
|||||||
newServerChannel.bind(addr, backlog);
|
newServerChannel.bind(addr, backlog);
|
||||||
newServerChannel.accept(application, this);
|
newServerChannel.accept(application, this);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
context.address = oldAddress;
|
context.serverAddress = oldAddress;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
this.address = context.address;
|
this.address = context.serverAddress;
|
||||||
this.serverChannel = newServerChannel;
|
this.serverChannel = newServerChannel;
|
||||||
logger.info(this.getClass().getSimpleName() + ("TCP".equalsIgnoreCase(netprotocol) ? "" : ("." + netprotocol))
|
logger.info(this.getClass().getSimpleName() + ("TCP".equalsIgnoreCase(netprotocol) ? "" : ("." + netprotocol))
|
||||||
+ " change address listen: " + address + ", started in " + (System.currentTimeMillis() - s) + " ms");
|
+ " change address listen: " + address + ", started in " + (System.currentTimeMillis() - s) + " ms");
|
||||||
@@ -414,7 +414,7 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
|
|||||||
contextConfig.maxconns = this.maxconns;
|
contextConfig.maxconns = this.maxconns;
|
||||||
contextConfig.maxbody = this.maxbody;
|
contextConfig.maxbody = this.maxbody;
|
||||||
contextConfig.charset = this.charset;
|
contextConfig.charset = this.charset;
|
||||||
contextConfig.address = this.address;
|
contextConfig.serverAddress = this.address;
|
||||||
contextConfig.prepare = this.dispatcher;
|
contextConfig.prepare = this.dispatcher;
|
||||||
contextConfig.resourceFactory = this.resourceFactory;
|
contextConfig.resourceFactory = this.resourceFactory;
|
||||||
contextConfig.aliveTimeoutSeconds = this.aliveTimeoutSeconds;
|
contextConfig.aliveTimeoutSeconds = this.aliveTimeoutSeconds;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public final class Transport {
|
|||||||
if (hasold) {
|
if (hasold) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
list.add(new TransportNode(factory.poolmaxconns, addr));
|
list.add(new TransportNode(factory.poolMaxConns, addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.transportNodes = list.toArray(new TransportNode[list.size()]);
|
this.transportNodes = list.toArray(new TransportNode[list.size()]);
|
||||||
@@ -139,14 +139,14 @@ public final class Transport {
|
|||||||
}
|
}
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (this.transportNodes.length == 0) {
|
if (this.transportNodes.length == 0) {
|
||||||
this.transportNodes = new TransportNode[]{new TransportNode(factory.poolmaxconns, addr)};
|
this.transportNodes = new TransportNode[]{new TransportNode(factory.poolMaxConns, addr)};
|
||||||
} else {
|
} else {
|
||||||
for (TransportNode i : this.transportNodes) {
|
for (TransportNode i : this.transportNodes) {
|
||||||
if (addr.equals(i.address)) {
|
if (addr.equals(i.address)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.transportNodes = Utility.append(transportNodes, new TransportNode(factory.poolmaxconns, addr));
|
this.transportNodes = Utility.append(transportNodes, new TransportNode(factory.poolMaxConns, addr));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ public final class Transport {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
this.transportNodes = Utility.remove(transportNodes, new TransportNode(factory.poolmaxconns, addr));
|
this.transportNodes = Utility.remove(transportNodes, new TransportNode(factory.poolMaxConns, addr));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ public class TransportFactory {
|
|||||||
protected final List<WeakReference<Transport>> transportReferences = new CopyOnWriteArrayList<>();
|
protected final List<WeakReference<Transport>> transportReferences = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
//连接池大小
|
//连接池大小
|
||||||
protected int poolmaxconns = Integer.getInteger("redkale.net.transport.pool.maxconns", Math.max(100, Utility.cpus() * 16)); //最少是wsthreads的两倍
|
protected int poolMaxConns = Integer.getInteger("redkale.net.transport.pool.maxconns", Math.max(100, Utility.cpus() * 16)); //最少是wsthreads的两倍
|
||||||
|
|
||||||
//检查不可用地址周期, 单位:秒
|
//检查不可用地址周期, 单位:秒
|
||||||
protected int checkinterval = Integer.getInteger("redkale.net.transport.check.interval", 30);
|
protected int checkInterval = Integer.getInteger("redkale.net.transport.check.interval", 30);
|
||||||
|
|
||||||
//心跳周期, 单位:秒
|
//心跳周期, 单位:秒
|
||||||
protected int pinginterval;
|
protected int pinginterval;
|
||||||
@@ -105,17 +105,17 @@ public class TransportFactory {
|
|||||||
|
|
||||||
public void init(AnyValue conf, ByteBuffer pingBuffer, int pongLength) {
|
public void init(AnyValue conf, ByteBuffer pingBuffer, int pongLength) {
|
||||||
if (conf != null) {
|
if (conf != null) {
|
||||||
this.poolmaxconns = conf.getIntValue(NAME_POOLMAXCONNS, this.poolmaxconns);
|
this.poolMaxConns = conf.getIntValue(NAME_POOLMAXCONNS, this.poolMaxConns);
|
||||||
this.pinginterval = conf.getIntValue(NAME_PINGINTERVAL, this.pinginterval);
|
this.pinginterval = conf.getIntValue(NAME_PINGINTERVAL, this.pinginterval);
|
||||||
this.checkinterval = conf.getIntValue(NAME_CHECKINTERVAL, this.checkinterval);
|
this.checkInterval = conf.getIntValue(NAME_CHECKINTERVAL, this.checkInterval);
|
||||||
if (this.poolmaxconns < 2) {
|
if (this.poolMaxConns < 2) {
|
||||||
this.poolmaxconns = 2;
|
this.poolMaxConns = 2;
|
||||||
}
|
}
|
||||||
if (this.pinginterval < 2) {
|
if (this.pinginterval < 2) {
|
||||||
this.pinginterval = 2;
|
this.pinginterval = 2;
|
||||||
}
|
}
|
||||||
if (this.checkinterval < 2) {
|
if (this.checkInterval < 2) {
|
||||||
this.checkinterval = 2;
|
this.checkInterval = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.scheduler = new ScheduledThreadPoolExecutor(1, (Runnable r) -> {
|
this.scheduler = new ScheduledThreadPoolExecutor(1, (Runnable r) -> {
|
||||||
@@ -127,9 +127,9 @@ public class TransportFactory {
|
|||||||
try {
|
try {
|
||||||
checks();
|
checks();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.log(Level.SEVERE, "TransportFactory schedule(interval=" + checkinterval + "s) check error", t);
|
logger.log(Level.SEVERE, "TransportFactory schedule(interval=" + checkInterval + "s) check error", t);
|
||||||
}
|
}
|
||||||
}, checkinterval, checkinterval, TimeUnit.SECONDS);
|
}, checkInterval, checkInterval, TimeUnit.SECONDS);
|
||||||
|
|
||||||
if (this.pinginterval > 0) {
|
if (this.pinginterval > 0) {
|
||||||
if (pingBuffer != null) {
|
if (pingBuffer != null) {
|
||||||
|
|||||||
4
src/main/java/org/redkale/net/client/package-info.java
Normal file
4
src/main/java/org/redkale/net/client/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 客户端网络包
|
||||||
|
*/
|
||||||
|
package org.redkale.net.client;
|
||||||
4
src/main/java/org/redkale/persistence/package-info.java
Normal file
4
src/main/java/org/redkale/persistence/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 提供类似javax.persistence包中的部分注解
|
||||||
|
*/
|
||||||
|
package org.redkale.persistence;
|
||||||
Reference in New Issue
Block a user