Merge
This commit is contained in:
commit
e27deedf24
1
.hgtags
1
.hgtags
@ -143,3 +143,4 @@ f0eccb2946986fb9626efde7d8ed9c8192623f5c jdk8-b17
|
||||
0ff7113a0882ec82d642cb9f0297b4e497807ced jdk8-b19
|
||||
6561530ea757c3f3a6fb171c9cc7b3885cdeca85 jdk8-b20
|
||||
b3a426170188f52981cf4573a2f14d487fddab0d jdk8-b21
|
||||
e8f03541af27e38aafb619b96863e17f65ffe53b jdk8-b22
|
||||
|
@ -143,3 +143,4 @@ a4f28069d44a379cda99dd1d921d19f819726d22 jdk8-b15
|
||||
237bc29afbfc6f56a4fe4a6008e2befb59c44bac jdk8-b19
|
||||
5a5eaf6374bcbe23530899579fed17a05b7705f3 jdk8-b20
|
||||
cc771d92284f71765eca14d6d08703c4af254c04 jdk8-b21
|
||||
7ad075c809952e355d25030605da6af30456ed74 jdk8-b22
|
||||
|
@ -143,3 +143,4 @@ e59c47de1ad8982ff3b0e843773a6902b36c2337 jdk8-b14
|
||||
e1366c5d84ef984095a332bcee70b3938232d07d jdk8-b19
|
||||
51d8b6cb18c0978ecfa4f33e1537d35ee01b69fa jdk8-b20
|
||||
f157fc2a71a38ce44007a6f18d5b011824dce705 jdk8-b21
|
||||
a11d0062c445d5f36651c78650ab88aa594bcbff jdk8-b22
|
||||
|
@ -211,3 +211,5 @@ a2fef924d8e6f37dac2a887315e3502876cc8e24 hs23-b08
|
||||
fe2c8764998112b7fefcd7d41599714813ae4327 jdk8-b20
|
||||
9952d1c439d64c5fd4ad1236a63a62bd5a49d4c3 jdk8-b21
|
||||
513351373923f74a7c91755748b95c9771e59f96 hs23-b10
|
||||
24727fb37561779077fdfa5a33342246f20e5c0f jdk8-b22
|
||||
dcc292399a39113957eebbd3e487b7e05e2c79fc hs23-b11
|
||||
|
@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011
|
||||
|
||||
HS_MAJOR_VER=23
|
||||
HS_MINOR_VER=0
|
||||
HS_BUILD_NUMBER=11
|
||||
HS_BUILD_NUMBER=12
|
||||
|
||||
JDK_MAJOR_VER=1
|
||||
JDK_MINOR_VER=8
|
||||
|
@ -143,3 +143,4 @@ ebec6a7e8d4e481d205a2109ddeea8121d76db7f jdk8-b18
|
||||
dffeb62b1a7fc8b316bf58fe5479323f3661894e jdk8-b19
|
||||
f052abb8f37444ba77858913887d0d92795dd6b8 jdk8-b20
|
||||
d41eeadf5c1344b88c5051a997aec9e1ad7ce1db jdk8-b21
|
||||
cf9d6ec44f891236ad18451021d6dcd57dc82f7b jdk8-b22
|
||||
|
@ -143,3 +143,4 @@ c9ab96ff23d52d85d5dcce1f9c0fd7a3de418c74 jdk8-b15
|
||||
b73b733214aa43648d69a2da51e6b48fda902a2d jdk8-b19
|
||||
2b2818e3386f4510c390f6aea90d77e1c6a5bf9e jdk8-b20
|
||||
c266cab0e3fff05f2048c23046c14d60f7102175 jdk8-b21
|
||||
8d3df89b0f2d3c603b2edb0f5e24af1245397cc6 jdk8-b22
|
||||
|
@ -143,3 +143,4 @@ b71d1acfae5240d8c1359443cd02b5ddb587231c jdk8-b17
|
||||
3778f85773055e81eab6c5ef828935ecca241810 jdk8-b19
|
||||
39e938cd1b82ec3aab0a9aa66fd8a0457cd0c9c2 jdk8-b20
|
||||
664fa4fb0ee411ef048903c479f8b962fcdb2f4b jdk8-b21
|
||||
dda27c73d8db4a9c7a23872b6f0c5106edcb2021 jdk8-b22
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,15 +25,24 @@
|
||||
|
||||
BUILDDIR = ../..
|
||||
PRODUCT = oracle
|
||||
#SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
|
||||
#SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||
#SUBDIRS_MAKEFLAGS += JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation,-path
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
# Files to compile
|
||||
#
|
||||
AUTO_FILES_JAVA_DIRS = com/oracle
|
||||
# build com/oracle/security/ucrypto on Solaris platform for non-OpenJDK builds
|
||||
UCRYPTO =
|
||||
ifndef OPENJDK
|
||||
ifeq ($(PLATFORM), solaris)
|
||||
UCRYPTO = security/ucrypto
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
include $(BUILDDIR)/common/Classes.gmk
|
||||
|
||||
SUBDIRS = net nio util $(UCRYPTO)
|
||||
|
||||
include $(BUILDDIR)/common/Subdirs.gmk
|
||||
|
||||
all build clean clobber::
|
||||
$(SUBDIRS-loop)
|
||||
|
||||
|
40
jdk/make/com/oracle/net/Makefile
Normal file
40
jdk/make/com/oracle/net/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
BUILDDIR = ../../..
|
||||
PACKAGE = com.oracle.net
|
||||
PRODUCT = oracle
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
# Files
|
||||
#
|
||||
AUTO_FILES_JAVA_DIRS = com/oracle/net
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
include $(BUILDDIR)/common/Classes.gmk
|
||||
|
40
jdk/make/com/oracle/nio/Makefile
Normal file
40
jdk/make/com/oracle/nio/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
BUILDDIR = ../../..
|
||||
PACKAGE = com.oracle.nio
|
||||
PRODUCT = oracle
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
# Files
|
||||
#
|
||||
AUTO_FILES_JAVA_DIRS = com/oracle/nio
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
include $(BUILDDIR)/common/Classes.gmk
|
||||
|
30
jdk/make/com/oracle/security/ucrypto/FILES_c.gmk
Normal file
30
jdk/make/com/oracle/security/ucrypto/FILES_c.gmk
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
ifndef OPENJDK
|
||||
FILES_c = \
|
||||
nativeFunc.c \
|
||||
nativeCrypto.c
|
||||
endif
|
270
jdk/make/com/oracle/security/ucrypto/Makefile
Normal file
270
jdk/make/com/oracle/security/ucrypto/Makefile
Normal file
@ -0,0 +1,270 @@
|
||||
#
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for building ucrypto.jar and its native libraries.
|
||||
#
|
||||
# This file was modified from make/sun/security/pkcs11/Makefile.
|
||||
#
|
||||
#
|
||||
# (The terms "OpenJDK" and "JDK" below refer to OpenJDK and Oracle
|
||||
# JDK builds respectively.)
|
||||
#
|
||||
# This Makefile does the "real" build of the Ucrypto provider files.
|
||||
# Since the sources are unavailable for OpenJDK, this Makefile is only
|
||||
# useful for JDK.
|
||||
#
|
||||
#
|
||||
# Main Targets (JDK on Solaris):
|
||||
#
|
||||
# all The usual, ucrypto.jar plus the native libraries.
|
||||
# builds and installs the prebuilt/signed jar.
|
||||
#
|
||||
# clobber/clean Cleans up the temp directory, ucrypto.jar, the
|
||||
# native libraries, and the config file from the
|
||||
# build area
|
||||
#
|
||||
# jar Builds, signs and installs ucrypto.jar
|
||||
# (Can only be done on machines with access to
|
||||
# the signing keystore)
|
||||
#
|
||||
# Other lesser-used Targets (JDK on Solaris):
|
||||
#
|
||||
# build-jar Builds ucrypto.jar (no sign/install)
|
||||
#
|
||||
# sign Builds/signs ucrypto.jar (no install)
|
||||
#
|
||||
# release Builds all targets in preparation
|
||||
# for workspace integration.
|
||||
# (Can only be done on machines with access to
|
||||
# the signing keystore)
|
||||
#
|
||||
# install-prebuilt Installs the pre-built jar files
|
||||
#
|
||||
# NOTE: None of the above target will update the prebuilt provider binary
|
||||
# under the closed workspace. To update it, you must explicitly copy the
|
||||
# binary from either the tmp/signed or lib/ext directory.
|
||||
#
|
||||
# This makefile was written to support parallel target execution.
|
||||
#
|
||||
|
||||
BUILDDIR = ../../../..
|
||||
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
ifndef OPENJDK
|
||||
ifneq ($(PLATFORM), solaris)
|
||||
all:
|
||||
else
|
||||
PACKAGE = com.oracle.security.ucrypto
|
||||
LIBRARY = j2ucrypto
|
||||
PRODUCT = oracle
|
||||
|
||||
#
|
||||
# The following is for when we need to do postprocessing
|
||||
# (signing/obfuscation) against a read-only build. If the OUTPUTDIR
|
||||
# isn't writable, the build currently crashes out.
|
||||
#
|
||||
ifdef ALT_JCE_BUILD_DIR
|
||||
# =====================================================
|
||||
# Where to place the output, in case we're building from a read-only
|
||||
# build area. (e.g. a release engineering build.)
|
||||
JCE_BUILD_DIR=${ALT_JCE_BUILD_DIR}
|
||||
IGNORE_WRITABLE_OUTPUTDIR_TEST=true
|
||||
else
|
||||
JCE_BUILD_DIR=${TEMPDIR}
|
||||
endif
|
||||
|
||||
JAVAC_MAX_WARNINGS=false
|
||||
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||
JAVAC_WARNINGS_FATAL=true
|
||||
|
||||
#
|
||||
# C and Java Files
|
||||
#
|
||||
include FILES_c.gmk
|
||||
|
||||
#
|
||||
# Subdirectories of these are automatically included.
|
||||
#
|
||||
AUTO_FILES_JAVA_DIRS = com/oracle/security/ucrypto
|
||||
|
||||
#
|
||||
# Java files that define native methods
|
||||
#
|
||||
FILES_export = \
|
||||
com/oracle/security/ucrypto/UcryptoProvider.java \
|
||||
com/oracle/security/ucrypto/NativeCipher.java \
|
||||
com/oracle/security/ucrypto/NativeDigest.java \
|
||||
com/oracle/security/ucrypto/NativeKey.java \
|
||||
com/oracle/security/ucrypto/NativeRSASignature.java \
|
||||
com/oracle/security/ucrypto/NativeRSACipher.java
|
||||
|
||||
#
|
||||
# Find native code
|
||||
#
|
||||
vpath %.c \
|
||||
$(CLOSED_PLATFORM_SRC)/native/com/oracle/security/ucrypto
|
||||
|
||||
#
|
||||
# Find include files
|
||||
#
|
||||
OTHER_INCLUDES += \
|
||||
-I$(CLOSED_PLATFORM_SRC)/native/com/oracle/security/ucrypto
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
CLASSDESTDIR = $(TEMPDIR)/classes
|
||||
JAVAHFLAGS = -bootclasspath \
|
||||
"$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)"
|
||||
|
||||
include $(BUILDDIR)/common/Mapfile-vers.gmk
|
||||
include $(BUILDDIR)/common/Library.gmk
|
||||
|
||||
#
|
||||
# Libraries to link
|
||||
#
|
||||
OTHER_LDLIBS = -ldl
|
||||
|
||||
# Default config file
|
||||
UCRYPTO_CFG_SRC = $(CLOSED_SRC)/share/lib/security/ucrypto-solaris.cfg
|
||||
UCRYPTO_CFG_BUILD = $(LIBDIR)/security/ucrypto-solaris.cfg
|
||||
|
||||
#
|
||||
# We use a variety of subdirectories in the $(TEMPDIR) depending on what
|
||||
# part of the build we're doing. Build is initially done in the unsigned
|
||||
# area and when files are signed, they will be placed in the appropriate area.
|
||||
#
|
||||
UNSIGNED_DIR = $(TEMPDIR)/unsigned
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
all: ucrypto-cfg build-jar install-prebuilt
|
||||
$(build-warning)
|
||||
|
||||
ucrypto-cfg: $(UCRYPTO_CFG_BUILD)
|
||||
|
||||
$(UCRYPTO_CFG_BUILD): $(UCRYPTO_CFG_SRC)
|
||||
$(install-file)
|
||||
|
||||
include $(BUILDDIR)/javax/crypto/Defs-jce.gmk
|
||||
|
||||
|
||||
# =====================================================
|
||||
# Build the unsigned ucrypto.jar file.
|
||||
#
|
||||
|
||||
JAR_DESTFILE = $(EXTDIR)/ucrypto.jar
|
||||
|
||||
#
|
||||
# The ucrypto.jar needs to be in the extension class directory,
|
||||
# therefore none of its classes can appear in $(CLASSBINDIR).
|
||||
# Currently no one is using any of the internals, so these files
|
||||
# should not have been built.
|
||||
#
|
||||
|
||||
#
|
||||
# Since the -C option to jar is used below, each directory entry must be
|
||||
# preceded with the appropriate directory to "cd" into.
|
||||
#
|
||||
JAR_DIRS = $(patsubst %, -C $(CLASSDESTDIR) %, $(AUTO_FILES_JAVA_DIRS))
|
||||
|
||||
build-jar: $(UNSIGNED_DIR)/ucrypto.jar
|
||||
|
||||
#
|
||||
# Build ucrypto.jar.
|
||||
#
|
||||
$(UNSIGNED_DIR)/ucrypto.jar: build
|
||||
$(prep-target)
|
||||
$(BOOT_JAR_CMD) cf $@ $(JAR_DIRS) \
|
||||
$(BOOT_JAR_JFLAGS)
|
||||
@$(java-vm-cleanup)
|
||||
|
||||
#
|
||||
# Sign ucrypto.jar
|
||||
#
|
||||
SIGNED_DIR = $(JCE_BUILD_DIR)/signed
|
||||
|
||||
sign: $(SIGNED_DIR)/ucrypto.jar
|
||||
|
||||
ifndef ALT_JCE_BUILD_DIR
|
||||
$(SIGNED_DIR)/ucrypto.jar: $(UNSIGNED_DIR)/ucrypto.jar
|
||||
else
|
||||
#
|
||||
# We have to remove the build dependency, otherwise, we'll try to rebuild it
|
||||
# which we can't do on a read-only filesystem.
|
||||
#
|
||||
$(SIGNED_DIR)/ucrypto.jar:
|
||||
@if [ ! -r $(UNSIGNED_DIR)/ucrypto.jar ] ; then \
|
||||
$(ECHO) "Couldn't find $(UNSIGNED_DIR)/ucrypto.jar"; \
|
||||
exit 1; \
|
||||
fi
|
||||
endif
|
||||
$(call sign-file, $(UNSIGNED_DIR)/ucrypto.jar)
|
||||
|
||||
|
||||
# =====================================================
|
||||
# Create the Release Engineering files. Signed builds, etc.
|
||||
#
|
||||
|
||||
release: $(SIGNED_DIR)/ucrypto.jar
|
||||
$(RM) $(JCE_BUILD_DIR)/release/ucrypto.jar
|
||||
$(MKDIR) -p $(JCE_BUILD_DIR)/release
|
||||
$(CP) $(SIGNED_DIR)/ucrypto.jar $(JCE_BUILD_DIR)/release
|
||||
$(release-warning)
|
||||
|
||||
|
||||
# =====================================================
|
||||
# Install routines.
|
||||
#
|
||||
|
||||
#
|
||||
# Install ucrypto.jar, depending on which type is requested.
|
||||
#
|
||||
jar: $(JAR_DESTFILE)
|
||||
$(release-warning)
|
||||
|
||||
$(JAR_DESTFILE): $(SIGNED_DIR)/ucrypto.jar
|
||||
$(install-file)
|
||||
|
||||
install-prebuilt:
|
||||
@$(ECHO) "\n>>>Installing prebuilt OracleUcrypto provider..."
|
||||
$(RM) $(JAR_DESTFILE)
|
||||
$(CP) $(PREBUILT_DIR)/ucrypto/ucrypto.jar $(JAR_DESTFILE)
|
||||
|
||||
|
||||
# =====================================================
|
||||
# Support routines.
|
||||
#
|
||||
clobber clean::
|
||||
$(RM) -r $(JAR_DESTFILE) $(TEMPDIR) $(JCE_BUILD_DIR)
|
||||
$(RM) -r $(UCRYPTO_CFG_BUILD)
|
||||
|
||||
.PHONY: build-jar jar sign release install-prebuilt
|
||||
|
||||
endif #ifneq ($(PLATFORM), solaris)
|
||||
endif #ifndef OPENJDK
|
69
jdk/make/com/oracle/security/ucrypto/mapfile-vers
Normal file
69
jdk/make/com/oracle/security/ucrypto/mapfile-vers
Normal file
@ -0,0 +1,69 @@
|
||||
#
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# Define public interface.
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
JNI_OnLoad;
|
||||
Java_com_oracle_security_ucrypto_UcryptoProvider_loadLibraries;
|
||||
Java_com_oracle_security_ucrypto_UcryptoProvider_getMechList;
|
||||
Java_com_oracle_security_ucrypto_NativeDigest_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeDigest_nativeUpdate;
|
||||
Java_com_oracle_security_ucrypto_NativeDigest_nativeDigest;
|
||||
Java_com_oracle_security_ucrypto_NativeDigest_nativeClone;
|
||||
Java_com_oracle_security_ucrypto_NativeDigest_nativeFree;
|
||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII;
|
||||
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI;
|
||||
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal;
|
||||
Java_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic;
|
||||
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeUpdate;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeDigest;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeClone;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeDigest_nativeFree;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZ_3BII;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeUpdate__JZJI;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeFinal;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeRSACipher_nativeAtomic;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
40
jdk/make/com/oracle/util/Makefile
Normal file
40
jdk/make/com/oracle/util/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
BUILDDIR = ../../..
|
||||
PACKAGE = com.oracle.util
|
||||
PRODUCT = oracle
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
# Files
|
||||
#
|
||||
AUTO_FILES_JAVA_DIRS = com/oracle/util
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
include $(BUILDDIR)/common/Classes.gmk
|
||||
|
@ -65,7 +65,7 @@ FILES_export = \
|
||||
$(MIDIFILES_export) \
|
||||
$(PORTFILES_export)
|
||||
|
||||
LDFLAGS += -lasound
|
||||
OTHER_LDLIBS += -lasound
|
||||
|
||||
CPPFLAGS += \
|
||||
-DUSE_DAUDIO=TRUE \
|
||||
|
@ -367,7 +367,8 @@ else
|
||||
FONTCONFIGS_SRC = $(CLOSED_SRC)/solaris/classes/sun/awt/fontconfigs
|
||||
_FONTCONFIGS = \
|
||||
fontconfig.properties \
|
||||
fontconfig.RedHat.5.5.properties \
|
||||
fontconfig.RedHat.5.properties \
|
||||
fontconfig.RedHat.6.properties \
|
||||
fontconfig.Turbo.properties \
|
||||
fontconfig.SuSE.10.properties \
|
||||
fontconfig.SuSE.11.properties
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -47,8 +47,8 @@ SUNWprivate_1.1 {
|
||||
Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseSession;
|
||||
# Java_sun_security_pkcs11_wrapper_PKCS11_C_1CloseAllSessions;
|
||||
Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetSessionInfo;
|
||||
# Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetOperationState;
|
||||
# Java_sun_security_pkcs11_wrapper_PKCS11_C_1SetOperationState;
|
||||
Java_sun_security_pkcs11_wrapper_PKCS11_C_1GetOperationState;
|
||||
Java_sun_security_pkcs11_wrapper_PKCS11_C_1SetOperationState;
|
||||
Java_sun_security_pkcs11_wrapper_PKCS11_C_1Login;
|
||||
Java_sun_security_pkcs11_wrapper_PKCS11_C_1Logout;
|
||||
Java_sun_security_pkcs11_wrapper_PKCS11_C_1CreateObject;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1225,14 +1225,7 @@ LoadMainClass(JNIEnv *env, int mode, char *name)
|
||||
"checkAndLoadMain",
|
||||
"(ZILjava/lang/String;)Ljava/lang/Class;"));
|
||||
|
||||
switch (mode) {
|
||||
case LM_CLASS:
|
||||
str = NewPlatformString(env, name);
|
||||
break;
|
||||
default:
|
||||
str = (*env)->NewStringUTF(env, name);
|
||||
break;
|
||||
}
|
||||
result = (*env)->CallStaticObjectMethod(env, cls, mid, USE_STDERR, mode, str);
|
||||
|
||||
if (JLI_IsTraceLauncher()) {
|
||||
|
@ -154,7 +154,7 @@ public final class TypeResolver {
|
||||
* @see #resolve(Type)
|
||||
*/
|
||||
public static Type resolve(Type actual, Type formal) {
|
||||
return new TypeResolver(actual).resolve(formal);
|
||||
return getTypeResolver(actual).resolve(formal);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +169,7 @@ public final class TypeResolver {
|
||||
* @see #resolve(Type[])
|
||||
*/
|
||||
public static Type[] resolve(Type actual, Type[] formals) {
|
||||
return new TypeResolver(actual).resolve(formals);
|
||||
return getTypeResolver(actual).resolve(formals);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,9 +228,20 @@ public final class TypeResolver {
|
||||
return classes;
|
||||
}
|
||||
|
||||
public static TypeResolver getTypeResolver(Type type) {
|
||||
synchronized (CACHE) {
|
||||
TypeResolver resolver = CACHE.get(type);
|
||||
if (resolver == null) {
|
||||
resolver = new TypeResolver(type);
|
||||
CACHE.put(type, resolver);
|
||||
}
|
||||
return resolver;
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<TypeVariable<?>, Type> map
|
||||
= new HashMap<TypeVariable<?>, Type>();
|
||||
private static final WeakCache<Type, TypeResolver> CACHE = new WeakCache<>();
|
||||
|
||||
private final Map<TypeVariable<?>, Type> map = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Constructs the type resolver for the given actual type.
|
||||
|
@ -802,9 +802,12 @@ public class AWTKeyStroke implements Serializable {
|
||||
*/
|
||||
protected Object readResolve() throws java.io.ObjectStreamException {
|
||||
synchronized (AWTKeyStroke.class) {
|
||||
if (getClass().equals(getAWTKeyStrokeClass())) {
|
||||
return getCachedStroke(keyChar, keyCode, modifiers, onKeyRelease);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private static int mapOldModifiers(int modifiers) {
|
||||
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
|
||||
|
@ -3118,4 +3118,9 @@ public final
|
||||
AnnotationType getAnnotationType() {
|
||||
return annotationType;
|
||||
}
|
||||
|
||||
/* Backing store of user-defined values pertaining to this class.
|
||||
* Maintained by the ClassValue class.
|
||||
*/
|
||||
transient ClassValue.ClassValueMap classValueMap;
|
||||
}
|
||||
|
@ -25,9 +25,14 @@
|
||||
|
||||
package java.lang;
|
||||
|
||||
import java.lang.ClassValue.ClassValueMap;
|
||||
import java.util.WeakHashMap;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static java.lang.ClassValue.ClassValueMap.probeHomeLocation;
|
||||
import static java.lang.ClassValue.ClassValueMap.probeBackupLocations;
|
||||
|
||||
/**
|
||||
* Lazily associate a computed value with (potentially) every type.
|
||||
* For example, if a dynamic language needs to construct a message dispatch
|
||||
@ -92,14 +97,22 @@ public abstract class ClassValue<T> {
|
||||
* @see #computeValue
|
||||
*/
|
||||
public T get(Class<?> type) {
|
||||
ClassValueMap map = getMap(type);
|
||||
if (map != null) {
|
||||
Object x = map.get(this);
|
||||
if (x != null) {
|
||||
return (T) map.unmaskNull(x);
|
||||
}
|
||||
}
|
||||
return setComputedValue(type);
|
||||
// non-racing this.hashCodeForCache : final int
|
||||
Entry<?>[] cache;
|
||||
Entry<T> e = probeHomeLocation(cache = getCacheCarefully(type), this);
|
||||
// racing e : current value <=> stale value from current cache or from stale cache
|
||||
// invariant: e is null or an Entry with readable Entry.version and Entry.value
|
||||
if (match(e))
|
||||
// invariant: No false positive matches. False negatives are OK if rare.
|
||||
// The key fact that makes this work: if this.version == e.version,
|
||||
// then this thread has a right to observe (final) e.value.
|
||||
return e.value();
|
||||
// The fast path can fail for any of these reasons:
|
||||
// 1. no entry has been computed yet
|
||||
// 2. hash code collision (before or after reduction mod cache.length)
|
||||
// 3. an entry has been removed (either on this type or another)
|
||||
// 4. the GC has somehow managed to delete e.version and clear the reference
|
||||
return getFromBackup(cache, type);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,83 +170,582 @@ public abstract class ClassValue<T> {
|
||||
*/
|
||||
public void remove(Class<?> type) {
|
||||
ClassValueMap map = getMap(type);
|
||||
if (map != null) {
|
||||
synchronized (map) {
|
||||
map.remove(this);
|
||||
}
|
||||
}
|
||||
map.removeEntry(this);
|
||||
}
|
||||
|
||||
/// Implementation...
|
||||
// FIXME: Use a data structure here similar that of ThreadLocal (7030453).
|
||||
|
||||
private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
|
||||
|
||||
/** Slow path for {@link #get}. */
|
||||
private T setComputedValue(Class<?> type) {
|
||||
// Possible functionality for JSR 292 MR 1
|
||||
/*public*/ void put(Class<?> type, T value) {
|
||||
ClassValueMap map = getMap(type);
|
||||
if (map == null) {
|
||||
map = initializeMap(type);
|
||||
}
|
||||
T value = computeValue(type);
|
||||
STORE_BARRIER.lazySet(0);
|
||||
// All stores pending from computeValue are completed.
|
||||
synchronized (map) {
|
||||
// Warm up the table with a null entry.
|
||||
map.preInitializeEntry(this);
|
||||
}
|
||||
STORE_BARRIER.lazySet(0);
|
||||
// All stores pending from table expansion are completed.
|
||||
synchronized (map) {
|
||||
value = (T) map.initializeEntry(this, value);
|
||||
// One might fear a possible race condition here
|
||||
// if the code for map.put has flushed the write
|
||||
// to map.table[*] before the writes to the Map.Entry
|
||||
// are done. This is not possible, since we have
|
||||
// warmed up the table with an empty entry.
|
||||
}
|
||||
return value;
|
||||
map.changeEntry(this, value);
|
||||
}
|
||||
|
||||
// Replace this map by a per-class slot.
|
||||
private static final WeakHashMap<Class<?>, ClassValueMap> ROOT
|
||||
= new WeakHashMap<Class<?>, ClassValueMap>();
|
||||
/// --------
|
||||
/// Implementation...
|
||||
/// --------
|
||||
|
||||
/** Return the cache, if it exists, else a dummy empty cache. */
|
||||
private static Entry<?>[] getCacheCarefully(Class<?> type) {
|
||||
// racing type.classValueMap{.cacheArray} : null => new Entry[X] <=> new Entry[Y]
|
||||
ClassValueMap map = type.classValueMap;
|
||||
if (map == null) return EMPTY_CACHE;
|
||||
Entry<?>[] cache = map.getCache();
|
||||
return cache;
|
||||
// invariant: returned value is safe to dereference and check for an Entry
|
||||
}
|
||||
|
||||
/** Initial, one-element, empty cache used by all Class instances. Must never be filled. */
|
||||
private static final Entry<?>[] EMPTY_CACHE = { null };
|
||||
|
||||
/**
|
||||
* Slow tail of ClassValue.get to retry at nearby locations in the cache,
|
||||
* or take a slow lock and check the hash table.
|
||||
* Called only if the first probe was empty or a collision.
|
||||
* This is a separate method, so compilers can process it independently.
|
||||
*/
|
||||
private T getFromBackup(Entry<?>[] cache, Class<?> type) {
|
||||
Entry<T> e = probeBackupLocations(cache, this);
|
||||
if (e != null)
|
||||
return e.value();
|
||||
return getFromHashMap(type);
|
||||
}
|
||||
|
||||
// Hack to suppress warnings on the (T) cast, which is a no-op.
|
||||
@SuppressWarnings("unchecked")
|
||||
Entry<T> castEntry(Entry<?> e) { return (Entry<T>) e; }
|
||||
|
||||
/** Called when the fast path of get fails, and cache reprobe also fails.
|
||||
*/
|
||||
private T getFromHashMap(Class<?> type) {
|
||||
// The fail-safe recovery is to fall back to the underlying classValueMap.
|
||||
ClassValueMap map = getMap(type);
|
||||
for (;;) {
|
||||
Entry<T> e = map.startEntry(this);
|
||||
if (!e.isPromise())
|
||||
return e.value();
|
||||
try {
|
||||
// Try to make a real entry for the promised version.
|
||||
e = makeEntry(e.version(), computeValue(type));
|
||||
} finally {
|
||||
// Whether computeValue throws or returns normally,
|
||||
// be sure to remove the empty entry.
|
||||
e = map.finishEntry(this, e);
|
||||
}
|
||||
if (e != null)
|
||||
return e.value();
|
||||
// else try again, in case a racing thread called remove (so e == null)
|
||||
}
|
||||
}
|
||||
|
||||
/** Check that e is non-null, matches this ClassValue, and is live. */
|
||||
boolean match(Entry<?> e) {
|
||||
// racing e.version : null (blank) => unique Version token => null (GC-ed version)
|
||||
// non-racing this.version : v1 => v2 => ... (updates are read faithfully from volatile)
|
||||
return (e != null && e.get() == this.version);
|
||||
// invariant: No false positives on version match. Null is OK for false negative.
|
||||
// invariant: If version matches, then e.value is readable (final set in Entry.<init>)
|
||||
}
|
||||
|
||||
/** Internal hash code for accessing Class.classValueMap.cacheArray. */
|
||||
final int hashCodeForCache = nextHashCode.getAndAdd(HASH_INCREMENT) & HASH_MASK;
|
||||
|
||||
/** Value stream for hashCodeForCache. See similar structure in ThreadLocal. */
|
||||
private static final AtomicInteger nextHashCode = new AtomicInteger();
|
||||
|
||||
/** Good for power-of-two tables. See similar structure in ThreadLocal. */
|
||||
private static final int HASH_INCREMENT = 0x61c88647;
|
||||
|
||||
/** Mask a hash code to be positive but not too large, to prevent wraparound. */
|
||||
static final int HASH_MASK = (-1 >>> 2);
|
||||
|
||||
/**
|
||||
* Private key for retrieval of this object from ClassValueMap.
|
||||
*/
|
||||
static class Identity {
|
||||
}
|
||||
/**
|
||||
* This ClassValue's identity, expressed as an opaque object.
|
||||
* The main object {@code ClassValue.this} is incorrect since
|
||||
* subclasses may override {@code ClassValue.equals}, which
|
||||
* could confuse keys in the ClassValueMap.
|
||||
*/
|
||||
final Identity identity = new Identity();
|
||||
|
||||
/**
|
||||
* Current version for retrieving this class value from the cache.
|
||||
* Any number of computeValue calls can be cached in association with one version.
|
||||
* But the version changes when a remove (on any type) is executed.
|
||||
* A version change invalidates all cache entries for the affected ClassValue,
|
||||
* by marking them as stale. Stale cache entries do not force another call
|
||||
* to computeValue, but they do require a synchronized visit to a backing map.
|
||||
* <p>
|
||||
* All user-visible state changes on the ClassValue take place under
|
||||
* a lock inside the synchronized methods of ClassValueMap.
|
||||
* Readers (of ClassValue.get) are notified of such state changes
|
||||
* when this.version is bumped to a new token.
|
||||
* This variable must be volatile so that an unsynchronized reader
|
||||
* will receive the notification without delay.
|
||||
* <p>
|
||||
* If version were not volatile, one thread T1 could persistently hold onto
|
||||
* a stale value this.value == V1, while while another thread T2 advances
|
||||
* (under a lock) to this.value == V2. This will typically be harmless,
|
||||
* but if T1 and T2 interact causally via some other channel, such that
|
||||
* T1's further actions are constrained (in the JMM) to happen after
|
||||
* the V2 event, then T1's observation of V1 will be an error.
|
||||
* <p>
|
||||
* The practical effect of making this.version be volatile is that it cannot
|
||||
* be hoisted out of a loop (by an optimizing JIT) or otherwise cached.
|
||||
* Some machines may also require a barrier instruction to execute
|
||||
* before this.version.
|
||||
*/
|
||||
private volatile Version<T> version = new Version<>(this);
|
||||
Version<T> version() { return version; }
|
||||
void bumpVersion() { version = new Version<>(this); }
|
||||
static class Version<T> {
|
||||
private final ClassValue<T> classValue;
|
||||
private final Entry<T> promise = new Entry<>(this);
|
||||
Version(ClassValue<T> classValue) { this.classValue = classValue; }
|
||||
ClassValue<T> classValue() { return classValue; }
|
||||
Entry<T> promise() { return promise; }
|
||||
boolean isLive() { return classValue.version() == this; }
|
||||
}
|
||||
|
||||
/** One binding of a value to a class via a ClassValue.
|
||||
* States are:<ul>
|
||||
* <li> promise if value == Entry.this
|
||||
* <li> else dead if version == null
|
||||
* <li> else stale if version != classValue.version
|
||||
* <li> else live </ul>
|
||||
* Promises are never put into the cache; they only live in the
|
||||
* backing map while a computeValue call is in flight.
|
||||
* Once an entry goes stale, it can be reset at any time
|
||||
* into the dead state.
|
||||
*/
|
||||
static class Entry<T> extends WeakReference<Version<T>> {
|
||||
final Object value; // usually of type T, but sometimes (Entry)this
|
||||
Entry(Version<T> version, T value) {
|
||||
super(version);
|
||||
this.value = value; // for a regular entry, value is of type T
|
||||
}
|
||||
private void assertNotPromise() { assert(!isPromise()); }
|
||||
/** For creating a promise. */
|
||||
Entry(Version<T> version) {
|
||||
super(version);
|
||||
this.value = this; // for a promise, value is not of type T, but Entry!
|
||||
}
|
||||
/** Fetch the value. This entry must not be a promise. */
|
||||
@SuppressWarnings("unchecked") // if !isPromise, type is T
|
||||
T value() { assertNotPromise(); return (T) value; }
|
||||
boolean isPromise() { return value == this; }
|
||||
Version<T> version() { return get(); }
|
||||
ClassValue<T> classValueOrNull() {
|
||||
Version<T> v = version();
|
||||
return (v == null) ? null : v.classValue();
|
||||
}
|
||||
boolean isLive() {
|
||||
Version<T> v = version();
|
||||
if (v == null) return false;
|
||||
if (v.isLive()) return true;
|
||||
clear();
|
||||
return false;
|
||||
}
|
||||
Entry<T> refreshVersion(Version<T> v2) {
|
||||
assertNotPromise();
|
||||
@SuppressWarnings("unchecked") // if !isPromise, type is T
|
||||
Entry<T> e2 = new Entry<>(v2, (T) value);
|
||||
clear();
|
||||
// value = null -- caller must drop
|
||||
return e2;
|
||||
}
|
||||
static final Entry<?> DEAD_ENTRY = new Entry<>(null, null);
|
||||
}
|
||||
|
||||
/** Return the backing map associated with this type. */
|
||||
private static ClassValueMap getMap(Class<?> type) {
|
||||
type.getClass(); // test for null
|
||||
return ROOT.get(type);
|
||||
// racing type.classValueMap : null (blank) => unique ClassValueMap
|
||||
// if a null is observed, a map is created (lazily, synchronously, uniquely)
|
||||
// all further access to that map is synchronized
|
||||
ClassValueMap map = type.classValueMap;
|
||||
if (map != null) return map;
|
||||
return initializeMap(type);
|
||||
}
|
||||
|
||||
private static final Object CRITICAL_SECTION = new Object();
|
||||
private static ClassValueMap initializeMap(Class<?> type) {
|
||||
synchronized (ClassValue.class) {
|
||||
ClassValueMap map = ROOT.get(type);
|
||||
if (map == null)
|
||||
ROOT.put(type, map = new ClassValueMap());
|
||||
ClassValueMap map;
|
||||
synchronized (CRITICAL_SECTION) { // private object to avoid deadlocks
|
||||
// happens about once per type
|
||||
if ((map = type.classValueMap) == null)
|
||||
type.classValueMap = map = new ClassValueMap(type);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
static <T> Entry<T> makeEntry(Version<T> explicitVersion, T value) {
|
||||
// Note that explicitVersion might be different from this.version.
|
||||
return new Entry<>(explicitVersion, value);
|
||||
|
||||
// As soon as the Entry is put into the cache, the value will be
|
||||
// reachable via a data race (as defined by the Java Memory Model).
|
||||
// This race is benign, assuming the value object itself can be
|
||||
// read safely by multiple threads. This is up to the user.
|
||||
//
|
||||
// The entry and version fields themselves can be safely read via
|
||||
// a race because they are either final or have controlled states.
|
||||
// If the pointer from the entry to the version is still null,
|
||||
// or if the version goes immediately dead and is nulled out,
|
||||
// the reader will take the slow path and retry under a lock.
|
||||
}
|
||||
|
||||
static class ClassValueMap extends WeakHashMap<ClassValue, Object> {
|
||||
/** Make sure this table contains an Entry for the given key, even if it is empty. */
|
||||
void preInitializeEntry(ClassValue key) {
|
||||
if (!this.containsKey(key))
|
||||
this.put(key, null);
|
||||
}
|
||||
/** Make sure this table contains a non-empty Entry for the given key. */
|
||||
Object initializeEntry(ClassValue key, Object value) {
|
||||
Object prior = this.get(key);
|
||||
if (prior != null) {
|
||||
return unmaskNull(prior);
|
||||
}
|
||||
this.put(key, maskNull(value));
|
||||
return value;
|
||||
// The following class could also be top level and non-public:
|
||||
|
||||
/** A backing map for all ClassValues, relative a single given type.
|
||||
* Gives a fully serialized "true state" for each pair (ClassValue cv, Class type).
|
||||
* Also manages an unserialized fast-path cache.
|
||||
*/
|
||||
static class ClassValueMap extends WeakHashMap<ClassValue.Identity, Entry<?>> {
|
||||
private final Class<?> type;
|
||||
private Entry<?>[] cacheArray;
|
||||
private int cacheLoad, cacheLoadLimit;
|
||||
|
||||
/** Number of entries initially allocated to each type when first used with any ClassValue.
|
||||
* It would be pointless to make this much smaller than the Class and ClassValueMap objects themselves.
|
||||
* Must be a power of 2.
|
||||
*/
|
||||
private static final int INITIAL_ENTRIES = 32;
|
||||
|
||||
/** Build a backing map for ClassValues, relative the given type.
|
||||
* Also, create an empty cache array and install it on the class.
|
||||
*/
|
||||
ClassValueMap(Class<?> type) {
|
||||
this.type = type;
|
||||
sizeCache(INITIAL_ENTRIES);
|
||||
}
|
||||
|
||||
Object maskNull(Object x) {
|
||||
return x == null ? this : x;
|
||||
Entry<?>[] getCache() { return cacheArray; }
|
||||
|
||||
/** Initiate a query. Store a promise (placeholder) if there is no value yet. */
|
||||
synchronized
|
||||
<T> Entry<T> startEntry(ClassValue<T> classValue) {
|
||||
@SuppressWarnings("unchecked") // one map has entries for all value types <T>
|
||||
Entry<T> e = (Entry<T>) get(classValue.identity);
|
||||
Version<T> v = classValue.version();
|
||||
if (e == null) {
|
||||
e = v.promise();
|
||||
// The presence of a promise means that a value is pending for v.
|
||||
// Eventually, finishEntry will overwrite the promise.
|
||||
put(classValue.identity, e);
|
||||
// Note that the promise is never entered into the cache!
|
||||
return e;
|
||||
} else if (e.isPromise()) {
|
||||
// Somebody else has asked the same question.
|
||||
// Let the races begin!
|
||||
if (e.version() != v) {
|
||||
e = v.promise();
|
||||
put(classValue.identity, e);
|
||||
}
|
||||
Object unmaskNull(Object x) {
|
||||
return x == this ? null : x;
|
||||
return e;
|
||||
} else {
|
||||
// there is already a completed entry here; report it
|
||||
if (e.version() != v) {
|
||||
// There is a stale but valid entry here; make it fresh again.
|
||||
// Once an entry is in the hash table, we don't care what its version is.
|
||||
e = e.refreshVersion(v);
|
||||
put(classValue.identity, e);
|
||||
}
|
||||
// Add to the cache, to enable the fast path, next time.
|
||||
checkCacheLoad();
|
||||
addToCache(classValue, e);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
/** Finish a query. Overwrite a matching placeholder. Drop stale incoming values. */
|
||||
synchronized
|
||||
<T> Entry<T> finishEntry(ClassValue<T> classValue, Entry<T> e) {
|
||||
@SuppressWarnings("unchecked") // one map has entries for all value types <T>
|
||||
Entry<T> e0 = (Entry<T>) get(classValue.identity);
|
||||
if (e == e0) {
|
||||
// We can get here during exception processing, unwinding from computeValue.
|
||||
assert(e.isPromise());
|
||||
remove(classValue.identity);
|
||||
return null;
|
||||
} else if (e0 != null && e0.isPromise() && e0.version() == e.version()) {
|
||||
// If e0 matches the intended entry, there has not been a remove call
|
||||
// between the previous startEntry and now. So now overwrite e0.
|
||||
Version<T> v = classValue.version();
|
||||
if (e.version() != v)
|
||||
e = e.refreshVersion(v);
|
||||
put(classValue.identity, e);
|
||||
// Add to the cache, to enable the fast path, next time.
|
||||
checkCacheLoad();
|
||||
addToCache(classValue, e);
|
||||
return e;
|
||||
} else {
|
||||
// Some sort of mismatch; caller must try again.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove an entry. */
|
||||
synchronized
|
||||
void removeEntry(ClassValue<?> classValue) {
|
||||
// make all cache elements for this guy go stale:
|
||||
if (remove(classValue.identity) != null) {
|
||||
classValue.bumpVersion();
|
||||
removeStaleEntries(classValue);
|
||||
}
|
||||
}
|
||||
|
||||
/** Change the value for an entry. */
|
||||
synchronized
|
||||
<T> void changeEntry(ClassValue<T> classValue, T value) {
|
||||
@SuppressWarnings("unchecked") // one map has entries for all value types <T>
|
||||
Entry<T> e0 = (Entry<T>) get(classValue.identity);
|
||||
Version<T> version = classValue.version();
|
||||
if (e0 != null) {
|
||||
if (e0.version() == version && e0.value() == value)
|
||||
// no value change => no version change needed
|
||||
return;
|
||||
classValue.bumpVersion();
|
||||
removeStaleEntries(classValue);
|
||||
}
|
||||
Entry<T> e = makeEntry(version, value);
|
||||
put(classValue.identity, e);
|
||||
// Add to the cache, to enable the fast path, next time.
|
||||
checkCacheLoad();
|
||||
addToCache(classValue, e);
|
||||
}
|
||||
|
||||
/// --------
|
||||
/// Cache management.
|
||||
/// --------
|
||||
|
||||
// Statics do not need synchronization.
|
||||
|
||||
/** Load the cache entry at the given (hashed) location. */
|
||||
static Entry<?> loadFromCache(Entry<?>[] cache, int i) {
|
||||
// non-racing cache.length : constant
|
||||
// racing cache[i & (mask)] : null <=> Entry
|
||||
return cache[i & (cache.length-1)];
|
||||
// invariant: returned value is null or well-constructed (ready to match)
|
||||
}
|
||||
|
||||
/** Look in the cache, at the home location for the given ClassValue. */
|
||||
static <T> Entry<T> probeHomeLocation(Entry<?>[] cache, ClassValue<T> classValue) {
|
||||
return classValue.castEntry(loadFromCache(cache, classValue.hashCodeForCache));
|
||||
}
|
||||
|
||||
/** Given that first probe was a collision, retry at nearby locations. */
|
||||
static <T> Entry<T> probeBackupLocations(Entry<?>[] cache, ClassValue<T> classValue) {
|
||||
if (PROBE_LIMIT <= 0) return null;
|
||||
// Probe the cache carefully, in a range of slots.
|
||||
int mask = (cache.length-1);
|
||||
int home = (classValue.hashCodeForCache & mask);
|
||||
Entry<?> e2 = cache[home]; // victim, if we find the real guy
|
||||
if (e2 == null) {
|
||||
return null; // if nobody is at home, no need to search nearby
|
||||
}
|
||||
// assume !classValue.match(e2), but do not assert, because of races
|
||||
int pos2 = -1;
|
||||
for (int i = home + 1; i < home + PROBE_LIMIT; i++) {
|
||||
Entry<?> e = cache[i & mask];
|
||||
if (e == null) {
|
||||
break; // only search within non-null runs
|
||||
}
|
||||
if (classValue.match(e)) {
|
||||
// relocate colliding entry e2 (from cache[home]) to first empty slot
|
||||
cache[home] = e;
|
||||
if (pos2 >= 0) {
|
||||
cache[i & mask] = Entry.DEAD_ENTRY;
|
||||
} else {
|
||||
pos2 = i;
|
||||
}
|
||||
cache[pos2 & mask] = ((entryDislocation(cache, pos2, e2) < PROBE_LIMIT)
|
||||
? e2 // put e2 here if it fits
|
||||
: Entry.DEAD_ENTRY);
|
||||
return classValue.castEntry(e);
|
||||
}
|
||||
// Remember first empty slot, if any:
|
||||
if (!e.isLive() && pos2 < 0) pos2 = i;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** How far out of place is e? */
|
||||
private static int entryDislocation(Entry<?>[] cache, int pos, Entry<?> e) {
|
||||
ClassValue<?> cv = e.classValueOrNull();
|
||||
if (cv == null) return 0; // entry is not live!
|
||||
int mask = (cache.length-1);
|
||||
return (pos - cv.hashCodeForCache) & mask;
|
||||
}
|
||||
|
||||
/// --------
|
||||
/// Below this line all functions are private, and assume synchronized access.
|
||||
/// --------
|
||||
|
||||
private void sizeCache(int length) {
|
||||
assert((length & (length-1)) == 0); // must be power of 2
|
||||
cacheLoad = 0;
|
||||
cacheLoadLimit = (int) ((double) length * CACHE_LOAD_LIMIT / 100);
|
||||
cacheArray = new Entry<?>[length];
|
||||
}
|
||||
|
||||
/** Make sure the cache load stays below its limit, if possible. */
|
||||
private void checkCacheLoad() {
|
||||
if (cacheLoad >= cacheLoadLimit) {
|
||||
reduceCacheLoad();
|
||||
}
|
||||
}
|
||||
private void reduceCacheLoad() {
|
||||
removeStaleEntries();
|
||||
if (cacheLoad < cacheLoadLimit)
|
||||
return; // win
|
||||
Entry<?>[] oldCache = getCache();
|
||||
if (oldCache.length > HASH_MASK)
|
||||
return; // lose
|
||||
sizeCache(oldCache.length * 2);
|
||||
for (Entry<?> e : oldCache) {
|
||||
if (e != null && e.isLive()) {
|
||||
addToCache(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove stale entries in the given range.
|
||||
* Should be executed under a Map lock.
|
||||
*/
|
||||
private void removeStaleEntries(Entry<?>[] cache, int begin, int count) {
|
||||
if (PROBE_LIMIT <= 0) return;
|
||||
int mask = (cache.length-1);
|
||||
int removed = 0;
|
||||
for (int i = begin; i < begin + count; i++) {
|
||||
Entry<?> e = cache[i & mask];
|
||||
if (e == null || e.isLive())
|
||||
continue; // skip null and live entries
|
||||
Entry<?> replacement = null;
|
||||
if (PROBE_LIMIT > 1) {
|
||||
// avoid breaking up a non-null run
|
||||
replacement = findReplacement(cache, i);
|
||||
}
|
||||
cache[i & mask] = replacement;
|
||||
if (replacement == null) removed += 1;
|
||||
}
|
||||
cacheLoad = Math.max(0, cacheLoad - removed);
|
||||
}
|
||||
|
||||
/** Clearing a cache slot risks disconnecting following entries
|
||||
* from the head of a non-null run, which would allow them
|
||||
* to be found via reprobes. Find an entry after cache[begin]
|
||||
* to plug into the hole, or return null if none is needed.
|
||||
*/
|
||||
private Entry<?> findReplacement(Entry<?>[] cache, int home1) {
|
||||
Entry<?> replacement = null;
|
||||
int haveReplacement = -1, replacementPos = 0;
|
||||
int mask = (cache.length-1);
|
||||
for (int i2 = home1 + 1; i2 < home1 + PROBE_LIMIT; i2++) {
|
||||
Entry<?> e2 = cache[i2 & mask];
|
||||
if (e2 == null) break; // End of non-null run.
|
||||
if (!e2.isLive()) continue; // Doomed anyway.
|
||||
int dis2 = entryDislocation(cache, i2, e2);
|
||||
if (dis2 == 0) continue; // e2 already optimally placed
|
||||
int home2 = i2 - dis2;
|
||||
if (home2 <= home1) {
|
||||
// e2 can replace entry at cache[home1]
|
||||
if (home2 == home1) {
|
||||
// Put e2 exactly where he belongs.
|
||||
haveReplacement = 1;
|
||||
replacementPos = i2;
|
||||
replacement = e2;
|
||||
} else if (haveReplacement <= 0) {
|
||||
haveReplacement = 0;
|
||||
replacementPos = i2;
|
||||
replacement = e2;
|
||||
}
|
||||
// And keep going, so we can favor larger dislocations.
|
||||
}
|
||||
}
|
||||
if (haveReplacement >= 0) {
|
||||
if (cache[(replacementPos+1) & mask] != null) {
|
||||
// Be conservative, to avoid breaking up a non-null run.
|
||||
cache[replacementPos & mask] = (Entry<?>) Entry.DEAD_ENTRY;
|
||||
} else {
|
||||
cache[replacementPos & mask] = null;
|
||||
cacheLoad -= 1;
|
||||
}
|
||||
}
|
||||
return replacement;
|
||||
}
|
||||
|
||||
/** Remove stale entries in the range near classValue. */
|
||||
private void removeStaleEntries(ClassValue<?> classValue) {
|
||||
removeStaleEntries(getCache(), classValue.hashCodeForCache, PROBE_LIMIT);
|
||||
}
|
||||
|
||||
/** Remove all stale entries, everywhere. */
|
||||
private void removeStaleEntries() {
|
||||
Entry[] cache = getCache();
|
||||
removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1);
|
||||
}
|
||||
|
||||
/** Add the given entry to the cache, in its home location, unless it is out of date. */
|
||||
private <T> void addToCache(Entry<T> e) {
|
||||
ClassValue<T> classValue = e.classValueOrNull();
|
||||
if (classValue != null)
|
||||
addToCache(classValue, e);
|
||||
}
|
||||
|
||||
/** Add the given entry to the cache, in its home location. */
|
||||
private <T> void addToCache(ClassValue<T> classValue, Entry<T> e) {
|
||||
if (PROBE_LIMIT <= 0) return; // do not fill cache
|
||||
// Add e to the cache.
|
||||
Entry<?>[] cache = getCache();
|
||||
int mask = (cache.length-1);
|
||||
int home = classValue.hashCodeForCache & mask;
|
||||
Entry<?> e2 = placeInCache(cache, home, e, false);
|
||||
if (e2 == null) return; // done
|
||||
if (PROBE_LIMIT > 1) {
|
||||
// try to move e2 somewhere else in his probe range
|
||||
int dis2 = entryDislocation(cache, home, e2);
|
||||
int home2 = home - dis2;
|
||||
for (int i2 = home2; i2 < home2 + PROBE_LIMIT; i2++) {
|
||||
if (placeInCache(cache, i2 & mask, e2, true) == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Note: At this point, e2 is just dropped from the cache.
|
||||
}
|
||||
|
||||
/** Store the given entry. Update cacheLoad, and return any live victim.
|
||||
* 'Gently' means return self rather than dislocating a live victim.
|
||||
*/
|
||||
private Entry<?> placeInCache(Entry<?>[] cache, int pos, Entry<?> e, boolean gently) {
|
||||
Entry<?> e2 = overwrittenEntry(cache[pos]);
|
||||
if (gently && e2 != null) {
|
||||
// do not overwrite a live entry
|
||||
return e;
|
||||
} else {
|
||||
cache[pos] = e;
|
||||
return e2;
|
||||
}
|
||||
}
|
||||
|
||||
/** Note an entry that is about to be overwritten.
|
||||
* If it is not live, quietly replace it by null.
|
||||
* If it is an actual null, increment cacheLoad,
|
||||
* because the caller is going to store something
|
||||
* in its place.
|
||||
*/
|
||||
private <T> Entry<T> overwrittenEntry(Entry<T> e2) {
|
||||
if (e2 == null) cacheLoad += 1;
|
||||
else if (e2.isLive()) return e2;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Percent loading of cache before resize. */
|
||||
private static final int CACHE_LOAD_LIMIT = 67; // 0..100
|
||||
/** Maximum number of probes to attempt. */
|
||||
private static final int PROBE_LIMIT = 6; // 1..
|
||||
// N.B. Set PROBE_LIMIT=0 to disable all fast paths.
|
||||
}
|
||||
}
|
||||
|
@ -818,8 +818,9 @@ public final class Math {
|
||||
return (a >= b) ? a : b;
|
||||
}
|
||||
|
||||
private static long negativeZeroFloatBits = Float.floatToIntBits(-0.0f);
|
||||
private static long negativeZeroDoubleBits = Double.doubleToLongBits(-0.0d);
|
||||
// Use raw bit-wise conversions on guaranteed non-NaN arguments.
|
||||
private static long negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f);
|
||||
private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);
|
||||
|
||||
/**
|
||||
* Returns the greater of two {@code float} values. That is,
|
||||
@ -836,9 +837,12 @@ public final class Math {
|
||||
* @return the larger of {@code a} and {@code b}.
|
||||
*/
|
||||
public static float max(float a, float b) {
|
||||
if (a != a) return a; // a is NaN
|
||||
if ((a == 0.0f) && (b == 0.0f)
|
||||
&& (Float.floatToIntBits(a) == negativeZeroFloatBits)) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0f) &&
|
||||
(b == 0.0f) &&
|
||||
(Float.floatToRawIntBits(a) == negativeZeroFloatBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a >= b) ? a : b;
|
||||
@ -859,9 +863,12 @@ public final class Math {
|
||||
* @return the larger of {@code a} and {@code b}.
|
||||
*/
|
||||
public static double max(double a, double b) {
|
||||
if (a != a) return a; // a is NaN
|
||||
if ((a == 0.0d) && (b == 0.0d)
|
||||
&& (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0d) &&
|
||||
(b == 0.0d) &&
|
||||
(Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a >= b) ? a : b;
|
||||
@ -910,9 +917,12 @@ public final class Math {
|
||||
* @return the smaller of {@code a} and {@code b}.
|
||||
*/
|
||||
public static float min(float a, float b) {
|
||||
if (a != a) return a; // a is NaN
|
||||
if ((a == 0.0f) && (b == 0.0f)
|
||||
&& (Float.floatToIntBits(b) == negativeZeroFloatBits)) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0f) &&
|
||||
(b == 0.0f) &&
|
||||
(Float.floatToRawIntBits(b) == negativeZeroFloatBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a <= b) ? a : b;
|
||||
@ -933,9 +943,12 @@ public final class Math {
|
||||
* @return the smaller of {@code a} and {@code b}.
|
||||
*/
|
||||
public static double min(double a, double b) {
|
||||
if (a != a) return a; // a is NaN
|
||||
if ((a == 0.0d) && (b == 0.0d)
|
||||
&& (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0d) &&
|
||||
(b == 0.0d) &&
|
||||
(Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a <= b) ? a : b;
|
||||
@ -1900,7 +1913,7 @@ public final class Math {
|
||||
/**
|
||||
* Returns a floating-point power of two in the normal range.
|
||||
*/
|
||||
public static float powerOfTwoF(int n) {
|
||||
static float powerOfTwoF(int n) {
|
||||
assert(n >= FloatConsts.MIN_EXPONENT && n <= FloatConsts.MAX_EXPONENT);
|
||||
return Float.intBitsToFloat(((n + FloatConsts.EXP_BIAS) <<
|
||||
(FloatConsts.SIGNIFICAND_WIDTH-1))
|
||||
|
@ -58,8 +58,7 @@ public class Object {
|
||||
*
|
||||
* @return The {@code Class} object that represents the runtime
|
||||
* class of this object.
|
||||
* @see Class Literals, section 15.8.2 of
|
||||
* <cite>The Java™ Language Specification</cite>.
|
||||
* @jls 15.8.2 Class Literals
|
||||
*/
|
||||
public final native Class<?> getClass();
|
||||
|
||||
@ -92,7 +91,7 @@ public class Object {
|
||||
* objects. (This is typically implemented by converting the internal
|
||||
* address of the object into an integer, but this implementation
|
||||
* technique is not required by the
|
||||
* Java<font size="-2"><sup>TM</sup></font> programming language.)
|
||||
* Java™ programming language.)
|
||||
*
|
||||
* @return a hash code value for this object.
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
@ -203,7 +202,7 @@ public class Object {
|
||||
* exception at run time.
|
||||
*
|
||||
* @return a clone of this instance.
|
||||
* @exception CloneNotSupportedException if the object's class does not
|
||||
* @throws CloneNotSupportedException if the object's class does not
|
||||
* support the {@code Cloneable} interface. Subclasses
|
||||
* that override the {@code clone} method can also
|
||||
* throw this exception to indicate that an instance cannot
|
||||
@ -264,7 +263,7 @@ public class Object {
|
||||
* <p>
|
||||
* Only one thread at a time can own an object's monitor.
|
||||
*
|
||||
* @exception IllegalMonitorStateException if the current thread is not
|
||||
* @throws IllegalMonitorStateException if the current thread is not
|
||||
* the owner of this object's monitor.
|
||||
* @see java.lang.Object#notifyAll()
|
||||
* @see java.lang.Object#wait()
|
||||
@ -288,7 +287,7 @@ public class Object {
|
||||
* description of the ways in which a thread can become the owner of
|
||||
* a monitor.
|
||||
*
|
||||
* @exception IllegalMonitorStateException if the current thread is not
|
||||
* @throws IllegalMonitorStateException if the current thread is not
|
||||
* the owner of this object's monitor.
|
||||
* @see java.lang.Object#notify()
|
||||
* @see java.lang.Object#wait()
|
||||
@ -368,11 +367,11 @@ public class Object {
|
||||
* a monitor.
|
||||
*
|
||||
* @param timeout the maximum time to wait in milliseconds.
|
||||
* @exception IllegalArgumentException if the value of timeout is
|
||||
* @throws IllegalArgumentException if the value of timeout is
|
||||
* negative.
|
||||
* @exception IllegalMonitorStateException if the current thread is not
|
||||
* @throws IllegalMonitorStateException if the current thread is not
|
||||
* the owner of the object's monitor.
|
||||
* @exception InterruptedException if any thread interrupted the
|
||||
* @throws InterruptedException if any thread interrupted the
|
||||
* current thread before or while the current thread
|
||||
* was waiting for a notification. The <i>interrupted
|
||||
* status</i> of the current thread is cleared when
|
||||
@ -433,12 +432,12 @@ public class Object {
|
||||
* @param timeout the maximum time to wait in milliseconds.
|
||||
* @param nanos additional time, in nanoseconds range
|
||||
* 0-999999.
|
||||
* @exception IllegalArgumentException if the value of timeout is
|
||||
* @throws IllegalArgumentException if the value of timeout is
|
||||
* negative or the value of nanos is
|
||||
* not in the range 0-999999.
|
||||
* @exception IllegalMonitorStateException if the current thread is not
|
||||
* @throws IllegalMonitorStateException if the current thread is not
|
||||
* the owner of this object's monitor.
|
||||
* @exception InterruptedException if any thread interrupted the
|
||||
* @throws InterruptedException if any thread interrupted the
|
||||
* current thread before or while the current thread
|
||||
* was waiting for a notification. The <i>interrupted
|
||||
* status</i> of the current thread is cleared when
|
||||
@ -489,9 +488,9 @@ public class Object {
|
||||
* description of the ways in which a thread can become the owner of
|
||||
* a monitor.
|
||||
*
|
||||
* @exception IllegalMonitorStateException if the current thread is not
|
||||
* @throws IllegalMonitorStateException if the current thread is not
|
||||
* the owner of the object's monitor.
|
||||
* @exception InterruptedException if any thread interrupted the
|
||||
* @throws InterruptedException if any thread interrupted the
|
||||
* current thread before or while the current thread
|
||||
* was waiting for a notification. The <i>interrupted
|
||||
* status</i> of the current thread is cleared when
|
||||
@ -510,7 +509,7 @@ public class Object {
|
||||
* system resources or to perform other cleanup.
|
||||
* <p>
|
||||
* The general contract of {@code finalize} is that it is invoked
|
||||
* if and when the Java<font size="-2"><sup>TM</sup></font> virtual
|
||||
* if and when the Java™ virtual
|
||||
* machine has determined that there is no longer any
|
||||
* means by which this object can be accessed by any thread that has
|
||||
* not yet died, except as a result of an action taken by the
|
||||
@ -549,6 +548,9 @@ public class Object {
|
||||
* ignored.
|
||||
*
|
||||
* @throws Throwable the {@code Exception} raised by this method
|
||||
* @see java.lang.ref.WeakReference
|
||||
* @see java.lang.ref.PhantomReference
|
||||
* @jls 12.6 Finalization of Class Instances
|
||||
*/
|
||||
protected void finalize() throws Throwable { }
|
||||
}
|
||||
|
@ -161,6 +161,8 @@ public final class StrictMath {
|
||||
* in radians.
|
||||
*/
|
||||
public static strictfp double toRadians(double angdeg) {
|
||||
// Do not delegate to Math.toRadians(angdeg) because
|
||||
// this method has the strictfp modifier.
|
||||
return angdeg / 180.0 * PI;
|
||||
}
|
||||
|
||||
@ -176,6 +178,8 @@ public final class StrictMath {
|
||||
* in degrees.
|
||||
*/
|
||||
public static strictfp double toDegrees(double angrad) {
|
||||
// Do not delegate to Math.toDegrees(angrad) because
|
||||
// this method has the strictfp modifier.
|
||||
return angrad * 180.0 / PI;
|
||||
}
|
||||
|
||||
@ -708,7 +712,7 @@ public final class StrictMath {
|
||||
* @return the absolute value of the argument.
|
||||
*/
|
||||
public static int abs(int a) {
|
||||
return (a < 0) ? -a : a;
|
||||
return Math.abs(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -725,7 +729,7 @@ public final class StrictMath {
|
||||
* @return the absolute value of the argument.
|
||||
*/
|
||||
public static long abs(long a) {
|
||||
return (a < 0) ? -a : a;
|
||||
return Math.abs(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -744,7 +748,7 @@ public final class StrictMath {
|
||||
* @return the absolute value of the argument.
|
||||
*/
|
||||
public static float abs(float a) {
|
||||
return (a <= 0.0F) ? 0.0F - a : a;
|
||||
return Math.abs(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -763,7 +767,7 @@ public final class StrictMath {
|
||||
* @return the absolute value of the argument.
|
||||
*/
|
||||
public static double abs(double a) {
|
||||
return (a <= 0.0D) ? 0.0D - a : a;
|
||||
return Math.abs(a);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -777,7 +781,7 @@ public final class StrictMath {
|
||||
* @return the larger of {@code a} and {@code b}.
|
||||
*/
|
||||
public static int max(int a, int b) {
|
||||
return (a >= b) ? a : b;
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -791,13 +795,9 @@ public final class StrictMath {
|
||||
* @return the larger of {@code a} and {@code b}.
|
||||
*/
|
||||
public static long max(long a, long b) {
|
||||
return (a >= b) ? a : b;
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
// Use raw bit-wise conversions on guaranteed non-NaN arguments.
|
||||
private static long negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f);
|
||||
private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);
|
||||
|
||||
/**
|
||||
* Returns the greater of two {@code float} values. That is,
|
||||
* the result is the argument closer to positive infinity. If the
|
||||
@ -813,15 +813,7 @@ public final class StrictMath {
|
||||
* @return the larger of {@code a} and {@code b}.
|
||||
*/
|
||||
public static float max(float a, float b) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0f) &&
|
||||
(b == 0.0f) &&
|
||||
(Float.floatToRawIntBits(a) == negativeZeroFloatBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a >= b) ? a : b;
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -839,15 +831,7 @@ public final class StrictMath {
|
||||
* @return the larger of {@code a} and {@code b}.
|
||||
*/
|
||||
public static double max(double a, double b) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0d) &&
|
||||
(b == 0.0d) &&
|
||||
(Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a >= b) ? a : b;
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -861,7 +845,7 @@ public final class StrictMath {
|
||||
* @return the smaller of {@code a} and {@code b}.
|
||||
*/
|
||||
public static int min(int a, int b) {
|
||||
return (a <= b) ? a : b;
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -875,7 +859,7 @@ public final class StrictMath {
|
||||
* @return the smaller of {@code a} and {@code b}.
|
||||
*/
|
||||
public static long min(long a, long b) {
|
||||
return (a <= b) ? a : b;
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -893,15 +877,7 @@ public final class StrictMath {
|
||||
* @return the smaller of {@code a} and {@code b.}
|
||||
*/
|
||||
public static float min(float a, float b) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0f) &&
|
||||
(b == 0.0f) &&
|
||||
(Float.floatToRawIntBits(b) == negativeZeroFloatBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a <= b) ? a : b;
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -919,15 +895,7 @@ public final class StrictMath {
|
||||
* @return the smaller of {@code a} and {@code b}.
|
||||
*/
|
||||
public static double min(double a, double b) {
|
||||
if (a != a)
|
||||
return a; // a is NaN
|
||||
if ((a == 0.0d) &&
|
||||
(b == 0.0d) &&
|
||||
(Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) {
|
||||
// Raw conversion ok since NaN can't map to -0.0.
|
||||
return b;
|
||||
}
|
||||
return (a <= b) ? a : b;
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -625,7 +625,7 @@ public class Throwable implements Serializable {
|
||||
* at Resource2.close(Resource2.java:20)
|
||||
* at Foo4.main(Foo4.java:5)
|
||||
* Caused by: java.lang.Exception: Rats, you caught me
|
||||
* at Resource2$CloseFailException.<init>(Resource2.java:45)
|
||||
* at Resource2$CloseFailException.<init>(Resource2.java:45)
|
||||
* ... 2 more
|
||||
* </pre>
|
||||
*/
|
||||
|
@ -378,6 +378,7 @@ class AdapterMethodHandle extends BoundMethodHandle {
|
||||
}
|
||||
|
||||
/** Construct an adapter conversion descriptor for a single-argument conversion. */
|
||||
@SuppressWarnings("cast") // some (int) casts below provide clarity but trigger warnings
|
||||
private static long makeConv(int convOp, int argnum, int src, int dest) {
|
||||
assert(src == (src & CONV_TYPE_MASK));
|
||||
assert(dest == (dest & CONV_TYPE_MASK));
|
||||
@ -390,6 +391,7 @@ class AdapterMethodHandle extends BoundMethodHandle {
|
||||
insertStackMove(stackMove)
|
||||
);
|
||||
}
|
||||
@SuppressWarnings("cast") // some (int) casts below provide clarity but trigger warnings
|
||||
private static long makeDupConv(int convOp, int argnum, int stackMove) {
|
||||
// simple argument motion, requiring one slot to specify
|
||||
assert(convOp == OP_DUP_ARGS || convOp == OP_DROP_ARGS);
|
||||
@ -401,6 +403,7 @@ class AdapterMethodHandle extends BoundMethodHandle {
|
||||
insertStackMove(stackMove)
|
||||
);
|
||||
}
|
||||
@SuppressWarnings("cast") // some (int) casts below provide clarity but trigger warnings
|
||||
private static long makeSwapConv(int convOp, int srcArg, byte srcType, int destSlot, byte destType) {
|
||||
// more complex argument motion, requiring two slots to specify
|
||||
assert(convOp == OP_SWAP_ARGS || convOp == OP_ROT_ARGS);
|
||||
@ -411,6 +414,7 @@ class AdapterMethodHandle extends BoundMethodHandle {
|
||||
(int) destSlot << CONV_VMINFO_SHIFT
|
||||
);
|
||||
}
|
||||
@SuppressWarnings("cast") // some (int) casts below provide clarity but trigger warnings
|
||||
private static long makeSpreadConv(int convOp, int argnum, int src, int dest, int stackMove) {
|
||||
// spreading or collecting, at a particular slot location
|
||||
assert(convOp == OP_SPREAD_ARGS || convOp == OP_COLLECT_ARGS || convOp == OP_FOLD_ARGS);
|
||||
|
@ -353,7 +353,7 @@ import static java.lang.invoke.MethodHandleStatics.*;
|
||||
assert(isResolved());
|
||||
}
|
||||
/** Create a name for the given reflected constructor. The resulting name will be in a resolved state. */
|
||||
public MemberName(Constructor ctor) {
|
||||
public MemberName(Constructor<?> ctor) {
|
||||
Object[] typeInfo = { void.class, ctor.getParameterTypes() };
|
||||
init(ctor.getDeclaringClass(), CONSTRUCTOR_NAME, typeInfo, flagsMods(IS_CONSTRUCTOR, ctor.getModifiers()));
|
||||
// fill in vmtarget, vmindex while we have ctor in hand:
|
||||
|
@ -275,7 +275,7 @@ mh.invokeExact(System.out, "Hello, world.");
|
||||
* generates a single invokevirtual instruction with
|
||||
* the symbolic type descriptor indicated in the following comment.
|
||||
* In these examples, the helper method {@code assertEquals} is assumed to
|
||||
* be a method which calls {@link Objects.equals java.util.Objects#equals}
|
||||
* be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals }
|
||||
* on its arguments, and asserts that the result is true.
|
||||
*
|
||||
* <h3>Exceptions</h3>
|
||||
|
@ -112,7 +112,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
assert(cookedConstructor.type().equals(ctype));
|
||||
ctype = ctype.dropParameterTypes(0, 1);
|
||||
cookedConstructor = AdapterMethodHandle.makeCollectArguments(cookedConstructor, returner, 0, true);
|
||||
MethodHandle allocator = new AllocateObject(allocateClass);
|
||||
AllocateObject allocator = new AllocateObject(allocateClass);
|
||||
// allocate() => new C(void)
|
||||
assert(allocator.type().equals(MethodType.methodType(allocateClass)));
|
||||
ctype = ctype.dropParameterTypes(0, 1);
|
||||
@ -120,19 +120,19 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
return fold;
|
||||
}
|
||||
|
||||
static final class AllocateObject<C> extends BoundMethodHandle {
|
||||
static final class AllocateObject /*<C>*/ extends BoundMethodHandle {
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
|
||||
private final Class<C> allocateClass;
|
||||
private final Class<?> /*<C>*/ allocateClass;
|
||||
|
||||
// for allocation only:
|
||||
private AllocateObject(Class<C> allocateClass) {
|
||||
private AllocateObject(Class<?> /*<C>*/ allocateClass) {
|
||||
super(ALLOCATE.asType(MethodType.methodType(allocateClass, AllocateObject.class)));
|
||||
this.allocateClass = allocateClass;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
private C allocate() throws InstantiationException {
|
||||
return (C) unsafe.allocateInstance(allocateClass);
|
||||
private Object /*C*/ allocate() throws InstantiationException {
|
||||
return unsafe.allocateInstance(allocateClass);
|
||||
}
|
||||
static final MethodHandle ALLOCATE;
|
||||
static {
|
||||
@ -148,8 +148,8 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
MethodHandle accessField(MemberName member, boolean isSetter,
|
||||
Class<?> lookupClass) {
|
||||
// Use sun. misc.Unsafe to dig up the dirt on the field.
|
||||
MethodHandle mh = new FieldAccessor(member, isSetter);
|
||||
return mh;
|
||||
FieldAccessor accessor = new FieldAccessor(member, isSetter);
|
||||
return accessor;
|
||||
}
|
||||
|
||||
static
|
||||
@ -175,7 +175,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
return mhs[isSetter ? 1 : 0];
|
||||
}
|
||||
|
||||
static final class FieldAccessor<C,V> extends BoundMethodHandle {
|
||||
static final class FieldAccessor /*<C,V>*/ extends BoundMethodHandle {
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
final Object base; // for static refs only
|
||||
final long offset;
|
||||
@ -190,26 +190,24 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
@Override
|
||||
String debugString() { return addTypeString(name, this); }
|
||||
|
||||
int getFieldI(C obj) { return unsafe.getInt(obj, offset); }
|
||||
void setFieldI(C obj, int x) { unsafe.putInt(obj, offset, x); }
|
||||
long getFieldJ(C obj) { return unsafe.getLong(obj, offset); }
|
||||
void setFieldJ(C obj, long x) { unsafe.putLong(obj, offset, x); }
|
||||
float getFieldF(C obj) { return unsafe.getFloat(obj, offset); }
|
||||
void setFieldF(C obj, float x) { unsafe.putFloat(obj, offset, x); }
|
||||
double getFieldD(C obj) { return unsafe.getDouble(obj, offset); }
|
||||
void setFieldD(C obj, double x) { unsafe.putDouble(obj, offset, x); }
|
||||
boolean getFieldZ(C obj) { return unsafe.getBoolean(obj, offset); }
|
||||
void setFieldZ(C obj, boolean x) { unsafe.putBoolean(obj, offset, x); }
|
||||
byte getFieldB(C obj) { return unsafe.getByte(obj, offset); }
|
||||
void setFieldB(C obj, byte x) { unsafe.putByte(obj, offset, x); }
|
||||
short getFieldS(C obj) { return unsafe.getShort(obj, offset); }
|
||||
void setFieldS(C obj, short x) { unsafe.putShort(obj, offset, x); }
|
||||
char getFieldC(C obj) { return unsafe.getChar(obj, offset); }
|
||||
void setFieldC(C obj, char x) { unsafe.putChar(obj, offset, x); }
|
||||
@SuppressWarnings("unchecked")
|
||||
V getFieldL(C obj) { return (V) unsafe.getObject(obj, offset); }
|
||||
@SuppressWarnings("unchecked")
|
||||
void setFieldL(C obj, V x) { unsafe.putObject(obj, offset, x); }
|
||||
int getFieldI(Object /*C*/ obj) { return unsafe.getInt(obj, offset); }
|
||||
void setFieldI(Object /*C*/ obj, int x) { unsafe.putInt(obj, offset, x); }
|
||||
long getFieldJ(Object /*C*/ obj) { return unsafe.getLong(obj, offset); }
|
||||
void setFieldJ(Object /*C*/ obj, long x) { unsafe.putLong(obj, offset, x); }
|
||||
float getFieldF(Object /*C*/ obj) { return unsafe.getFloat(obj, offset); }
|
||||
void setFieldF(Object /*C*/ obj, float x) { unsafe.putFloat(obj, offset, x); }
|
||||
double getFieldD(Object /*C*/ obj) { return unsafe.getDouble(obj, offset); }
|
||||
void setFieldD(Object /*C*/ obj, double x) { unsafe.putDouble(obj, offset, x); }
|
||||
boolean getFieldZ(Object /*C*/ obj) { return unsafe.getBoolean(obj, offset); }
|
||||
void setFieldZ(Object /*C*/ obj, boolean x) { unsafe.putBoolean(obj, offset, x); }
|
||||
byte getFieldB(Object /*C*/ obj) { return unsafe.getByte(obj, offset); }
|
||||
void setFieldB(Object /*C*/ obj, byte x) { unsafe.putByte(obj, offset, x); }
|
||||
short getFieldS(Object /*C*/ obj) { return unsafe.getShort(obj, offset); }
|
||||
void setFieldS(Object /*C*/ obj, short x) { unsafe.putShort(obj, offset, x); }
|
||||
char getFieldC(Object /*C*/ obj) { return unsafe.getChar(obj, offset); }
|
||||
void setFieldC(Object /*C*/ obj, char x) { unsafe.putChar(obj, offset, x); }
|
||||
Object /*V*/ getFieldL(Object /*C*/ obj) { return unsafe.getObject(obj, offset); }
|
||||
void setFieldL(Object /*C*/ obj, Object /*V*/ x) { unsafe.putObject(obj, offset, x); }
|
||||
// cast (V) is OK here, since we wrap convertArguments around the MH.
|
||||
|
||||
static Object staticBase(final MemberName field) {
|
||||
@ -244,8 +242,9 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
void setStaticS(short x) { unsafe.putShort(base, offset, x); }
|
||||
char getStaticC() { return unsafe.getChar(base, offset); }
|
||||
void setStaticC(char x) { unsafe.putChar(base, offset, x); }
|
||||
V getStaticL() { return (V) unsafe.getObject(base, offset); }
|
||||
void setStaticL(V x) { unsafe.putObject(base, offset, x); }
|
||||
@SuppressWarnings("unchecked") // (V) is for internal clarity but triggers warning
|
||||
Object /*V*/ getStaticL() { return unsafe.getObject(base, offset); }
|
||||
void setStaticL(Object /*V*/ x) { unsafe.putObject(base, offset, x); }
|
||||
|
||||
static String fname(Class<?> vclass, boolean isSetter, boolean isStatic) {
|
||||
String stem;
|
||||
|
@ -150,7 +150,7 @@ public class MethodHandleProxies {
|
||||
}
|
||||
return intfc.cast(Proxy.newProxyInstance(
|
||||
intfc.getClassLoader(),
|
||||
new Class[]{ intfc, WrapperInstance.class },
|
||||
new Class<?>[]{ intfc, WrapperInstance.class },
|
||||
new InvocationHandler() {
|
||||
private Object getArg(String name) {
|
||||
if ((Object)name == "getWrapperInstanceTarget") return target;
|
||||
|
@ -948,10 +948,11 @@ return mh1;
|
||||
public MethodHandle unreflect(Method m) throws IllegalAccessException {
|
||||
MemberName method = new MemberName(m);
|
||||
assert(method.isMethod());
|
||||
if (!m.isAccessible()) checkMethod(method.getDeclaringClass(), method, method.isStatic());
|
||||
if (m.isAccessible())
|
||||
return MethodHandleImpl.findMethod(method, true, /*no lookupClass*/ null);
|
||||
checkMethod(method.getDeclaringClass(), method, method.isStatic());
|
||||
MethodHandle mh = MethodHandleImpl.findMethod(method, true, lookupClassOrNull());
|
||||
if (!m.isAccessible()) mh = restrictProtectedReceiver(method, mh);
|
||||
return mh;
|
||||
return restrictProtectedReceiver(method, mh);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1006,11 +1007,17 @@ return mh1;
|
||||
* is set and {@code asVarargsCollector} fails
|
||||
* @throws NullPointerException if the argument is null
|
||||
*/
|
||||
@SuppressWarnings("rawtypes") // Will be Constructor<?> after JSR 292 MR
|
||||
public MethodHandle unreflectConstructor(Constructor c) throws IllegalAccessException {
|
||||
MemberName ctor = new MemberName(c);
|
||||
assert(ctor.isConstructor());
|
||||
if (!c.isAccessible()) checkAccess(c.getDeclaringClass(), ctor);
|
||||
MethodHandle rawCtor = MethodHandleImpl.findMethod(ctor, false, lookupClassOrNull());
|
||||
MethodHandle rawCtor;
|
||||
if (c.isAccessible()) {
|
||||
rawCtor = MethodHandleImpl.findMethod(ctor, false, /*no lookupClass*/ null);
|
||||
} else {
|
||||
checkAccess(c.getDeclaringClass(), ctor);
|
||||
rawCtor = MethodHandleImpl.findMethod(ctor, false, lookupClassOrNull());
|
||||
}
|
||||
MethodHandle allocator = MethodHandleImpl.makeAllocator(rawCtor);
|
||||
return fixVarargs(allocator, rawCtor);
|
||||
}
|
||||
@ -1225,7 +1232,7 @@ return mh1;
|
||||
? "expected a static field"
|
||||
: "expected a non-static field", this);
|
||||
if (trusted)
|
||||
return MethodHandleImpl.accessField(field, isSetter, lookupClassOrNull());
|
||||
return MethodHandleImpl.accessField(field, isSetter, /*no lookupClass*/ null);
|
||||
checkAccess(refc, field);
|
||||
MethodHandle mh = MethodHandleImpl.accessField(field, isSetter, lookupClassOrNull());
|
||||
return restrictProtectedReceiver(field, mh);
|
||||
|
@ -92,7 +92,7 @@ class FileTreeWalker {
|
||||
(System.getSecurityManager() == null))
|
||||
{
|
||||
BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
|
||||
if (!followLinks || !cached.isSymbolicLink())
|
||||
if (cached != null && (!followLinks || !cached.isSymbolicLink()))
|
||||
attrs = cached;
|
||||
}
|
||||
IOException exc = null;
|
||||
|
@ -1431,7 +1431,7 @@ public final class Files {
|
||||
* <li>It is <i>transitive</i>: for three {@code Paths}
|
||||
* {@code f}, {@code g}, and {@code h}, if {@code isSameFile(f,g)} returns
|
||||
* {@code true} and {@code isSameFile(g,h)} returns {@code true}, then
|
||||
* {@code isSameFile(g,h)} will return return {@code true}.
|
||||
* {@code isSameFile(f,h)} will return return {@code true}.
|
||||
* </ul>
|
||||
*
|
||||
* @param path
|
||||
|
@ -72,7 +72,7 @@ import java.util.Iterator;
|
||||
* directory and is UTF-8 encoded.
|
||||
* <pre>
|
||||
* Path path = FileSystems.getDefault().getPath("logs", "access.log");
|
||||
* BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
|
||||
* BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
|
||||
* </pre>
|
||||
*
|
||||
* <a name="interop"><h4>Interoperability</h4></a>
|
||||
|
@ -1932,6 +1932,7 @@ public class BasicTreeUI extends TreeUI
|
||||
else {
|
||||
Rectangle beginRect = getPathBounds(tree, getPathForRow
|
||||
(tree, beginRow));
|
||||
if (beginRect != null) {
|
||||
Rectangle visRect = tree.getVisibleRect();
|
||||
Rectangle testRect = beginRect;
|
||||
int beginY = beginRect.y;
|
||||
@ -1949,6 +1950,7 @@ public class BasicTreeUI extends TreeUI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the preferred minimum size.
|
||||
*/
|
||||
@ -3485,7 +3487,7 @@ public class BasicTreeUI extends TreeUI
|
||||
}
|
||||
|
||||
Rectangle bounds = getPathBounds(tree, path);
|
||||
if (y > (bounds.y + bounds.height)) {
|
||||
if (bounds == null || y > (bounds.y + bounds.height)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,9 @@ public class ValueConversions {
|
||||
private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();
|
||||
|
||||
private static EnumMap<Wrapper, MethodHandle>[] newWrapperCaches(int n) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("unchecked") // generic array creation
|
||||
EnumMap<Wrapper, MethodHandle>[] caches
|
||||
= (EnumMap<Wrapper, MethodHandle>[]) new EnumMap[n]; // unchecked warning expected here
|
||||
= (EnumMap<Wrapper, MethodHandle>[]) new EnumMap<?,?>[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
caches[i] = new EnumMap<>(Wrapper.class);
|
||||
return caches;
|
||||
@ -1097,7 +1097,7 @@ public class ValueConversions {
|
||||
}
|
||||
|
||||
private static MethodHandle buildNewArray(int nargs) {
|
||||
return MethodHandles.insertArguments(NEW_ARRAY, 0, (int) nargs);
|
||||
return MethodHandles.insertArguments(NEW_ARRAY, 0, nargs);
|
||||
}
|
||||
|
||||
private static final MethodHandle[] FILLERS = new MethodHandle[MAX_ARITY+1];
|
||||
@ -1122,7 +1122,7 @@ public class ValueConversions {
|
||||
}
|
||||
MethodHandle leftFill = filler(leftLen); // recursive fill
|
||||
MethodHandle rightFill = FILL_ARRAYS[rightLen];
|
||||
rightFill = MethodHandles.insertArguments(rightFill, 1, (int) leftLen); // [leftLen..nargs-1]
|
||||
rightFill = MethodHandles.insertArguments(rightFill, 1, leftLen); // [leftLen..nargs-1]
|
||||
|
||||
// Combine the two fills: right(left(newArray(nargs), x1..x20), x21..x23)
|
||||
MethodHandle mh = filler(0); // identity function produces result
|
||||
|
@ -31,7 +31,7 @@ public enum Wrapper {
|
||||
BYTE(Byte.class, byte.class, 'B', (Byte)(byte)0, new byte[0], Format.signed(8)),
|
||||
SHORT(Short.class, short.class, 'S', (Short)(short)0, new short[0], Format.signed(16)),
|
||||
CHAR(Character.class, char.class, 'C', (Character)(char)0, new char[0], Format.unsigned(16)),
|
||||
INT(Integer.class, int.class, 'I', (Integer)(int)0, new int[0], Format.signed(32)),
|
||||
INT(Integer.class, int.class, 'I', (Integer)/*(int)*/0, new int[0], Format.signed(32)),
|
||||
LONG(Long.class, long.class, 'J', (Long)(long)0, new long[0], Format.signed(64)),
|
||||
FLOAT(Float.class, float.class, 'F', (Float)(float)0, new float[0], Format.floating(32)),
|
||||
DOUBLE(Double.class, double.class, 'D', (Double)(double)0, new double[0], Format.floating(64)),
|
||||
@ -539,7 +539,7 @@ public enum Wrapper {
|
||||
switch (basicTypeChar) {
|
||||
case 'L': throw newIllegalArgumentException("cannot wrap to object type");
|
||||
case 'V': return null;
|
||||
case 'I': return Integer.valueOf((int)x);
|
||||
case 'I': return Integer.valueOf(x);
|
||||
case 'J': return Long.valueOf(x);
|
||||
case 'F': return Float.valueOf(x);
|
||||
case 'D': return Double.valueOf(x);
|
||||
|
@ -216,11 +216,8 @@ public class Agent {
|
||||
adaptorClass.getMethod("initialize",
|
||||
String.class, Properties.class);
|
||||
initializeMethod.invoke(null,snmpPort,props);
|
||||
} catch (ClassNotFoundException x) {
|
||||
// The SNMP packages are not present: throws an exception.
|
||||
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
|
||||
} catch (NoSuchMethodException x) {
|
||||
// should not happen...
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException x) {
|
||||
// snmp runtime doesn't exist - initialization fails
|
||||
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
|
||||
} catch (InvocationTargetException x) {
|
||||
final Throwable cause = x.getCause();
|
||||
@ -230,9 +227,6 @@ public class Agent {
|
||||
throw (Error) cause;
|
||||
// should not happen...
|
||||
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,cause);
|
||||
} catch (IllegalAccessException x) {
|
||||
// should not happen...
|
||||
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT,x);
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,7 +303,7 @@ public class Agent {
|
||||
// invoke the premain(String args) method
|
||||
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(cname);
|
||||
Method premain = clz.getMethod("premain",
|
||||
new Class[] { String.class });
|
||||
new Class<?>[] { String.class });
|
||||
premain.invoke(null, /* static */
|
||||
new Object[] { args });
|
||||
} catch (ClassNotFoundException ex) {
|
||||
|
@ -117,11 +117,11 @@ public class ConnectorAddressLink {
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException(iae.getMessage());
|
||||
}
|
||||
List counters =
|
||||
List<Counter> counters =
|
||||
new PerfInstrumentation(bb).findByPattern(CONNECTOR_ADDRESS_COUNTER);
|
||||
Iterator i = counters.iterator();
|
||||
Iterator<Counter> i = counters.iterator();
|
||||
if (i.hasNext()) {
|
||||
Counter c = (Counter) i.next();
|
||||
Counter c = i.next();
|
||||
return (String) c.getValue();
|
||||
} else {
|
||||
return null;
|
||||
@ -167,13 +167,13 @@ public class ConnectorAddressLink {
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException(iae.getMessage());
|
||||
}
|
||||
List counters = new PerfInstrumentation(bb).getAllCounters();
|
||||
Map<String, String> properties = new HashMap<String, String>();
|
||||
for (Object c : counters) {
|
||||
String name = ((Counter) c).getName();
|
||||
List<Counter> counters = new PerfInstrumentation(bb).getAllCounters();
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
for (Counter c : counters) {
|
||||
String name = c.getName();
|
||||
if (name.startsWith(REMOTE_CONNECTOR_COUNTER_PREFIX) &&
|
||||
!name.equals(CONNECTOR_ADDRESS_COUNTER)) {
|
||||
properties.put(name, ((Counter) c).getValue().toString());
|
||||
properties.put(name, c.getValue().toString());
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
|
@ -91,7 +91,7 @@ class Flag {
|
||||
Flag[] flags = new Flag[numFlags];
|
||||
int count = getFlags(names, flags, numFlags);
|
||||
|
||||
List<Flag> result = new ArrayList<Flag>();
|
||||
List<Flag> result = new ArrayList<>();
|
||||
for (Flag f : flags) {
|
||||
if (f != null) {
|
||||
result.add(f);
|
||||
|
@ -69,11 +69,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
|
||||
Field f = cl.getDeclaredField("builder");
|
||||
f.setAccessible(true);
|
||||
return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo());
|
||||
} catch(ClassNotFoundException e) {
|
||||
return null;
|
||||
} catch(NoSuchFieldException e) {
|
||||
return null;
|
||||
} catch(IllegalAccessException e) {
|
||||
} catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -82,7 +78,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
|
||||
synchronized(compositeTypeByBuilder) {
|
||||
gict = compositeTypeByBuilder.get(builder);
|
||||
if(gict == null) {
|
||||
OpenType[] gcNotifInfoItemTypes = new OpenType[] {
|
||||
OpenType<?>[] gcNotifInfoItemTypes = new OpenType<?>[] {
|
||||
SimpleType.STRING,
|
||||
SimpleType.STRING,
|
||||
SimpleType.STRING,
|
||||
@ -141,7 +137,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
|
||||
GC_INFO
|
||||
};
|
||||
private static HashMap<GcInfoBuilder,CompositeType> compositeTypeByBuilder =
|
||||
new HashMap<GcInfoBuilder,CompositeType>();
|
||||
new HashMap<>();
|
||||
|
||||
public static String getGcName(CompositeData cd) {
|
||||
String gcname = getString(cd, GC_NAME);
|
||||
@ -195,7 +191,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData {
|
||||
private static synchronized CompositeType getBaseGcNotifInfoCompositeType() {
|
||||
if (baseGcNotifInfoCompositeType == null) {
|
||||
try {
|
||||
OpenType[] baseGcNotifInfoItemTypes = new OpenType[] {
|
||||
OpenType<?>[] baseGcNotifInfoItemTypes = new OpenType<?>[] {
|
||||
SimpleType.STRING,
|
||||
SimpleType.STRING,
|
||||
SimpleType.STRING,
|
||||
|
@ -70,14 +70,11 @@ class GarbageCollectorImpl extends MemoryManagerImpl
|
||||
private String[] poolNames = null;
|
||||
synchronized String[] getAllPoolNames() {
|
||||
if (poolNames == null) {
|
||||
List pools = ManagementFactory.getMemoryPoolMXBeans();
|
||||
List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
|
||||
poolNames = new String[pools.size()];
|
||||
int i = 0;
|
||||
for (ListIterator iter = pools.listIterator();
|
||||
iter.hasNext();
|
||||
i++) {
|
||||
MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
|
||||
poolNames[i] = p.getName();
|
||||
for (MemoryPoolMXBean m : pools) {
|
||||
poolNames[i++] = m.getName();
|
||||
}
|
||||
}
|
||||
return poolNames;
|
||||
|
@ -104,7 +104,7 @@ public class GcInfoBuilder {
|
||||
int itemCount = numGcInfoItems + gcExtItemCount;
|
||||
allItemNames = new String[itemCount];
|
||||
String[] allItemDescs = new String[itemCount];
|
||||
OpenType[] allItemTypes = new OpenType[itemCount];
|
||||
OpenType<?>[] allItemTypes = new OpenType<?>[itemCount];
|
||||
|
||||
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
|
||||
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
|
||||
|
@ -76,11 +76,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
|
||||
Field f = cl.getDeclaredField("builder");
|
||||
f.setAccessible(true);
|
||||
return (GcInfoBuilder)f.get(info);
|
||||
} catch(ClassNotFoundException e) {
|
||||
return null;
|
||||
} catch(NoSuchFieldException e) {
|
||||
return null;
|
||||
} catch(IllegalAccessException e) {
|
||||
} catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -92,11 +88,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
|
||||
Field f = cl.getDeclaredField("extAttributes");
|
||||
f.setAccessible(true);
|
||||
return (Object[])f.get(info);
|
||||
} catch(ClassNotFoundException e) {
|
||||
return null;
|
||||
} catch(NoSuchFieldException e) {
|
||||
return null;
|
||||
} catch(IllegalAccessException e) {
|
||||
} catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -180,10 +172,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
|
||||
Method m = GcInfo.class.getMethod("getMemoryUsageBeforeGc");
|
||||
memoryUsageMapType =
|
||||
MappedMXBeanType.getMappedType(m.getGenericReturnType());
|
||||
} catch (NoSuchMethodException e) {
|
||||
// Should never reach here
|
||||
throw new AssertionError(e);
|
||||
} catch (OpenDataException e) {
|
||||
} catch (NoSuchMethodException | OpenDataException e) {
|
||||
// Should never reach here
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
@ -197,7 +186,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
|
||||
static synchronized OpenType[] getBaseGcInfoItemTypes() {
|
||||
if (baseGcInfoItemTypes == null) {
|
||||
OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
|
||||
baseGcInfoItemTypes = new OpenType[] {
|
||||
baseGcInfoItemTypes = new OpenType<?>[] {
|
||||
SimpleType.LONG,
|
||||
SimpleType.LONG,
|
||||
SimpleType.LONG,
|
||||
@ -225,10 +214,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
|
||||
try {
|
||||
TabularData td = (TabularData) cd.get(MEMORY_USAGE_BEFORE_GC);
|
||||
return cast(memoryUsageMapType.toJavaTypeData(td));
|
||||
} catch (InvalidObjectException e) {
|
||||
// Should never reach here
|
||||
throw new AssertionError(e);
|
||||
} catch (OpenDataException e) {
|
||||
} catch (InvalidObjectException | OpenDataException e) {
|
||||
// Should never reach here
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
@ -244,10 +230,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
|
||||
TabularData td = (TabularData) cd.get(MEMORY_USAGE_AFTER_GC);
|
||||
//return (Map<String,MemoryUsage>)
|
||||
return cast(memoryUsageMapType.toJavaTypeData(td));
|
||||
} catch (InvalidObjectException e) {
|
||||
// Should never reach here
|
||||
throw new AssertionError(e);
|
||||
} catch (OpenDataException e) {
|
||||
} catch (InvalidObjectException | OpenDataException e) {
|
||||
// Should never reach here
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class HotSpotDiagnostic implements HotSpotDiagnosticMXBean {
|
||||
|
||||
public List<VMOption> getDiagnosticOptions() {
|
||||
List<Flag> allFlags = Flag.getAllFlags();
|
||||
List<VMOption> result = new ArrayList<VMOption>();
|
||||
List<VMOption> result = new ArrayList<>();
|
||||
for (Flag flag : allFlags) {
|
||||
if (flag.isWriteable() && flag.isExternal()) {
|
||||
result.add(flag.getVMOption());
|
||||
|
@ -120,13 +120,13 @@ class HotspotCompilation
|
||||
// current implementation. We first look up in the SUN_CI namespace
|
||||
// since most counters are in SUN_CI namespace.
|
||||
|
||||
if ((c = (Counter) counters.get(SUN_CI + name)) != null) {
|
||||
if ((c = counters.get(SUN_CI + name)) != null) {
|
||||
return c;
|
||||
}
|
||||
if ((c = (Counter) counters.get(COM_SUN_CI + name)) != null) {
|
||||
if ((c = counters.get(COM_SUN_CI + name)) != null) {
|
||||
return c;
|
||||
}
|
||||
if ((c = (Counter) counters.get(JAVA_CI + name)) != null) {
|
||||
if ((c = counters.get(JAVA_CI + name)) != null) {
|
||||
return c;
|
||||
}
|
||||
|
||||
@ -136,10 +136,8 @@ class HotspotCompilation
|
||||
|
||||
private void initCompilerCounters() {
|
||||
// Build a tree map of the current list of performance counters
|
||||
ListIterator iter = getInternalCompilerCounters().listIterator();
|
||||
counters = new TreeMap<String, Counter>();
|
||||
while (iter.hasNext()) {
|
||||
Counter c = (Counter) iter.next();
|
||||
counters = new TreeMap<>();
|
||||
for (Counter c: getInternalCompilerCounters()) {
|
||||
counters.put(c.getName(), c);
|
||||
}
|
||||
|
||||
@ -200,7 +198,7 @@ class HotspotCompilation
|
||||
}
|
||||
|
||||
public java.util.List<CompilerThreadStat> getCompilerThreadStats() {
|
||||
List<CompilerThreadStat> list = new ArrayList<CompilerThreadStat>(threads.length);
|
||||
List<CompilerThreadStat> list = new ArrayList<>(threads.length);
|
||||
int i = 0;
|
||||
if (threads[0] == null) {
|
||||
// no adaptor thread
|
||||
|
@ -58,7 +58,7 @@ class HotspotThread
|
||||
String[] names = new String[count];
|
||||
long[] times = new long[count];
|
||||
int numThreads = getInternalThreadTimes0(names, times);
|
||||
Map<String, Long> result = new HashMap<String, Long>(numThreads);
|
||||
Map<String, Long> result = new HashMap<>(numThreads);
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
result.put(names[i], new Long(times[i]));
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public abstract class LazyCompositeData
|
||||
return compositeData().toString();
|
||||
}
|
||||
|
||||
public Collection values() {
|
||||
public Collection<?> values() {
|
||||
return compositeData().values();
|
||||
}
|
||||
|
||||
@ -153,16 +153,15 @@ public abstract class LazyCompositeData
|
||||
|
||||
// We can't use CompositeType.isValue() since it returns false
|
||||
// if the type name doesn't match.
|
||||
Set allItems = type1.keySet();
|
||||
Set<String> allItems = type1.keySet();
|
||||
|
||||
// Check all items in the type1 exist in type2
|
||||
if (!type2.keySet().containsAll(allItems))
|
||||
return false;
|
||||
|
||||
for (Iterator iter = allItems.iterator(); iter.hasNext(); ) {
|
||||
String item = (String) iter.next();
|
||||
OpenType ot1 = type1.getType(item);
|
||||
OpenType ot2 = type2.getType(item);
|
||||
for (String item: allItems) {
|
||||
OpenType<?> ot1 = type1.getType(item);
|
||||
OpenType<?> ot2 = type2.getType(item);
|
||||
if (ot1 instanceof CompositeType) {
|
||||
if (! (ot2 instanceof CompositeType))
|
||||
return false;
|
||||
@ -183,8 +182,8 @@ public abstract class LazyCompositeData
|
||||
protected static boolean isTypeMatched(TabularType type1, TabularType type2) {
|
||||
if (type1 == type2) return true;
|
||||
|
||||
List list1 = type1.getIndexNames();
|
||||
List list2 = type2.getIndexNames();
|
||||
List<String> list1 = type1.getIndexNames();
|
||||
List<String> list2 = type2.getIndexNames();
|
||||
|
||||
// check if the list of index names are the same
|
||||
if (!list1.equals(list2))
|
||||
|
@ -110,7 +110,7 @@ public class ManagementFactoryHelper {
|
||||
|
||||
public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
|
||||
MemoryPoolMXBean[] pools = MemoryImpl.getMemoryPools();
|
||||
List<MemoryPoolMXBean> list = new ArrayList<MemoryPoolMXBean>(pools.length);
|
||||
List<MemoryPoolMXBean> list = new ArrayList<>(pools.length);
|
||||
for (MemoryPoolMXBean p : pools) {
|
||||
list.add(p);
|
||||
}
|
||||
@ -119,7 +119,7 @@ public class ManagementFactoryHelper {
|
||||
|
||||
public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
|
||||
MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers();
|
||||
List<MemoryManagerMXBean> result = new ArrayList<MemoryManagerMXBean>(mgrs.length);
|
||||
List<MemoryManagerMXBean> result = new ArrayList<>(mgrs.length);
|
||||
for (MemoryManagerMXBean m : mgrs) {
|
||||
result.add(m);
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class ManagementFactoryHelper {
|
||||
|
||||
public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
|
||||
MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers();
|
||||
List<GarbageCollectorMXBean> result = new ArrayList<GarbageCollectorMXBean>(mgrs.length);
|
||||
List<GarbageCollectorMXBean> result = new ArrayList<>(mgrs.length);
|
||||
for (MemoryManagerMXBean m : mgrs) {
|
||||
if (GarbageCollectorMXBean.class.isInstance(m)) {
|
||||
result.add(GarbageCollectorMXBean.class.cast(m));
|
||||
|
@ -62,18 +62,18 @@ import com.sun.management.VMOption;
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class MappedMXBeanType {
|
||||
private static final WeakHashMap<Type,MappedMXBeanType> convertedTypes =
|
||||
new WeakHashMap<Type,MappedMXBeanType>();
|
||||
new WeakHashMap<>();
|
||||
|
||||
boolean isBasicType = false;
|
||||
OpenType openType = inProgress;
|
||||
Class mappedTypeClass;
|
||||
OpenType<?> openType = inProgress;
|
||||
Class<?> mappedTypeClass;
|
||||
|
||||
static synchronized MappedMXBeanType newMappedType(Type javaType)
|
||||
throws OpenDataException {
|
||||
|
||||
MappedMXBeanType mt = null;
|
||||
if (javaType instanceof Class) {
|
||||
final Class c = (Class) javaType;
|
||||
final Class<?> c = (Class<?>) javaType;
|
||||
if (c.isEnum()) {
|
||||
mt = new EnumMXBeanType(c);
|
||||
} else if (c.isArray()) {
|
||||
@ -85,7 +85,7 @@ public abstract class MappedMXBeanType {
|
||||
final ParameterizedType pt = (ParameterizedType) javaType;
|
||||
final Type rawType = pt.getRawType();
|
||||
if (rawType instanceof Class) {
|
||||
final Class rc = (Class) rawType;
|
||||
final Class<?> rc = (Class<?>) rawType;
|
||||
if (rc == List.class) {
|
||||
mt = new ListMXBeanType(pt);
|
||||
} else if (rc == Map.class) {
|
||||
@ -106,7 +106,7 @@ public abstract class MappedMXBeanType {
|
||||
}
|
||||
|
||||
// basic types do not require data mapping
|
||||
static synchronized MappedMXBeanType newBasicType(Class c, OpenType ot)
|
||||
static synchronized MappedMXBeanType newBasicType(Class<?> c, OpenType<?> ot)
|
||||
throws OpenDataException {
|
||||
MappedMXBeanType mt = new BasicMXBeanType(c, ot);
|
||||
convertedTypes.put(c, mt);
|
||||
@ -127,7 +127,7 @@ public abstract class MappedMXBeanType {
|
||||
}
|
||||
|
||||
// Convert a class to an OpenType
|
||||
public static synchronized OpenType toOpenType(Type t)
|
||||
public static synchronized OpenType<?> toOpenType(Type t)
|
||||
throws OpenDataException {
|
||||
MappedMXBeanType mt = getMappedType(t);
|
||||
return mt.getOpenType();
|
||||
@ -152,7 +152,7 @@ public abstract class MappedMXBeanType {
|
||||
}
|
||||
|
||||
// Return the mapped open type
|
||||
OpenType getOpenType() {
|
||||
OpenType<?> getOpenType() {
|
||||
return openType;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ public abstract class MappedMXBeanType {
|
||||
}
|
||||
|
||||
// Return the mapped open type
|
||||
Class getMappedTypeClass() {
|
||||
Class<?> getMappedTypeClass() {
|
||||
return mappedTypeClass;
|
||||
}
|
||||
|
||||
@ -192,8 +192,8 @@ public abstract class MappedMXBeanType {
|
||||
// T <-> T (no conversion)
|
||||
//
|
||||
static class BasicMXBeanType extends MappedMXBeanType {
|
||||
final Class basicType;
|
||||
BasicMXBeanType(Class c, OpenType openType) {
|
||||
final Class<?> basicType;
|
||||
BasicMXBeanType(Class<?> c, OpenType<?> openType) {
|
||||
this.basicType = c;
|
||||
this.openType = openType;
|
||||
this.mappedTypeClass = c;
|
||||
@ -228,7 +228,7 @@ public abstract class MappedMXBeanType {
|
||||
//
|
||||
static class EnumMXBeanType extends MappedMXBeanType {
|
||||
final Class enumClass;
|
||||
EnumMXBeanType(Class c) {
|
||||
EnumMXBeanType(Class<?> c) {
|
||||
this.enumClass = c;
|
||||
this.openType = STRING;
|
||||
this.mappedTypeClass = String.class;
|
||||
@ -269,16 +269,16 @@ public abstract class MappedMXBeanType {
|
||||
// E[] <-> openTypeData(E)[]
|
||||
//
|
||||
static class ArrayMXBeanType extends MappedMXBeanType {
|
||||
final Class arrayClass;
|
||||
final Class<?> arrayClass;
|
||||
protected MappedMXBeanType componentType;
|
||||
protected MappedMXBeanType baseElementType;
|
||||
|
||||
ArrayMXBeanType(Class c) throws OpenDataException {
|
||||
ArrayMXBeanType(Class<?> c) throws OpenDataException {
|
||||
this.arrayClass = c;
|
||||
this.componentType = getMappedType(c.getComponentType());
|
||||
|
||||
StringBuilder className = new StringBuilder();
|
||||
Class et = c;
|
||||
Class<?> et = c;
|
||||
int dim;
|
||||
for (dim = 0; et.isArray(); dim++) {
|
||||
className.append('[');
|
||||
@ -299,7 +299,7 @@ public abstract class MappedMXBeanType {
|
||||
throw ode;
|
||||
}
|
||||
|
||||
openType = new ArrayType(dim, baseElementType.getOpenType());
|
||||
openType = new ArrayType<>(dim, baseElementType.getOpenType());
|
||||
}
|
||||
|
||||
protected ArrayMXBeanType() {
|
||||
@ -395,7 +395,7 @@ public abstract class MappedMXBeanType {
|
||||
throw ode;
|
||||
}
|
||||
|
||||
openType = new ArrayType(dim, baseElementType.getOpenType());
|
||||
openType = new ArrayType<>(dim, baseElementType.getOpenType());
|
||||
}
|
||||
|
||||
Type getJavaType() {
|
||||
@ -428,7 +428,7 @@ public abstract class MappedMXBeanType {
|
||||
throw new OpenDataException("Element Type for " + pt +
|
||||
" not supported");
|
||||
}
|
||||
final Class et = (Class) argTypes[0];
|
||||
final Class<?> et = (Class<?>) argTypes[0];
|
||||
if (et.isArray()) {
|
||||
throw new OpenDataException("Element Type for " + pt +
|
||||
" not supported");
|
||||
@ -445,7 +445,7 @@ public abstract class MappedMXBeanType {
|
||||
ode.initCause(e);
|
||||
throw ode;
|
||||
}
|
||||
openType = new ArrayType(1, paramType.getOpenType());
|
||||
openType = new ArrayType<>(1, paramType.getOpenType());
|
||||
}
|
||||
|
||||
Type getJavaType() {
|
||||
@ -473,7 +473,7 @@ public abstract class MappedMXBeanType {
|
||||
throws OpenDataException, InvalidObjectException {
|
||||
|
||||
final Object[] openArray = (Object[]) data;
|
||||
List<Object> result = new ArrayList<Object>(openArray.length);
|
||||
List<Object> result = new ArrayList<>(openArray.length);
|
||||
for (Object o : openArray) {
|
||||
result.add(paramType.toJavaTypeData(o));
|
||||
}
|
||||
@ -514,7 +514,7 @@ public abstract class MappedMXBeanType {
|
||||
// FIXME: generate typeName for generic
|
||||
typeName = "Map<" + keyType.getName() + "," +
|
||||
valueType.getName() + ">";
|
||||
final OpenType[] mapItemTypes = new OpenType[] {
|
||||
final OpenType<?>[] mapItemTypes = new OpenType<?>[] {
|
||||
keyType.getOpenType(),
|
||||
valueType.getOpenType(),
|
||||
};
|
||||
@ -543,7 +543,7 @@ public abstract class MappedMXBeanType {
|
||||
final TabularData table = new TabularDataSupport(tabularType);
|
||||
final CompositeType rowType = tabularType.getRowType();
|
||||
|
||||
for (Map.Entry entry : map.entrySet()) {
|
||||
for (Map.Entry<Object, Object> entry : map.entrySet()) {
|
||||
final Object key = keyType.toOpenTypeData(entry.getKey());
|
||||
final Object value = valueType.toOpenTypeData(entry.getValue());
|
||||
final CompositeData row =
|
||||
@ -560,7 +560,7 @@ public abstract class MappedMXBeanType {
|
||||
|
||||
final TabularData td = (TabularData) data;
|
||||
|
||||
Map<Object, Object> result = new HashMap<Object, Object>();
|
||||
Map<Object, Object> result = new HashMap<>();
|
||||
for (CompositeData row : (Collection<CompositeData>) td.values()) {
|
||||
Object key = keyType.toJavaTypeData(row.get(KEY));
|
||||
Object value = valueType.toJavaTypeData(row.get(VALUE));
|
||||
@ -607,7 +607,7 @@ public abstract class MappedMXBeanType {
|
||||
final boolean isCompositeData;
|
||||
Method fromMethod = null;
|
||||
|
||||
CompositeDataMXBeanType(Class c) throws OpenDataException {
|
||||
CompositeDataMXBeanType(Class<?> c) throws OpenDataException {
|
||||
this.javaClass = c;
|
||||
this.mappedTypeClass = COMPOSITE_DATA_CLASS;
|
||||
|
||||
@ -639,8 +639,8 @@ public abstract class MappedMXBeanType {
|
||||
return javaClass.getMethods();
|
||||
}
|
||||
});
|
||||
final List<String> names = new ArrayList<String>();
|
||||
final List<OpenType> types = new ArrayList<OpenType>();
|
||||
final List<String> names = new ArrayList<>();
|
||||
final List<OpenType<?>> types = new ArrayList<>();
|
||||
|
||||
/* Select public methods that look like "T getX()" or "boolean
|
||||
isX()", where T is not void and X is not the empty
|
||||
@ -678,7 +678,7 @@ public abstract class MappedMXBeanType {
|
||||
c.getName(),
|
||||
nameArray, // field names
|
||||
nameArray, // field descriptions
|
||||
types.toArray(new OpenType[0]));
|
||||
types.toArray(new OpenType<?>[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -722,7 +722,7 @@ public abstract class MappedMXBeanType {
|
||||
// so that no other classes are sent over the wire
|
||||
CompositeData cd = (CompositeData) data;
|
||||
CompositeType ct = cd.getCompositeType();
|
||||
String[] itemNames = (String[]) ct.keySet().toArray(new String[0]);
|
||||
String[] itemNames = ct.keySet().toArray(new String[0]);
|
||||
Object[] itemValues = cd.getAll(itemNames);
|
||||
return new CompositeDataSupport(ct, itemNames, itemValues);
|
||||
}
|
||||
@ -779,9 +779,9 @@ public abstract class MappedMXBeanType {
|
||||
}
|
||||
private static final long serialVersionUID = -3413063475064374490L;
|
||||
}
|
||||
private static final OpenType inProgress;
|
||||
private static final OpenType<?> inProgress;
|
||||
static {
|
||||
OpenType t;
|
||||
OpenType<?> t;
|
||||
try {
|
||||
t = new InProgress();
|
||||
} catch (OpenDataException e) {
|
||||
@ -799,8 +799,8 @@ public abstract class MappedMXBeanType {
|
||||
static {
|
||||
try {
|
||||
for (int i = 0; i < simpleTypes.length; i++) {
|
||||
final OpenType t = simpleTypes[i];
|
||||
Class c;
|
||||
final OpenType<?> t = simpleTypes[i];
|
||||
Class<?> c;
|
||||
try {
|
||||
c = Class.forName(t.getClassName(), false,
|
||||
String.class.getClassLoader());
|
||||
@ -816,7 +816,7 @@ public abstract class MappedMXBeanType {
|
||||
if (c.getName().startsWith("java.lang.")) {
|
||||
try {
|
||||
final Field typeField = c.getField("TYPE");
|
||||
final Class primitiveType = (Class) typeField.get(null);
|
||||
final Class<?> primitiveType = (Class<?>) typeField.get(null);
|
||||
MappedMXBeanType.newBasicType(primitiveType, t);
|
||||
} catch (NoSuchFieldException e) {
|
||||
// OK: must not be a primitive wrapper
|
||||
|
@ -92,7 +92,7 @@ public class MonitorInfoCompositeData extends LazyCompositeData {
|
||||
monitorInfoCompositeType = (CompositeType)
|
||||
MappedMXBeanType.toOpenType(MonitorInfo.class);
|
||||
Set<String> s = monitorInfoCompositeType.keySet();
|
||||
monitorInfoItemNames = (String[]) s.toArray(new String[0]);
|
||||
monitorInfoItemNames = s.toArray(new String[0]);
|
||||
} catch (OpenDataException e) {
|
||||
// Should never reach here
|
||||
throw new AssertionError(e);
|
||||
|
@ -71,7 +71,7 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
|
||||
efficient solution would be to clone the listener list
|
||||
every time a notification is sent. */
|
||||
synchronized (listenerLock) {
|
||||
List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList.size() + 1);
|
||||
List<ListenerInfo> newList = new ArrayList<>(listenerList.size() + 1);
|
||||
newList.addAll(listenerList);
|
||||
newList.add(new ListenerInfo(listener, filter, handback));
|
||||
listenerList = newList;
|
||||
@ -82,12 +82,12 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
|
||||
throws ListenerNotFoundException {
|
||||
|
||||
synchronized (listenerLock) {
|
||||
List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList);
|
||||
List<ListenerInfo> newList = new ArrayList<>(listenerList);
|
||||
/* We scan the list of listeners in reverse order because
|
||||
in forward order we would have to repeat the loop with
|
||||
the same index after a remove. */
|
||||
for (int i=newList.size()-1; i>=0; i--) {
|
||||
ListenerInfo li = (ListenerInfo)newList.get(i);
|
||||
ListenerInfo li = newList.get(i);
|
||||
|
||||
if (li.listener == listener)
|
||||
newList.remove(i);
|
||||
@ -106,10 +106,10 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
|
||||
boolean found = false;
|
||||
|
||||
synchronized (listenerLock) {
|
||||
List<ListenerInfo> newList = new ArrayList<ListenerInfo>(listenerList);
|
||||
List<ListenerInfo> newList = new ArrayList<>(listenerList);
|
||||
final int size = newList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ListenerInfo li = (ListenerInfo) newList.get(i);
|
||||
ListenerInfo li = newList.get(i);
|
||||
|
||||
if (li.listener == listener) {
|
||||
found = true;
|
||||
@ -148,7 +148,7 @@ abstract class NotificationEmitterSupport implements NotificationEmitter {
|
||||
|
||||
final int size = currentList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ListenerInfo li = (ListenerInfo) currentList.get(i);
|
||||
ListenerInfo li = currentList.get(i);
|
||||
|
||||
if (li.filter == null
|
||||
|| li.filter.isNotificationEnabled(notification)) {
|
||||
|
@ -128,7 +128,7 @@ class RuntimeImpl implements RuntimeMXBean {
|
||||
|
||||
public Map<String,String> getSystemProperties() {
|
||||
Properties sysProps = System.getProperties();
|
||||
Map<String,String> map = new HashMap<String, String>();
|
||||
Map<String,String> map = new HashMap<>();
|
||||
|
||||
// Properties.entrySet() does not include the entries in
|
||||
// the default properties. So use Properties.stringPropertyNames()
|
||||
|
@ -190,7 +190,7 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
|
||||
threadInfoV6Attributes.length;
|
||||
String[] v5ItemNames = new String[numV5Attributes];
|
||||
String[] v5ItemDescs = new String[numV5Attributes];
|
||||
OpenType[] v5ItemTypes = new OpenType[numV5Attributes];
|
||||
OpenType<?>[] v5ItemTypes = new OpenType<?>[numV5Attributes];
|
||||
int i = 0;
|
||||
for (String n : itemNames) {
|
||||
if (isV5Attribute(n)) {
|
||||
|
@ -73,7 +73,7 @@ public class PerfInstrumentation {
|
||||
buffer.position(prologue.getEntryOffset());
|
||||
nextEntry = buffer.position();
|
||||
// rebuild all the counters
|
||||
map = new TreeMap<String, Counter>();
|
||||
map = new TreeMap<>();
|
||||
}
|
||||
|
||||
boolean hasNext() {
|
||||
@ -154,7 +154,7 @@ public class PerfInstrumentation {
|
||||
map.put(c.getName(), c);
|
||||
}
|
||||
}
|
||||
return new ArrayList<Counter>(map.values());
|
||||
return new ArrayList<>(map.values());
|
||||
}
|
||||
|
||||
public synchronized List<Counter> findByPattern(String patternString) {
|
||||
@ -167,7 +167,8 @@ public class PerfInstrumentation {
|
||||
|
||||
Pattern pattern = Pattern.compile(patternString);
|
||||
Matcher matcher = pattern.matcher("");
|
||||
List<Counter> matches = new ArrayList<Counter>();
|
||||
List<Counter> matches = new ArrayList<>();
|
||||
|
||||
|
||||
for (Map.Entry<String,Counter> me: map.entrySet()) {
|
||||
String name = me.getKey();
|
||||
|
@ -234,14 +234,15 @@ public final class ConnectorBootstrap {
|
||||
"authenticated Subject is null");
|
||||
}
|
||||
final Set<Principal> principals = subject.getPrincipals();
|
||||
for (Principal p: principals) {
|
||||
if (properties.containsKey(p.getName())) {
|
||||
for (Principal p1: principals) {
|
||||
if (properties.containsKey(p1.getName())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Set<String> principalsStr = new HashSet<String>();
|
||||
for (Principal p: principals) {
|
||||
principalsStr.add(p.getName());
|
||||
|
||||
final Set<String> principalsStr = new HashSet<>();
|
||||
for (Principal p2: principals) {
|
||||
principalsStr.add(p2.getName());
|
||||
}
|
||||
throw new SecurityException(
|
||||
"Access denied! No entries found in the access file [" +
|
||||
@ -255,9 +256,9 @@ public final class ConnectorBootstrap {
|
||||
if (fname == null) {
|
||||
return p;
|
||||
}
|
||||
FileInputStream fin = new FileInputStream(fname);
|
||||
try (FileInputStream fin = new FileInputStream(fname)) {
|
||||
p.load(fin);
|
||||
fin.close();
|
||||
}
|
||||
return p;
|
||||
}
|
||||
private final Map<String, Object> environment;
|
||||
@ -430,7 +431,7 @@ public final class ConnectorBootstrap {
|
||||
try {
|
||||
// Export remote connector address and associated configuration
|
||||
// properties to the instrumentation buffer.
|
||||
Map<String, String> properties = new HashMap<String, String>();
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
properties.put("remoteAddress", url.toString());
|
||||
properties.put("authenticate", useAuthenticationStr);
|
||||
properties.put("ssl", useSslStr);
|
||||
@ -456,7 +457,7 @@ public final class ConnectorBootstrap {
|
||||
System.setProperty("java.rmi.server.randomIDs", "true");
|
||||
|
||||
// This RMI server should not keep the VM alive
|
||||
Map<String, Object> env = new HashMap<String, Object>();
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
env.put(RMIExporter.EXPORTER_ATTRIBUTE, new PermanentExporter());
|
||||
|
||||
// The local connector server need only be available via the
|
||||
@ -599,12 +600,9 @@ public final class ConnectorBootstrap {
|
||||
try {
|
||||
// Load the SSL keystore properties from the config file
|
||||
Properties p = new Properties();
|
||||
InputStream in = new FileInputStream(sslConfigFileName);
|
||||
try {
|
||||
try (InputStream in = new FileInputStream(sslConfigFileName)) {
|
||||
BufferedInputStream bin = new BufferedInputStream(in);
|
||||
p.load(bin);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
String keyStore =
|
||||
p.getProperty("javax.net.ssl.keyStore");
|
||||
@ -628,11 +626,8 @@ public final class ConnectorBootstrap {
|
||||
KeyStore ks = null;
|
||||
if (keyStore != null) {
|
||||
ks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
FileInputStream ksfis = new FileInputStream(keyStore);
|
||||
try {
|
||||
try (FileInputStream ksfis = new FileInputStream(keyStore)) {
|
||||
ks.load(ksfis, keyStorePasswd);
|
||||
} finally {
|
||||
ksfis.close();
|
||||
}
|
||||
}
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance(
|
||||
@ -642,11 +637,8 @@ public final class ConnectorBootstrap {
|
||||
KeyStore ts = null;
|
||||
if (trustStore != null) {
|
||||
ts = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
FileInputStream tsfis = new FileInputStream(trustStore);
|
||||
try {
|
||||
try (FileInputStream tsfis = new FileInputStream(trustStore)) {
|
||||
ts.load(tsfis, trustStorePasswd);
|
||||
} finally {
|
||||
tsfis.close();
|
||||
}
|
||||
}
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
|
||||
@ -689,7 +681,7 @@ public final class ConnectorBootstrap {
|
||||
|
||||
JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
|
||||
|
||||
Map<String, Object> env = new HashMap<String, Object>();
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
PermanentExporter exporter = new PermanentExporter();
|
||||
|
||||
|
@ -118,10 +118,11 @@ public final class AdaptorBootstrap {
|
||||
/**
|
||||
* Retrieve the Trap Target List from the ACL file.
|
||||
**/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static List<NotificationTarget> getTargetList(InetAddressAcl acl,
|
||||
int defaultTrapPort) {
|
||||
final ArrayList<NotificationTarget> result =
|
||||
new ArrayList<NotificationTarget>();
|
||||
new ArrayList<>();
|
||||
if (acl != null) {
|
||||
if (log.isDebugOn())
|
||||
log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing"));
|
||||
|
@ -90,14 +90,14 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
|
||||
SnmpOidTable table = null;
|
||||
if(tableRef == null) {
|
||||
table = new JVM_MANAGEMENT_MIBOidTable();
|
||||
tableRef = new WeakReference<SnmpOidTable>(table);
|
||||
tableRef = new WeakReference<>(table);
|
||||
return table;
|
||||
}
|
||||
|
||||
table = tableRef.get();
|
||||
if(table == null) {
|
||||
table = new JVM_MANAGEMENT_MIBOidTable();
|
||||
tableRef = new WeakReference<SnmpOidTable>(table);
|
||||
tableRef = new WeakReference<>(table);
|
||||
}
|
||||
|
||||
return table;
|
||||
@ -198,7 +198,7 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
|
||||
* List of notification targets.
|
||||
*/
|
||||
private ArrayList<NotificationTarget> notificationTargets =
|
||||
new ArrayList<NotificationTarget>();
|
||||
new ArrayList<>();
|
||||
private final NotificationEmitter emitter;
|
||||
private final NotificationHandler handler;
|
||||
|
||||
@ -215,7 +215,7 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
|
||||
}
|
||||
|
||||
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
|
||||
final Iterator iterator = notificationTargets.iterator();
|
||||
final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
|
||||
final SnmpAdaptorServer adaptor =
|
||||
(SnmpAdaptorServer) getSnmpAdaptor();
|
||||
|
||||
@ -232,7 +232,7 @@ public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
|
||||
while(iterator.hasNext()) {
|
||||
NotificationTarget target = null;
|
||||
try {
|
||||
target = (NotificationTarget) iterator.next();
|
||||
target = iterator.next();
|
||||
SnmpPeer peer =
|
||||
new SnmpPeer(target.getAddress(), target.getPort());
|
||||
SnmpParameters p = new SnmpParameters();
|
||||
|
@ -58,6 +58,8 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
*/
|
||||
public class JvmMemGCTableMetaImpl extends JvmMemGCTableMeta {
|
||||
|
||||
static final long serialVersionUID = 8250461197108867607L;
|
||||
|
||||
/**
|
||||
* This class acts as a filter over the SnmpTableHandler
|
||||
* used for the JvmMemoryManagerTable. It filters out
|
||||
|
@ -61,12 +61,17 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
*/
|
||||
public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
|
||||
|
||||
static final long serialVersionUID = 36176771566817592L;
|
||||
|
||||
/**
|
||||
* A concrete implementation of {@link SnmpNamedListTableCache}, for the
|
||||
* jvmMemManagerTable.
|
||||
**/
|
||||
private static class JvmMemManagerTableCache
|
||||
extends SnmpNamedListTableCache {
|
||||
|
||||
static final long serialVersionUID = 6564294074653009240L;
|
||||
|
||||
/**
|
||||
* Create a weak cache for the jvmMemManagerTable.
|
||||
* @param validity validity of the cached data, in ms.
|
||||
@ -87,7 +92,7 @@ public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
|
||||
* <code>MemoryManagerMXBean</code> in the list.
|
||||
* @return <code>((MemoryManagerMXBean)item).getName()</code>
|
||||
**/
|
||||
protected String getKey(Object context, List rawDatas,
|
||||
protected String getKey(Object context, List<?> rawDatas,
|
||||
int rank, Object item) {
|
||||
if (item == null) return null;
|
||||
final String name = ((MemoryManagerMXBean)item).getName();
|
||||
@ -99,7 +104,7 @@ public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
|
||||
* Call <code>getTableHandler(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object, Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
@ -114,7 +119,7 @@ public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
|
||||
* Call ManagementFactory.getMemoryManagerMXBeans() to
|
||||
* load the raw data of this table.
|
||||
**/
|
||||
protected List loadRawDatas(Map userData) {
|
||||
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
|
||||
return ManagementFactory.getMemoryManagerMXBeans();
|
||||
}
|
||||
|
||||
|
@ -64,13 +64,17 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 1896509775012355443L;
|
||||
|
||||
/**
|
||||
* A concrete implementation of {@link SnmpTableCache}, for the
|
||||
* jvmMemMgrPoolRelTable.
|
||||
**/
|
||||
|
||||
private static class JvmMemMgrPoolRelTableCache
|
||||
extends SnmpTableCache {
|
||||
|
||||
static final long serialVersionUID = 6059937161990659184L;
|
||||
final private JvmMemMgrPoolRelTableMetaImpl meta;
|
||||
|
||||
/**
|
||||
@ -87,7 +91,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object,Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
@ -101,7 +105,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
return buildPoolIndexMap((SnmpCachedData)handler);
|
||||
|
||||
// not optimizable... too bad.
|
||||
final Map<String, SnmpOid> m = new HashMap<String, SnmpOid>();
|
||||
final Map<String, SnmpOid> m = new HashMap<>();
|
||||
SnmpOid index=null;
|
||||
while ((index = handler.getNext(index))!=null) {
|
||||
final MemoryPoolMXBean mpm =
|
||||
@ -124,7 +128,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
final SnmpOid[] indexes = cached.indexes;
|
||||
final Object[] datas = cached.datas;
|
||||
final int len = indexes.length;
|
||||
final Map<String, SnmpOid> m = new HashMap<String, SnmpOid>(len);
|
||||
final Map<String, SnmpOid> m = new HashMap<>(len);
|
||||
for (int i=0; i<len; i++) {
|
||||
final SnmpOid index = indexes[i];
|
||||
if (index == null) continue;
|
||||
@ -165,13 +169,13 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
final long time = System.currentTimeMillis();
|
||||
|
||||
// Build a Map poolname -> index
|
||||
final Map poolIndexMap = buildPoolIndexMap(mpHandler);
|
||||
final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);
|
||||
|
||||
// For each memory manager, get the list of memory pools
|
||||
// For each memory pool, find its index in the memory pool table
|
||||
// Create a row in the relation table.
|
||||
final TreeMap<SnmpOid, Object> table =
|
||||
new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator);
|
||||
new TreeMap<>(SnmpCachedData.oidComparator);
|
||||
updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);
|
||||
|
||||
return new SnmpCachedData(time,table);
|
||||
@ -207,7 +211,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
|
||||
MemoryManagerMXBean mmm,
|
||||
SnmpOid mmIndex,
|
||||
Map poolIndexMap) {
|
||||
Map<String, SnmpOid> poolIndexMap) {
|
||||
|
||||
// The MemoryManager index is an int, so it's the first
|
||||
// and only subidentifier.
|
||||
@ -230,7 +234,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
for (int i = 0; i < mpList.length; i++) {
|
||||
final String mpmName = mpList[i];
|
||||
if (mpmName == null) continue;
|
||||
final SnmpOid mpIndex = (SnmpOid)poolIndexMap.get(mpmName);
|
||||
final SnmpOid mpIndex = poolIndexMap.get(mpmName);
|
||||
if (mpIndex == null) continue;
|
||||
|
||||
// The MemoryPool index is an int, so it's the first
|
||||
@ -261,7 +265,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
|
||||
SnmpTableHandler mmHandler,
|
||||
SnmpTableHandler mpHandler,
|
||||
Map poolIndexMap) {
|
||||
Map<String, SnmpOid> poolIndexMap) {
|
||||
if (mmHandler instanceof SnmpCachedData) {
|
||||
updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
|
||||
mpHandler,poolIndexMap);
|
||||
@ -280,7 +284,7 @@ public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
|
||||
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
|
||||
SnmpCachedData mmHandler,
|
||||
SnmpTableHandler mpHandler,
|
||||
Map poolIndexMap) {
|
||||
Map<String, SnmpOid> poolIndexMap) {
|
||||
|
||||
final SnmpOid[] indexes = mmHandler.indexes;
|
||||
final Object[] datas = mmHandler.datas;
|
||||
|
@ -61,11 +61,16 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
*/
|
||||
public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
|
||||
|
||||
static final long serialVersionUID = -2525820976094284957L;
|
||||
|
||||
/**
|
||||
* A concrete implementation of {@link SnmpNamedListTableCache}, for the
|
||||
* jvmMemPoolTable.
|
||||
**/
|
||||
private static class JvmMemPoolTableCache extends SnmpNamedListTableCache {
|
||||
|
||||
static final long serialVersionUID = -1755520683086760574L;
|
||||
|
||||
/**
|
||||
* Create a weak cache for the jvmMemPoolTable.
|
||||
* @param validity validity of the cached data, in ms.
|
||||
@ -86,7 +91,7 @@ public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
|
||||
* <code>MemoryPoolMXBean</code> in the list.
|
||||
* @return <code>((MemoryPoolMXBean)item).getName()</code>
|
||||
**/
|
||||
protected String getKey(Object context, List rawDatas,
|
||||
protected String getKey(Object context, List<?> rawDatas,
|
||||
int rank, Object item) {
|
||||
if (item == null) return null;
|
||||
final String name = ((MemoryPoolMXBean)item).getName();
|
||||
@ -98,7 +103,7 @@ public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
|
||||
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object, Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
@ -113,7 +118,7 @@ public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
|
||||
* Call ManagementFactory.getMemoryPoolMXBeans() to
|
||||
* load the raw data of this table.
|
||||
**/
|
||||
protected List loadRawDatas(Map userData) {
|
||||
protected List<MemoryPoolMXBean> loadRawDatas(Map<Object, Object> userData) {
|
||||
return ManagementFactory.getMemoryPoolMXBeans();
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
|
||||
*/
|
||||
public EnumJvmMemoryGCCall getJvmMemoryGCCall()
|
||||
throws SnmpStatusException {
|
||||
final Map m = JvmContextFactory.getUserData();
|
||||
final Map<Object,Object> m = JvmContextFactory.getUserData();
|
||||
|
||||
if (m != null) {
|
||||
final EnumJvmMemoryGCCall cached
|
||||
|
@ -50,6 +50,8 @@ import sun.management.snmp.util.MibLogger;
|
||||
* The class is used for representing SNMP metadata for the "JvmMemory" group.
|
||||
*/
|
||||
public class JvmMemoryMetaImpl extends JvmMemoryMeta {
|
||||
|
||||
static final long serialVersionUID = -6500448253825893071L;
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmMemory".
|
||||
*/
|
||||
|
@ -47,6 +47,8 @@ import sun.management.snmp.jvmmib.JvmOSMBean;
|
||||
*/
|
||||
public class JvmOSImpl implements JvmOSMBean, Serializable {
|
||||
|
||||
static final long serialVersionUID = 1839834731763310809L;
|
||||
|
||||
/**
|
||||
* Constructor for the "JvmOS" group.
|
||||
* If the group contains a table, the entries created through an
|
||||
|
@ -44,6 +44,8 @@ import sun.management.snmp.jvmmib.JvmRTBootClassPathEntryMBean;
|
||||
public class JvmRTBootClassPathEntryImpl
|
||||
implements JvmRTBootClassPathEntryMBean, Serializable {
|
||||
|
||||
static final long serialVersionUID = -2282652055235913013L;
|
||||
|
||||
private final String item;
|
||||
private final int index;
|
||||
|
||||
|
@ -71,6 +71,8 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
public class JvmRTBootClassPathTableMetaImpl
|
||||
extends JvmRTBootClassPathTableMeta {
|
||||
|
||||
static final long serialVersionUID = -8659886610487538299L;
|
||||
|
||||
private SnmpTableCache cache;
|
||||
|
||||
/**
|
||||
@ -78,6 +80,7 @@ public class JvmRTBootClassPathTableMetaImpl
|
||||
* JvmRTBootClassPathTable.
|
||||
**/
|
||||
private static class JvmRTBootClassPathTableCache extends SnmpTableCache {
|
||||
static final long serialVersionUID = -2637458695413646098L;
|
||||
private JvmRTBootClassPathTableMetaImpl meta;
|
||||
|
||||
JvmRTBootClassPathTableCache(JvmRTBootClassPathTableMetaImpl meta,
|
||||
@ -90,7 +93,7 @@ public class JvmRTBootClassPathTableMetaImpl
|
||||
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object,Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ import sun.management.snmp.jvmmib.JvmRTClassPathEntryMBean;
|
||||
public class JvmRTClassPathEntryImpl implements JvmRTClassPathEntryMBean,
|
||||
Serializable {
|
||||
|
||||
static final long serialVersionUID = 8524792845083365742L;
|
||||
private final String item;
|
||||
private final int index;
|
||||
|
||||
|
@ -70,6 +70,8 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
*/
|
||||
public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
|
||||
|
||||
static final long serialVersionUID = -6914494148818455166L;
|
||||
|
||||
private SnmpTableCache cache;
|
||||
|
||||
/**
|
||||
@ -77,6 +79,7 @@ public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
|
||||
* JvmRTClassPathTable.
|
||||
**/
|
||||
private static class JvmRTClassPathTableCache extends SnmpTableCache {
|
||||
static final long serialVersionUID = 3805032372592117315L;
|
||||
private JvmRTClassPathTableMetaImpl meta;
|
||||
|
||||
JvmRTClassPathTableCache(JvmRTClassPathTableMetaImpl meta,
|
||||
@ -89,7 +92,7 @@ public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
|
||||
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object, Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ import sun.management.snmp.jvmmib.JvmRTInputArgsEntryMBean;
|
||||
public class JvmRTInputArgsEntryImpl implements JvmRTInputArgsEntryMBean,
|
||||
Serializable {
|
||||
|
||||
static final long serialVersionUID = 1000306518436503395L;
|
||||
private final String item;
|
||||
private final int index;
|
||||
|
||||
|
@ -70,6 +70,7 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
*/
|
||||
public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
|
||||
|
||||
static final long serialVersionUID = -2083438094888099238L;
|
||||
private SnmpTableCache cache;
|
||||
|
||||
/**
|
||||
@ -77,6 +78,8 @@ public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
|
||||
* JvmRTInputArgsTable.
|
||||
**/
|
||||
private static class JvmRTInputArgsTableCache extends SnmpTableCache {
|
||||
|
||||
static final long serialVersionUID = 1693751105464785192L;
|
||||
private JvmRTInputArgsTableMetaImpl meta;
|
||||
|
||||
JvmRTInputArgsTableCache(JvmRTInputArgsTableMetaImpl meta,
|
||||
@ -89,7 +92,7 @@ public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
|
||||
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object,Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ import sun.management.snmp.jvmmib.JvmRTLibraryPathEntryMBean;
|
||||
public class JvmRTLibraryPathEntryImpl implements JvmRTLibraryPathEntryMBean,
|
||||
Serializable {
|
||||
|
||||
static final long serialVersionUID = -3322438153507369765L;
|
||||
private final String item;
|
||||
private final int index;
|
||||
|
||||
|
@ -70,6 +70,7 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
*/
|
||||
public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
|
||||
|
||||
static final long serialVersionUID = 6713252710712502068L;
|
||||
private SnmpTableCache cache;
|
||||
|
||||
/**
|
||||
@ -77,6 +78,7 @@ public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
|
||||
* JvmRTLibraryPathTable.
|
||||
**/
|
||||
private static class JvmRTLibraryPathTableCache extends SnmpTableCache {
|
||||
static final long serialVersionUID = 2035304445719393195L;
|
||||
private JvmRTLibraryPathTableMetaImpl meta;
|
||||
|
||||
JvmRTLibraryPathTableCache(JvmRTLibraryPathTableMetaImpl meta,
|
||||
@ -89,7 +91,7 @@ public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
|
||||
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object,Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ import sun.management.snmp.jvmmib.JvmRTLibraryPathTableMeta;
|
||||
*/
|
||||
public class JvmRuntimeMetaImpl extends JvmRuntimeMeta {
|
||||
|
||||
static final long serialVersionUID = -6570428414857608618L;
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmRuntime".
|
||||
*/
|
||||
|
@ -53,6 +53,8 @@ import sun.management.snmp.util.MibLogger;
|
||||
public class JvmThreadInstanceEntryImpl
|
||||
implements JvmThreadInstanceEntryMBean, Serializable {
|
||||
|
||||
static final long serialVersionUID = 910173589985461347L;
|
||||
|
||||
public final static class ThreadStateMap {
|
||||
public final static class Byte0 {
|
||||
public final static byte inNative = (byte)0x80; // bit 1
|
||||
|
@ -78,6 +78,8 @@ import sun.management.snmp.util.JvmContextFactory;
|
||||
public class JvmThreadInstanceTableMetaImpl
|
||||
extends JvmThreadInstanceTableMeta {
|
||||
|
||||
static final long serialVersionUID = -8432271929226397492L;
|
||||
|
||||
/**
|
||||
* Maximum depth of the stacktrace that might be returned through
|
||||
* SNMP.
|
||||
@ -135,6 +137,7 @@ public class JvmThreadInstanceTableMetaImpl
|
||||
private static class JvmThreadInstanceTableCache
|
||||
extends SnmpTableCache {
|
||||
|
||||
static final long serialVersionUID = 4947330124563406878L;
|
||||
final private JvmThreadInstanceTableMetaImpl meta;
|
||||
|
||||
/**
|
||||
@ -151,7 +154,7 @@ public class JvmThreadInstanceTableMetaImpl
|
||||
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
|
||||
**/
|
||||
public SnmpTableHandler getTableHandler() {
|
||||
final Map userData = JvmContextFactory.getUserData();
|
||||
final Map<Object, Object> userData = JvmContextFactory.getUserData();
|
||||
return getTableDatas(userData);
|
||||
}
|
||||
|
||||
@ -172,7 +175,7 @@ public class JvmThreadInstanceTableMetaImpl
|
||||
|
||||
SnmpOid indexes[] = new SnmpOid[id.length];
|
||||
final TreeMap<SnmpOid, Object> table =
|
||||
new TreeMap<SnmpOid, Object>(SnmpCachedData.oidComparator);
|
||||
new TreeMap<>(SnmpCachedData.oidComparator);
|
||||
for(int i = 0; i < id.length; i++) {
|
||||
log.debug("", "Making index for thread id [" + id[i] +"]");
|
||||
//indexes[i] = makeOid(id[i]);
|
||||
@ -277,7 +280,7 @@ public class JvmThreadInstanceTableMetaImpl
|
||||
|
||||
// Get the request contextual cache (userData).
|
||||
//
|
||||
final Map m = JvmContextFactory.getUserData();
|
||||
final Map<Object,Object> m = JvmContextFactory.getUserData();
|
||||
|
||||
// Get the handler.
|
||||
//
|
||||
|
@ -66,6 +66,8 @@ import sun.management.snmp.jvmmib.JvmThreadInstanceTableMeta;
|
||||
*/
|
||||
public class JvmThreadingMetaImpl extends JvmThreadingMeta {
|
||||
|
||||
static final long serialVersionUID = -2104788458393251457L;
|
||||
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmThreading".
|
||||
*/
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmClassesVerboseLevel extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -620710366914810374L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "verbose");
|
||||
intTable.put(new Integer(1), "silent");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmClassesVerboseLevel extends Enumerated implements Serializab
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer,String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String,Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmJITCompilerTimeMonitoring extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 3953565918146461236L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "supported");
|
||||
intTable.put(new Integer(1), "unsupported");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmJITCompilerTimeMonitoring extends Enumerated implements Seri
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer, String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String, Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,12 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmMemManagerState extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 8249515157795166343L;
|
||||
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "valid");
|
||||
intTable.put(new Integer(1), "invalid");
|
||||
@ -70,11 +72,11 @@ public class EnumJvmMemManagerState extends Enumerated implements Serializable {
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer, String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String, Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmMemPoolCollectThreshdSupport extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 8610091819732806282L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "supported");
|
||||
intTable.put(new Integer(1), "unsupported");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmMemPoolCollectThreshdSupport extends Enumerated implements S
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer, String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String, Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmMemPoolState extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 3038175407527743027L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "valid");
|
||||
intTable.put(new Integer(1), "invalid");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmMemPoolState extends Enumerated implements Serializable {
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer,String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String,Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmMemPoolThreshdSupport extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 7014693561120661029L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "supported");
|
||||
intTable.put(new Integer(1), "unsupported");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmMemPoolThreshdSupport extends Enumerated implements Serializ
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer,String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String,Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmMemPoolType extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -7214498472962396555L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "heap");
|
||||
intTable.put(new Integer(1), "nonheap");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmMemPoolType extends Enumerated implements Serializable {
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer,String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String,Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmMemoryGCCall extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -2869147994287351375L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "supported");
|
||||
intTable.put(new Integer(5), "failed");
|
||||
@ -76,11 +77,11 @@ public class EnumJvmMemoryGCCall extends Enumerated implements Serializable {
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer, String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String, Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmMemoryGCVerboseLevel extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 1362427628755978190L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "verbose");
|
||||
intTable.put(new Integer(1), "silent");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmMemoryGCVerboseLevel extends Enumerated implements Serializa
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer,String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String,Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmRTBootClassPathSupport extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -5957542680437939894L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(2), "supported");
|
||||
intTable.put(new Integer(1), "unsupported");
|
||||
@ -70,11 +71,11 @@ public class EnumJvmRTBootClassPathSupport extends Enumerated implements Seriali
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer, String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String, Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmThreadContentionMonitoring extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -6411827583604137210L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(3), "enabled");
|
||||
intTable.put(new Integer(4), "disabled");
|
||||
@ -72,11 +73,11 @@ public class EnumJvmThreadContentionMonitoring extends Enumerated implements Ser
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer,String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String,Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,11 @@ import com.sun.jmx.snmp.Enumerated;
|
||||
*/
|
||||
public class EnumJvmThreadCpuTimeMonitoring extends Enumerated implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -532837824105215699L;
|
||||
protected static Hashtable<Integer, String> intTable =
|
||||
new Hashtable<Integer, String>();
|
||||
new Hashtable<>();
|
||||
protected static Hashtable<String, Integer> stringTable =
|
||||
new Hashtable<String, Integer>();
|
||||
new Hashtable<>();
|
||||
static {
|
||||
intTable.put(new Integer(3), "enabled");
|
||||
intTable.put(new Integer(4), "disabled");
|
||||
@ -72,11 +73,11 @@ public class EnumJvmThreadCpuTimeMonitoring extends Enumerated implements Serial
|
||||
super(x);
|
||||
}
|
||||
|
||||
protected Hashtable getIntTable() {
|
||||
protected Hashtable<Integer,String> getIntTable() {
|
||||
return intTable ;
|
||||
}
|
||||
|
||||
protected Hashtable getStringTable() {
|
||||
protected Hashtable<String,Integer> getStringTable() {
|
||||
return stringTable ;
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
|
||||
*/
|
||||
public abstract class JVM_MANAGEMENT_MIB extends SnmpMib implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 6895037919735816732L;
|
||||
/**
|
||||
* Default constructor. Initialize the Mib tree.
|
||||
*/
|
||||
|
@ -47,6 +47,7 @@ import com.sun.jmx.snmp.SnmpOidTableSupport;
|
||||
*/
|
||||
public class JVM_MANAGEMENT_MIBOidTable extends SnmpOidTableSupport implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -5010870014488732061L;
|
||||
/**
|
||||
* Default constructor. Initialize the Mib tree.
|
||||
*/
|
||||
|
@ -70,6 +70,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
|
||||
public class JvmClassLoadingMeta extends SnmpMibGroup
|
||||
implements Serializable, SnmpStandardMetaServer {
|
||||
|
||||
static final long serialVersionUID = 5722857476941218568L;
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmClassLoading".
|
||||
*/
|
||||
|
@ -70,6 +70,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
|
||||
public class JvmCompilationMeta extends SnmpMibGroup
|
||||
implements Serializable, SnmpStandardMetaServer {
|
||||
|
||||
static final long serialVersionUID = -95492874115033638L;
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmCompilation".
|
||||
*/
|
||||
|
@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
|
||||
public class JvmMemGCEntryMeta extends SnmpMibEntry
|
||||
implements Serializable, SnmpStandardMetaServer {
|
||||
|
||||
static final long serialVersionUID = 6082082529298387063L;
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmMemGCEntry".
|
||||
*/
|
||||
|
@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
|
||||
*/
|
||||
public class JvmMemGCTableMeta extends SnmpMibTable implements Serializable {
|
||||
|
||||
static final long serialVersionUID = -8843296871149264612L;
|
||||
/**
|
||||
* Constructor for the table. Initialize metadata for "JvmMemGCTableMeta".
|
||||
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
|
||||
|
@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
|
||||
public class JvmMemManagerEntryMeta extends SnmpMibEntry
|
||||
implements Serializable, SnmpStandardMetaServer {
|
||||
|
||||
static final long serialVersionUID = 8166956416408970453L;
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmMemManagerEntry".
|
||||
*/
|
||||
|
@ -68,6 +68,7 @@ import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
|
||||
*/
|
||||
public class JvmMemManagerTableMeta extends SnmpMibTable implements Serializable {
|
||||
|
||||
static final long serialVersionUID = 5026520607518015233L;
|
||||
/**
|
||||
* Constructor for the table. Initialize metadata for "JvmMemManagerTableMeta".
|
||||
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
|
||||
|
@ -71,6 +71,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
|
||||
public class JvmMemMgrPoolRelEntryMeta extends SnmpMibEntry
|
||||
implements Serializable, SnmpStandardMetaServer {
|
||||
|
||||
static final long serialVersionUID = 7414270971113459798L;
|
||||
/**
|
||||
* Constructor for the metadata associated to "JvmMemMgrPoolRelEntry".
|
||||
*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user