cache
This commit is contained in:
@@ -49,6 +49,7 @@ public class CachedInstanceTest {
|
||||
classLoader = RedkaleClassLoader.currentClassLoader();
|
||||
CacheMemorySource remoteSource = new CacheMemorySource("cache-remote");
|
||||
remoteSource.init(null);
|
||||
|
||||
resourceFactory = ResourceFactory.create();
|
||||
resourceFactory.register(new Environment());
|
||||
manager = CachedManagerService.create(remoteSource);
|
||||
@@ -64,28 +65,19 @@ public class CachedInstanceTest {
|
||||
|
||||
@Test
|
||||
public void run1() throws Exception {
|
||||
ClassLoader parent = Thread.currentThread().getContextClassLoader();
|
||||
Class<CachedInstance> serviceClass = CachedInstance.class;
|
||||
CachedAsmMethodBoost boost = new CachedAsmMethodBoost(false, serviceClass);
|
||||
CachedAsmMethodBoost boost2 = new CachedAsmMethodBoost(false, serviceClass);
|
||||
RedkaleClassLoader classLoader = RedkaleClassLoader.currentClassLoader();
|
||||
Class<CachedInstance> instanceClass = CachedInstance.class;
|
||||
CachedAsmMethodBoost boost = new CachedAsmMethodBoost(false, instanceClass);
|
||||
CachedAsmMethodBoost boost2 = new CachedAsmMethodBoost(false, instanceClass);
|
||||
SncpRpcGroups grous = new SncpRpcGroups();
|
||||
AsyncGroup iGroup = AsyncGroup.create("", Utility.newScheduledExecutor(1), 0, 0);
|
||||
SncpClient client = new SncpClient(
|
||||
"", iGroup, "0", new InetSocketAddress("127.0.0.1", 8080), new ClientAddress(), "TCP", 1, 16);
|
||||
CachedInstance instance = Sncp.createLocalService(
|
||||
classLoader, "", serviceClass, boost, resourceFactory, grous, client, null, null, null);
|
||||
classLoader, "a", instanceClass, boost, resourceFactory, grous, client, null, null, null);
|
||||
resourceFactory.inject(instance);
|
||||
CachedInstance instance2 = Sncp.createLocalService(
|
||||
new RedkaleClassLoader(parent),
|
||||
"",
|
||||
serviceClass,
|
||||
boost2,
|
||||
resourceFactory2,
|
||||
grous,
|
||||
client,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
classLoader, "b", instanceClass, boost2, resourceFactory2, grous, client, null, null, null);
|
||||
resourceFactory2.inject(instance2);
|
||||
|
||||
System.out.println(instance.getName2());
|
||||
|
||||
Reference in New Issue
Block a user