Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(jmc-core): Upgrade Java Mission Control to version 8.1.0 #99

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<java.version>11</java.version>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>
<jmc.version>7.1.1</jmc.version>
<jmc.version>8.1.0</jmc.version>

<org.apache.maven.plugins.compiler.version>3.8.1</org.apache.maven.plugins.compiler.version>
<org.apache.maven.plugins.surefire.version>3.0.0-M5</org.apache.maven.plugins.surefire.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
*
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The contents of this file are subject to the terms of either the Universal Permissive License
Expand All @@ -10,17 +10,17 @@
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
Expand All @@ -35,10 +35,10 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.openjdk.jmc.common.IPredicate;
import org.openjdk.jmc.rjmx.IConnectionHandle;
import org.openjdk.jmc.rjmx.subscription.IMBeanHelperService;
import org.openjdk.jmc.rjmx.subscription.IMRIMetadata;
Expand All @@ -60,7 +60,7 @@ public abstract class AbstractAttributeSubscription implements IMRISubscription
private final IMRIMetadata m_attributeInfo;
private MRIValueEvent m_lastEvent;
private IUpdatePolicy m_updatePolicy;
private final IPredicate<Object> m_valueFilter;
private final Predicate<Object> m_valueFilter;

/**
* Constructor for AbstractAttribute.
Expand Down Expand Up @@ -180,7 +180,7 @@ public MRIValueEvent getLastMRIValueEvent() {
* the newly created event.
*/
protected void storeAndFireEvent(MRIValueEvent event) {
if (m_valueFilter != null && m_valueFilter.evaluate(event.getValue())) {
if (m_valueFilter != null && m_valueFilter.test(event.getValue())) {
LOGGER.log(Level.INFO, "Subscription filtered out value: " + event.getValue()); //$NON-NLS-1$
return;
}
Expand Down Expand Up @@ -235,16 +235,16 @@ public String toString() {
return getClass().getName() + '[' + getMRIMetadata() + ']';
}

private static IPredicate<Object> getValueFilter(IMRIMetadata metadata) {
private static Predicate<Object> getValueFilter(IMRIMetadata metadata) {
// FIXME: We hard code the filters for now, but this should be handled along with content types
String mri = metadata.getMRI().getQualifiedName();
if ("attribute://java.lang:type=OperatingSystem/ProcessCpuLoad".equals(mri) //$NON-NLS-1$
|| "attribute://java.lang:type=OperatingSystem/SystemCpuLoad".equals(mri) //$NON-NLS-1$
|| "attribute://java.lang:type=OperatingSystem/SystemLoadAverage".equals(mri)) { //$NON-NLS-1$
return new IPredicate<Object>() {
return new Predicate<Object>() {

@Override
public boolean evaluate(Object value) {
public boolean test(Object value) {
return !(value instanceof Number) || ((Number) value).doubleValue() < 0;
}
};
Expand Down