本文整理汇总了Java中com.gemstone.gemfire.cache.GemFireCache类的典型用法代码示例。如果您正苦于以下问题:Java GemFireCache类的具体用法?Java GemFireCache怎么用?Java GemFireCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GemFireCache类属于com.gemstone.gemfire.cache包,在下文中一共展示了GemFireCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例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());
}
}
}
}
示例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");
}};
}
示例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);
}
}
示例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);
}
}
}
示例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
}
}
示例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");
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例13: restarting
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public void restarting(DistributedSystem ds, GemFireCache cache) {
this.cache = (GemFireCacheImpl)cache;
}
示例14: setCache
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public HDFSRegionDirector setCache(GemFireCache cache) {
this.cache = cache;
return this;
}
示例15: getCache
import com.gemstone.gemfire.cache.GemFireCache; //导入依赖的package包/类
public GemFireCache getCache() {
return this.cache;
}