public abstract class JConsolePlugin extends Object
service provider
mechanism to search the JConsole plugins. Users can provide their JConsole plugins in a jar file containing a file named META-INF/services/com.sun.tools.jconsole.JConsolePlugin
This file contains one line for each plugin, for example,
com.sun.example.JTop
which is the fully qualified class name of the class implementing JConsolePlugin
.
To load the JConsole plugins in JConsole, run:
jconsole -pluginpath <plugin-path>
where <plugin-path>
specifies the paths of JConsole plugins to look up which can be a directory or a jar file. Multiple paths are separated by the path separator character of the platform.
When a new JConsole window is created for a connection, an instance of each JConsolePlugin
will be created. The JConsoleContext
object is not available at its construction time. JConsole will set the JConsoleContext
object for a plugin after the plugin object is created. It will then call its getTabs
method and add the returned tabs to the JConsole window.
Modifier | Constructor | Description |
---|---|---|
protected |
Constructor. |
Modifier and Type | Method | Description |
---|---|---|
final void |
addContextPropertyChangeListener |
Adds a PropertyChangeListener to the JConsoleContext object for this plugin. |
void |
dispose() |
Dispose this plugin. |
final JConsoleContext |
getContext() |
Returns the JConsoleContext object representing the connection to an application. |
abstract Map |
getTabs() |
Returns the tabs to be added in JConsole window. |
abstract SwingWorker |
newSwingWorker() |
Returns a SwingWorker to perform the GUI update for this plugin at the same interval as JConsole updates the GUI. |
final void |
removeContextPropertyChangeListener |
Removes a PropertyChangeListener from the listener list of the JConsoleContext object for this plugin. |
final void |
setContext |
Sets the JConsoleContext object representing the connection to an application. |
protected JConsolePlugin()
public final void setContext(JConsoleContext context)
JConsoleContext
object representing the connection to an application. This method will be called only once after the plugin is created and before the getTabs()
is called. The given context
can be in any connection state
when this method is called.context
- a JConsoleContext
objectpublic final JConsoleContext getContext()
JConsoleContext
object representing the connection to an application. This method may return null
if it is called before the context
is initialized.JConsoleContext
object representing the connection to an application.public abstract Map<String,JPanel> getTabs()
The returned map contains one entry for each tab to be added in the tabbed pane in a JConsole window with the tab name as the key and the JPanel
object as the value. This method returns an empty map if no tab is added by this plugin. This method will be called from the Event Dispatch Thread once at the new connection time.
JPanel
object representing the tabs to be added in the JConsole window; or an empty map.public abstract SwingWorker<?,?> newSwingWorker()
SwingWorker
to perform the GUI update for this plugin at the same interval as JConsole updates the GUI. JConsole schedules the GUI update at an interval specified for a connection. This method will be called at every update to obtain a SwingWorker
for each plugin.
JConsole will invoke the execute()
method to schedule the returned SwingWorker
for execution if:
SwingWorker
object has not been executed (i.e. the SwingWorker.getState()
method returns PENDING
state); andSwingWorker
object returned in the previous update has completed the task if it was not null
(i.e. the SwingWorker.isDone
method returns true
).SwingWorker
object will not be scheduled to work. A plugin can schedule its own GUI update and this method will return null
.
SwingWorker
to perform the GUI update; or null
.public void dispose()
JConsoleContext
can be in any connection state
when this method is called.public final void addContextPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to the JConsoleContext
object for this plugin. This method is a convenient method for this plugin to register a listener when the JConsoleContext
object may or may not be available. For example, a plugin constructor can call this method to register a listener to listen to the connectionState
property changes and the listener will be added to the JConsoleContext
object when it is available.
listener
- The PropertyChangeListener
to be addedNullPointerException
- if listener
is null
.public final void removeContextPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from the listener list of the JConsoleContext
object for this plugin. If listener
was never added, no exception is thrown and no action is taken.listener
- the PropertyChangeListener
to be removedNullPointerException
- if listener
is null
.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.jconsole/com/sun/tools/jconsole/JConsolePlugin.html