@ManagedAttribute(description="Sets the size of the remove queue; creates a new remove queue") public void rqbRemoveQueueSize(int size) { if(size == queue_size) return; queue_size=size; remove_queue=new Message[queue_size]; }
protected void findFields(Object instance) { // traverse class hierarchy and find all annotated fields for(Class<?> clazz=instance.getClass(); clazz != null && clazz != Object.class; clazz=clazz.getSuperclass()) { Field[] fields=clazz.getDeclaredFields(); for(Field field: fields) { ManagedAttribute attr=field.getAnnotation(ManagedAttribute.class); Property prop=field.getAnnotation(Property.class); boolean expose_prop=prop != null && prop.exposeAsManagedAttribute(); boolean expose=attr != null || expose_prop; if(expose) { String fieldName=attr != null? attr.name() : (prop != null? prop.name() : null); if(fieldName != null && fieldName.trim().isEmpty()) fieldName=field.getName(); String descr=attr != null? attr.description() : prop.description(); boolean writable=attr != null? attr.writable() : prop.writable(); MBeanAttributeInfo info=new MBeanAttributeInfo(fieldName, field.getType().getCanonicalName(), descr, true, !Modifier.isFinal(field.getModifiers()) && writable, false); atts.put(fieldName, new AttributeEntry(field.getName(), info)); } } } }
@Override public String getName() { if (this.accessible.isAnnotationPresent(ManagedAttribute.class)) { String name = this.accessible.getAnnotation(ManagedAttribute.class).name(); if (!name.isEmpty()) return name; } if (this.accessible.isAnnotationPresent(Property.class)) { String name = this.accessible.getAnnotation(Property.class).name(); if (!name.isEmpty()) return name; } return null; }
@Override public String getDescription() { if (this.accessible.isAnnotationPresent(ManagedAttribute.class)) { return this.accessible.getAnnotation(ManagedAttribute.class).description(); } if (this.accessible.isAnnotationPresent(Property.class)) { return this.accessible.getAnnotation(Property.class).description(); } return this.accessible.toString(); }
return; boolean writable=(prop != null && prop.writable()) || (attr_annotation != null && attr_annotation.writable()); String attr_name=attr_annotation != null? attr_annotation.name() : prop != null? prop.name() : null; if(attr_name != null && !attr_name.trim().isEmpty()) attr_name=attr_name.trim(); String descr=attr_annotation != null ? attr_annotation.description() : prop != null? prop.description() : null; AttributeEntry attr=atts.get(attr_name); if(attr != null) {
String attr_name=attr_annotation != null? attr_annotation.name() : prop != null? prop.name() : null; if(attr_name != null && !attr_name.trim().isEmpty()) attr_name=attr_name.trim(); String method_name=attr_annotation != null? attr_annotation.name() : prop != null? prop.name() : null; if(method_name != null && !method_name.trim().isEmpty()) method_name=method_name.trim();
@Override public String getDescription() { if (this.accessible.isAnnotationPresent(ManagedAttribute.class)) { return this.accessible.getAnnotation(ManagedAttribute.class).description(); } if (this.accessible.isAnnotationPresent(Property.class)) { return this.accessible.getAnnotation(Property.class).description(); } return this.accessible.toString(); }
protected void findFields(Object instance) { // traverse class hierarchy and find all annotated fields for(Class<?> clazz=instance.getClass(); clazz != null && clazz != Object.class; clazz=clazz.getSuperclass()) { Field[] fields=clazz.getDeclaredFields(); for(Field field: fields) { ManagedAttribute attr=field.getAnnotation(ManagedAttribute.class); Property prop=field.getAnnotation(Property.class); boolean expose_prop=prop != null && prop.exposeAsManagedAttribute(); boolean expose=attr != null || expose_prop; if(expose) { String fieldName=attr != null? attr.name() : (prop != null? prop.name() : null); if(fieldName != null && fieldName.trim().isEmpty()) fieldName=field.getName(); String descr=attr != null? attr.description() : prop.description(); boolean writable=attr != null? attr.writable() : prop.writable(); MBeanAttributeInfo info=new MBeanAttributeInfo(fieldName, field.getType().getCanonicalName(), descr, true, !Modifier.isFinal(field.getModifiers()) && writable, false); atts.put(fieldName, new AttributeEntry(field.getName(), info)); } } } }
@ManagedAttribute(description="Whether or not to log suspect messages") public boolean isLogSuspectedMessages() { return log_suspected_msgs; } public void setLogSuspectedMessages(boolean log_suspected_msgs) {
@Override public String getName() { if (this.accessible.isAnnotationPresent(ManagedAttribute.class)) { String name = this.accessible.getAnnotation(ManagedAttribute.class).name(); if (!name.isEmpty()) return name; } if (this.accessible.isAnnotationPresent(Property.class)) { String name = this.accessible.getAnnotation(Property.class).name(); if (!name.isEmpty()) return name; } return null; }
@Override public String getDescription() { if (this.accessible.isAnnotationPresent(ManagedAttribute.class)) { return this.accessible.getAnnotation(ManagedAttribute.class).description(); } if (this.accessible.isAnnotationPresent(Property.class)) { return this.accessible.getAnnotation(Property.class).description(); } return this.accessible.toString(); }
return; boolean writable=(prop != null && prop.writable()) || (attr_annotation != null && attr_annotation.writable()); String attr_name=attr_annotation != null? attr_annotation.name() : prop != null? prop.name() : null; if(attr_name != null && !attr_name.trim().isEmpty()) attr_name=attr_name.trim(); String descr=attr_annotation != null ? attr_annotation.description() : prop != null? prop.description() : null; AttributeEntry attr=atts.get(attr_name); if(attr != null) {
@ManagedAttribute(description="Number of credit responses sent") public int getNumberOfCreditResponsesSent() { return num_credit_responses_sent; }
@Override public String getName() { if (this.accessible.isAnnotationPresent(ManagedAttribute.class)) { String name = this.accessible.getAnnotation(ManagedAttribute.class).name(); if (!name.isEmpty()) return name; } if (this.accessible.isAnnotationPresent(Property.class)) { String name = this.accessible.getAnnotation(Property.class).name(); if (!name.isEmpty()) return name; } return null; }
@ManagedAttribute public double getAverageFlushDuration() { return averageFlushDuration; }
String attr_name=attr_annotation != null? attr_annotation.name() : prop != null? prop.name() : null; if(attr_name != null && !attr_name.trim().isEmpty()) attr_name=attr_name.trim(); String method_name=attr_annotation != null? attr_annotation.name() : prop != null? prop.name() : null; if(method_name != null && !method_name.trim().isEmpty()) method_name=method_name.trim();
@ManagedAttribute(description="Number of credit requests sent") public int getNumberOfCreditRequestsSent() { return num_credit_requests_sent; }
@ManagedAttribute public long getTotalTimeInFlush() { return totalTimeInFlush; }
@ManagedAttribute public int getNumberOfFlushes() { return numberOfFlushes; }
@ManagedAttribute(description="Whether or not the current instance is the coordinator") public boolean isCoord() { return impl instanceof CoordGmsImpl; }