forked from OpenLiberty/open-liberty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue OpenLiberty#8611 add introspector for persistent executor
- Loading branch information
Showing
6 changed files
with
154 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...sistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorIntrospector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package com.ibm.ws.concurrent.persistent.internal; | ||
|
||
import java.io.PrintWriter; | ||
import java.security.AccessController; | ||
|
||
import org.osgi.framework.BundleContext; | ||
import org.osgi.framework.FrameworkUtil; | ||
import org.osgi.framework.ServiceReference; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.ConfigurationPolicy; | ||
|
||
import com.ibm.websphere.concurrent.persistent.PersistentExecutor; | ||
import com.ibm.websphere.ras.annotation.Trivial; | ||
import com.ibm.ws.kernel.service.util.SecureAction; | ||
import com.ibm.wsspi.logging.Introspector; | ||
|
||
/** | ||
* Introspector for persistent executors. | ||
*/ | ||
@Component(configurationPolicy = ConfigurationPolicy.IGNORE) | ||
public class PersistentExecutorIntrospector implements Introspector { | ||
@Override | ||
@Trivial | ||
public String getIntrospectorName() { | ||
System.out.println("getIntrospectorName"); | ||
return "PersistentExecutorIntrospector"; | ||
} | ||
|
||
@Override | ||
@Trivial | ||
public String getIntrospectorDescription() { | ||
System.out.println("getIntrospectorDescription"); | ||
return "Persistent timers/tasks diagnostics"; | ||
} | ||
|
||
@Override | ||
public void introspect(PrintWriter out) throws Exception { | ||
SecureAction priv = AccessController.doPrivileged(SecureAction.get()); | ||
BundleContext bundleContext = priv.getBundleContext(FrameworkUtil.getBundle(getClass())); | ||
|
||
for (ServiceReference<PersistentExecutor> ref : priv.getServiceReferences(bundleContext, PersistentExecutor.class, "(!(com.ibm.wsspi.resource.ResourceFactory=true))")) { | ||
System.out.println("Found service reference: " + ref); | ||
PersistentExecutorImpl executor = (PersistentExecutorImpl) priv.getService(bundleContext, ref); | ||
executor.introspect(out); | ||
} | ||
|
||
ServiceReference<ApplicationTracker> appTrackerRef = bundleContext.getServiceReference(ApplicationTracker.class); | ||
bundleContext.getService(appTrackerRef); | ||
|
||
ApplicationTracker appTracker = priv.getService(bundleContext, ApplicationTracker.class); | ||
appTracker.introspect(out); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters