changeset 10856:8e8647461811

8196297: Remove obsolete JFR logger code Reviewed-by: aghaisas
author kcr
date Fri, 02 Mar 2018 05:46:23 -0800
parents 75647ec072e9
children 15fcabec7e20
files .idea/base.iml build.gradle buildSrc/dalvik.gradle modules/javafx.base/src/main/java-jfr/com/sun/javafx/logging/JFRInputEvent.java modules/javafx.base/src/main/java-jfr/com/sun/javafx/logging/JFRLogger.java modules/javafx.base/src/main/java-jfr/com/sun/javafx/logging/JFRPulseEvent.java modules/javafx.base/src/main/java/com/sun/javafx/logging/PulseLogger.java netbeans/base/nbproject/build-impl.xml netbeans/base/nbproject/genfiles.properties netbeans/base/nbproject/project.properties netbeans/base/nbproject/project.xml
diffstat 11 files changed, 24 insertions(+), 336 deletions(-) [+]
line wrap: on
line diff
--- a/.idea/base.iml	Thu Mar 01 12:01:23 2018 +0530
+++ b/.idea/base.iml	Fri Mar 02 05:46:23 2018 -0800
@@ -8,7 +8,6 @@
       <sourceFolder url="file://$MODULE_DIR$/modules/javafx.base/src/main/resources" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/modules/javafx.base/src/test/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/modules/javafx.base/src/test/resources" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/modules/javafx.base/src/main/java-jfr" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/modules/javafx.base/build/gensrc/java" isTestSource="false" />
       <excludeFolder url="file://$MODULE_DIR$/modules/javafx.base/build/classes" />
       <excludeFolder url="file://$MODULE_DIR$/modules/javafx.base/build/dependency-cache" />
@@ -20,4 +19,4 @@
     <orderEntry type="inheritedJdk" />
     <orderEntry type="library" scope="TEST" name="junit4" level="application" />
   </component>
-</module>
\ No newline at end of file
+</module>
--- a/build.gradle	Thu Mar 01 12:01:23 2018 +0530
+++ b/build.gradle	Fri Mar 02 05:46:23 2018 -0800
@@ -1675,10 +1675,6 @@
         }
     }
 
-//    if (IS_COMPILE_JFR) {
-//        sourceSets.main.java.srcDirs += "src/main/java-jfr"
-//    }
-
     // Make sure to include $buildDir/gensrc/java that we previously created.
     // We DO NOT want to include src/main/version-info
 
--- a/buildSrc/dalvik.gradle	Thu Mar 01 12:01:23 2018 +0530
+++ b/buildSrc/dalvik.gradle	Fri Mar 02 05:46:23 2018 -0800
@@ -781,4 +781,3 @@
 DALVIK.includeGTK = true
 DALVIK.includeLens = true
 ext.IS_COMPILE_PANGO = false
