当前位置: 首页>>代码示例>>Java>>正文


Java LogWriter类代码示例

本文整理汇总了Java中org.apache.geode.LogWriter的典型用法代码示例。如果您正苦于以下问题:Java LogWriter类的具体用法?Java LogWriter怎么用?Java LogWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LogWriter类属于org.apache.geode包,在下文中一共展示了LogWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: pause

import org.apache.geode.LogWriter; //导入依赖的package包/类
/** pause for specified ms interval
 * Make sure system clock has advanced by the specified number of millis before
 * returning.
 */
public static final void pause(int ms) {
  LogWriter log = getLogWriter();
  if (ms >= 1000 || log.fineEnabled()) { // check for fine but log at info
    getLogWriter().info("Pausing for " + ms + " ms..."/*, new Exception()*/);
  }
  final long target = System.currentTimeMillis() + ms;
  try {
    for (;;) {
      long msLeft = target - System.currentTimeMillis();
      if (msLeft <= 0) {
        break;
      }
      Thread.sleep(msLeft);
    }
  }
  catch (InterruptedException e) {
    fail("interrupted", e);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:DistributedTestCase.java

示例3: oganizedOperandsSingleRangeJunctionCreation

import org.apache.geode.LogWriter; //导入依赖的package包/类
/**
 * Tests the creation of a single RangeJunction if the CompiledJunction only contains same index
 * condition with or without iter operand
 */
private OrganizedOperands oganizedOperandsSingleRangeJunctionCreation(int junctionType,
    CompiledValue[] operandsForCJ, ExecutionContext context) {
  LogWriter logger = CacheUtils.getCache().getLogger();
  OrganizedOperands oo = null;
  try {
    CompiledJunction cj = new CompiledJunction(operandsForCJ, junctionType);
    context.addDependencies(new CompiledID("dummy"), cj.computeDependencies(context));
    cj.getPlanInfo(context);
    oo = cj.testOrganizedOperands(context);
    return oo;
  } catch (Exception e) {
    logger.error(e);
    fail(e.toString());
  }
  return oo;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:CompiledJunctionInternalsJUnitTest.java

示例4: getConnection

import org.apache.geode.LogWriter; //导入依赖的package包/类
public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
  if (DEBUG) {
    try {
      throw new NullPointerException("Asif:JCAManagedConnection:getConnection");
    } catch (NullPointerException npe) {
      npe.printStackTrace();
    }
  }
  try {
    if (!this.initDone || this.cache.isClosed()) {
      init();
    }
    LogWriter logger = this.cache.getLogger();
    if (logger.fineEnabled()) {
      logger.fine("JCAManagedConnection:getConnection. Returning new Connection");
    }

    GFConnectionImpl conn = new GFConnectionImpl(this);
    this.connections.add(conn);
    return conn;
  } catch (SystemException e) {
    this.onError(e);
    throw new ResourceException("GemFire Resource unavailable", e);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:26,代码来源:JCAManagedConnection.java

示例5: getMetaData

import org.apache.geode.LogWriter; //导入依赖的package包/类
public ManagedConnectionMetaData getMetaData() throws ResourceException {
  if (DEBUG) {
    try {
      throw new NullPointerException("Asif:JCAManagedConnection:getMetaData");
    } catch (NullPointerException npe) {
      npe.printStackTrace();
    }
  }
  if (this.initDone && !this.cache.isClosed()) {
    LogWriter logger = this.cache.getLogger();
    if (logger.fineEnabled()) {
      logger.fine("JCAManagedConnection:getMetaData");
    }
  }
  return new JCAManagedConnectionMetaData(this.factory.getProductName(),
      this.factory.getVersion(), this.factory.getUserName());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:JCAManagedConnection.java

示例6: init

import org.apache.geode.LogWriter; //导入依赖的package包/类
@Override
public void init(final Properties securityProps, final LogWriter systemLogWriter,
    final LogWriter securityLogWriter) throws AuthenticationFailedException {
  logger.info("Initializing LdapUserAuthenticator with {}", securityProps);

  this.ldapServer = securityProps.getProperty(LDAP_SERVER_NAME);
  if (this.ldapServer == null || this.ldapServer.length() == 0) {
    throw new AuthenticationFailedException(
        "LdapUserAuthenticator: LDAP server property [" + LDAP_SERVER_NAME + "] not specified");
  }

  this.baseDomainName = securityProps.getProperty(LDAP_BASEDN_NAME);
  if (this.baseDomainName == null || this.baseDomainName.length() == 0) {
    throw new AuthenticationFailedException(
        "LdapUserAuthenticator: LDAP base DN property [" + LDAP_BASEDN_NAME + "] not specified");
  }

  final String sslName = securityProps.getProperty(LDAP_SSL_NAME);
  if (sslName != null && sslName.toLowerCase().equals("true")) {
    this.ldapUrlScheme = "ldaps://";
  } else {
    this.ldapUrlScheme = "ldap://";
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:LdapUserAuthenticator.java

示例7: init

import org.apache.geode.LogWriter; //导入依赖的package包/类
@Override
public void init(final Properties securityProperties, final LogWriter systemLogWriter,
    final LogWriter securityLogWriter) throws AuthenticationFailedException {
  this.systemLogWriter = systemLogWriter;
  this.securityLogWriter = securityLogWriter;

  this.pubKeyFilePath = securityProperties.getProperty(PUBLIC_KEY_FILE);
  if (this.pubKeyFilePath == null) {
    throw new AuthenticationFailedException("PKCSAuthenticator: property " + PUBLIC_KEY_FILE
        + " not specified as the public key file.");
  }

  this.pubKeyPass = securityProperties.getProperty(PUBLIC_KEYSTORE_PASSWORD);
  this.aliasCertificateMap = new HashMap();

  populateMap();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:PKCSAuthenticator.java

示例8: createLogWriter

import org.apache.geode.LogWriter; //导入依赖的package包/类
protected LogWriter createLogWriter() {
  final Properties props = createGemFireProperties();

  // create configuration with log-file and log-level
  // this.configDirectory = new File(getUniqueName());

  this.configDirectory.mkdir();
  assertTrue(this.configDirectory.isDirectory() && this.configDirectory.canWrite());

  // this.gemfireProperties = new File(this.configDirectory, "gemfire.properties");
  // writeProperties(props, this.gemfireProperties);

  final DistributionConfig config = new DistributionConfigImpl(props, false, false);

  // create a LogWriter that writes to log-file
  final boolean appendToFile = false;
  final boolean isLoner = true;
  final boolean isSecurityLog = false;
  final boolean logConfig = true;
  final FileOutputStream[] fosHolder = null;

  final LogWriter logWriter = TestLogWriterFactory.createLogWriter(appendToFile, isLoner,
      isSecurityLog, config, logConfig, fosHolder);
  return logWriter;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:26,代码来源:LogWriterPerformanceTest.java

示例9: 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

示例10: testBug35358

import org.apache.geode.LogWriter; //导入依赖的package包/类
/**
 * This test does the following<br>
 * 1)Create client cache and region<br>
 * 2)Call registerInterest with specific keys (having extra keys other than those pre-populated on
 * server cache) and policy:KEYS<br>
 * 3)At the end of registerInterest call, verify that only prepolulated entries are created in the
 * client cache with null values (entries for keys in the keylist which are not on the server
 * should not be created on the client as a result of registerInterest call)<br>
 */
@Test
public void testBug35358() {
  Host host = Host.getHost(0);
  LogWriter logger = getSystem().getLogWriter();
  logger.fine("testBug35358 BEGIN");
  Object[] objArr = new Object[2];
  objArr[0] = InterestResultPolicy.KEYS;
  /* registering for 5 extra keys */
  objArr[1] = new Integer(PREPOPULATED_ENTRIES + 5);
  vm1.invoke(() -> InterestResultPolicyDUnitTest
      .createClientCache(NetworkUtils.getServerHostName(host), new Integer(PORT)));
  vm1.invoke(InterestResultPolicyDUnitTest.class, "registerInterest", objArr);
  vm1.invoke(InterestResultPolicyDUnitTest.class, "verifyResult", objArr);
  Integer cnt = (Integer) vm0.invoke(() -> InterestResultPolicyDUnitTest.getEntryCount());
  assertEquals(cnt.intValue(), PREPOPULATED_ENTRIES);
  logger.fine("testBug35358 END");
}
 
开发者ID:ampool,项目名称:monarch,代码行数:27,代码来源:InterestResultPolicyDUnitTest.java

示例11: registerInterest

import org.apache.geode.LogWriter; //导入依赖的package包/类
/**
 * Registers the test region on client with a keylist containing all keys pre-populated on server
 * and a given {@link InterestResultPolicy} type.
 *
 * @param interestPolicy - InterestResultPolicy type specified (NONE,KEYS,KEY_VALUES or DEFAULT)
 */
public static void registerInterest(Object interestPolicy, Object totalKeysToRegister) {
  InterestResultPolicy policy = (InterestResultPolicy) interestPolicy;
  int totalKeys = ((Integer) totalKeysToRegister).intValue();
  Region region1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
  LogWriter logger = cache.getLogger();
  logger.fine("Registering interest in " + totalKeys + " keys");
  List keylist = new ArrayList();
  for (int i = 0; i < totalKeys; i++) {
    keylist.add("key-" + i);
  }

  try {
    region1.registerInterest(keylist, policy);
  } catch (CacheWriterException e) {
    Assert.fail("failed to register interestlist for the client", e);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:InterestResultPolicyDUnitTest.java

示例12: 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

示例13: 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

示例14: 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

示例15: executeWithThrowException

import org.apache.geode.LogWriter; //导入依赖的package包/类
private void executeWithThrowException(FunctionContext context) {
  DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
  RegionFunctionContext rfContext = (RegionFunctionContext) context;
  LogWriter logger = ds.getLogWriter();
  logger.fine("Executing executeWithThrowException in TestFunction on Member : "
      + ds.getDistributedMember() + "with Context : " + context);
  if (context.getArguments() instanceof Boolean) {
    logger.fine("MyFunctionExecutionException Exception is intentionally thrown");
    throw new MyFunctionExecutionException("I have been thrown from TestFunction");
  } else if (rfContext.getArguments() instanceof Set) {
    Set origKeys = (Set) rfContext.getArguments();
    for (Iterator i = origKeys.iterator(); i.hasNext();) {
      Region r = PartitionRegionHelper.getLocalDataForContext(rfContext);
      Object key = i.next();
      Object val = r.get(key);
      if (val != null) {
        throw new MyFunctionExecutionException("I have been thrown from TestFunction");
      }
    }
  } else {
    logger.fine("Result sent back :" + Boolean.FALSE);
    rfContext.getResultSender().lastResult(Boolean.FALSE);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:TestFunction.java


注:本文中的org.apache.geode.LogWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。