use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class HARQueueNewImplDUnitTest method createOneMoreBridgeServer.
public static Integer createOneMoreBridgeServer(Boolean notifyBySubscription) throws Exception {
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
CacheServer server1 = cache.addCacheServer();
server1.setPort(port);
server1.setNotifyBySubscription(notifyBySubscription.booleanValue());
server1.getClientSubscriptionConfig().setEvictionPolicy(HARegionQueue.HA_EVICTION_POLICY_MEMORY);
// let this server to use default diskstore
server1.start();
return new Integer(server1.getPort());
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class HARQueueNewImplDUnitTest method stopServer.
public static void stopServer() {
try {
Iterator iter = cache.getCacheServers().iterator();
if (iter.hasNext()) {
CacheServer server = (CacheServer) iter.next();
server.stop();
}
} catch (Exception e) {
fail("failed in stopServer()" + e);
}
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class CacheServerTestUtil method createCacheServer.
public static void createCacheServer(String regionName, Boolean notifyBySubscription, Integer serverPort) throws Exception {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
new CacheServerTestUtil().createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableBridgeConflation(true);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
cache.createRegion(regionName, attrs);
CacheServer server = cache.addCacheServer();
server.setPort(serverPort.intValue());
server.setNotifyBySubscription(notifyBySubscription.booleanValue());
server.start();
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class CacheServerUtils method getCacheServer.
/**
* Returns single CacheServer for the specified Cache instance
*/
public static CacheServer getCacheServer(final Cache cache) {
List<CacheServer> cacheServers = cache.getCacheServers();
CacheServer cacheServer = cacheServers.get(0);
return cacheServer;
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class BackwardCompatibilityHigherVersionClientDUnitTest method createServerCache.
public static Integer createServerCache() throws Exception {
new BackwardCompatibilityHigherVersionClientDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME, attrs);
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
CacheServer server1 = cache.addCacheServer();
server1.setPort(port);
server1.setNotifyBySubscription(true);
server1.start();
return new Integer(server1.getPort());
}
Aggregations