增加部分package-info

This commit is contained in:
Redkale
2023-01-07 20:19:46 +08:00
parent 084ba6609d
commit da96d2ef9f
11 changed files with 49 additions and 25 deletions

View File

@@ -0,0 +1,4 @@
/**
* 提供基础注解包
*/
package org.redkale.annotation;

View File

@@ -0,0 +1,4 @@
/**
* 提供系统默认监控包
*/
package org.redkale.boot.watch;

View File

@@ -0,0 +1,4 @@
/**
* 提供注册服务与发现服务包
*/
package org.redkale.cluster;

View File

@@ -0,0 +1,4 @@
/**
* MQ服务包
*/
package org.redkale.mq;

View File

@@ -61,7 +61,7 @@ public class AsyncIOGroup extends AsyncGroup {
private ScheduledThreadPoolExecutor timeoutExecutor;
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) {

View File

@@ -72,14 +72,14 @@ public class Context {
protected int writeTimeoutSeconds;
//服务的监听地址
protected InetSocketAddress address;
protected InetSocketAddress serverAddress;
//字符集
protected Charset charset;
public Context(ContextConfig config) {
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);
}
@@ -95,7 +95,7 @@ public class Context {
this.maxconns = maxconns;
this.maxbody = maxbody;
this.charset = StandardCharsets.UTF_8.equals(charset) ? null : charset;
this.address = address;
this.serverAddress = address;
this.prepare = prepare;
this.resourceFactory = resourceFactory;
this.aliveTimeoutSeconds = aliveTimeoutSeconds;
@@ -180,7 +180,7 @@ public class Context {
}
public InetSocketAddress getServerAddress() {
return address;
return serverAddress;
}
public long getServerStartTime() {
@@ -240,7 +240,7 @@ public class Context {
public DispatcherServlet prepare;
//服务的监听地址
public InetSocketAddress address;
public InetSocketAddress serverAddress;
//字符集
public Charset charset;

View File

@@ -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 {
long s = System.currentTimeMillis();
Objects.requireNonNull(addr);
final InetSocketAddress oldAddress = context.address;
final InetSocketAddress oldAddress = context.serverAddress;
final ProtocolServer oldServerChannel = this.serverChannel;
context.address = addr;
context.serverAddress = addr;
ProtocolServer newServerChannel = null;
try {
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.accept(application, this);
} catch (IOException e) {
context.address = oldAddress;
context.serverAddress = oldAddress;
throw e;
}
this.address = context.address;
this.address = context.serverAddress;
this.serverChannel = newServerChannel;
logger.info(this.getClass().getSimpleName() + ("TCP".equalsIgnoreCase(netprotocol) ? "" : ("." + netprotocol))
+ " 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.maxbody = this.maxbody;
contextConfig.charset = this.charset;
contextConfig.address = this.address;
contextConfig.serverAddress = this.address;
contextConfig.prepare = this.dispatcher;
contextConfig.resourceFactory = this.resourceFactory;
contextConfig.aliveTimeoutSeconds = this.aliveTimeoutSeconds;

View File

@@ -117,7 +117,7 @@ public final class Transport {
if (hasold) {
continue;
}
list.add(new TransportNode(factory.poolmaxconns, addr));
list.add(new TransportNode(factory.poolMaxConns, addr));
}
}
this.transportNodes = list.toArray(new TransportNode[list.size()]);
@@ -139,14 +139,14 @@ public final class Transport {
}
synchronized (this) {
if (this.transportNodes.length == 0) {
this.transportNodes = new TransportNode[]{new TransportNode(factory.poolmaxconns, addr)};
this.transportNodes = new TransportNode[]{new TransportNode(factory.poolMaxConns, addr)};
} else {
for (TransportNode i : this.transportNodes) {
if (addr.equals(i.address)) {
return false;
}
}
this.transportNodes = Utility.append(transportNodes, new TransportNode(factory.poolmaxconns, addr));
this.transportNodes = Utility.append(transportNodes, new TransportNode(factory.poolMaxConns, addr));
}
return true;
}
@@ -157,7 +157,7 @@ public final class Transport {
return false;
}
synchronized (this) {
this.transportNodes = Utility.remove(transportNodes, new TransportNode(factory.poolmaxconns, addr));
this.transportNodes = Utility.remove(transportNodes, new TransportNode(factory.poolMaxConns, addr));
}
return true;
}

View File

@@ -57,10 +57,10 @@ public class TransportFactory {
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;
@@ -105,17 +105,17 @@ public class TransportFactory {
public void init(AnyValue conf, ByteBuffer pingBuffer, int pongLength) {
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.checkinterval = conf.getIntValue(NAME_CHECKINTERVAL, this.checkinterval);
if (this.poolmaxconns < 2) {
this.poolmaxconns = 2;
this.checkInterval = conf.getIntValue(NAME_CHECKINTERVAL, this.checkInterval);
if (this.poolMaxConns < 2) {
this.poolMaxConns = 2;
}
if (this.pinginterval < 2) {
this.pinginterval = 2;
}
if (this.checkinterval < 2) {
this.checkinterval = 2;
if (this.checkInterval < 2) {
this.checkInterval = 2;
}
}
this.scheduler = new ScheduledThreadPoolExecutor(1, (Runnable r) -> {
@@ -127,9 +127,9 @@ public class TransportFactory {
try {
checks();
} 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 (pingBuffer != null) {

View File

@@ -0,0 +1,4 @@
/**
* 客户端网络包
*/
package org.redkale.net.client;

View File

@@ -0,0 +1,4 @@
/**
* 提供类似javax.persistence包中的部分注解
*/
package org.redkale.persistence;