當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。