View Javadoc

1   /**
2    * Copyright 2007 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.util;
21  
22  import java.util.HashSet;
23  import java.util.Set;
24  
25  /**
26   * Certain JVM versions are known to be unstable with HBase. This
27   * class has a utility function to determine whether the current JVM
28   * is known to be unstable.
29   */
30  public abstract class JvmVersion {
31    private static Set<String> BAD_JVM_VERSIONS = new HashSet<String>();
32    static {
33      BAD_JVM_VERSIONS.add("1.6.0_18");
34    }
35  
36    /**
37     * Return true if the current JVM is known to be unstable.
38     */
39    public static boolean isBadJvmVersion() {
40      String version = System.getProperty("java.version");
41      return version != null && BAD_JVM_VERSIONS.contains(version);
42    }
43  }