public class Query extends Object implements QueryMBean
collectMetrics() and exportCollectedMetrics()).| Constructor and Description |
|---|
Query(ObjectName objectName)
Creates a Query on the given
objectName. |
Query(String objectName)
Creates a Query on the given
objectName. |
| Modifier and Type | Method and Description |
|---|---|
Query |
addAttribute(QueryAttribute attribute)
Add the given attribute to the list attributes of this query
and maintains the reverse relation (see
QueryAttribute.getQuery()). |
Query |
addAttribute(String attributeName)
Create a basic
QueryAttribute, add it to the list attributes of this query
and maintains the reverse relation (see QueryAttribute.getQuery()). |
void |
collectMetrics()
Collect the values for this query and store them as
QueryResult in the queryResults queue |
int |
exportCollectedMetrics()
Export the collected metrics to the OutputWriters associated with this Query
(see
getEffectiveOutputWriters()). |
int |
getCollectedMetricsCount() |
int |
getCollectionCount() |
long |
getCollectionDurationInNanos() |
int |
getDiscardedResultsCount()
Returns the number of discarded elements in the
queryResults queue
or -1 if the queue is not a DiscardingBlockingQueue. |
List<OutputWriter> |
getEffectiveOutputWriters()
Return the
outputWriters to which the collected metrics of this Query are exported,
the outputWriters declared at query level or a the parent level. |
EmbeddedJmxTrans |
getEmbeddedJmxTrans() |
int |
getExportCount() |
long |
getExportDurationInNanos() |
int |
getExportedMetricsCount() |
String |
getId() |
ObjectName |
getObjectName() |
List<OutputWriter> |
getOutputWriters() |
Collection<QueryAttribute> |
getQueryAttributes() |
String |
getResultAlias() |
BlockingQueue<QueryResult> |
getResults() |
void |
setEmbeddedJmxTrans(EmbeddedJmxTrans embeddedJmxTrans) |
void |
setId(String id) |
void |
setResultAlias(String resultAlias) |
void |
setResultsQueue(BlockingQueue<QueryResult> queryResultQueue)
WARNING: queryResults queue should not be changed at runtime as the operation is not thread safe.
|
void |
start()
Start all the OutputWriters attached to this Query
|
void |
stop()
Stop all the OutputWriters attached to this Query
|
String |
toString() |
public Query(@Nonnull String objectName)
objectName.objectName - ObjectName to query, can contain wildcards ('*' or '?')public Query(@Nonnull ObjectName objectName)
objectName.objectName - ObjectName to query, can contain wildcards ('*' or '?')public void collectMetrics()
QueryResult in the queryResults queuecollectMetrics in interface QueryMBeanpublic int exportCollectedMetrics()
getEffectiveOutputWriters()).
Metrics are batched according to EmbeddedJmxTrans.getExportBatchSize()exportCollectedMetrics in interface QueryMBean@PostConstruct public void start() throws Exception
Exception@PreDestroy public void stop() throws Exception
Exception@Nonnull public ObjectName getObjectName()
getObjectName in interface QueryMBean@Nonnull public Collection<QueryAttribute> getQueryAttributes()
@Nonnull public Query addAttribute(@Nonnull QueryAttribute attribute)
QueryAttribute.getQuery()).attribute - attribute to add@Nonnull public Query addAttribute(@Nonnull String attributeName)
QueryAttribute, add it to the list attributes of this query
and maintains the reverse relation (see QueryAttribute.getQuery()).attributeName - attribute to add@Nonnull public BlockingQueue<QueryResult> getResults()
public void setResultsQueue(@Nonnull BlockingQueue<QueryResult> queryResultQueue)
public EmbeddedJmxTrans getEmbeddedJmxTrans()
public void setEmbeddedJmxTrans(EmbeddedJmxTrans embeddedJmxTrans)
@Nonnull public List<OutputWriter> getEffectiveOutputWriters()
outputWriters to which the collected metrics of this Query are exported,
the outputWriters declared at query level or a the parent level.@Nonnull public List<OutputWriter> getOutputWriters()
@Nullable public String getResultAlias()
getResultAlias in interface QueryMBeanpublic int getCollectedMetricsCount()
getCollectedMetricsCount in interface QueryMBeanpublic long getCollectionDurationInNanos()
getCollectionDurationInNanos in interface QueryMBeanpublic int getCollectionCount()
getCollectionCount in interface QueryMBeanpublic int getExportedMetricsCount()
getExportedMetricsCount in interface QueryMBeanpublic long getExportDurationInNanos()
getExportDurationInNanos in interface QueryMBeanpublic int getExportCount()
getExportCount in interface QueryMBeanpublic String getId()
getId in interface QueryMBeanpublic void setId(String id)
public int getDiscardedResultsCount()
queryResults queue
or -1 if the queue is not a DiscardingBlockingQueue.getDiscardedResultsCount in interface QueryMBeanCopyright © 2017. All Rights Reserved.