This commit is contained in:
@@ -32,7 +32,7 @@ public class MethodDebugVisitor {
|
|||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Map<Label, Integer> labels = new LinkedHashMap();
|
private final Map<Label, Integer> labels = new LinkedHashMap<>();
|
||||||
|
|
||||||
private static final String[] opcodes = new String[200]; //0 -18
|
private static final String[] opcodes = new String[200]; //0 -18
|
||||||
|
|
||||||
|
|||||||
@@ -502,6 +502,7 @@ public final class Application {
|
|||||||
if (listenClass.isEmpty()) continue;
|
if (listenClass.isEmpty()) continue;
|
||||||
Class clazz = classLoader.loadClass(listenClass);
|
Class clazz = classLoader.loadClass(listenClass);
|
||||||
if (!ApplicationListener.class.isAssignableFrom(clazz)) continue;
|
if (!ApplicationListener.class.isAssignableFrom(clazz)) continue;
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
ApplicationListener listener = (ApplicationListener) clazz.getDeclaredConstructor().newInstance();
|
ApplicationListener listener = (ApplicationListener) clazz.getDeclaredConstructor().newInstance();
|
||||||
listener.init(config);
|
listener.init(config);
|
||||||
this.listeners.add(listener);
|
this.listeners.add(listener);
|
||||||
|
|||||||
@@ -56,16 +56,19 @@ public class NodeHttpServer extends NodeServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected ClassFilter<Service> createServiceClassFilter() {
|
protected ClassFilter<Service> createServiceClassFilter() {
|
||||||
return createClassFilter(this.sncpGroup, null, Service.class, new Class[]{org.redkale.watch.WatchService.class}, Annotation.class, "services", "service");
|
return createClassFilter(this.sncpGroup, null, Service.class, new Class[]{org.redkale.watch.WatchService.class}, Annotation.class, "services", "service");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected ClassFilter<Filter> createFilterClassFilter() {
|
protected ClassFilter<Filter> createFilterClassFilter() {
|
||||||
return createClassFilter(null, null, HttpFilter.class, new Class[]{WatchFilter.class}, null, "filters", "filter");
|
return createClassFilter(null, null, HttpFilter.class, new Class[]{WatchFilter.class}, null, "filters", "filter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected ClassFilter<Servlet> createServletClassFilter() {
|
protected ClassFilter<Servlet> createServletClassFilter() {
|
||||||
return createClassFilter(null, WebServlet.class, HttpServlet.class, new Class[]{WatchServlet.class}, null, "servlets", "servlet");
|
return createClassFilter(null, WebServlet.class, HttpServlet.class, new Class[]{WatchServlet.class}, null, "servlets", "servlet");
|
||||||
}
|
}
|
||||||
@@ -87,6 +90,7 @@ public class NodeHttpServer extends NodeServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void loadServlet(ClassFilter<? extends Servlet> servletFilter, ClassFilter otherFilter) throws Exception {
|
protected void loadServlet(ClassFilter<? extends Servlet> servletFilter, ClassFilter otherFilter) throws Exception {
|
||||||
if (httpServer != null) loadHttpServlet(servletFilter, otherFilter);
|
if (httpServer != null) loadHttpServlet(servletFilter, otherFilter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,16 +24,19 @@ public class NodeWatchServer extends NodeHttpServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected ClassFilter<Service> createServiceClassFilter() {
|
protected ClassFilter<Service> createServiceClassFilter() {
|
||||||
return createClassFilter(this.sncpGroup, null, WatchService.class, null, Annotation.class, "services", "service");
|
return createClassFilter(this.sncpGroup, null, WatchService.class, null, Annotation.class, "services", "service");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected ClassFilter<Filter> createFilterClassFilter() {
|
protected ClassFilter<Filter> createFilterClassFilter() {
|
||||||
return createClassFilter(null, null, WatchFilter.class, null, null, "filters", "filter");
|
return createClassFilter(null, null, WatchFilter.class, null, null, "filters", "filter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected ClassFilter<Servlet> createServletClassFilter() {
|
protected ClassFilter<Servlet> createServletClassFilter() {
|
||||||
return createClassFilter(null, WebServlet.class, WatchServlet.class, null, null, "servlets", "servlet");
|
return createClassFilter(null, WebServlet.class, WatchServlet.class, null, null, "servlets", "servlet");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class OptionalCoder<R extends Reader, W extends Writer, T> extends Simple
|
|||||||
|
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public OptionalCoder(final ConvertFactory factory, final Type type) {
|
public OptionalCoder(final ConvertFactory factory, final Type type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public final class BigIntegerSimpledCoder<R extends Reader, W extends Writer> ex
|
|||||||
public static final BigIntegerSimpledCoder instance = new BigIntegerSimpledCoder();
|
public static final BigIntegerSimpledCoder instance = new BigIntegerSimpledCoder();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void convertTo(W out, BigInteger value) {
|
public void convertTo(W out, BigInteger value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
out.writeNull();
|
out.writeNull();
|
||||||
@@ -34,6 +35,7 @@ public final class BigIntegerSimpledCoder<R extends Reader, W extends Writer> ex
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public BigInteger convertFrom(R in) {
|
public BigInteger convertFrom(R in) {
|
||||||
byte[] bytes = ByteArraySimpledCoder.instance.convertFrom(in);
|
byte[] bytes = ByteArraySimpledCoder.instance.convertFrom(in);
|
||||||
return bytes == null ? null : new BigInteger(bytes);
|
return bytes == null ? null : new BigInteger(bytes);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public final class DLongSimpledCoder<R extends Reader, W extends Writer> extends
|
|||||||
public static final DLongSimpledCoder instance = new DLongSimpledCoder();
|
public static final DLongSimpledCoder instance = new DLongSimpledCoder();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void convertTo(final W out, final DLong value) {
|
public void convertTo(final W out, final DLong value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
out.writeNull();
|
out.writeNull();
|
||||||
@@ -36,6 +37,7 @@ public final class DLongSimpledCoder<R extends Reader, W extends Writer> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public DLong convertFrom(R in) {
|
public DLong convertFrom(R in) {
|
||||||
byte[] bs = bsSimpledCoder.convertFrom(in);
|
byte[] bs = bsSimpledCoder.convertFrom(in);
|
||||||
if (bs == null) return null;
|
if (bs == null) return null;
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public final class DoubleArraySimpledCoder<R extends Reader, W extends Writer> e
|
|||||||
public static final DoubleStreamSimpledCoder instance = new DoubleStreamSimpledCoder();
|
public static final DoubleStreamSimpledCoder instance = new DoubleStreamSimpledCoder();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void convertTo(W out, DoubleStream values) {
|
public void convertTo(W out, DoubleStream values) {
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
out.writeNull();
|
out.writeNull();
|
||||||
@@ -83,6 +84,7 @@ public final class DoubleArraySimpledCoder<R extends Reader, W extends Writer> e
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public DoubleStream convertFrom(R in) {
|
public DoubleStream convertFrom(R in) {
|
||||||
double[] value = DoubleArraySimpledCoder.instance.convertFrom(in);
|
double[] value = DoubleArraySimpledCoder.instance.convertFrom(in);
|
||||||
return value == null ? null : DoubleStream.of(value);
|
return value == null ? null : DoubleStream.of(value);
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public final class IntArraySimpledCoder<R extends Reader, W extends Writer> exte
|
|||||||
public static final IntStreamSimpledCoder instance = new IntStreamSimpledCoder();
|
public static final IntStreamSimpledCoder instance = new IntStreamSimpledCoder();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void convertTo(W out, IntStream values) {
|
public void convertTo(W out, IntStream values) {
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
out.writeNull();
|
out.writeNull();
|
||||||
@@ -83,6 +84,7 @@ public final class IntArraySimpledCoder<R extends Reader, W extends Writer> exte
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public IntStream convertFrom(R in) {
|
public IntStream convertFrom(R in) {
|
||||||
int[] value = IntArraySimpledCoder.instance.convertFrom(in);
|
int[] value = IntArraySimpledCoder.instance.convertFrom(in);
|
||||||
return value == null ? null : IntStream.of(value);
|
return value == null ? null : IntStream.of(value);
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public final class LongArraySimpledCoder<R extends Reader, W extends Writer> ext
|
|||||||
public static final LongStreamSimpledCoder instance = new LongStreamSimpledCoder();
|
public static final LongStreamSimpledCoder instance = new LongStreamSimpledCoder();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void convertTo(W out, LongStream values) {
|
public void convertTo(W out, LongStream values) {
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
out.writeNull();
|
out.writeNull();
|
||||||
@@ -83,6 +84,7 @@ public final class LongArraySimpledCoder<R extends Reader, W extends Writer> ext
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public LongStream convertFrom(R in) {
|
public LongStream convertFrom(R in) {
|
||||||
long[] value = LongArraySimpledCoder.instance.convertFrom(in);
|
long[] value = LongArraySimpledCoder.instance.convertFrom(in);
|
||||||
return value == null ? null : LongStream.of(value);
|
return value == null ? null : LongStream.of(value);
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public abstract class AsyncConnection implements AsynchronousByteChannel, AutoCl
|
|||||||
*/
|
*/
|
||||||
public static CompletableFuture<AsyncConnection> createTCP(final AsynchronousChannelGroup group, final SSLContext sslContext,
|
public static CompletableFuture<AsyncConnection> createTCP(final AsynchronousChannelGroup group, final SSLContext sslContext,
|
||||||
final SocketAddress address, final boolean noDelay, final int readTimeoutSecond, final int writeTimeoutSecond) {
|
final SocketAddress address, final boolean noDelay, final int readTimeoutSecond, final int writeTimeoutSecond) {
|
||||||
final CompletableFuture future = new CompletableFuture();
|
final CompletableFuture<AsyncConnection> future = new CompletableFuture<>();
|
||||||
try {
|
try {
|
||||||
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
|
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
|
||||||
channel.connect(address, null, new CompletionHandler<Void, Void>() {
|
channel.connect(address, null, new CompletionHandler<Void, Void>() {
|
||||||
|
|||||||
26
src/org/redkale/net/SSLCreator.java
Normal file
26
src/org/redkale/net/SSLCreator.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* 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.net;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import org.redkale.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据配置生成SSLContext
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* 详情见: https://redkale.org
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public interface SSLCreator {
|
||||||
|
|
||||||
|
default SSLContext create(Server server, AnyValue sslConf) throws IOException {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -124,6 +124,19 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
|
|||||||
this.responsePoolSize = config.getIntValue("responsePoolSize", this.threads * 2);
|
this.responsePoolSize = config.getIntValue("responsePoolSize", this.threads * 2);
|
||||||
this.name = config.getValue("name", "Server-" + protocol + "-" + this.address.getPort());
|
this.name = config.getValue("name", "Server-" + protocol + "-" + this.address.getPort());
|
||||||
if (!this.name.matches("^[a-zA-Z][\\w_-]{1,64}$")) throw new RuntimeException("server.name (" + this.name + ") is illegal");
|
if (!this.name.matches("^[a-zA-Z][\\w_-]{1,64}$")) throw new RuntimeException("server.name (" + this.name + ") is illegal");
|
||||||
|
AnyValue sslConf = config.getAnyValue("ssl");
|
||||||
|
if (sslConf != null) {
|
||||||
|
String creatorClass = sslConf.getValue("creator", SSLCreator.class.getName());
|
||||||
|
if (SSLCreator.class.getName().equals(creatorClass) || creatorClass.isEmpty()) {
|
||||||
|
this.sslContext = new SSLCreator() {
|
||||||
|
}.create(this, sslConf);
|
||||||
|
} else {
|
||||||
|
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
SSLCreator creator = ((SSLCreator) classLoader.loadClass(creatorClass).getDeclaredConstructor().newInstance());
|
||||||
|
this.sslContext = creator.create(this, sslConf);
|
||||||
|
}
|
||||||
|
}
|
||||||
final AtomicInteger counter = new AtomicInteger();
|
final AtomicInteger counter = new AtomicInteger();
|
||||||
final Format f = createFormat();
|
final Format f = createFormat();
|
||||||
final String n = name;
|
final String n = name;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public class HttpPrepareServlet extends PrepareServlet<String, HttpContext, Http
|
|||||||
List<HttpServlet> list = removeHttpServlet(predicateEntry, predicateFilter);
|
List<HttpServlet> list = removeHttpServlet(predicateEntry, predicateFilter);
|
||||||
return list == null || list.isEmpty() ? null : list.get(0);
|
return list == null || list.isEmpty() ? null : list.get(0);
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends WebSocket> HttpServlet removeHttpServlet(Class<T> websocketOrServletType) {
|
public <T extends WebSocket> HttpServlet removeHttpServlet(Class<T> websocketOrServletType) {
|
||||||
Predicate<MappingEntry> predicateEntry = (t) -> {
|
Predicate<MappingEntry> predicateEntry = (t) -> {
|
||||||
Class type = t.servlet.getClass();
|
Class type = t.servlet.getClass();
|
||||||
@@ -144,6 +144,7 @@ public class HttpPrepareServlet extends PrepareServlet<String, HttpContext, Http
|
|||||||
return list == null || list.isEmpty() ? null : list.get(0);
|
return list == null || list.isEmpty() ? null : list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public boolean addForbidURIReg(final String urlreg) {
|
public boolean addForbidURIReg(final String urlreg) {
|
||||||
if (urlreg == null || urlreg.isEmpty()) return false;
|
if (urlreg == null || urlreg.isEmpty()) return false;
|
||||||
synchronized (excludeLock) {
|
synchronized (excludeLock) {
|
||||||
@@ -169,6 +170,7 @@ public class HttpPrepareServlet extends PrepareServlet<String, HttpContext, Http
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public boolean removeForbidURIReg(final String urlreg) {
|
public boolean removeForbidURIReg(final String urlreg) {
|
||||||
if (urlreg == null || urlreg.isEmpty()) return false;
|
if (urlreg == null || urlreg.isEmpty()) return false;
|
||||||
synchronized (excludeLock) {
|
synchronized (excludeLock) {
|
||||||
@@ -198,6 +200,7 @@ public class HttpPrepareServlet extends PrepareServlet<String, HttpContext, Http
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void init(HttpContext context, AnyValue config) {
|
public void init(HttpContext context, AnyValue config) {
|
||||||
super.init(context, config); //必须要执行
|
super.init(context, config); //必须要执行
|
||||||
Collection<HttpServlet> servlets = getServlets();
|
Collection<HttpServlet> servlets = getServlets();
|
||||||
|
|||||||
@@ -59,10 +59,12 @@ public class HttpScope {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T find(String name) {
|
public <T> T find(String name) {
|
||||||
return this.attributes == null ? null : (T) this.attributes.get(name);
|
return this.attributes == null ? null : (T) this.attributes.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T find(HttpScope parent, String name) {
|
public <T> T find(HttpScope parent, String name) {
|
||||||
T rs = this.attributes == null ? null : (T) this.attributes.get(name);
|
T rs = this.attributes == null ? null : (T) this.attributes.get(name);
|
||||||
if (rs != null) return rs;
|
if (rs != null) return rs;
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
|
|||||||
HttpMapping mapping = method.getAnnotation(HttpMapping.class);
|
HttpMapping mapping = method.getAnnotation(HttpMapping.class);
|
||||||
this.ignore = mapping == null || !mapping.auth();
|
this.ignore = mapping == null || !mapping.auth();
|
||||||
this.cacheseconds = mapping == null ? 0 : mapping.cacheseconds();
|
this.cacheseconds = mapping == null ? 0 : mapping.cacheseconds();
|
||||||
this.cache = cacheseconds > 0 ? new ConcurrentHashMap() : null;
|
this.cache = cacheseconds > 0 ? new ConcurrentHashMap<>() : null;
|
||||||
this.cacheHandler = cacheseconds > 0 ? (HttpResponse response, ByteBuffer[] buffers) -> {
|
this.cacheHandler = cacheseconds > 0 ? (HttpResponse response, ByteBuffer[] buffers) -> {
|
||||||
int status = response.getStatus();
|
int status = response.getStatus();
|
||||||
if (status != 200) return null;
|
if (status != 200) return null;
|
||||||
|
|||||||
@@ -441,6 +441,7 @@ public final class SncpClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void success() {
|
public void success() {
|
||||||
future.complete(this.body);
|
future.complete(this.body);
|
||||||
transport.offerBuffer(buffer);
|
transport.offerBuffer(buffer);
|
||||||
@@ -547,6 +548,7 @@ public final class SncpClient {
|
|||||||
|
|
||||||
protected final Creator<? extends CompletableFuture> futureCreator;
|
protected final Creator<? extends CompletableFuture> futureCreator;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public SncpAction(final Class clazz, Method method, DLong actionid) {
|
public SncpAction(final Class clazz, Method method, DLong actionid) {
|
||||||
this.actionid = actionid == null ? Sncp.hash(method) : actionid;
|
this.actionid = actionid == null ? Sncp.hash(method) : actionid;
|
||||||
Type rt = TypeToken.getGenericType(method.getGenericReturnType(), clazz);
|
Type rt = TypeToken.getGenericType(method.getGenericReturnType(), clazz);
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public final class SncpDynServlet extends SncpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void execute(SncpRequest request, SncpResponse response) throws IOException {
|
public void execute(SncpRequest request, SncpResponse response) throws IOException {
|
||||||
if (bufferSupplier == null) {
|
if (bufferSupplier == null) {
|
||||||
bufferSupplier = request.getContext().getBufferSupplier();
|
bufferSupplier = request.getContext().getBufferSupplier();
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.redkale.util.*;
|
|||||||
*
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Local
|
@Local
|
||||||
@AutoLoad(false)
|
@AutoLoad(false)
|
||||||
@ResourceType(CacheSource.class)
|
@ResourceType(CacheSource.class)
|
||||||
@@ -85,6 +86,7 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void init(AnyValue conf) {
|
public void init(AnyValue conf) {
|
||||||
if (this.convert == null) this.convert = this.defaultConvert;
|
if (this.convert == null) this.convert = this.defaultConvert;
|
||||||
if (this.convert == null) this.convert = JsonConvert.root();
|
if (this.convert == null) this.convert = JsonConvert.root();
|
||||||
@@ -320,6 +322,7 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public V get(String key) {
|
public V get(String key) {
|
||||||
if (key == null) return null;
|
if (key == null) return null;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -362,6 +365,7 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@RpcMultiRun
|
@RpcMultiRun
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public V getAndRefresh(String key, final int expireSeconds) {
|
public V getAndRefresh(String key, final int expireSeconds) {
|
||||||
if (key == null) return null;
|
if (key == null) return null;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -375,6 +379,7 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@RpcMultiRun
|
@RpcMultiRun
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public String getStringAndRefresh(String key, final int expireSeconds) {
|
public String getStringAndRefresh(String key, final int expireSeconds) {
|
||||||
if (key == null) return null;
|
if (key == null) return null;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.redkale.util.*;
|
|||||||
* @param <T> Entity类的类型
|
* @param <T> Entity类的类型
|
||||||
* @param <F> 字段的类型
|
* @param <F> 字段的类型
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public final class DataCallArrayAttribute<T, F> implements Attribute<T[], F> {
|
public final class DataCallArrayAttribute<T, F> implements Attribute<T[], F> {
|
||||||
|
|
||||||
public static final DataCallArrayAttribute instance = new DataCallArrayAttribute();
|
public static final DataCallArrayAttribute instance = new DataCallArrayAttribute();
|
||||||
|
|||||||
Reference in New Issue
Block a user