Skip to content

Commit

Permalink
- Reverted renaming of attributes (https://issues.redhat.com/browse/J…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Jul 31, 2024
1 parent dc64687 commit 5fad6bf
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/org/jgroups/jmx/ResourceDMBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ public class ResourceDMBean implements DynamicMBean {

static {OBJECT_METHODS=new ArrayList<>(Arrays.asList(Object.class.getMethods()));}

protected static final Predicate<AccessibleObject> FILTER=obj -> obj.isAnnotationPresent(ManagedAttribute.class) ||
(obj.isAnnotationPresent(Property.class) && obj.getAnnotation(Property.class).exposeAsManagedAttribute());
protected static final Predicate<AccessibleObject> FILTER=obj -> !obj.isAnnotationPresent(Deprecated.class) &&
(obj.isAnnotationPresent(ManagedAttribute.class) ||
(obj.isAnnotationPresent(Property.class) && obj.getAnnotation(Property.class).exposeAsManagedAttribute()));

public ResourceDMBean(Object instance) {
this(instance, null);
Expand Down
14 changes: 13 additions & 1 deletion src/org/jgroups/protocols/FlowControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static org.jgroups.Message.TransientFlag.DONT_BLOCK;
import static org.jgroups.Message.TransientFlag.DONT_LOOPBACK;
import static org.jgroups.conf.AttributeType.SCALAR;


/**
Expand Down Expand Up @@ -111,12 +112,23 @@ public void resetStats() {
public <T extends FlowControl> T setMinCredits(long m) {min_credits=m; return (T)this;}
public long getMaxBlockTime() {return max_block_time;}
public <T extends FlowControl> T setMaxBlockTime(long t) {max_block_time=t; return (T)this;}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumberOfCreditRequestsReceived() {return num_credit_requests_received;}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumberOfCreditRequestsSent() {return num_credit_requests_sent;}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumberOfCreditResponsesReceived() {return num_credit_responses_received;}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumberOfCreditResponsesSent() {return num_credit_responses_sent;}


public abstract String printSenderCredits();

@ManagedOperation(description="Print receiver credits")
Expand Down
5 changes: 3 additions & 2 deletions src/org/jgroups/protocols/Locking.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.jgroups.blocks.locking.AwaitInfo;
import org.jgroups.blocks.locking.LockInfo;
import org.jgroups.blocks.locking.LockNotification;
import org.jgroups.conf.AttributeType;
import org.jgroups.stack.Protocol;
import org.jgroups.util.*;

Expand Down Expand Up @@ -122,10 +123,10 @@ public String getView() {
return view != null? view.toString() : null;
}

@ManagedAttribute(description="Number of server locks (only on coord)")
@ManagedAttribute(description="Number of server locks (only on coord)",type=AttributeType.SCALAR)
public int getNumServerLocks() {return server_locks.size();}

@ManagedAttribute(description="Number of client locks")
@ManagedAttribute(description="Number of client locks",type=AttributeType.SCALAR)
public int getNumClientLocks() {return client_lock_table.numLocks();}

public void init() throws Exception {
Expand Down
7 changes: 7 additions & 0 deletions src/org/jgroups/protocols/RED.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import static org.jgroups.conf.AttributeType.SCALAR;

/**
* Implementation of Random Early Drop: messages are discarded when the bundler's queue in the transport nears exhaustion.
* See Floyd and Van Jacobsen's paper for details.
Expand Down Expand Up @@ -62,7 +64,12 @@ public class RED extends Protocol {
public boolean isEnabled() {return enabled;}
public RED setEnabled(boolean e) {enabled=e; return this;}
public double getMinThreshold() {return min_threshold;}
/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@SuppressWarnings("DeprecatedIsStillUsed")
@ManagedAttribute(type=SCALAR) @Deprecated
public long getDroppedMessages() {return dropped_msgs.sum();}
/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getTotalMessages() {return total_msgs.sum();}
@ManagedAttribute(description="Percentage of all messages that were dropped")
public double getDropRate() {return dropped_msgs.sum() / (double)total_msgs.sum();}
Expand Down
20 changes: 20 additions & 0 deletions src/org/jgroups/protocols/TP.java
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,26 @@ public <T extends TP> T setThreadPool(Executor thread_pool) {
return (T)this;
}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumRejectedMsgs() {return thread_pool.numberOfRejectedMessages();}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumberOfThreadDumps() {return thread_pool.getNumberOfThreadDumps();}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumUcastMsgsSent() {return msg_stats.getNumUcastsSent();}
/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumMcastMsgsSent() {return msg_stats.getNumMcastsSent();}
/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumUcastMsgsReceived() {return msg_stats.getNumUcastsReceived();} /** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumMcastMsgsReceived() {return msg_stats.getNumMcastsReceived();}

public ThreadFactory getThreadFactory() {
return thread_factory;
}
Expand Down
18 changes: 12 additions & 6 deletions src/org/jgroups/protocols/UNICAST3.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,22 @@ public Table<Message> getSendWindow(Address target) {
return entry != null? entry.msgs : null;
}

@ManagedAttribute(description="Returns the number of outgoing (send) connections")
@ManagedAttribute(description="Returns the number of outgoing (send) connections",type=SCALAR)
public int getNumSendConnections() {
return send_table.size();
}

@ManagedAttribute(description="Returns the number of incoming (receive) connections")
@ManagedAttribute(description="Returns the number of incoming (receive) connections",type=SCALAR)
public int getNumReceiveConnections() {
return recv_table.size();
}

@ManagedAttribute(description="Returns the total number of outgoing (send) and incoming (receive) connections")
@ManagedAttribute(description="Returns the total number of outgoing (send) and incoming (receive) connections",type=SCALAR)
public int getNumConnections() {
return getNumReceiveConnections() + getNumSendConnections();
}

@ManagedAttribute(description="Next seqno issued by the timestamper")
@ManagedAttribute(description="Next seqno issued by the timestamper",type=SCALAR)
public int getTimestamper() {return timestamper.get();}

public int getAckThreshold() {return ack_threshold;}
Expand Down Expand Up @@ -267,9 +267,15 @@ public String printConnections() {
return sb.toString();
}


/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumMessagesSent() {return num_msgs_sent.sum();}

/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumMessagesReceived() {return num_msgs_received.sum();}


public long getNumAcksSent() {return num_acks_sent.sum();}
public long getNumAcksReceived() {return num_acks_received.sum();}
public long getNumXmits() {return num_xmits.sum();}
Expand All @@ -288,7 +294,7 @@ public UNICAST3 setMaxRetransmitTime(long max_retransmit_time) {
@ManagedAttribute(description="Is the retransmit task running")
public boolean isXmitTaskRunning() {return xmit_task != null && !xmit_task.isDone();}

@ManagedAttribute
@ManagedAttribute(type=SCALAR)
public int getAgeOutCacheSize() {
return cache != null? cache.size() : 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/jgroups/protocols/pbcast/FLUSH.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public long getTotalTimeInFlush() {
return totalTimeInFlush;
}

@ManagedAttribute
@ManagedAttribute(type=AttributeType.SCALAR)
public int getNumberOfFlushes() {
return numberOfFlushes;
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/jgroups/protocols/pbcast/GMS.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public String printPreviousMembers() {



@ManagedAttribute
@ManagedAttribute(type=AttributeType.SCALAR)
public int getViewHandlerSize() {return view_handler.size();}
@ManagedAttribute
public boolean isViewHandlerSuspended() {return view_handler.suspended();}
Expand Down
11 changes: 10 additions & 1 deletion src/org/jgroups/protocols/pbcast/STABLE.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,18 @@ public STABLE() {

// @ManagedAttribute(name="bytes_received")
public long getBytes() {return num_bytes_received;}
@ManagedAttribute(description="The number of votes for the current digest")
@ManagedAttribute(description="The number of votes for the current digest",type=SCALAR)
public int getNumVotes() {return votes != null? votes.cardinality() : 0;}

@ManagedAttribute(type=SCALAR)
public long getStableReceived() {return num_stable_msgs_received.sum();}
@ManagedAttribute(type=SCALAR)
public long getStableSent() {return num_stable_msgs_sent.sum();}
@ManagedAttribute(type=SCALAR)
public long getStabilityReceived() {return num_stability_msgs_received.sum();}
@ManagedAttribute(type=SCALAR)
public long getStabilitySent() {return num_stability_msgs_received.sum();}

@ManagedAttribute
public boolean getStableTaskRunning() {
stable_task_lock.lock();
Expand Down
6 changes: 6 additions & 0 deletions src/org/jgroups/protocols/pbcast/STATE_TRANSFER.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ public class STATE_TRANSFER extends Protocol implements ProcessingQueue.Handler<
protected volatile boolean waiting_for_state_response=false;

protected boolean flushProtocolInStack=false;
/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumberOfStateRequests() {return num_state_reqs.sum();}
/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public long getNumberOfStateBytesSent() {return num_bytes_sent.sum();}
/** Don't remove! https://issues.redhat.com/browse/JGRP-2814 */
@ManagedAttribute(type=SCALAR) @Deprecated
public double getAverageStateSize() {return avg_state_size;}

public List<Integer> requiredDownServices() {
Expand Down

0 comments on commit 5fad6bf

Please sign in to comment.