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


Java Cache.getLoggerI18n方法代码示例

本文整理汇总了Java中com.gemstone.gemfire.cache.Cache.getLoggerI18n方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.getLoggerI18n方法的具体用法?Java Cache.getLoggerI18n怎么用?Java Cache.getLoggerI18n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.gemstone.gemfire.cache.Cache的用法示例。


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

示例1: compileQuery

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Compile the query and return a set of regions involved in the query It
 * throws an QueryInvalidException if the query is not proper
 * 
 * @param cache
 *          current cache
 * @param query
 *          input query
 * @return a set of regions involved in the query
 * @throws QueryInvalidException
 */
@SuppressWarnings("deprecation")
public static Set<String> compileQuery(Cache cache, String query) throws QueryInvalidException {
  QCompiler compiler = new QCompiler(cache.getLoggerI18n());
  Set<String> regionsInQuery = null;
  try {
    CompiledValue compiledQuery = compiler.compileQuery(query);
    Set<String> regions = new HashSet<String>();
    compiledQuery.getRegionsInQuery(regions, null);
    regionsInQuery = Collections.unmodifiableSet(regions);
    return regionsInQuery;
  } catch (QueryInvalidException qe) {
    cache.getLogger().error(query + " Failed Error " + qe);
    throw qe;
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:27,代码来源:QueryDataFunction.java

示例2: SingleWriteSingleReadRegionQueue

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Constructor. This constructor lets the caller initialize the head and tail
 * of the queue.
 *
 * @param cache
 *          The GemFire <code>Cache</code>
 * @param regionName
 *          The name of the region on which to create the queue. A region with
 *          this name will be retrieved if it exists or created if it does
 *          not.
 * @param attributes
 *          The <code>GatewayQueueAttributes</code> containing queue
 *          attributes like the name of the directory in which to store
 *          overflowed queue entries and the maximum amount of memory (MB) to
 *          allow in the queue before overflowing entries to disk
 * @param listener
 *          A <code>CacheListener</code> to for the region to use
 * @param stats
 *          a <code>GatewayStats</code> to record this queue's statistics in
 * @param headKey
 *          The key of the head entry in the <code>Region</code>
 * @param tailKey
 *          The key of the tail entry in the <code>Region</code>
 */
public SingleWriteSingleReadRegionQueue(Cache cache, String regionName,
    GatewayQueueAttributes attributes, CacheListener listener,
    GatewayStats stats, long headKey, long tailKey) {
  this._logger = cache.getLoggerI18n();
  this._regionName = regionName;
  assert(attributes!=null);
  this._diskStoreName = attributes.getDiskStoreName();
  if (this._diskStoreName == null) {
    this._overflowDirectory = attributes.getOverflowDirectory();
  } else {
    this._overflowDirectory = null;
  }
  this._enableConflation = attributes.getBatchConflation();
  this._maximumQueueMemory = attributes.getMaximumQueueMemory();
  this._batchSize = attributes.getBatchSize();
  this._enablePersistence = attributes.getEnablePersistence();
  this._stats = stats;
  this._headKey = headKey;
  this._tailKey.set(tailKey);
  this._indexes = new HashMap();
  initializeRegion(cache, listener);
  if (this._logger.fineEnabled()) {
    this._logger.fine(this + ": Contains " + size() + " elements");
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:50,代码来源:SingleWriteSingleReadRegionQueue.java

示例3: ClientHealthMonitor

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 *
 * Constructor.
 * 
 * @param cache
 *          The GemFire <code>Cache</code>
 * @param maximumTimeBetweenPings
 *          The maximum time allowed between pings before determining the
 *          client has died and interrupting its sockets.
 */
private ClientHealthMonitor(Cache cache, int maximumTimeBetweenPings,
    CacheClientNotifierStats stats) {
  // Set the Cache
  this._cache = cache;

  // Set the LogWriterI18n
  this._logger = cache.getLoggerI18n();

  // Initialize the client threads map
  this._clientThreads = new HashMap();
  
  if (maximumTimeBetweenPings > 0) {
    if (this._logger.fineEnabled())
      this._logger.fine(this + ": Initializing client health monitor thread");
    this._clientMonitor = new ClientHealthMonitorThread(maximumTimeBetweenPings);
    this._clientMonitor.start();
  } else {
    if (this._logger.configEnabled()) {
      this._logger.config(LocalizedStrings.ClientHealthMonitor_CLIENT_HEALTH_MONITOR_THREAD_DISABLED_DUE_TO_MAXIMUMTIMEBETWEENPINGS_SETTING__0, maximumTimeBetweenPings);
    }
    this._clientMonitor = null;
  }

  this.stats = stats;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:36,代码来源:ClientHealthMonitor.java

示例4: DefaultQuery

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/** Should be constructed from DefaultQueryService
 * @see QueryService#newQuery
 */
public DefaultQuery(String queryString, Cache cache) {
  this.queryString = queryString;
  QCompiler compiler = new QCompiler(cache.getLoggerI18n());
  this.compiledQuery = compiler.compileQuery(queryString);
  this.traceOn = (compiler.isTraceRequested() || QUERY_VERBOSE);
  this.cache = cache;
  this.stats = new DefaultQueryStatistics();
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:12,代码来源:DefaultQuery.java

示例5: createAsyncQueueForHDFS

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public static AsyncEventQueue createAsyncQueueForHDFS(Cache cache,
   String regionPath, boolean writeOnly, HDFSEventQueueAttributes eventAttribs)
{
  LogWriterI18n logger = cache.getLoggerI18n();
  String defaultAsyncQueueName = HDFSStoreFactoryImpl.getEventQueueName(regionPath);

  AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
  factory.setBatchSize(eventAttribs.getBatchSizeMB());
  factory.setPersistent(eventAttribs.isPersistent());
  factory.setDiskStoreName(eventAttribs.getDiskStoreName());
  factory.setMaximumQueueMemory(eventAttribs.getMaximumQueueMemory());
  factory.setBatchTimeInterval(eventAttribs.getBatchTimeInterval());
  factory.setDiskSynchronous(eventAttribs.isDiskSynchronous());
  factory.setDiskSynchronous(eventAttribs.isDiskSynchronous());
  factory.setDispatcherThreads(eventAttribs.getDispatcherThreads());
  factory.setParallel(true);
  factory.addGatewayEventFilter(new HDFSEventQueueFilter(logger));
  ((AsyncEventQueueFactoryImpl)factory).setBucketSorted(!writeOnly);
  ((AsyncEventQueueFactoryImpl)factory).setIsHDFSQueue(true);
  
  AsyncEventQueue asyncQ = null;
  
  if (!writeOnly)
    asyncQ = factory.create(defaultAsyncQueueName, new HDFSEventListener(cache.getLoggerI18n()));
  else
    asyncQ = factory.create(defaultAsyncQueueName, new HDFSWriteOnlyStoreEventListener(cache.getLoggerI18n()));
  
  logger.fine("HDFS: async queue created for HDFS. Id: " + asyncQ.getId() + ". Disk store: " + asyncQ.getDiskStoreName() + 
      ". Batch size: " + asyncQ.getBatchSize() + ". bucket sorted:  " + !writeOnly) ;
  return asyncQ;
  
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:33,代码来源:HDFSIntegrationUtil.java

示例6: doQueryRegionsAssociatedMembers

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private void doQueryRegionsAssociatedMembers(String queryTemplate, int expectedMembers, boolean returnAll, String... regions){
  Cache cache = CacheFactory.getAnyInstance();
  
  String query = queryTemplate;
  int i=1;
  for(String r:regions){
    query = query.replace("?"+i, r);
    i++;
  }
  Log.getLogWriter().info("Checking members for query : " + query);
  QCompiler compiler = new QCompiler(cache.getLoggerI18n());
  Set<String> regionsInQuery = null;
  try{
    CompiledValue compiledQuery = compiler.compileQuery(query);    
    Set regionSet = new HashSet();
    compiledQuery.getRegionsInQuery(regionSet, null);//GFSH ENV VARIBLES
    regionsInQuery = Collections.unmodifiableSet(regionSet);
    Log.getLogWriter().info("Region in query : " + regionsInQuery);
    if(regionsInQuery.size()>0){
      Set<DistributedMember> members = DataCommands.getQueryRegionsAssociatedMembers(regionsInQuery, cache, returnAll);
      Log.getLogWriter().info("Members for Region in query : " + members);
      if(expectedMembers!=-1){
        assertNotNull(members);
        assertEquals(expectedMembers, members.size());
      }else
        assertEquals(0,members.size());
    }else{
      assertEquals(-1, expectedMembers);//Regions do not exist at all
    }
  }catch(QueryInvalidException qe){
    fail("Invalid Query",qe);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:34,代码来源:GemfireDataCommandsDUnitTest.java

示例7: _select

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public DataCommandResult _select(String query) {
  Cache cache = CacheFactory.getAnyInstance();
  DataCommandResult dataResult = null;

  if (query == null || query.isEmpty()) {
    dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
        CliStrings.QUERY__MSG__QUERY_EMPTY, false);
    return dataResult;
  }
  
  //String query = querySB.toString().trim();      
  Object array[] = DataCommands.replaceGfshEnvVar(query, CommandExecutionContext.getShellEnv());
  query = (String) array[1];
  query = addLimit(query);
  
  @SuppressWarnings("deprecation")
  QCompiler compiler = new QCompiler(cache.getLoggerI18n());
  Set<String> regionsInQuery = null;
  try {
    CompiledValue compiledQuery = compiler.compileQuery(query);
    Set<String> regions = new HashSet<String>();
    compiledQuery.getRegionsInQuery(regions, null);
    regionsInQuery = Collections.unmodifiableSet(regions);
    if (regionsInQuery.size() > 0) {
      Set<DistributedMember> members = DataCommands.getQueryRegionsAssociatedMembers(regionsInQuery, cache, false);
      if (members != null && members.size() > 0) {
        DataCommandFunction function = new DataCommandFunction();
        DataCommandRequest request = new DataCommandRequest();
        request.setCommand(CliStrings.QUERY);
        request.setQuery(query);
        dataResult = DataCommands.callFunctionForRegion(request, function, members);
        dataResult.setInputQuery(query);
        return (dataResult);
      } else {
        return (dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
            CliStrings.format(CliStrings.QUERY__MSG__REGIONS_NOT_FOUND, regionsInQuery.toString()), false));
      }
    } else {
      return (dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
          CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY, "Region mentioned in query probably missing /"),
          false));
    }
  } catch (QueryInvalidException qe) {        
    cache.getLogger().error(query + " Failed Error " + qe);
    return (dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
        CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY, qe.getMessage()), false));
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:49,代码来源:DataCommandFunction.java

示例8: ServerConnection

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Creates a new <code>ServerConnection</code> that processes messages
 * received from an edge client over a given <code>Socket</code>.
 */
public ServerConnection(
  Socket s,
  Cache c,
  CachedRegionHelper helper,
  CacheServerStats stats,
  int hsTimeout,
  int socketBufferSize,
String communicationModeStr,
byte communicationMode,
Acceptor acceptor)
{
  StringBuffer buffer = new StringBuffer(100);
  if(((AcceptorImpl)acceptor).isGatewayReceiver()) {
    buffer
      .append("GatewayReceiver connection from [");
  }
  else{
    buffer
      .append("Server connection from [");
  }
  buffer
      .append(communicationModeStr)
      .append(" host address=")
      .append(s.getInetAddress().getHostAddress())
      .append("; ")
      .append(communicationModeStr)
      .append(" port=")
      .append(s.getPort())
      .append("]");
  this.name = buffer.toString();

  this.stats = stats;
  this.acceptor = (AcceptorImpl)acceptor;
  this.crHelper = helper;
  this.logger = c.getLoggerI18n();
  this.securityLogger = c.getSecurityLoggerI18n();
  this.communicationModeStr = communicationModeStr;
  this.communicationMode = communicationMode;
  this.principal = null;
  this.authzRequest = null;
  this.postAuthzRequest = null;
  this.randomConnectionIdGen = new Random(this.hashCode());
  
  try {
    // requestMsg.setUseDataStream(useDataStream);
    // replyMsg.setUseDataStream(useDataStream);
    // responseMsg.setUseDataStream(useDataStream);
    // errorMsg.setUseDataStream(useDataStream);

    initStreams(s, socketBufferSize, stats);
    Assert.assertTrue(this.logger != null);


    requestMsg.setLogger(this.logger);
    replyMsg.setLogger(this.logger);
    responseMsg.setLogger(this.logger);
    chunkedResponseMsg.setLogger(this.logger);
    queryResponseMsg.setLogger(this.logger);
    executeFunctionResponseMsg.setLogger(this.logger);
    registerInterestResponseMsg.setLogger(this.logger);
    errorMsg.setLogger(this.logger);
    if (logger.fineEnabled()) {
      logger.fine(getName() + ": Accepted client connection from " +
          "[client host name=" + s.getInetAddress().getCanonicalHostName() +
          "; client host address=" + s.getInetAddress().getHostAddress() +
          "; client port=" + s.getPort() + "]");
    }
    this.handShakeTimeout = hsTimeout;
  }
  catch (Exception e) {
    if (logger.fineEnabled())
      logger.fine("While creating server connection", e);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:79,代码来源:ServerConnection.java

示例9: CacheClientNotifier

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param cache
 *          The GemFire <code>Cache</code>
 * @param acceptorStats
 * @param maximumMessageCount
 * @param messageTimeToLive
 * @param transactionTimeToLive - ttl for txstates for disconnected clients
 * @param listener a listener which should receive notifications
 *          abouts queues being added or removed.
 * @param overflowAttributesList
 */
private CacheClientNotifier(Cache cache, CacheServerStats acceptorStats, 
    int maximumMessageCount, int messageTimeToLive, int transactionTimeToLive,
    ConnectionListener listener,
    List overflowAttributesList, boolean isGatewayReceiver) {
  // Set the Cache
  this.setCache((GemFireCacheImpl)cache);
  this.acceptorStats = acceptorStats;

  // Set the LogWriterI18n
  this._logger = cache.getLoggerI18n();

  this._connectionListener = listener;

  // Set the security LogWriter
  this._securityLogger = cache.getSecurityLoggerI18n();

  // Create the overflow artifacts
  if (overflowAttributesList != null
      && !HARegionQueue.HA_EVICTION_POLICY_NONE.equals(overflowAttributesList
          .get(0))) {
    haContainer = new HAContainerRegion(cache.getRegion(Region.SEPARATOR
        + BridgeServerImpl.clientMessagesRegion((GemFireCacheImpl)cache,
            (String)overflowAttributesList.get(0),
            ((Integer)overflowAttributesList.get(1)).intValue(),
            ((Integer)overflowAttributesList.get(2)).intValue(),
            (String)overflowAttributesList.get(3),
            (Boolean)overflowAttributesList.get(4))));
  }
  else {
    haContainer = new HAContainerMap(new HashMap());
  }
  if (this._logger.fineEnabled()) {
    this._logger.fine("ha container ("
        + haContainer.getName()
        + ") has been created.");
  }

  this.maximumMessageCount = maximumMessageCount;
  this.messageTimeToLive = messageTimeToLive;
  this.transactionTimeToLive = transactionTimeToLive;

  // Initialize the statistics
  StatisticsFactory factory ;
  if(isGatewayReceiver){
    factory = new DummyStatisticsFactory();
  }else{
    factory = this.getCache().getDistributedSystem(); 
  }
  this._statistics = new CacheClientNotifierStats(factory);

  // Initialize the executors
  // initializeExecutors(this._logger);

  try {
    this.logFrequency = Long.valueOf(System
        .getProperty(MAX_QUEUE_LOG_FREQUENCY));
    if (this.logFrequency <= 0) {
      this.logFrequency = DEFAULT_LOG_FREQUENCY;
    }
  } catch (Exception e) {
    this.logFrequency = DEFAULT_LOG_FREQUENCY;
  }
  
  // Schedule task to periodically ping clients.
  scheduleClientPingTask();
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:80,代码来源:CacheClientNotifier.java

示例10: DefaultQueryService

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public DefaultQueryService(Cache cache) {
  if (cache == null)
      throw new IllegalArgumentException(LocalizedStrings.DefaultQueryService_CACHE_MUST_NOT_BE_NULL.toLocalizedString());
  this.cache = cache;
  logger = cache.getLoggerI18n();
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:7,代码来源:DefaultQueryService.java


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