本文整理汇总了Java中org.jboss.as.server.CurrentServiceContainer.getServiceContainer方法的典型用法代码示例。如果您正苦于以下问题:Java CurrentServiceContainer.getServiceContainer方法的具体用法?Java CurrentServiceContainer.getServiceContainer怎么用?Java CurrentServiceContainer.getServiceContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.server.CurrentServiceContainer
的用法示例。
在下文中一共展示了CurrentServiceContainer.getServiceContainer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGet
import org.jboss.as.server.CurrentServiceContainer; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
ServiceContainer sc = CurrentServiceContainer.getServiceContainer();
// for(ServiceName sn: sc.getServiceNames()) {
// log.info("" + sn);
// }
ServiceName sn = ServiceName.of("jboss", "infinispan", "web", "repl");
ServiceController scon = sc.getService(sn);
Cache cache = (Cache)scon.getValue();
log.info("" + cache);
String path = req.getPathInfo();
Object o = null;
if ("/put".equals(path)) {
cache.put("test", "blah");
}
else if ("/get".equals(path)) {
o = cache.get("test");
}
res.setContentType("text/html");
PrintWriter out = res.getWriter();
if (o != null) {
out.println(o);
}
}
示例2: currentServiceContainer
import org.jboss.as.server.CurrentServiceContainer; //导入方法依赖的package包/类
private ServiceContainer currentServiceContainer() {
if(System.getSecurityManager() == null) {
return CurrentServiceContainer.getServiceContainer();
}
return AccessController.doPrivileged(new PrivilegedAction<ServiceContainer>() {
@Override
public ServiceContainer run() {
return CurrentServiceContainer.getServiceContainer();
}
});
}
示例3: initialize
import org.jboss.as.server.CurrentServiceContainer; //导入方法依赖的package包/类
/**
* Install the MSC service which listens for JMX notifications.
*/
@Override
public void initialize(ExtensionContext context) {
log.info("Initializing " + EXTENSION_NAME);
container = CurrentServiceContainer.getServiceContainer();
if(container.getService(JMXNotificationsService.SERVICE_NAME) == null) {
log.info("Installing " + JMXNotificationsService.SERVICE_NAME);
final ServiceTarget target = container.subTarget();
JMXNotificationsService service = new JMXNotificationsService();
target.addService(JMXNotificationsService.SERVICE_NAME, service)
.install();
}
}
示例4: getWebServer
import org.jboss.as.server.CurrentServiceContainer; //导入方法依赖的package包/类
private static WebServer getWebServer() {
WebServer result = null;
ServiceName service = ServiceName.JBOSS.append("web");
ServiceContainer container = CurrentServiceContainer.getServiceContainer();
ServiceController<?> controller = container.getService(service);
if (controller == null) {
LOGGER.log(Level.SEVERE, "The service controller is null!");
} else {
result = (WebServer) controller.getService();
}
return result;
}
示例5: listServiceNames
import org.jboss.as.server.CurrentServiceContainer; //导入方法依赖的package包/类
public static String listServiceNames() {
String s = "";
ServiceContainer sc = CurrentServiceContainer.getServiceContainer();
List<ServiceName> names = sc.getServiceNames();
for(ServiceName n: names) {
log.info(n.toString());
s += n.toString() + "\n";
}
return s;
}