-ext.IS_COMPILE_JFR = false
--- a/modules/javafx.base/src/main/java-jfr/com/sun/javafx/logging/JFRInputEvent.java	Thu Mar 01 12:01:23 2018 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-package com.sun.javafx.logging;
-
-import com.oracle.jrockit.jfr.ContentType;
-import com.oracle.jrockit.jfr.EventDefinition;
-import com.oracle.jrockit.jfr.EventToken;
-import com.oracle.jrockit.jfr.TimedEvent;
-import com.oracle.jrockit.jfr.ValueDefinition;
-
-@EventDefinition(path="javafx/input", name = "JavaFX Input", description="JavaFX input event", stacktrace=false, thread=true)
-public class JFRInputEvent extends TimedEvent {
-
-    @ValueDefinition(name="inputType", description="Input event type", contentType=ContentType.None)
-    private String input;
-
-    public JFRInputEvent(EventToken eventToken) {
-        super(eventToken);
-    }
-
-    public String getInput() {
-        return input;
-    }
-
-    public void setInput(String s) {
-        input = s;
-    }
-}
--- a/modules/javafx.base/src/main/java-jfr/com/sun/javafx/logging/JFRLogger.java	Thu Mar 01 12:01:23 2018 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-package com.sun.javafx.logging;
-
-import com.oracle.jrockit.jfr.EventToken;
-import com.oracle.jrockit.jfr.Producer;
-
-/**
- * Logs pulse related information with Java Flight Recorder.
- */
-class JFRLogger extends Logger {
-
-    private static final String PRODUCER_URI = "http://www.oracle.com/technetwork/java/javafx/index.html";
-    private static JFRLogger jfrLogger;
-
-    private final Producer producer;
-    private final EventToken pulseEventToken;
-    private final EventToken inputEventToken;
-    private final ThreadLocal<JFRPulseEvent> curPhaseEvent;
-    private final ThreadLocal<JFRInputEvent> curInputEvent;
-
-    private JFRLogger() throws Exception {
-        producer = new Producer("JavaFX producer", "JavaFX producer.", PRODUCER_URI);
-        pulseEventToken = producer.addEvent(JFRPulseEvent.class);
-        inputEventToken = producer.addEvent(JFRInputEvent.class);
-        producer.register();
-        curPhaseEvent = new ThreadLocal() {
-            @Override
-            public JFRPulseEvent initialValue() {
-                return new JFRPulseEvent(pulseEventToken);
-            }
-        };
-        curInputEvent = new ThreadLocal(){
-            @Override
-            public JFRInputEvent initialValue() {
-                return new JFRInputEvent(inputEventToken);
-            }
-        };
-    }
-
-    public static JFRLogger getInstance() {
-        if (jfrLogger == null) {
-            /* Guards against exceptions in the constructor and the absence of jfr.jar at run time */
-            try {
-                Class klass = Class.forName("com.oracle.jrockit.jfr.FlightRecorder");
-                if (klass != null && com.oracle.jrockit.jfr.FlightRecorder.isActive()) {
-                    jfrLogger = new JFRLogger();
-                }
-            }
-            catch (Exception e) {
-                jfrLogger = null;
-            }
-        }
-        return jfrLogger;
-    }
-
-    /**
-     *  Pulse number reconstruction for the render thread relies on the current synchronization
-     *  between the FX and render threads: renderStart() is called on the FX thread after all
-     *  previous RenderJobs have finished and before any new RenderJob is pushed.
-     */
-    private int pulseNumber;
-    private int fxPulseNumber;
-    private int renderPulseNumber;
-    private Thread fxThread;
-
-    @Override
-    public void pulseStart() {
-        ++pulseNumber;
-        fxPulseNumber = pulseNumber;
-        if (fxThread == null) {
-            fxThread = Thread.currentThread();
-        }
-        newPhase("Pulse start");
-    }
-
-    @Override
-    public void pulseEnd() {
-        newPhase(null);
-        fxPulseNumber = 0;
-    }
-
-    @Override
-    public void renderStart() {
-        renderPulseNumber = fxPulseNumber;
-    }
-
-    @Override
-    public void renderEnd() {
-        newPhase(null);
-        renderPulseNumber = 0;
-    }
-
-    /**
-     * Finishes the current phase and starts a new one if phaseName is not null.
-     * @param phaseName The name for the new phase.
-     */
-    @Override
-    public void newPhase(String phaseName) {
-        if (pulseEventToken == null) {
-            return;
-        }
-
-        JFRPulseEvent event = curPhaseEvent.get();
-
-        /* Cleanup if recording has finished */
-        if (!pulseEventToken.isEnabled()) {
-            event.setPhase(null);
-            return;
-        }
-
-        /* Finish the previous phase if any */
-        if (event.getPhase() != null) {
-            event.end();
-            event.commit();
-        }
-
-        /* Done if the new phase name is null */
-        if (phaseName == null) {
-            event.setPhase(null);
-            return;
-        }
-
-        event.reset();
-        event.begin();
-        event.setPhase(phaseName);
-        event.setPulseNumber(Thread.currentThread() == fxThread ? fxPulseNumber : renderPulseNumber);
-    }
-
-    @Override
-    public void newInput(String input) {
-        if (inputEventToken == null) {
-            return;
-        }
-
-        JFRInputEvent event = curInputEvent.get();
-
-        /* Cleanup if recording has finished */
-        if (!inputEventToken.isEnabled()) {
-            event.setInput(null);
-            return;
-        }
-
-        /* Finish the previous input event if any */
-        if (event.getInput() != null) {
-            event.end();
-            event.commit();
-        }
-
-        /* Done if the new input is null */
-        if (input == null) {
-            event.setInput(null);
-            return;
-        }
-
-        event.reset();
-        event.begin();
-        event.setInput(input);
-    }
-}
--- a/modules/javafx.base/src/main/java-jfr/com/sun/javafx/logging/JFRPulseEvent.java	Thu Mar 01 12:01:23 2018 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-package com.sun.javafx.logging;
-
-import com.oracle.jrockit.jfr.ContentType;
-import com.oracle.jrockit.jfr.EventDefinition;
-import com.oracle.jrockit.jfr.EventToken;
-import com.oracle.jrockit.jfr.TimedEvent;
-import com.oracle.jrockit.jfr.ValueDefinition;
-
-@EventDefinition(path="javafx/pulse", name = "JavaFX Pulse Phase", description="Describes a phase in JavaFX pulse processing", stacktrace=false, thread=true)
-public class JFRPulseEvent extends TimedEvent {
-
-    @ValueDefinition(name="pulseID", description="Pulse number", contentType=ContentType.None, relationKey="http://www.oracle.com/javafx/pulse/id")
-    private int pulseNumber;
-
-    @ValueDefinition(name="phaseName", description="Pulse phase name", contentType=ContentType.None)
-    private String phase;
-
-    public JFRPulseEvent(EventToken eventToken) {
-        super(eventToken);
-    }
-
-    public int getPulseNumber() {
-        return pulseNumber;
-    }
-
-    public void setPulseNumber(int n) {
-        pulseNumber = n;
-    }
-
-    public String getPhase() {
-        return phase;
-    }
-
-    public void setPhase(String s) {
-        phase = s;
-    }
-}
--- a/modules/javafx.base/src/main/java/com/sun/javafx/logging/PulseLogger.java	Thu Mar 01 12:01:23 2018 +0530
+++ b/modules/javafx.base/src/main/java/com/sun/javafx/logging/PulseLogger.java	Fri Mar 02 05:46:23 2018 -0800
@@ -42,19 +42,21 @@
         if (logger != null) {
             list.add(logger);
         }
