This commit is contained in:
@@ -350,9 +350,9 @@ public final class Application {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.sncpTransportFactory = TransportFactory.create(transportExec, transportPool, transportGroup, (SSLContext) null, readTimeoutSeconds, writeTimeoutSeconds, strategy);
|
this.sncpTransportFactory = TransportFactory.create(transportExec, transportPool, transportGroup, (SSLContext) null, readTimeoutSeconds, writeTimeoutSeconds, strategy);
|
||||||
DefaultAnyValue tarnsportConf = DefaultAnyValue.create(TransportFactory.NAME_POOLMAXCONNS, System.getProperty("net.transport.poolmaxconns", "100"))
|
DefaultAnyValue tarnsportConf = DefaultAnyValue.create(TransportFactory.NAME_POOLMAXCONNS, System.getProperty("net.transport.pool.maxconns", "100"))
|
||||||
.addValue(TransportFactory.NAME_PINGINTERVAL, System.getProperty("net.transport.pinginterval", "30"))
|
.addValue(TransportFactory.NAME_PINGINTERVAL, System.getProperty("net.transport.ping.interval", "30"))
|
||||||
.addValue(TransportFactory.NAME_CHECKINTERVAL, System.getProperty("net.transport.checkinterval", "30"));
|
.addValue(TransportFactory.NAME_CHECKINTERVAL, System.getProperty("net.transport.check.interval", "30"));
|
||||||
this.sncpTransportFactory.init(tarnsportConf, Sncp.PING_BUFFER, Sncp.PONG_BUFFER.remaining());
|
this.sncpTransportFactory.init(tarnsportConf, Sncp.PING_BUFFER, Sncp.PONG_BUFFER.remaining());
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.setNodeid(this.nodeid);
|
cluster.setNodeid(this.nodeid);
|
||||||
@@ -856,14 +856,14 @@ public final class Application {
|
|||||||
public static <T extends Service> T singleton(String name, Class<T> serviceClass, Class<? extends Service>... extServiceClasses) throws Exception {
|
public static <T extends Service> T singleton(String name, Class<T> serviceClass, Class<? extends Service>... extServiceClasses) throws Exception {
|
||||||
if (serviceClass == null) throw new IllegalArgumentException("serviceClass is null");
|
if (serviceClass == null) throw new IllegalArgumentException("serviceClass is null");
|
||||||
final Application application = Application.create(true);
|
final Application application = Application.create(true);
|
||||||
System.setProperty("red" + "kale-singleton-serviceclass", serviceClass.getName());
|
System.setProperty("red" + "kale.singleton.serviceclass", serviceClass.getName());
|
||||||
if (extServiceClasses != null && extServiceClasses.length > 0) {
|
if (extServiceClasses != null && extServiceClasses.length > 0) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (Class clazz : extServiceClasses) {
|
for (Class clazz : extServiceClasses) {
|
||||||
if (sb.length() > 0) sb.append(',');
|
if (sb.length() > 0) sb.append(',');
|
||||||
sb.append(clazz.getName());
|
sb.append(clazz.getName());
|
||||||
}
|
}
|
||||||
System.setProperty("red" + "kale-singleton-extserviceclasses", sb.toString());
|
System.setProperty("red" + "kale.singleton.extserviceclasses", sb.toString());
|
||||||
}
|
}
|
||||||
application.init();
|
application.init();
|
||||||
application.start();
|
application.start();
|
||||||
|
|||||||
@@ -158,8 +158,8 @@ public abstract class NodeServer {
|
|||||||
|
|
||||||
ClassFilter<Service> serviceFilter = createServiceClassFilter();
|
ClassFilter<Service> serviceFilter = createServiceClassFilter();
|
||||||
if (application.singletonrun) { //singleton模式下只加载指定的Service
|
if (application.singletonrun) { //singleton模式下只加载指定的Service
|
||||||
final String ssc = System.getProperty("red" + "kale-singleton-serviceclass");
|
final String ssc = System.getProperty("red" + "kale.singleton.serviceclass");
|
||||||
final String extssc = System.getProperty("red" + "kale-singleton-extserviceclasses");
|
final String extssc = System.getProperty("red" + "kale.singleton.extserviceclasses");
|
||||||
if (ssc != null) {
|
if (ssc != null) {
|
||||||
final List<String> sscList = new ArrayList<>();
|
final List<String> sscList = new ArrayList<>();
|
||||||
sscList.add(ssc);
|
sscList.add(ssc);
|
||||||
|
|||||||
25
src/org/redkale/mq/MessageHttpRequest.java
Normal file
25
src/org/redkale/mq/MessageHttpRequest.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.mq;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import org.redkale.net.http.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class MessageHttpRequest extends HttpRequest {
|
||||||
|
|
||||||
|
public MessageHttpRequest(HttpContext context) {
|
||||||
|
super(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int readHeader(ByteBuffer buffer) {
|
||||||
|
return super.readHeader(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
src/org/redkale/mq/MessageHttpResponse.java
Normal file
22
src/org/redkale/mq/MessageHttpResponse.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.mq;
|
||||||
|
|
||||||
|
import org.redkale.net.Response;
|
||||||
|
import org.redkale.net.http.*;
|
||||||
|
import org.redkale.util.ObjectPool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class MessageHttpResponse extends HttpResponse {
|
||||||
|
|
||||||
|
public MessageHttpResponse(HttpContext context, MessageHttpRequest request,
|
||||||
|
ObjectPool<Response> responsePool, HttpResponseConfig config) {
|
||||||
|
super(context, request, responsePool, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/org/redkale/mq/MessageSncpRequest.java
Normal file
28
src/org/redkale/mq/MessageSncpRequest.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.mq;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import org.redkale.net.sncp.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* 详情见: https://redkale.org
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class MessageSncpRequest extends SncpRequest {
|
||||||
|
|
||||||
|
public MessageSncpRequest(SncpContext context) {
|
||||||
|
super(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int readHeader(ByteBuffer buffer) {
|
||||||
|
return super.readHeader(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/org/redkale/mq/MessageSncpResponse.java
Normal file
24
src/org/redkale/mq/MessageSncpResponse.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.mq;
|
||||||
|
|
||||||
|
import org.redkale.net.Response;
|
||||||
|
import org.redkale.net.sncp.*;
|
||||||
|
import org.redkale.util.ObjectPool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* 详情见: https://redkale.org
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class MessageSncpResponse extends SncpResponse {
|
||||||
|
|
||||||
|
public MessageSncpResponse(SncpContext context, MessageSncpRequest request, ObjectPool<Response> responsePool) {
|
||||||
|
super(context, request, responsePool);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,8 +21,8 @@ import org.redkale.service.Service;
|
|||||||
import org.redkale.util.*;
|
import org.redkale.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System.getProperty("net.transport.pinginterval", "30") 心跳周期,默认30秒
|
* System.getProperty("net.transport.ping.interval", "30") 心跳周期,默认30秒
|
||||||
* System.getProperty("net.transport.checkinterval", "30") 检查不可用地址周期,默认30秒
|
* System.getProperty("net.transport.check.interval", "30") 检查不可用地址周期,默认30秒
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: https://redkale.org
|
* 详情见: https://redkale.org
|
||||||
@@ -65,10 +65,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("net.transport.poolmaxconns", Math.max(100, Runtime.getRuntime().availableProcessors() * 16)); //最少是wsthreads的两倍
|
protected int poolmaxconns = Integer.getInteger("net.transport.pool.maxconns", Math.max(100, Runtime.getRuntime().availableProcessors() * 16)); //最少是wsthreads的两倍
|
||||||
|
|
||||||
//检查不可用地址周期, 单位:秒
|
//检查不可用地址周期, 单位:秒
|
||||||
protected int checkinterval = Integer.getInteger("net.transport.checkinterval", 30);
|
protected int checkinterval = Integer.getInteger("net.transport.check.interval", 30);
|
||||||
|
|
||||||
//心跳周期, 单位:秒
|
//心跳周期, 单位:秒
|
||||||
protected int pinginterval;
|
protected int pinginterval;
|
||||||
|
|||||||
Reference in New Issue
Block a user