annotate graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DelegatingDebugConfig.java @ 21554:b1530a6cce8c

renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 26 May 2015 23:21:15 +0200
parents graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DelegatingDebugConfig.java@2740dad59eb7
children f5b549811bac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 17069
diff changeset
23 package com.oracle.jvmci.debug;
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import java.io.*;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 import java.util.*;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 17069
diff changeset
28 import com.oracle.jvmci.debug.internal.*;
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 17069
diff changeset
29
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
30
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 public class DelegatingDebugConfig implements DebugConfig {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33 protected final DebugConfig delegate;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
35 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
36 * The features of a {@link DelegatingDebugConfig} that can be force
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
37 * {@linkplain DelegatingDebugConfig#enable(Feature) enabled}/
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
38 * {@linkplain DelegatingDebugConfig#disable(Feature) disabled} or
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
39 * {@linkplain DelegatingDebugConfig#delegate(Feature) delegated}.
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
40 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
41 public enum Feature {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
42 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
43 * @see Debug#isLogEnabledForMethod()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
44 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
45 LOG_METHOD,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
46 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
47 * @see Debug#isDumpEnabledForMethod()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
48 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
49 DUMP_METHOD,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
50 /**
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
51 * @see Debug#isVerifyEnabled()
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
52 */
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
53 VERIFY,
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
54 /**
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
55 * @see Debug#isVerifyEnabledForMethod()
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
56 */
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
57 VERIFY_METHOD,
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
58 /**
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
59 * @see Debug#isMeterEnabled()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
60 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
61 METER,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
62 /**
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
63 * @see Debug#isMemUseTrackingEnabled()
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
64 */
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
65 TRACK_MEM_USE,
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
66 /**
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
67 * @see Debug#isTimeEnabled()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
68 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
69 TIME,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
70 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
71 * @see DebugConfig#interceptException(Throwable)
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
72 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
73 INTERCEPT
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
74 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
75
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
76 private final Map<Feature, Boolean> featureState = new EnumMap<>(Feature.class);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
77
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
78 /**
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
79 * The debug levels of a {@link DelegatingDebugConfig} than can be
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
80 * {@linkplain DelegatingDebugConfig#override(Level, int) overridden} or
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
81 * {@linkplain DelegatingDebugConfig#delegate(Level) delegated}.
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
82 */
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
83 public enum Level {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
84 LOG,
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
85 DUMP
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
86 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
87
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
88 private final Map<Level, Integer> levelState = new EnumMap<>(Level.class);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
89
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
90 /**
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
91 * Creates a config that delegates to the {@link DebugScope#getConfig() current config}.
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
92 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
93 public DelegatingDebugConfig() {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
94 this(DebugScope.getConfig());
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
95 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
96
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
97 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
98 * Creates a config that delegates to a given config.
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
99 */
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
100 public DelegatingDebugConfig(DebugConfig delegate) {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
101 this.delegate = delegate;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
102 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
103
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
104 public DelegatingDebugConfig enable(Feature feature) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
105 featureState.put(feature, Boolean.TRUE);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
106 return this;
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
107 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
108
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
109 public DelegatingDebugConfig disable(Feature feature) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
110 featureState.put(feature, Boolean.FALSE);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
111 return this;
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
112 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
113
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
114 public DelegatingDebugConfig override(Level level, int newLevel) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
115 levelState.put(level, newLevel);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
116 return this;
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
117 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
118
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
119 public DelegatingDebugConfig delegate(Feature feature) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
120 featureState.put(feature, null);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
121 return this;
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
122 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
123
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
124 public DelegatingDebugConfig delegate(Level level) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
125 levelState.put(level, null);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
126 return this;
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
127 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
128
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
129 @Override
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
130 public int getLogLevel() {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
131 Integer ls = levelState.get(Level.LOG);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
132 if (ls == null) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
133 return delegate.getLogLevel();
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
134 }
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
135 return ls.intValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
136 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
137
13323
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13158
diff changeset
138 public boolean isLogEnabledForMethod() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
139 Boolean fs = featureState.get(Feature.LOG_METHOD);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
140 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
141 return delegate.isLogEnabledForMethod();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
142 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
143 return fs.booleanValue();
13323
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13158
diff changeset
144 }
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13158
diff changeset
145
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147 public boolean isMeterEnabled() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
148 Boolean fs = featureState.get(Feature.METER);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
149 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
150 return delegate.isMeterEnabled();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
151 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
152 return fs.booleanValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
155 public boolean isMemUseTrackingEnabled() {
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
156 Boolean fs = featureState.get(Feature.TRACK_MEM_USE);
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
157 if (fs == null) {
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
158 return delegate.isMemUseTrackingEnabled();
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
159 }
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
160 return fs.booleanValue();
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
161 }
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
162
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
163 @Override
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
164 public int getDumpLevel() {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
165 Integer ls = levelState.get(Level.DUMP);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
166 if (ls == null) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
167 return delegate.getDumpLevel();
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
168 }
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
169 return ls.intValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
170 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
171
13323
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13158
diff changeset
172 public boolean isDumpEnabledForMethod() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
173 Boolean fs = featureState.get(Feature.DUMP_METHOD);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
174 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
175 return delegate.isDumpEnabledForMethod();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
176 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
177 return fs.booleanValue();
13323
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13158
diff changeset
178 }
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13158
diff changeset
179
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
180 @Override
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
181 public boolean isVerifyEnabled() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
182 Boolean fs = featureState.get(Feature.VERIFY);
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
183 if (fs == null) {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
184 return delegate.isVerifyEnabled();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
185 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
186 return fs.booleanValue();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
187 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
188
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
189 public boolean isVerifyEnabledForMethod() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
190 Boolean fs = featureState.get(Feature.VERIFY_METHOD);
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
191 if (fs == null) {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
192 return delegate.isVerifyEnabledForMethod();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
193 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
194 return fs.booleanValue();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
195 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
196
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
197 @Override
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
198 public boolean isTimeEnabled() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
199 Boolean fs = featureState.get(Feature.TIME);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
200 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
201 return delegate.isTimeEnabled();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
202 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
203 return fs.booleanValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
204 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
205
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
206 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
207 public RuntimeException interceptException(Throwable e) {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
208 Boolean fs = featureState.get(Feature.INTERCEPT);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
209 if (fs == null || fs) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
210 return delegate.interceptException(e);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
211 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
212 return null;
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
213 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
214
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
215 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
216 public Collection<DebugDumpHandler> dumpHandlers() {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
217 return delegate.dumpHandlers();
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
218 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
219
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
220 @Override
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
221 public Collection<DebugVerifyHandler> verifyHandlers() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
222 return delegate.verifyHandlers();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
223 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
224
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
225 @Override
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
226 public PrintStream output() {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
227 return delegate.output();
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
228 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
229
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
230 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
231 public void addToContext(Object o) {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
232 delegate.addToContext(o);
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
233 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
234
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
235 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
236 public void removeFromContext(Object o) {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
237 delegate.removeFromContext(o);
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
238 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
239 }