-        try {
-            Class klass = Class.forName("com.sun.javafx.logging.JFRLogger");
-            if (klass != null) {
-                Method method = klass.getDeclaredMethod("getInstance");
-                logger = (Logger) method.invoke(null);
-                if (logger != null) {
-                    list.add(logger);
-                }
-            }
-        }
-        catch (NoClassDefFoundError | ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
-            // Ignore
-        }
+
+//        // Another optional logger could be added as follows:
+//        try {
+//            Class klass = Class.forName("com.sun.javafx.logging.OtherLogger");
+//            if (klass != null) {
+//                Method method = klass.getDeclaredMethod("getInstance");
+//                logger = (Logger) method.invoke(null);
+//                if (logger != null) {
+//                    list.add(logger);
+//                }
+//            }
+//        }
+//        catch (NoClassDefFoundError | ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+//            // Ignore
+//        }
 
         loggers = list.toArray(new Logger[list.size()]);
         PULSE_LOGGING_ENABLED = loggers.length > 0;
--- a/netbeans/base/nbproject/build-impl.xml	Thu Mar 01 12:01:23 2018 +0530
+++ b/netbeans/base/nbproject/build-impl.xml	Fri Mar 02 05:46:23 2018 -0800
@@ -165,7 +165,6 @@
             <or>
                 <available file="${src.dir}"/>
                 <available file="${src.version-info.dir}"/>
-                <available file="${src.java-jfr.dir}"/>
             </or>
         </condition>
         <condition property="netbeans.home+have.tests">
@@ -254,7 +253,6 @@
     <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
         <fail unless="src.dir">Must set src.dir</fail>
         <fail unless="src.version-info.dir">Must set src.version-info.dir</fail>
-        <fail unless="src.java-jfr.dir">Must set src.java-jfr.dir</fail>
         <fail unless="test.src.dir">Must set test.src.dir</fail>
         <fail unless="build.dir">Must set build.dir</fail>
         <fail unless="dist.dir">Must set dist.dir</fail>
@@ -276,7 +274,7 @@
     </target>
     <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.dir}:${src.version-info.dir}:${src.java-jfr.dir}" name="srcdir"/>
+            <attribute default="${src.dir}:${src.version-info.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <attribute default="${javac.processorpath}" name="processorpath"/>
@@ -317,7 +315,7 @@
     </target>
     <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.dir}:${src.version-info.dir}:${src.java-jfr.dir}" name="srcdir"/>
