// router characteristics here must match the definition in the stack configuration
router = new GossipRouter(12001, "127.0.0.1");
router.start();
Thread.sleep(10000);
JChannelFactory factory1 = new JChannelFactory();
factory1.setMultiplexerConfig(muxFile);
factory1.setNamingServicePort(1099);
factory1.setNodeName("node1");
factory1.setExposeChannels(false);
factory1.setExposeProtocols(false);
factory1.create();
factory1.start();
Configuration cacheConfig1 = new Configuration();
cacheConfig1.setMultiplexerStack(stackName);
cacheConfig1.setCacheMode("REPL_SYNC");
DependencyInjectedConfigurationRegistry registry1 = new DependencyInjectedConfigurationRegistry();
registry1.registerConfiguration("config1", cacheConfig1);
CacheManager cacheManager1 = new CacheManager(registry1, factory1);
HAPartitionCacheHandlerImpl cacheHandler1 = new HAPartitionCacheHandlerImpl();
cacheHandler1.setCacheManager(cacheManager1);
cacheHandler1.setCacheConfigName("config1");
DistributedStateImpl ds1 = new DistributedStateImpl();
ds1.setCacheHandler(cacheHandler1);
partition1 = new ClusterPartition();
partition1.setPartitionName(partitionName);
partition1.setCacheHandler(cacheHandler1);
partition1.setStateTransferTimeout(30000);
partition1.setMethodCallTimeout(60000);
partition1.setDistributedStateImpl(ds1);
partition1.setBindIntoJndi(false);
partition1.create();
partition1.start();
DistributedReplicantManager drm1 = partition1.getDistributedReplicantManager();
Thread.sleep(10000);
// Use a different stack name with the same config to avoid singleton conflicts
stackName = "tunnel2";
JChannelFactory factory2 = new JChannelFactory();
factory2.setMultiplexerConfig(muxFile);
factory2.setNamingServicePort(1099);
factory2.setNodeName("node2");
factory2.setExposeChannels(false);
factory2.setExposeProtocols(false);
factory2.create();
factory2.start();
Configuration cacheConfig2 = new Configuration();
cacheConfig2.setMultiplexerStack(stackName);
cacheConfig2.setCacheMode("REPL_SYNC");