本文整理汇总了Java中org.apache.geode.LogWriter.info方法的典型用法代码示例。如果您正苦于以下问题:Java LogWriter.info方法的具体用法?Java LogWriter.info怎么用?Java LogWriter.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.geode.LogWriter
的用法示例。
在下文中一共展示了LogWriter.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPerformanceLogger
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
@Override
protected PerformanceLogger createPerformanceLogger() {
final LogWriter logWriter = createLogWriter();
final PerformanceLogger perfLogger = new PerformanceLogger() {
@Override
public void log(final String message) {
logWriter.info(message);
}
@Override
public boolean isEnabled() {
return logWriter.infoEnabled();
}
};
return perfLogger;
}
示例2: execute5
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void execute5(FunctionContext context) {
DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
LogWriter logger = ds.getLogWriter();
if (this.props.get("TERMINATE") != null && this.props.get("TERMINATE").equals("YES")) {
logger.info("Function Terminated");
} else {
try {
synchronized (this) {
logger.info("Function Running");
this.wait(20000);
}
} catch (InterruptedException e) {
}
}
context.getResultSender().lastResult(Boolean.TRUE);
}
示例3: execute
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
@Override
public void execute(FunctionContext context) {
DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
LogWriter logger = ds.getLogWriter();
Cache cache = CacheFactory.getAnyInstance();
String regionName = (String) context.getArguments();
Region<String, Integer> region1 = cache.getRegion(regionName);
if (region1 == null) {
RegionFactory<String, Integer> rf;
rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
region1 = rf.create(regionName);
}
region1.put(ds.getDistributedMember().toString(), 1);
logger.info("Executing FireAndForgetFunctionOnAllServers on Member : "
+ ds.getDistributedMember() + " with Context : " + context);
if (!hasResult()) {
return;
}
}
示例4: executeFunctionReturningArgs
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void executeFunctionReturningArgs(FunctionContext context) {
DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
LogWriter logger = ds.getLogWriter();
logger.info("Executing executeFunctionReturningArgs in TestFunction on Member : "
+ ds.getDistributedMember() + "with Context : " + context);
if (!hasResult()) {
return;
}
Object[] args = (Object[]) context.getArguments();
if (args != null) {
context.getResultSender().lastResult(args[0]);
} else {
context.getResultSender().lastResult(Boolean.FALSE);
}
}
示例5: getCacheSerializableRunnableForIndexCreationCheck
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public CacheSerializableRunnable getCacheSerializableRunnableForIndexCreationCheck(
final String name) {
return new CacheSerializableRunnable("PrIndexCreationCheck") {
@Override
public void run2() {
Cache cache1 = getCache();
LogWriter logger = cache1.getLogger();
PartitionedRegion region = (PartitionedRegion) cache1.getRegion(name);
Map indexMap = region.getIndex();
Set indexSet = indexMap.entrySet();
Iterator it = indexSet.iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Index index = (Index) entry.getValue();
logger.info("the partitioned index created on this region " + " " + index);
logger.info("Current number of buckets indexed : " + ""
+ ((PartitionedIndex) index).getNumberOfIndexedBuckets());
}
JUnit4CacheTestCase.closeCache();
JUnit4DistributedTestCase.disconnectFromDS();
}
};
}
示例6: prIndexCreationCheck
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public CacheSerializableRunnable prIndexCreationCheck(final String regionName,
final String indexName, final int bucketCount) {
CacheSerializableRunnable sr = new CacheSerializableRunnable(
"pr IndexCreationCheck" + regionName + " indexName :" + indexName) {
public void run2() {
// closeCache();
Cache cache = getCache();
LogWriter logger = cache.getLogger();
PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
Map indexMap = region.getIndex();
PartitionedIndex index = (PartitionedIndex) region.getIndex().get(indexName);
if (index == null) {
fail("Index " + indexName + " Not Found for region " + regionName);
}
logger.info("Current number of buckets indexed : " + ""
+ ((PartitionedIndex) index).getNumberOfIndexedBuckets());
if (bucketCount >= 0) {
waitForIndexedBuckets((PartitionedIndex) index, bucketCount);
}
if (!index.isPopulated()) {
fail("Index isPopulatedFlag is not set to true");
}
}
};
return sr;
}
示例7: dumpStackTrace
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public static void dumpStackTrace(Thread t, StackTraceElement[] stack, LogWriter logger) {
StringBuilder msg = new StringBuilder();
msg.append("Thread=<")
.append(t)
.append("> stackDump:\n");
for (int i=0; i < stack.length; i++) {
msg.append("\t")
.append(stack[i])
.append("\n");
}
logger.info(msg.toString());
}
示例8: remoteTestPostSnapshot
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void remoteTestPostSnapshot(String name, boolean isController, boolean isRoot)
throws CacheException {
assertTrue(preSnapshotRegion.isDestroyed());
try {
preSnapshotRegion.get("0");
fail("Should have thrown a RegionReinitializedException");
} catch (RegionReinitializedException e) {
// pass
}
LogWriter log = getCache().getLogger();
// get new reference to region
Region postSnapshotRegion = isRoot ? getRootRegion(name) : getRootRegion().getSubregion(name);
assertNotNull("Could not get reference to reinitialized region", postSnapshotRegion);
boolean expectData =
isController || postSnapshotRegion.getAttributes().getMirrorType().isMirrored()
|| postSnapshotRegion.getAttributes().getDataPolicy().isPreloaded();
log.info("region has " + postSnapshotRegion.keys().size() + " entries");
assertEquals(expectData ? MAX_KEYS : 0, postSnapshotRegion.keys().size());
// gets the data either locally or by netSearch
assertEquals(new Integer(3), postSnapshotRegion.get("3"));
// bug 33311 coverage
if (expectData) {
assertFalse(postSnapshotRegion.containsValueForKey("9"));
assertTrue(postSnapshotRegion.containsKey("9"));
}
}
示例9: cacheLogWriterMessageShouldMatchCustomConfig
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
@Test
public void cacheLogWriterMessageShouldMatchCustomConfig() throws Exception {
String logLogger = LogService.MAIN_LOGGER_NAME;
Level logLevel = Level.INFO;
String logMessage = "this is a log statement from " + testName.getMethodName();
LogWriter logger = this.cache.getLogger();
assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
.isFalse();
BasicAppender.clearEvents();
logger.info(logMessage);
BasicAppender appender = BasicAppender.getInstance();
assertThat(appender).isNotNull();
assertThat(appender.events().size()).isGreaterThan(0);
LogEvent event = null;
for (LogEvent logEvent : appender.events()) {
if (logEvent.getMessage().getFormattedMessage().contains(logMessage)) {
event = logEvent;
break;
}
}
assertThat(event).isNotNull();
assertThat(event.getLoggerName()).isEqualTo(logLogger);
assertThat(event.getLevel()).isEqualTo(logLevel);
assertThat(event.getMessage().getFormattedMessage()).isEqualTo(logMessage);
assertThat(systemOutRule.getLog()).contains(logLevel.name());
assertThat(systemOutRule.getLog()).contains(logMessage);
assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
assertThat(systemOutRule.getLog())
.containsPattern(defineLogStatementRegex(logLevel, logMessage));
}
示例10: doCreateEntry
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
protected void doCreateEntry(String name) {
LogWriter log = org.apache.geode.test.dunit.LogWriterUtils.getLogWriter();
log.info("<ExpectedException action=add>" + "dunit.RMIException" + "</ExpectedException>");
Object[] args = new Object[] {name,};
Host host = Host.getHost(0);
VM vm = host.getVM(0);
try {
vm.invoke(this.getClass(), "createEntry", args);
} catch (RMIException e) {
// expected
}
log.info("<ExpectedException action=add>" + "dunit.RMIException" + "</ExpectedException>");
}
示例11: consumeMemory
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* @param percentTenured
*/
public MemoryHog consumeMemory(final int percentTenured) {
final long maxSecondsToRun = 180;
final LogWriter logger = this.cache.getLogger();
final long start = System.nanoTime();
for (int i = 100;; i++) {
// Create garbage
byte[] val = new byte[1012]; // 1024 less 4 bytes for obj ref, less 8 bytes for Integer key
// == 1012
// Some random usage of the data to prevent optimization
val[percentTenured] = (byte) i;
if (percentTenured > 0 && (i % 100) <= percentTenured) {
// Grow heap
this.tenuredData.put(new Integer(i), val);
}
if (i % 1000 == 0) {
long runTime = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - start);
if (runTime > maxSecondsToRun) {
logger.info(this.name + ": Ending consume loop after " + runTime + "s");
break;
}
}
if (this.criticalState.get()) {
logger.info(this.name + ": Clearing tenured data: size="
+ (this.tenuredData.size() / 1024) + "Mb");
this.tenuredData.clear();
this.criticalState.set(false);
try {
Thread.sleep(250);
} catch (InterruptedException ie) {
}
}
}
return this;
}
示例12: executeFunctionRunningForLongTime
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void executeFunctionRunningForLongTime(FunctionContext context) {
DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
LogWriter logger = ds.getLogWriter();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
logger.info("Exception in executeFunctionRunningForLongTime");
}
context.getResultSender().lastResult("Ran executeFunctionRunningForLongTime for 10000000");
}
示例13: execute1
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void execute1(FunctionContext context) {
DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
LogWriter logger = ds.getLogWriter();
logger.info("Executing execute1 in TestFunction on Member : " + ds.getDistributedMember()
+ "with Context : " + context);
if (!hasResult()) {
return;
}
if (context.getArguments() instanceof Boolean) {
// context.getResultSender().sendResult();
context.getResultSender().lastResult((Serializable) context.getArguments());
} else if (context.getArguments() instanceof String) {
/*
* String key = (String)context.getArguments(); return key;
*/
context.getResultSender().lastResult((Serializable) context.getArguments());
} else if (context.getArguments() instanceof Set) {
Set origKeys = (Set) context.getArguments();
ArrayList vals = new ArrayList();
for (Iterator i = origKeys.iterator(); i.hasNext();) {
Object val = i.next();
if (val != null) {
vals.add(val);
}
}
/* return vals; */
context.getResultSender().lastResult(vals);
} else {
/* return Boolean.FALSE; */
context.getResultSender().lastResult(Boolean.FALSE);
}
}
示例14: execute5
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
public void execute5(FunctionContext context) {
DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
LogWriter logger = ds.getLogWriter();
logger.info("Executing executeException in TestFunction on Member : "
+ ds.getDistributedMember() + "with Context : " + context);
if (this.hasResult()) {
if (context.getArguments() instanceof String) {
context.getResultSender().lastResult("Success");
} else {
context.getResultSender().lastResult("Failure");
}
}
}
示例15: getCacheSerializableRunnableForPRCreate
import org.apache.geode.LogWriter; //导入方法依赖的package包/类
/**
* Creats a partiotioned region using an xml file descriptions.
*
*
* @return CacheSerializable
*
*/
public CacheSerializableRunnable getCacheSerializableRunnableForPRCreate(
final String regionName) {
SerializableRunnable prIndexCreator = new CacheSerializableRunnable("PrRegionCreator") {
@Override
public void run2() {
try {
Cache cache = getCache();
LogWriter logger = cache.getLogger();
PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
Map indexMap = region.getIndex();
Set indexSet = indexMap.entrySet();
Iterator it = indexSet.iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Index index = (Index) entry.getValue();
logger.info("The partitioned index created on this region " + " " + index);
logger.info("Current number of buckets indexed : " + ""
+ ((PartitionedIndex) index).getNumberOfIndexedBuckets());
}
} finally {
GemFireCacheImpl.testCacheXml = null;
}
}
};
return (CacheSerializableRunnable) prIndexCreator;
}