org.hibernate.search.util.logging.impl.Log.debugf()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.hibernate.search.util.logging.impl.Log.debugf()方法的一些代码示例,展示了Log.debugf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.debugf()方法的具体详情如下:
包路径:org.hibernate.search.util.logging.impl.Log
类名称:Log
方法名:debugf

Log.debugf介绍

暂无

代码示例

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private static SearchMapping getNewInstanceOfSearchMapping(Class<?> clazz, Method method) {
  SearchMapping mapping;
  try {
    LOG.debugf( "invoking factory method [ %s.%s ] to get search mapping instance", clazz.getName(), method.getName() );
    Object instance = clazz.newInstance();
    mapping = (SearchMapping) method.invoke( instance );
  }
  catch (Exception e) {
    throw new SearchException( "Unable to call the factory method: " + clazz.getName() + "." + method.getName(), e );
  }
  return mapping;
}

代码示例来源:origin: hibernate/hibernate-search

static long getRefreshPeriod(Properties properties, String directoryProviderName) {
  String refreshPeriod = properties.getProperty( REFRESH_PROP_NAME, "3600" );
  long period;
  try {
    period = Long.parseLong( refreshPeriod );
  }
  catch (NumberFormatException nfe) {
    throw new SearchException(
        "Unable to initialize index: " + directoryProviderName + "; refresh period is not numeric.", nfe
    );
  }
  log.debugf( "Refresh period: %d seconds", (Long) period );
  return period * 1000; //per second
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

static long getRefreshPeriod(Properties properties, String directoryProviderName) {
  String refreshPeriod = properties.getProperty( REFRESH_PROP_NAME, "3600" );
  long period;
  try {
    period = Long.parseLong( refreshPeriod );
  }
  catch (NumberFormatException nfe) {
    throw new SearchException(
        "Unable to initialize index: " + directoryProviderName + "; refresh period is not numeric.", nfe
    );
  }
  log.debugf( "Refresh period: %d seconds", (Long) period );
  return period * 1000; //per second
}

代码示例来源:origin: hibernate/hibernate-search

private static SearchMapping getNewInstanceOfSearchMapping(Class<?> clazz, Method method) {
  SearchMapping mapping;
  try {
    LOG.debugf( "invoking factory method [ %s.%s ] to get search mapping instance", clazz.getName(), method.getName() );
    final Object instance = ClassLoaderHelper.untypedInstanceFromClass( clazz, "SearchMapping provider" );
    mapping = (SearchMapping) method.invoke( instance );
  }
  catch (Exception e) {
    throw new SearchException( "Unable to call the factory method: " + clazz.getName() + "." + method.getName(), e );
  }
  return mapping;
}

代码示例来源:origin: hibernate/hibernate-search

static AbstractWorkspaceImpl createWorkspace(DirectoryBasedIndexManager indexManager,
    WorkerBuildContext context, Properties cfg) {
  final String indexName = indexManager.getIndexName();
  final boolean exclusiveIndexUsage = PropertiesParseHelper.isExclusiveIndexUsageEnabled( cfg );
  if ( exclusiveIndexUsage ) {
    log.debugf( "Starting workspace for index " + indexName + " using an exclusive index strategy" );
    return new ExclusiveIndexWorkspaceImpl( indexManager, context, cfg );
  }
  else {
    log.debugf( "Starting workspace for index " + indexName + " using a shared index strategy" );
    return new SharedIndexWorkspaceImpl( indexManager, context, cfg );
  }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public void initialize(String directoryProviderName, Properties properties, BuildContext context) {
  this.properties = properties;
  this.directoryProviderName = directoryProviderName;
  this.serviceManager = context.getServiceManager();
  //source guessing
  sourceIndexDir = DirectoryProviderHelper.getSourceDirectoryPath( directoryProviderName, properties, false );
  log.debugf( "Source directory: %s", sourceIndexDir );
  indexDir = DirectoryHelper.getVerifiedIndexPath( directoryProviderName, properties, true ).normalize();
  log.debugf( "Index directory: %s", indexDir );
  //No longer useful but invoke it still to log a deprecation warning as needed:
  DirectoryProviderHelper.getCopyBufferSize( directoryProviderName, properties );
  current = 0; //publish all state to other threads
}

代码示例来源:origin: hibernate/hibernate-search

@Override
public void initialize(String directoryProviderName, Properties properties, BuildContext context) {
  this.properties = properties;
  this.directoryProviderName = directoryProviderName;
  this.serviceManager = context.getServiceManager();
  //source guessing
  sourceIndexDir = DirectoryProviderHelper.getSourceDirectoryPath( directoryProviderName, properties, false );
  log.debugf( "Source directory: %s", sourceIndexDir );
  indexDir = DirectoryHelper.getVerifiedIndexPath( directoryProviderName, properties, true ).normalize();
  log.debugf( "Index directory: %s", indexDir );
  //No longer useful but invoke it still to log a deprecation warning as needed:
  DirectoryProviderHelper.getCopyBufferSize( directoryProviderName, properties );
  current = 0; //publish all state to other threads
}

代码示例来源:origin: hibernate/hibernate-search

/**
 * @param query Query to cache results of
 * @param size soft reference size (gets multiplied by {@link #HARD_TO_SOFT_RATIO}.
 */
public CachingWrapperQuery(Query query, int size) {
  this.query = query;
  final int softRefSize = size * HARD_TO_SOFT_RATIO;
  if ( log.isDebugEnabled() ) {
    log.debugf( "Initialising SoftLimitMRUCache with hard ref size of %d and a soft ref of %d", (Integer) size, (Integer) softRefSize );
  }
  this.cache = new SoftLimitMRUCache( size, softRefSize );
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * @param query Query to cache results of
 * @param size soft reference size (gets multiplied by {@link #HARD_TO_SOFT_RATIO}.
 */
public CachingWrapperQuery(Query query, int size) {
  this.query = query;
  final int softRefSize = size * HARD_TO_SOFT_RATIO;
  if ( log.isDebugEnabled() ) {
    log.debugf( "Initialising SoftLimitMRUCache with hard ref size of %d and a soft ref of %d", (Integer) size, (Integer) softRefSize );
  }
  this.cache = new SoftLimitMRUCache( size, softRefSize );
}

代码示例来源:origin: hibernate/hibernate-search

/**
 * @param properties the configuration of the DirectoryProvider
 * @param directoryProviderName the name of the DirectoryProvider, used for error reporting
 * @return The period in milliseconds to keep retrying initialization of a DirectoryProvider
 */
static long getRetryInitializePeriod(Properties properties, String directoryProviderName) {
  int retry_period_seconds = ConfigurationParseHelper.getIntValue( properties, RETRY_INITIALIZE_PROP_NAME, 0 );
  log.debugf( "Retry initialize period for Directory %s: %d seconds", directoryProviderName, retry_period_seconds );
  if ( retry_period_seconds < 0 ) {
    throw new SearchException( RETRY_INITIALIZE_PROP_NAME + " for Directory " + directoryProviderName + " must be a positive integer" );
  }
  return retry_period_seconds * 1000; //convert into milliseconds
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * @param properties the configuration of the DirectoryProvider
 * @param directoryProviderName the name of the DirectoryProvider, used for error reporting
 * @return The period in milliseconds to keep retrying initialization of a DirectoryProvider
 */
static long getRetryInitializePeriod(Properties properties, String directoryProviderName) {
  int retry_period_seconds = ConfigurationParseHelper.getIntValue( properties, RETRY_INITIALIZE_PROP_NAME, 0 );
  log.debugf( "Retry initialize period for Directory %s: %d seconds", directoryProviderName, retry_period_seconds );
  if ( retry_period_seconds < 0 ) {
    throw new SearchException( RETRY_INITIALIZE_PROP_NAME + " for Directory " + directoryProviderName + " must be a positive integer" );
  }
  return retry_period_seconds * 1000; //convert into milliseconds
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

static AbstractWorkspaceImpl createWorkspace(DirectoryBasedIndexManager indexManager,
    WorkerBuildContext context, Properties cfg) {
  final String indexName = indexManager.getIndexName();
  final boolean exclusiveIndexUsage = PropertiesParseHelper.isExclusiveIndexUsageEnabled( cfg );
  if ( exclusiveIndexUsage ) {
    log.debugf( "Starting workspace for index " + indexName + " using an exclusive index strategy" );
    return new ExclusiveIndexWorkspaceImpl( indexManager, context, cfg );
  }
  else {
    log.debugf( "Starting workspace for index " + indexName + " using a shared index strategy" );
    return new SharedIndexWorkspaceImpl( indexManager, context, cfg );
  }
}

代码示例来源:origin: hibernate/hibernate-search

public ParameterSet(Properties prop) {
  //don't iterate on property entries as we know all the keys:
  for ( IndexWriterSetting t : IndexWriterSetting.values() ) {
    String key = t.getKey();
    String value = prop.getProperty( key );
    if ( !( value == null || EXPLICIT_DEFAULT_VALUE.equalsIgnoreCase( value ) ) ) {
      if ( log.isDebugEnabled() ) {
        //TODO add DirectoryProvider name when available to log message
        log.debugf( "Set index writer parameter %s to value : %s", key, value );
      }
      parameters.put( t, t.parseVal( value ) );
    }
  }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

public ParameterSet(Properties prop) {
  //don't iterate on property entries as we know all the keys:
  for ( IndexWriterSetting t : IndexWriterSetting.values() ) {
    String key = t.getKey();
    String value = prop.getProperty( key );
    if ( !( value == null || EXPLICIT_DEFAULT_VALUE.equalsIgnoreCase( value ) ) ) {
      if ( log.isDebugEnabled() ) {
        //TODO add DirectoryProvider name when available to log message
        log.debugf( "Set index writer parameter %s to value : %s", key, value );
      }
      parameters.put( t, t.parseVal( value ) );
    }
  }
}

代码示例来源:origin: hibernate/hibernate-search

/**
 * Return the root directory to store test indexes in. Tests should never use or delete this directly but rather
 * nest sub directories in it to avoid interferences across tests.
 *
 * @param requester The test class requesting the index directory, its name will be part of the returned directory
 * @return Return the root directory to store test indexes
 */
public static Path getIndexDirectory(Path parent, Class<?> requester) {
  Path indexDirPath = parent.resolve( "indextemp-" + requester.getSimpleName() );
  indexDirPath.toFile().deleteOnExit();
  String indexDir = indexDirPath.toAbsolutePath().toString();
  log.debugf( "Using %s as index directory.", indexDir );
  return indexDirPath;
}

代码示例来源:origin: hibernate/hibernate-search

static void cleanupDirectories( Path root ) throws IOException {
  log.debugf( "Deleting test directory %s ", root.toAbsolutePath() );
  FileHelper.delete( root );
}

代码示例来源:origin: hibernate/hibernate-search

/**
 * Creates an FSDirectory in provided directory and initializes
 * an index if not already existing.
 *
 * @param indexDir the directory where to write a new index
 * @param properties the configuration properties
 * @param serviceManager provides access to services
 * @return the created {@code FSDirectory} instance
 * @throws java.io.IOException if an error
 */
public static FSDirectory createFSIndex(Path indexDir, Properties properties, ServiceManager serviceManager) throws IOException {
  LockFactory lockFactory = getLockFactory( indexDir, properties, serviceManager );
  FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
  FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, lockFactory );
  log.debugf( "Initialize index: '%s'", indexDir.toAbsolutePath() );
  DirectoryHelper.initializeIndexIfNeeded( fsDirectory );
  return fsDirectory;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * Creates an FSDirectory in provided directory and initializes
 * an index if not already existing.
 *
 * @param indexDir the directory where to write a new index
 * @param properties the configuration properties
 * @param serviceManager provides access to services
 * @return the created {@code FSDirectory} instance
 * @throws java.io.IOException if an error
 */
public static FSDirectory createFSIndex(Path indexDir, Properties properties, ServiceManager serviceManager) throws IOException {
  LockFactory lockFactory = getLockFactory( indexDir, properties, serviceManager );
  FSDirectoryType fsDirectoryType = FSDirectoryType.getType( properties );
  FSDirectory fsDirectory = fsDirectoryType.getDirectory( indexDir, lockFactory );
  log.debugf( "Initialize index: '%s'", indexDir.toAbsolutePath() );
  DirectoryHelper.initializeIndexIfNeeded( fsDirectory );
  return fsDirectory;
}

代码示例来源:origin: hibernate/hibernate-search

@Override
protected synchronized void doClose() throws IOException {
  /**
   * Important: we don't really close the sub readers but we delegate to the
   * close method of the managing ReaderProvider, which might reuse the same
   * IndexReader.
   */
  final boolean debugEnabled = log.isDebugEnabled();
  if ( debugEnabled ) {
    log.debugf( "Closing MultiReader: %s", this );
  }
  for ( int i = 0; i < readersForClosing.length; i++ ) {
    ReaderProvider container = readerProviders[i];
    container.closeIndexReader( readersForClosing[i] ); // might be virtual
  }
  if ( debugEnabled ) {
    log.trace( "MultiReader closed." );
  }
}

代码示例来源:origin: hibernate/hibernate-search

/**
 * Store indexes permanently in FSDirectory. Helper to automatically cleanup
 * the filesystem when the builder is closed; alternatively you could just use
 * properties directly and clean the filesystem explicitly.
 *
 * @param testClass needed to locate an appropriate temporary directory
 * @return the same builder (this).
 */
public FullTextSessionBuilder useFileSystemDirectoryProvider(Class<?> testClass) {
  indexRootDirectory = TestConstants.getIndexDirectory( TestConstants.getTempTestDataDir() );
  log.debugf( "Using %s as index directory.", indexRootDirectory.toAbsolutePath() );
  cfg.setProperty( "hibernate.search.default.directory_provider", "filesystem" );
  cfg.setProperty( "hibernate.search.default.indexBase", indexRootDirectory.toAbsolutePath().toString() );
  usingFileSystem = true;
  return this;
}

相关文章

微信公众号

最新文章

更多

Log类方法