Skip to content

Commit

Permalink
Fixes issue #24762 Replaces 2 debug locations to use AMXLoggerInfo
Browse files Browse the repository at this point in the history
instead instead of System.out. Removed all debug System out methods to
avoid using them in the future. No system.out used anymore in amx-core
module.
  • Loading branch information
escay committed Feb 7, 2024
1 parent 042920d commit 1e9626d
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 77 deletions.
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2006, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -61,10 +62,6 @@ public final class AMXJ2EEStartupService
org.glassfish.hk2.api.PreDestroy,
AMXLoader, ConfigListener {

private static void debug(final String s) {
System.out.println(s);
}

@Inject
private MBeanServer mMBeanServer;

Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -38,9 +39,6 @@
@AMXMBeanMetadata(singleton = true, globalSingleton = true, leaf = true)
public final class MBeanTracker implements NotificationListener, MBeanRegistration, MBeanTrackerMBean {

private static void debug(final Object o) {
System.out.println("" + o);
}
/**
* maps a parent ObjectName to a Set of children
*/
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -14,10 +15,6 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.glassfish.admin.amx.core;

import java.util.ArrayList;
Expand All @@ -40,11 +37,6 @@
@Taxonomy(stability = Stability.UNCOMMITTED)
public final class PathnameParser
{
private static void debug(final Object o)
{
System.out.println("" + o);
}

private final char mDelim;

private final char mNameLeft;
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -51,10 +52,6 @@ public final class Util {

private static final String QUOTE_CHAR = "\"";

private static void debug(final String s) {
System.out.println(s);
}

public static String quoteIfNeeded(String name) {
if(name.indexOf(":") > 1) {
return ObjectName.quote(name);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -66,10 +66,6 @@ public final class AMXStartupService
org.glassfish.hk2.api.PreDestroy,
AMXStartupServiceMBean {

private static void debug(final String s) {
System.out.println(s);
}

@Inject
ServiceLocator mHabitat;
@Inject
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -53,9 +54,6 @@ Responsible for loading ConfigBeanProxy MBeans (com.sun.enterprise.config.server
public final class AMXConfigLoader
implements TransactionListener {

private static void debug(final String s) {
System.out.println(s);
}
private volatile AMXConfigLoaderThread mLoaderThread;
private final Transactions mTransactions;
private final Logger mLogger = AMXLoggerInfo.getLogger();
Expand Down Expand Up @@ -209,7 +207,7 @@ private void sortAndDispatch(
issueAttributeChange(cb, propertyName, oldValue, newValue, whenChanged);
}
} else {
debug("AMXConfigLoader.sortAndDispatch: WARNING: source is not a ConfigBean");
mLogger.fine("AMXConfigLoader.sortAndDispatch: WARNING: source is not a ConfigBean");
}
}
}
Expand Down Expand Up @@ -482,8 +480,7 @@ private ObjectName createAndRegister(
//System.out.println( "AMXConfigLoader.createAndRegister(): REGISTERED: " + objectName + " at " + System.currentTimeMillis() );
//System.out.println( JMXUtil.toString( mServer.getMBeanInfo(objectName) ) );
} catch (final JMException e) {
debug(ExceptionUtil.toString(e));

mLogger.log(Level.WARNING, AMXLoggerInfo.cantRegister, new Object[]{getType(cb), getKey(cb), e});
objectName = null;
}
return objectName;
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -55,9 +56,6 @@ public final class AMXConfigStartupService
org.glassfish.hk2.api.PreDestroy,
AMXLoader {

private static void debug(final String s) {
System.out.println(s);
}
@Inject
InjectedValues mInjectedValues;
@Inject//(name=AppserverMBeanServerFactory.OFFICIAL_MBEANSERVER)
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -43,10 +44,6 @@
@Taxonomy( stability = Stability.UNCOMMITTED)
public class AttributeResolverHelper extends VariableResolver {

private static void debug(final String s) {
System.out.println("##### " + s);
}

public AttributeResolverHelper(final AMXConfigProxy amx) {
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -1601,12 +1601,6 @@ public Map<String, String> getDefaultValues(final boolean useAttributeNames)
}
return m;
}

private static void debug(final String s)
{
System.out.println("### " + s);
}

}


Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -13,12 +14,6 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package org.glassfish.admin.amx.impl.config;

import java.util.concurrent.ConcurrentHashMap;
Expand All @@ -35,7 +30,6 @@
*/
@Taxonomy( stability=Stability.NOT_AN_INTERFACE )
public final class ConfigBeanRegistry {
private static void debug( final String s ) { System.out.println(s); }

public static final class MBeanInstance
{
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -214,10 +215,6 @@ protected void doRun() throws InterruptedException {
}
}
}

private static void debug(final Object o) {
System.out.println(o.toString());
}
}


Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -24,10 +25,6 @@

public final class ImplUtil {

private static void debug(final String s) {
System.out.println(s);
}

/**
Unload this AMX MBean and all its children.
MBean should be unloaded at the leafs first, working back to DomainRoot so as to
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -13,11 +14,6 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.glassfish.admin.amx.impl.util;

import java.lang.annotation.Annotation;
Expand Down Expand Up @@ -61,9 +57,6 @@ public final class MBeanInfoSupport {
private MBeanInfoSupport() {
}

private static void debug(final Object o) {
System.out.println(o.toString());
}
private static MBeanInfo amxspiMBeanInfo = null;

public static synchronized MBeanInfo getAMX_SPIMBeanInfo() {
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -55,11 +56,6 @@ public ObjectNameBuilder(final MBeanServer mbeanServer, final ObjectName parent)
mJMXDomain = parent.getDomain();
}

private static void debug(final Object o) {
System.out.println("" + o);
//AMXDebug.getInstance().getOutput( "org.glassfish.admin.amx.support.ObjectNameBuilder" ).println( o );
}

public String getJMXDomain() {
return (mJMXDomain);
}
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -50,10 +51,6 @@ public void handleNotification(final Notification notifIn, final Object handback
}
}

private static void cdebug(final String s) {
System.out.println(s);
}

/**
Wait (block) until the MBean is unregistered.
@return true if unregistered, false if an error
Expand Down

0 comments on commit 1e9626d

Please sign in to comment.