+            <attribute default="${src.dir}:${src.version-info.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <attribute default="${javac.processorpath}" name="processorpath"/>
@@ -350,7 +348,7 @@
     </target>
     <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
         <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.dir}:${src.version-info.dir}:${src.java-jfr.dir}" name="srcdir"/>
+            <attribute default="${src.dir}:${src.version-info.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <sequential>
@@ -961,14 +959,13 @@
                 <include name="*"/>
             </dirset>
         </pathconvert>
-        <j2seproject3:depend srcdir="${src.dir}:${src.version-info.dir}:${src.java-jfr.dir}:${build.generated.subdirs}"/>
+        <j2seproject3:depend srcdir="${src.dir}:${src.version-info.dir}:${build.generated.subdirs}"/>
     </target>
     <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
         <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
         <copy todir="${build.classes.dir}">
             <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.version-info.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
-            <fileset dir="${src.java-jfr.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
         </copy>
     </target>
     <target if="has.persistence.xml" name="-copy-persistence-xml">
@@ -989,7 +986,7 @@
     <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
         <j2seproject3:force-recompile/>
-        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.version-info.dir}:${src.java-jfr.dir}"/>
+        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.version-info.dir}"/>
     </target>
     <target name="-post-compile-single">
         <!-- Empty placeholder for easier customization. -->
@@ -1264,9 +1261,6 @@
             <fileset dir="${src.version-info.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
                 <filename name="**/*.java"/>
             </fileset>
-            <fileset dir="${src.java-jfr.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
-                <filename name="**/*.java"/>
-            </fileset>
             <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
                 <include name="**/*.java"/>
                 <exclude name="*.java"/>
@@ -1280,9 +1274,6 @@
             <fileset dir="${src.version-info.dir}" excludes="${excludes}" includes="${includes}">
                 <filename name="**/doc-files/**"/>
             </fileset>
-            <fileset dir="${src.java-jfr.dir}" excludes="${excludes}" includes="${includes}">
-                <filename name="**/doc-files/**"/>
-            </fileset>
             <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
                 <include name="**/doc-files/**"/>
             </fileset>
--- a/netbeans/base/nbproject/genfiles.properties	Thu Mar 01 12:01:23 2018 +0530
+++ b/netbeans/base/nbproject/genfiles.properties	Fri Mar 02 05:46:23 2018 -0800
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=1dc297ee
+build.xml.data.CRC32=e91acb8f
 build.xml.script.CRC32=1943b7b2
 build.xml.stylesheet.CRC32=8064a381@1.75.2.48
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=1dc297ee
-nbproject/build-impl.xml.script.CRC32=27275d1e
+nbproject/build-impl.xml.data.CRC32=e91acb8f
+nbproject/build-impl.xml.script.CRC32=514ef4a3
 nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
--- a/netbeans/base/nbproject/project.properties	Thu Mar 01 12:01:23 2018 +0530
+++ b/netbeans/base/nbproject/project.properties	Fri Mar 02 05:46:23 2018 -0800
@@ -29,7 +29,6 @@
 excludes=
 file.reference.main-java=../../modules/javafx.base/src/main/java
 file.reference.main-java8=../../modules/javafx.base/src/main/java8
-file.reference.main-java-jfr=../../modules/javafx.base/src/main/java-jfr
 file.reference.main-version-info=../../modules/javafx.base/src/main/version-info
 file.reference.test-java=../../modules/javafx.base/src/test/java
 includes=**
@@ -80,6 +79,5 @@
     ${build.test.classes.dir}
 source.encoding=UTF-8
 src.dir=${file.reference.main-java}
-src.java-jfr.dir=${file.reference.main-java-jfr}
 src.version-info.dir=${file.reference.main-version-info}
 test.src.dir=${file.reference.test-java}
--- a/netbeans/base/nbproject/project.xml	Thu Mar 01 12:01:23 2018 +0530
+++ b/netbeans/base/nbproject/project.xml	Fri Mar 02 05:46:23 2018 -0800
@@ -8,7 +8,6 @@
             <source-roots>
                 <root id="src.dir"/>
                 <root id="src.version-info.dir" name="version-info"/>
-                <root id="src.java-jfr.dir" name="java-jfr"/>
             </source-roots>
             <test-roots>
                 <root id="test.src.dir"/>