本文整理汇总了Java中com.gemstone.gemfire.cache.GemFireCache类的典型用法代码示例。如果您正苦于以下问题:Java GemFireCache类的具体用法?Java GemFireCache怎么用?Java GemFireCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GemFireCache类属于com.gemstone.gemfire.cache包,在下文中一共展示了GemFireCache类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doRebalance
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public static void doRebalance(GemFireCache cache) {
ResourceManager resMan = cache.getResourceManager();
boolean heapEviction = (resMan.getEvictionHeapPercentage() > 0);
RebalanceFactory factory = resMan.createRebalanceFactory();
try {
RebalanceResults simulateResults = null;
if (!heapEviction) {
Log.getLogWriter().info("Calling rebalance simulate");
RebalanceOperation simulateOp = factory.simulate();
simulateResults = simulateOp.getResults();
Log.getLogWriter().info(RebalanceUtil.RebalanceResultsToString(simulateResults, "Simulate"));
}
Log.getLogWriter().info("Starting rebalancing");
RebalanceOperation rebalanceOp = factory.start();
RebalanceResults rebalanceResults = rebalanceOp.getResults();
Log.getLogWriter().info(RebalanceUtil.RebalanceResultsToString(rebalanceResults, "Rebalance"));
if (!(heapEviction || (ConfigPrms.getHadoopConfig() != null))) {
RebalanceUtil.isBalanceImproved(rebalanceResults); // this throws an exception if not improved
RebalanceUtil.checkSimulateAgainstRebalance(simulateResults, rebalanceResults);
}
} catch (InterruptedException e) {
throw new TestException(TestHelper.getStackTrace(e));
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:27,代码来源:ParRegUtil.java
示例2: HydraTask_recreateBucketsFromHDFS
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public synchronized static void HydraTask_recreateBucketsFromHDFS(GemFireCache cache) {
Set<Region<?,?>> regSet = cache.rootRegions();
Integer thisVmId = RemoteTestModule.getMyVmid();
Iterator it = regSet.iterator();
while (it.hasNext()) {
Region aRegion = (Region)(it.next());
PartitionAttributes prAttr = aRegion.getAttributes().getPartitionAttributes();
if (prAttr != null) { // is a partitioned region
if (prAttr.getLocalMaxMemory() != 0) { // is a data store, not an accessor
Set keys = aRegion.keySet();
Log.getLogWriter().info("after aRegion.keySet() recreateBucketsFromHDFS found keySet size = " + keys.size() + " with region.size() = " + aRegion.size() + " for " + aRegion.getFullPath());
for (Iterator kit = keys.iterator(); kit.hasNext(); ) {
Object key = kit.next();
aRegion.get(key);
}
Log.getLogWriter().info("iterating aRegion.keySet() recreateBucketsFromHDFS found keySet size = " + keys.size() + " with region.size() = " + aRegion.size() + " for " + aRegion.getFullPath());
}
}
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:ParRegUtil.java
示例3: localRegionFactory
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
@Bean
LocalRegionFactoryBean<String, Conference> localRegionFactory(final GemFireCache cache) {
return new LocalRegionFactoryBean<String, Conference>() {{
setCache(cache);
setName("conference");
}};
}
开发者ID:hantsy,项目名称:spring4-sandbox,代码行数:8,代码来源:GemfireCacheConfig.java
示例4: checkForDistUser
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public static void checkForDistUser(final Properties props,
final String sharedSchemaName, final int privileges,
final boolean readOnlyConnection) {
try {
checkDistUser(props, sharedSchemaName, privileges, readOnlyConnection);
} catch (SQLException e) {
e.printStackTrace();
GemFireCache cache = Misc.getGemFireCacheNoThrow();
throw GemFireXDRuntimeException.newRuntimeException("Check Exception in "
+ (cache != null ? cache.getDistributedSystem()
.getDistributedMember() : "cache is null"), e);
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:SecurityTestUtils.java
示例5: restarting
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public void restarting(DistributedSystem ds, GemFireCache cache) {
if (ds != null) {
this.logger = ds.getLogWriter().convertToLogWriterI18n();
for (TcpHandler handler: this.allHandlers) {
handler.restarting(ds, cache);
}
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:9,代码来源:InternalLocator.java
示例6: restarting
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public void restarting(DistributedSystem ds, GemFireCache cache) {
if (ds != null) {
this.loadSnapshot = new LocatorLoadSnapshot();
this.ds = (InternalDistributedSystem)ds;
this.advisor = ControllerAdvisor.createControllerAdvisor(this); // escapes constructor but allows field to be final
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:8,代码来源:ServerLocator.java
示例7: HydraTask_waitForRecovery
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public synchronized static void HydraTask_waitForRecovery(GemFireCache cache) {
Set<Region<?,?>> regSet = cache.rootRegions();
Integer thisVmId = RemoteTestModule.getMyVmid();
List prNames = new ArrayList();
Iterator it = regSet.iterator();
int numColocatedRegions = 0;
while (it.hasNext()) {
Region aRegion = (Region)(it.next());
PartitionAttributes prAttr = aRegion.getAttributes().getPartitionAttributes();
if (prAttr != null) { // is a partitioned region
if (prAttr.getLocalMaxMemory() != 0) { // is a data store, not an acessor
if (prAttr.getRedundantCopies() != 0) { // this PR has redundant copies to recover
prNames.add(aRegion.getFullPath());
}
if (prAttr.getColocatedWith() != null) {
numColocatedRegions++;
}
}
}
}
if (prNames.size() != 0) {
if (ConfigPrms.getHadoopConfig() != null) {
int numPRs = (prNames.size() * 2) - numColocatedRegions;
PRObserver.waitForRebalRecov(thisVmId, 1, numPRs, null, null, false);
} else {
PRObserver.waitForRebalRecov(thisVmId, 1, prNames.size(), prNames, null, false);
}
} else {
Log.getLogWriter().info("No recovery to wait for; there are no data store PRs in this vm");
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:32,代码来源:ParRegUtil.java
示例8: initCacheClient
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
/**
* Initializes the client caches and the regions
*
*/
public static void initCacheClient() {
synchronized (DurableClientsTest.class) {
if (getCache() == null) { // first thread
// create the cache and region
GemFireCache cache = createCache();
int numOfRegion = TestConfig.tab().intAt(
durableClients.DurableClientsPrms.numberOfRegions, 1);
for (int i = 0; i < numOfRegion; i++) {
Region region = createRegion(REGION_NAME + i);
PoolImpl mybw = ClientHelper.getPool(region);
DurableClientsTest.myPool = mybw;
Log.getLogWriter().info(
"The primary server endpoint is " + mybw.getPrimaryName());
String VmDurableId = ((InternalDistributedSystem)InternalDistributedSystem
.getAnyInstance()).getConfig().getDurableClientId();
Log.getLogWriter().info(" VM Durable Client Id is " + VmDurableId);
if (!DurableClientsBB.getBB().getSharedMap().containsKey(VmDurableId)) {
HashMap map = new HashMap();
DurableClientsBB.getBB().getSharedMap().put(VmDurableId, map);
}
}
// client sending the ready message
readyForEvents();
}
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:35,代码来源:DurableClientsTest.java
示例9: initCQClient
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
/**
* Initializes the test region in the cache client VM and registers a CQ
*/
public static void initCQClient() {
synchronized (HAClientQueue.class) {
if (getCache() == null) {
// create the cache and region
GemFireCache cache = createCache();
// init CQ Service
CQUtil.initialize();
CQUtil.initializeCQService(useClientCache);
int numOfRegion = TestConfig.tab().intAt(
durableClients.DurableClientsPrms.numberOfRegions, 1);
for (int i = 0; i < numOfRegion; i++) {
Region region = createRegion(REGION_NAME + i);
PoolImpl mybw = ClientHelper.getPool(region);
myPool = mybw;
Log.getLogWriter().info(
"The primary server endpoint is " + mybw.getPrimaryName());
String VmDurableId = ((InternalDistributedSystem)InternalDistributedSystem
.getAnyInstance()).getConfig().getDurableClientId();
Log.getLogWriter().info(" VM Durable Client Id is " + VmDurableId);
if (!DurableClientsBB.getBB().getSharedMap().containsKey(VmDurableId)) {
HashMap map = new HashMap();
DurableClientsBB.getBB().getSharedMap().put(VmDurableId, map);
}
Log.getLogWriter().info("Doing durable cq register");
CQUtil.registerDurableCQ(region);
}
readyForEvents();
}
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:36,代码来源:DurableClientsTest.java
示例10: getCache
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
/**
* Utility method to get either the Cache or ClientCache (depending on
* test configuration).
*/
public static GemFireCache getCache() {
GemFireCache cache = null;
if (useClientCache) {
cache = ClientCacheHelper.getCache();
} else {
cache = CacheHelper.getCache();
}
return cache;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:DurableClientsTest.java
示例11: createCache
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
/**
* Utility method to create the cache or client cache (depending on
* test configuration).
*/
public static GemFireCache createCache () {
GemFireCache cache = null;
if (useClientCache) {
cache = ClientCacheHelper.createCache(ConfigPrms.getClientCacheConfig());
} else {
cache = CacheHelper.createCache(ConfigPrms.getCacheConfig());
}
return cache;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:DurableClientsTest.java
示例12: processErrorBatch
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
/**
* Store JSON Message on <code>ERROR_REGION</code>
* @param message
*/
private void processErrorBatch(final String message) {
try {
GemFireCache gemFireCache = CacheFactory.getAnyInstance();
Region region = gemFireCache.getRegion(ERROR_REGION);
String id = String.format("%d-%s", System.currentTimeMillis(), gemFireCache.getName());
region.put(id, message);
} catch (Exception ex) {
LOGGER.log(Level.SEVERE
,String.format("Error to store failed message. Error: %s %n Message: %n ---- %s ---- %n", ex.getMessage(), message)
,ex);
}
}
开发者ID:markito,项目名称:GemFire-WAN-REST-example,代码行数:18,代码来源:TransactionEventListener.java
示例13: restarting
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public void restarting(DistributedSystem ds, GemFireCache cache) {
this.cache = (GemFireCacheImpl)cache;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:4,代码来源:JmxManagerLocator.java
示例14: setCache
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public HDFSRegionDirector setCache(GemFireCache cache) {
this.cache = cache;
return this;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:5,代码来源:HDFSRegionDirector.java
示例15: getCache
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public GemFireCache getCache() {
return this.cache;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:4,代码来源:HDFSRegionDirector.java
示例16: restarting
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public void restarting(DistributedSystem ds, GemFireCache cache) {
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:3,代码来源:LocatorImpl.java
示例17: restarting
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
/**
* Informs the handler that TcpServer is restarting with the given
* distributed system and cache
*/
void restarting(DistributedSystem ds, GemFireCache cache);
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:6,代码来源:TcpHandler.java
示例18: restarting
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public void restarting(DistributedSystem ds, GemFireCache cache) { }
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:2,代码来源:AutoConnectionSourceImplJUnitTest.java
注:本文中的com.gemstone.gemfire.cache.GemFireCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论