src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RecordingInternals.java
author egahlin
Fri, 30 Aug 2019 20:39:38 +0200
branchJEP-349-branch
changeset 57971 aa7b1ea52413
parent 57360 5d043a159d5c
permissions -rw-r--r--
Add onError handler + various cleanup
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52850
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     1
/*
57360
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
52850
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     4
 *
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    10
 *
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    15
 * accompanied this code).
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    16
 *
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    20
 *
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    23
 * questions.
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    24
 */
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    25
package jdk.jfr.internal.consumer;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    26
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    27
import java.io.IOException;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    28
import java.util.List;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    29
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    30
import jdk.jfr.consumer.RecordedEvent;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    31
import jdk.jfr.consumer.RecordedObject;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    32
import jdk.jfr.consumer.RecordingFile;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    33
import jdk.jfr.internal.Type;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    34
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    35
public abstract class RecordingInternals {
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    36
57360
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    37
    public static RecordingInternals instance() {
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    38
        if (INSTANCE == null) {
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    39
            // Force initialization
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    40
            try {
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    41
                Class<?> c = RecordedObject.class;
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    42
                Class.forName(c.getName(), true, c.getClassLoader());
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    43
            } catch (ClassNotFoundException e) {
57971
aa7b1ea52413 Add onError handler + various cleanup
egahlin
parents: 57360
diff changeset
    44
                throw new InternalError("Should not happen");
57360
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    45
            }
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    46
        }
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    47
        return INSTANCE;
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    48
    }
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    49
52850
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    50
    public static RecordingInternals INSTANCE;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    51
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    52
    public abstract boolean isLastEventInChunk(RecordingFile file);
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    53
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    54
    public abstract Object getOffsetDataTime(RecordedObject event, String name);
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    55
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    56
    public abstract List<Type> readTypes(RecordingFile file) throws IOException;
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    57
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    58
    public abstract void sort(List<RecordedEvent> events);
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    59
57360
5d043a159d5c Preview
egahlin
parents: 52850
diff changeset
    60
    public abstract Parser newStringParser();
52850
f527b24990d7 8205516: JFR tool
egahlin
parents:
diff changeset
    61
}