commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebbASF <...@git.apache.org>
Subject [GitHub] commons-lang pull request #231: Evaluate Architecure
Date Tue, 07 Mar 2017 23:23:37 GMT
Github user sebbASF commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/231#discussion_r104807087
  
    --- Diff: src/main/java/org/apache/commons/lang3/ArchUtils.java ---
    @@ -0,0 +1,446 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.lang3;
    +
    +import java.util.HashMap;
    +import java.util.Map;
    +
    +/**
    + * An utility class for the os.arch System Property. The class defines methods for
    + * identifying the architecture of the current JVM.
    + * <p>
    + * <p>
    + * Important: The os.arch System Property returns the architecture used by the JVM
    + * not of the operating system.
    + * </p>
    + *
    + * @author Tomschi
    + */
    +public class ArchUtils {
    +
    +    /**
    +     * This {@link Map} contains the the possible os.arch property {@link String}'s.
    +     */
    +    private static final Map<String, String> map;
    +
    +    /**
    +     * The value for x86 architecture.
    +     */
    +    private static final String X86 = "x86";
    +
    +    /**
    +     * The value for x86_64 architecture.
    +     */
    +    private static final String X86_64 = "x86_64";
    +
    +    /**
    +     * The value for ia64_32 architecture.
    +     */
    +    private static final String IA64_32 = "ia64_32";
    +
    +    /**
    +     * The value for ia64 architecture.
    +     */
    +    private static final String IA64 = "ia64";
    +
    +    /**
    +     * The value for ppc architecture.
    +     */
    +    private static final String PPC = "ppc";
    +
    +    /**
    +     * The value for ppc64 architecture.
    +     */
    +    private static final String PPC64 = "ppc64";
    +
    +    static {
    +        map = new HashMap<>();
    +
    --- End diff --
    
    HashMap is not thread-safe.
    Since there are public methods which can also update the map, this means the class is
not thread-safe either.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message