本文整理汇总了Java中com.gemstone.gemfire.cache.Cache.addBridgeServer方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.addBridgeServer方法的具体用法?Java Cache.addBridgeServer怎么用?Java Cache.addBridgeServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.gemstone.gemfire.cache.Cache
的用法示例。
在下文中一共展示了Cache.addBridgeServer方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBridgeServerInVM
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected int addBridgeServerInVM(VM vm, final String[] groups) {
SerializableCallable connect =
new SerializableCallable("Add Bridge server") {
public Object call() throws Exception {
Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
BridgeServer server = cache.addBridgeServer();
final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
server.setPort(serverPort);
server.setGroups(groups);
server.start();
return new Integer(serverPort);
}
};
Integer port = (Integer) vm.invoke(connect);
return port.intValue();
}
示例2: startBridgeServer
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
* Starts a bridge server on the given port
*
* @since 4.0
*/
public int startBridgeServer(int port)
throws IOException {
Cache cache = getCache();
BridgeServer bridge = cache.addBridgeServer();
bridge.setPort(port);
bridge.setMaxThreads(getMaxThreads());
bridge.start();
return bridge.getPort();
}
示例3: createServerCache
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public static Integer createServerCache(Boolean notifyBySubscription, Integer maxThreads)
throws Exception {
Cache cache = new BridgeWriterMiscDUnitTest("temp").createCacheV(new Properties());
unsetSlowDispatcherFlag();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableConflation(true);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes myAttrs = factory.create();
Region r1 = cache.createRegion(REGION_NAME1, myAttrs);
Region r2 = cache.createRegion(REGION_NAME2, myAttrs);
factory = new AttributesFactory();
factory.setDataPolicy(DataPolicy.PARTITION);
RegionAttributes prAttrs = factory.create();
Region pr = cache.createRegion(PR_REGION_NAME, prAttrs);
assertNotNull(r1);
assertNotNull(r2);
assertNotNull(pr);
BridgeServer server = cache.addBridgeServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
r1.getCache().getDistributedSystem().getLogWriter().info("Starting server on port " + port);
server.setPort(port);
server.setMaxThreads(maxThreads.intValue());
server.setNotifyBySubscription(notifyBySubscription.booleanValue());
server.start();
r1.getCache().getDistributedSystem().getLogWriter().info("Started server on port " + server.getPort());
return new Integer(server.getPort());
}
示例4: createBridgeServer
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected void createBridgeServer(int port) {
Cache c = getCache();
BridgeServer bridge = c.addBridgeServer();
bridge.setNotifyBySubscription(true);
bridge.setPort(port);
try {
bridge.start();
} catch (IOException ioe) {
fail("Could not start BridgeServer on port " + port);
}
}
示例5: startBridgeServer
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
* Starts a bridge server on the given port, using the given
* deserializeValues and notifyBySubscription to serve up the
* given region.
*/
protected void startBridgeServer(int port, boolean notifyBySubscription)
throws IOException {
Cache cache = getCache();
BridgeServer bridge = cache.addBridgeServer();
bridge.setPort(port);
bridge.setNotifyBySubscription(notifyBySubscription);
bridge.start();
bridgeServerPort = bridge.getPort();
}
示例6: startBridgeServer
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
* Starts a bridge server on the given port, using the given
* deserializeValues and notifyBySubscription to serve up the
* given region.
*
* @since 6.6
*/
public void startBridgeServer(int port, boolean notifyBySubscription)
throws IOException {
Cache cache = getCache();
BridgeServer bridge = cache.addBridgeServer();
bridge.setPort(port);
bridge.setNotifyBySubscription(notifyBySubscription);
bridge.start();
bridgeServerPort = bridge.getPort();
}
示例7: startCacheServer
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
* Starts a bridge server on the given port, using the given
* deserializeValues and notifyBySubscription to serve up the
* given region.
*/
protected void startCacheServer(int port, boolean notifyBySubscription)
throws IOException {
Cache cache = CacheFactory.getAnyInstance();
BridgeServer bridge = cache.addBridgeServer();
bridge.setPort(port);
bridge.setNotifyBySubscription(notifyBySubscription);
bridge.start();
bridgeServerPort = bridge.getPort();
}
示例8: startBridgeServer
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
* Starts a bridge server on the given port, using the given
* deserializeValues and notifyBySubscription to serve up the
* given region.
*
* @since 5.5
*/
protected void startBridgeServer(int port, boolean notifyBySubscription)
throws IOException {
Cache cache = getCache();
BridgeServer bridge = cache.addBridgeServer();
bridge.setPort(port);
bridge.setNotifyBySubscription(notifyBySubscription);
bridge.start();
bridgeServerPort = bridge.getPort();
}
示例9: startBridgeServer
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
* Starts a bridge server on the given port, using the given
* deserializeValues and notifyBySubscription to serve up the
* given region.
*
* @since 4.0
*/
public void startBridgeServer(int port, boolean notifyBySubscription)
throws IOException {
Cache cache = getCache();
BridgeServer bridge = cache.addBridgeServer();
bridge.setPort(port);
bridge.setNotifyBySubscription(notifyBySubscription);
bridge.start();
bridgeServerPort = bridge.getPort();
}
示例10: startBridgeServerInVM
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected int startBridgeServerInVM(final VM vm, final String[] groups,
String locators, final String[] regions) {
SerializableCallable connect =
new SerializableCallable("Start bridge server") {
public Object call() throws IOException {
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(mCastPort));
props.setProperty(DistributionConfig.MCAST_ADDRESS_NAME, DistributionConfig.DEFAULT_MCAST_ADDRESS.getHostAddress());
props.setProperty(DistributionConfig.LOCATORS_NAME, "");
props.setProperty(DistributionConfig.BIND_ADDRESS_NAME,
getServerHostName(vm.getHost()));
DistributedSystem ds = getSystem(props);
Cache cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableBridgeConflation(true);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
for(int i = 0; i < regions.length; i++) {
cache.createRegion(regions[i], attrs);
}
BridgeServer server = cache.addBridgeServer();
final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
server.setPort(serverPort);
server.setGroups(groups);
server.start();
remoteObjects.put(CACHE_KEY, cache);
return new Integer(serverPort);
}
};
Integer port = (Integer) vm.invoke(connect);
return port.intValue();
}
示例11: startBridgeServerInVM
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected int startBridgeServerInVM(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
SerializableCallable connect =
new SerializableCallable("Start bridge server") {
public Object call() throws IOException {
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
DistributedSystem ds = getSystem(props);
Cache cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableBridgeConflation(true);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
for(int i = 0; i < regions.length; i++) {
cache.createRegion(regions[i], attrs);
}
BridgeServer server = cache.addBridgeServer();
final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
server.setPort(serverPort);
server.setGroups(groups);
server.setLoadProbe(probe);
server.start();
remoteObjects.put(CACHE_KEY, cache);
return new Integer(serverPort);
}
};
Integer port = (Integer) vm.invoke(connect);
return port.intValue();
}
示例12: startBridgeServerWithEmbeddedLocator
import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected int startBridgeServerWithEmbeddedLocator(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
SerializableCallable connect =
new SerializableCallable("Start bridge server") {
public Object call() throws IOException {
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
props.setProperty(DistributionConfig.START_LOCATOR_NAME, locators);
props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
DistributedSystem ds = getSystem(props);
Cache cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableBridgeConflation(true);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
for(int i = 0; i < regions.length; i++) {
cache.createRegion(regions[i], attrs);
}
BridgeServer server = cache.addBridgeServer();
server.setGroups(groups);
server.setLoadProbe(probe);
final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
server.setPort(serverPort);
server.start();
remoteObjects.put(CACHE_KEY, cache);
return new Integer(serverPort);
}
};
Integer port = (Integer) vm.invoke(connect);
return port.intValue();
}