當前位置: 首頁>>代碼示例>>Java>>正文


Java LogWriter.info方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:19,代碼來源:LogWriterPerformanceTest.java

示例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);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:19,代碼來源:TestFunction.java

示例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;
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:22,代碼來源:FireAndForgetFunctionOnAllServers.java

示例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);
  }


}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:18,代碼來源:TestFunction.java

示例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();

    }
  };
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:26,代碼來源:PRQueryDUnitHelper.java

示例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;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:27,代碼來源:QueryIndexUsingXMLDUnitTest.java

示例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());
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:13,代碼來源:DistributedTestCase.java

示例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"));
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:30,代碼來源:RegionTestCase.java

示例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));
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:39,代碼來源:CustomConfigWithCacheIntegrationTest.java

示例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>");
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:16,代碼來源:SystemFailureDUnitTest.java

示例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;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:40,代碼來源:MXMemoryPoolListenerExample.java

示例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");

}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:12,代碼來源:TestFunction.java

示例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);
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:34,代碼來源:TestFunction.java

示例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");
    }
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:14,代碼來源:TestFunction.java

示例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;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:35,代碼來源:PRQueryDUnitHelper.java


注:本文中的org.apache.geode.LogWriter.info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。