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


Java ESLogger.warn方法代码示例

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


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

示例1: shouldIgnoreOrRejectNewClusterState

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
/**
 * In the case we follow an elected master the new cluster state needs to have the same elected master and
 * the new cluster state version needs to be equal or higher than our cluster state version.
 * If the first condition fails we reject the cluster state and throw an error.
 * If the second condition fails we ignore the cluster state.
 */
static boolean shouldIgnoreOrRejectNewClusterState(ESLogger logger, ClusterState currentState, ClusterState newClusterState) {
    if (currentState.nodes().masterNodeId() == null) {
        return false;
    }
    if (!currentState.nodes().masterNodeId().equals(newClusterState.nodes().masterNodeId())) {
        logger.warn("received a cluster state from a different master then the current one, rejecting (received {}, current {})", newClusterState.nodes().masterNode(), currentState.nodes().masterNode());
        throw new IllegalStateException("cluster state from a different master than the current one, rejecting (received " + newClusterState.nodes().masterNode() + ", current " + currentState.nodes().masterNode() + ")");
    } else if (newClusterState.version() < currentState.version()) {
        // if the new state has a smaller version, and it has the same master node, then no need to process it
        logger.debug("received a cluster state that has a lower version than the current one, ignoring (received {}, current {})", newClusterState.version(), currentState.version());
        return true;
    } else {
        return false;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:ZenDiscovery.java

示例2: convertedValue

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
private static String convertedValue(Set<String> settingsThatRequireUnits,
                                     String settingName,
                                     String settingValue,
                                     ESLogger logger,
                                     String unit,
                                     String unitName) {
    if (settingsThatRequireUnits.contains(settingName) == false) {
        return settingValue;
    }
    try {
        Long.parseLong(settingValue);
    } catch (NumberFormatException e) {
        return settingValue;
    }
    // It's a naked number that previously would be interpreted as default unit; now we add it:
    logger.warn("{} setting [{}] with value [{}] is missing units; assuming default units ({}) but in future versions this will be a hard error",
            unitName, settingName, settingValue, unit);
    return settingValue + unit;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:20,代码来源:MetaData.java

示例3: loadShardPath

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
/**
 * This method walks through the nodes shard paths to find the data and state path for the given shard. If multiple
 * directories with a valid shard state exist the one with the highest version will be used.
 * <b>Note:</b> this method resolves custom data locations for the shard.
 */
public static ShardPath loadShardPath(ESLogger logger, NodeEnvironment env, ShardId shardId, Settings indexSettings) throws IOException {
    final String indexUUID = indexSettings.get(IndexMetaData.SETTING_INDEX_UUID, IndexMetaData.INDEX_UUID_NA_VALUE);
    final Path[] paths = env.availableShardPaths(shardId);
    Path loadedPath = null;
    for (Path path : paths) {
        ShardStateMetaData load = ShardStateMetaData.FORMAT.loadLatestState(logger, path);
        if (load != null) {
            if (load.indexUUID.equals(indexUUID) == false && IndexMetaData.INDEX_UUID_NA_VALUE.equals(load.indexUUID) == false) {
                logger.warn("{} found shard on path: [{}] with a different index UUID - this shard seems to be leftover from a different index with the same name. Remove the leftover shard in order to reuse the path with the current index", shardId, path);
                throw new IllegalStateException(shardId + " index UUID in shard state was: " + load.indexUUID + " expected: " + indexUUID + " on shard path: " + path);
            }
            if (loadedPath == null) {
                loadedPath = path;
            } else{
                throw new IllegalStateException(shardId + " more than one shard state found");
            }
        }

    }
    if (loadedPath == null) {
        return null;
    } else {
        final Path dataPath;
        final Path statePath = loadedPath;
        if (NodeEnvironment.hasCustomDataPath(indexSettings)) {
            dataPath = env.resolveCustomLocation(indexSettings, shardId);
        } else {
            dataPath = statePath;
        }
        logger.debug("{} loaded data path [{}], state path [{}]", shardId, dataPath, statePath);
        return new ShardPath(NodeEnvironment.hasCustomDataPath(indexSettings), dataPath, statePath, indexUUID, shardId);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:39,代码来源:ShardPath.java

示例4: MergePolicyConfig

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
public MergePolicyConfig(ESLogger logger, Settings indexSettings) {
    this.logger = logger;
    this.noCFSRatio = parseNoCFSRatio(indexSettings.get(INDEX_COMPOUND_FORMAT, Double.toString(TieredMergePolicy.DEFAULT_NO_CFS_RATIO)));
    double forceMergeDeletesPctAllowed = indexSettings.getAsDouble("index.merge.policy.expunge_deletes_allowed", DEFAULT_EXPUNGE_DELETES_ALLOWED); // percentage
    ByteSizeValue floorSegment = indexSettings.getAsBytesSize("index.merge.policy.floor_segment", DEFAULT_FLOOR_SEGMENT);
    int maxMergeAtOnce = indexSettings.getAsInt("index.merge.policy.max_merge_at_once", DEFAULT_MAX_MERGE_AT_ONCE);
    int maxMergeAtOnceExplicit = indexSettings.getAsInt("index.merge.policy.max_merge_at_once_explicit", DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT);
    // TODO is this really a good default number for max_merge_segment, what happens for large indices, won't they end up with many segments?
    ByteSizeValue maxMergedSegment = indexSettings.getAsBytesSize("index.merge.policy.max_merged_segment", DEFAULT_MAX_MERGED_SEGMENT);
    double segmentsPerTier = indexSettings.getAsDouble("index.merge.policy.segments_per_tier", DEFAULT_SEGMENTS_PER_TIER);
    double reclaimDeletesWeight = indexSettings.getAsDouble("index.merge.policy.reclaim_deletes_weight", DEFAULT_RECLAIM_DELETES_WEIGHT);
    this.mergesEnabled = indexSettings.getAsBoolean(INDEX_MERGE_ENABLED, true);
    if (mergesEnabled == false) {
        logger.warn("[{}] is set to false, this should only be used in tests and can cause serious problems in production environments", INDEX_MERGE_ENABLED);
    }
    maxMergeAtOnce = adjustMaxMergeAtOnceIfNeeded(maxMergeAtOnce, segmentsPerTier);
    mergePolicy.setNoCFSRatio(noCFSRatio);
    mergePolicy.setForceMergeDeletesPctAllowed(forceMergeDeletesPctAllowed);
    mergePolicy.setFloorSegmentMB(floorSegment.mbFrac());
    mergePolicy.setMaxMergeAtOnce(maxMergeAtOnce);
    mergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
    mergePolicy.setMaxMergedSegmentMB(maxMergedSegment.mbFrac());
    mergePolicy.setSegmentsPerTier(segmentsPerTier);
    mergePolicy.setReclaimDeletesWeight(reclaimDeletesWeight);
    logger.debug("using [tiered] merge mergePolicy with expunge_deletes_allowed[{}], floor_segment[{}], max_merge_at_once[{}], max_merge_at_once_explicit[{}], max_merged_segment[{}], segments_per_tier[{}], reclaim_deletes_weight[{}]",
            forceMergeDeletesPctAllowed, floorSegment, maxMergeAtOnce, maxMergeAtOnceExplicit, maxMergedSegment, segmentsPerTier, reclaimDeletesWeight);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:28,代码来源:MergePolicyConfig.java

示例5: getFromSettings

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
private static Translog.Durabilty getFromSettings(ESLogger logger, Settings settings, Translog.Durabilty defaultValue) {
    final String value = settings.get(TranslogConfig.INDEX_TRANSLOG_DURABILITY, defaultValue.name());
    try {
        return Translog.Durabilty.valueOf(value.toUpperCase(Locale.ROOT));
    } catch (IllegalArgumentException ex) {
        logger.warn("Can't apply {} illegal value: {} using {} instead, use one of: {}", TranslogConfig.INDEX_TRANSLOG_DURABILITY,
                value, defaultValue, Arrays.toString(Translog.Durabilty.values()));
        return defaultValue;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:IndexShard.java

示例6: configure

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
@Override
protected void configure() {
    bind(DynamicSettings.class).annotatedWith(ClusterDynamicSettings.class).toInstance(clusterDynamicSettings.build());
    bind(DynamicSettings.class).annotatedWith(IndexDynamicSettings.class).toInstance(indexDynamicSettings.build());

    // bind ShardsAllocator
    String shardsAllocatorType = shardsAllocators.bindType(binder(), settings, ClusterModule.SHARDS_ALLOCATOR_TYPE_KEY, ClusterModule.BALANCED_ALLOCATOR);
    if (shardsAllocatorType.equals(ClusterModule.EVEN_SHARD_COUNT_ALLOCATOR)) {
        final ESLogger logger = Loggers.getLogger(getClass(), settings);
        logger.warn("{} allocator has been removed in 2.0 using {} instead", ClusterModule.EVEN_SHARD_COUNT_ALLOCATOR, ClusterModule.BALANCED_ALLOCATOR);
    }
    allocationDeciders.bind(binder());
    indexTemplateFilters.bind(binder());

    bind(ClusterInfoService.class).to(clusterInfoServiceImpl).asEagerSingleton();
    bind(GatewayAllocator.class).asEagerSingleton();
    bind(AllocationService.class).asEagerSingleton();
    bind(DiscoveryNodeService.class).asEagerSingleton();
    bind(ClusterService.class).to(InternalClusterService.class).asEagerSingleton();
    bind(OperationRouting.class).asEagerSingleton();
    bind(MetaDataCreateIndexService.class).asEagerSingleton();
    bind(MetaDataDeleteIndexService.class).asEagerSingleton();
    bind(MetaDataIndexStateService.class).asEagerSingleton();
    bind(MetaDataMappingService.class).asEagerSingleton();
    bind(MetaDataIndexAliasesService.class).asEagerSingleton();
    bind(MetaDataUpdateSettingsService.class).asEagerSingleton();
    bind(MetaDataIndexTemplateService.class).asEagerSingleton();
    bind(IndexNameExpressionResolver.class).asEagerSingleton();
    bind(RoutingService.class).asEagerSingleton();
    bind(ShardStateAction.class).asEagerSingleton();
    bind(NodeIndexDeletedAction.class).asEagerSingleton();
    bind(NodeMappingRefreshAction.class).asEagerSingleton();
    bind(MappingUpdatedAction.class).asEagerSingleton();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:35,代码来源:ClusterModule.java

示例7: parseVersion

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static Version parseVersion(@Nullable String version, Version defaultVersion, ESLogger logger) {
    if (version == null) {
        return defaultVersion;
    }
    try {
        return Version.parse(version);
    } catch (ParseException e) {
        logger.warn("no version match {}, default to {}", e, version, defaultVersion);
        return defaultVersion;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:Lucene.java

示例8: initializeNatives

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
/** initialize native resources */
public static void initializeNatives(Path tmpFile, boolean mlockAll, boolean seccomp, boolean ctrlHandler) {
    final ESLogger logger = Loggers.getLogger(Bootstrap.class);

    // check if the user is running as root, and bail
    if (Natives.definitelyRunningAsRoot()) {
        if (Boolean.parseBoolean(System.getProperty("es.insecure.allow.root"))) {
            logger.warn("running as ROOT user. this is a bad idea!");
        } else {
            throw new RuntimeException("don't run elasticsearch as root.");
        }
    }

    // enable secure computing mode
    if (seccomp) {
        Natives.trySeccomp(tmpFile);
    }

    // mlockall if requested
    if (mlockAll) {
        if (Constants.WINDOWS) {
            Natives.tryVirtualLock();
        } else {
            Natives.tryMlockall();
        }
    }

    // listener for windows close event
    if (ctrlHandler) {
        Natives.addConsoleCtrlHandler(new ConsoleCtrlHandler() {
            @Override
            public boolean handle(int code) {
                if (CTRL_CLOSE_EVENT == code) {
                    logger.info("running graceful exit on windows");
                    Bootstrap.stop();
                    return true;
                }
                return false;
            }
        });
    }

    // force remainder of JNA to be loaded (if available).
    try {
        JNAKernel32Library.getInstance();
    } catch (Throwable ignored) {
        // we've already logged this.
    }

    // init lucene random seed. it will use /dev/urandom where available:
    StringHelper.randomId();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:53,代码来源:BootstrapProxy.java

示例9: initializeNatives

import org.elasticsearch.common.logging.ESLogger; //导入方法依赖的package包/类
/** initialize native resources */
public static void initializeNatives(Path tmpFile, boolean mlockAll, boolean seccomp, boolean ctrlHandler) {
    final ESLogger logger = Loggers.getLogger(Bootstrap.class);

    // check if the user is running as root, and bail
    if (Natives.definitelyRunningAsRoot()) {
        if (Boolean.parseBoolean(System.getProperty("es.insecure.allow.root"))) {
            logger.warn("running as ROOT user. this is a bad idea!");
        } else {
            throw new RuntimeException("don't run elasticsearch as root.");
        }
    }

    // enable secure computing mode
    if (seccomp) {
        Natives.trySeccomp(tmpFile);
    }

    // mlockall if requested
    if (mlockAll) {
        if (Constants.WINDOWS) {
           Natives.tryVirtualLock();
        } else {
           Natives.tryMlockall();
        }
    }

    // listener for windows close event
    if (ctrlHandler) {
        Natives.addConsoleCtrlHandler(new ConsoleCtrlHandler() {
            @Override
            public boolean handle(int code) {
                if (CTRL_CLOSE_EVENT == code) {
                    logger.info("running graceful exit on windows");
                    Bootstrap.stop();
                    return true;
                }
                return false;
            }
        });
    }

    // force remainder of JNA to be loaded (if available).
    try {
        JNAKernel32Library.getInstance();
    } catch (Throwable ignored) {
        // we've already logged this.
    }

    // init lucene random seed. it will use /dev/urandom where available:
    StringHelper.randomId();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:53,代码来源:Bootstrap.java


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