org.glassfish.pfl.tf.spi.MethodMonitorBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webservices-rt Show documentation
Show all versions of webservices-rt Show documentation
This module contains the Metro runtime code.
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.glassfish.pfl.tf.spi;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author ken
*/
public abstract class MethodMonitorBase extends Named
implements MethodMonitor {
private final Class> cls;
private final MethodMonitorFactory mmf;
private final Collection myContents;
public static class MethodMonitorFactorySelfImpl extends
MethodMonitorFactoryBase {
private MethodMonitor mm ;
public MethodMonitorFactorySelfImpl( String name ) {
super( name ) ;
}
public void init( MethodMonitor mm ) {
this.mm = mm ;
}
public MethodMonitor create(Class> cls) {
return mm ;
}
}
protected MethodMonitorBase(final String name, final Class> cls ) {
this( name, cls, new MethodMonitorFactorySelfImpl( name )) ;
((MethodMonitorFactorySelfImpl)factory()).init(this);
}
protected MethodMonitorBase(final String name, final Class> cls,
final MethodMonitorFactory mmf) {
super("MethodMonitor", name);
this.cls = cls;
this.mmf = mmf;
final Set temp = new HashSet();
temp.add(this);
this.myContents = Collections.unmodifiableSet(temp);
}
protected MethodMonitorBase(final String name, final Class> cls,
final MethodMonitorFactory mmf, Set contents) {
super("MethodMonitor", name);
this.cls = cls;
this.mmf = mmf;
this.myContents = Collections.unmodifiableSet(contents);
}
public final Class> myClass() {
return cls;
}
public final MethodMonitorFactory factory() {
return mmf;
}
public final Collection contents() {
return myContents;
}
}