@Override public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { return mbeanServer.queryMBeans(name, query); }
@Override public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { return mbeanServer.queryMBeans(name, query); }
@Override public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { return mbeanServer.queryMBeans(name, query); }
@Override public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { return mbeanServer.queryMBeans(name, query); }
/** * Gets MBeans controlled by the MBean server. This method allows any of the following to be obtained: All MBeans, a * set of MBeans specified by pattern matching on the ObjectName and/or a Query expression, a specific MBean. When * the object name is null or no domain and key properties are specified, all objects are to be selected (and * filtered if a query is specified). It returns the set of ObjectInstance objects (containing the ObjectName and * the Java Class name) for the selected MBeans. * * @param objectName The object name pattern identifying the MBeans to be retrieved. If null or no domain and key * properties are specified, all the MBeans registered will be retrieved. * @param queryExp The query expression to be applied for selecting MBeans. If null no query expression will be * applied for selecting MBean * @return A set containing the ObjectInstance objects for the selected MBeans. If no MBean satisfies the query an * empty list is returned. */ public static Set<ObjectInstance> queryMBeans(ObjectName objectName, QueryExp queryExp) { return mbeanServer.queryMBeans(objectName, queryExp); }
@Override public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { // We need to filter out the AccessControlMXBean so that the clients wouldn't see it if (query != null) return mbs.queryMBeans(name, Query.and(query, notAccessControlMBean)); else return mbs.queryMBeans(name, notAccessControlMBean); }
/** {@inheritDoc} */ @Override public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp qry) { return origin.queryMBeans(name, qry); }
public static List<MBeanPooledResource> of(String objectName, String poolTypeName, String mbeanKeyPropertyName, String mbeanActiveAttribute, String mbeanCountAttribute, String mbeanMaxAttribute, String mbeanQueueAttribute) { try { final Set<ObjectInstance> objectInstances = server.queryMBeans(new ObjectName(objectName), null); List<MBeanPooledResource> pools = new ArrayList<MBeanPooledResource>(objectInstances.size()); for (final ObjectInstance objectInstance : objectInstances) { pools.add(new MBeanPooledResource(poolTypeName, objectInstance.getObjectName(), mbeanKeyPropertyName, mbeanActiveAttribute, mbeanCountAttribute, mbeanMaxAttribute, mbeanQueueAttribute)); } return pools; } catch (Exception e) { logger.warn(e.getMessage() + " (this exception is ignored)", e); return new LinkedList<MBeanPooledResource>(); } }
Set<ObjectInstance> queryMBeans = null; try { queryMBeans = mbeanServer.queryMBeans(null, null); } catch (Exception ex) { LOG.error("Could not get Mbeans for monitoring", ex);
private boolean isMbeanRegistered(String cacheName, String type) throws MalformedObjectNameException { String query = "javax.cache:type=" + type + ",CacheManager=*,Cache=" + cacheName; return server.queryMBeans(ObjectName.getInstance(query), null).size() == 1; }
private Resource probeTransactions(MBeanServer mbs, boolean exposeAllLogs) throws OperationFailedException { try { ObjectName on = new ObjectName(osMBeanName); mbs.setAttribute(on, new javax.management.Attribute("ExposeAllRecordsAsMBeans", Boolean.valueOf(exposeAllLogs))); mbs.invoke(on, "probe", null, null); Set<ObjectInstance> transactions = mbs.queryMBeans(new ObjectName(osMBeanName + ",*"), null); final Resource resource = Resource.Factory.create(); addTransactions(resource, transactions, mbs); return resource; } catch (JMException e) { throw new OperationFailedException("Transaction discovery error: ", e); } catch (IOException e) { throw new OperationFailedException("Transaction discovery error: ", e); } }
private void addTransactions(final Resource parent, Set<ObjectInstance> transactions, MBeanServer mbs) throws IntrospectionException, InstanceNotFoundException, IOException, ReflectionException, MalformedObjectNameException { for (ObjectInstance oi : transactions) { String transactionId = oi.getObjectName().getCanonicalName(); if (!transactionId.contains("puid") && transactionId.contains("itype")) { final Resource transaction = new LogStoreResource.LogStoreRuntimeResource(oi.getObjectName()); final ModelNode model = transaction.getModel(); Map<String, String> tAttributes = getMBeanValues( mbs, oi.getObjectName(), LogStoreConstants.TXN_JMX_NAMES); String txnId = tAttributes.get("Id"); addAttributes(model, LogStoreConstants.MODEL_TO_JMX_TXN_NAMES, tAttributes); // model.get(LogStoreConstants.JMX_ON_ATTRIBUTE).set(transactionId); String participantQuery = transactionId + ",puid=*"; Set<ObjectInstance> participants = mbs.queryMBeans(new ObjectName(participantQuery), null); addParticipants(transaction, participants, mbs); final PathElement element = PathElement.pathElement(LogStoreConstants.TRANSACTIONS, txnId); parent.registerChild(element, transaction); } } }
if (!srv.queryMBeans(objName, null).isEmpty()) throw new IgniteCheckedException("MBean was already registered: " + objName); else {
/** {@inheritDoc} */ public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) { return delegate.queryMBeans(name, query); }
/** * Checks if is threading enabled. * * @return true, if is threading enabled */ public static boolean isThreadingEnabled() { try { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); ObjectName threadingOName = new ObjectName("java.lang:type=Threading"); Set<ObjectInstance> threading = mbeanServer.queryMBeans(threadingOName, null); return threading != null && !threading.isEmpty(); } catch (MalformedObjectNameException e) { logger.trace("", e); return false; } } }
private static void appendDomainInfo(StringBuffer pRet, MBeanServer pServer, String pDomain) { try { pRet.append(" == ").append(pDomain).append("\n"); Set<ObjectInstance> beans = pServer.queryMBeans(new ObjectName(pDomain + ":*"),null); for (ObjectInstance o : beans) { String n = o.getObjectName().getCanonicalKeyPropertyListString(); pRet.append(" ").append(n).append("\n"); } } catch (MalformedObjectNameException e) { // Shouldnt happen pRet.append(" INTERNAL ERROR: ").append(e).append("\n"); } } }
String serverName = getContainerWrapper().getTomcatContainer().getName(); Set<ObjectInstance> threadPools = server.queryMBeans(new ObjectName(serverName + ":type=ThreadPool,*"), null); poolNames = new ArrayList<>(threadPools.size()); for (ObjectInstance threadPool : threadPools) { Set<ObjectInstance> workers = server.queryMBeans( new ObjectName(threadPoolName.getDomain() + ":type=RequestProcessor,*"), null); server.queryMBeans(new ObjectName(serverName + ":type=Executor,*"), null); executorNames = new ArrayList<>(executors.size()); for (ObjectInstance executor : executors) {
if (mbeanServer.queryMBeans(threadingOName, null) != null && threadId != -1) {
@Test @DirtiesContext public void changeMessageHistoryPatterns() throws Exception { Set<ObjectInstance> mbeans = server.queryMBeans(null, null); boolean tested = false; for (ObjectInstance mbean : mbeans) { if (mbean.toString().contains("MessageHistoryConfigurer")) { ObjectName objectName = mbean.getObjectName(); try { server.setAttribute(objectName, new Attribute("ComponentNamePatternsString", "foo, bar")); fail("Exception expected"); } catch (MBeanException e) { assertThat(e.getTargetException(), instanceOf(IllegalStateException.class)); assertThat(e.getTargetException().getMessage(), containsString("cannot be changed")); } catch (Exception e) { throw e; } server.invoke(objectName, "stop", new Object[]{}, new String[]{}); server.setAttribute(objectName, new Attribute("ComponentNamePatternsString", "foo, bar")); assertEquals("bar,foo", server.getAttribute(objectName, "ComponentNamePatternsString")); tested = true; break; } } assertTrue(tested); }
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("single-config.xml", getClass()); MBeanServer server = context.getBean(MBeanServer.class); Set<ObjectInstance> mbeans = server.queryMBeans(null, null); int bits = 0; int count = 0;