Return-Path: Delivered-To: apmail-jakarta-avalon-cvs-archive@apache.org Received: (qmail 97883 invoked from network); 6 Sep 2002 02:10:20 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 6 Sep 2002 02:10:20 -0000 Received: (qmail 10477 invoked by uid 97); 6 Sep 2002 02:11:00 -0000 Delivered-To: qmlist-jakarta-archive-avalon-cvs@jakarta.apache.org Received: (qmail 10411 invoked by uid 97); 6 Sep 2002 02:10:59 -0000 Mailing-List: contact avalon-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-cvs@jakarta.apache.org Received: (qmail 10394 invoked by uid 97); 6 Sep 2002 02:10:58 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 6 Sep 2002 02:10:13 -0000 Message-ID: <20020906021013.24841.qmail@icarus.apache.org> From: leif@apache.org To: jakarta-avalon-excalibur-cvs@apache.org Subject: cvs commit: jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces InstrumentDescriptor.java InstrumentManagerClient.java InstrumentSampleDescriptor.java InstrumentSampleSnapshot.java InstrumentableDescriptor.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N leif 2002/09/05 19:10:13 Modified: instrument-manager/src/java/org/apache/excalibur/instrument/manager AbstractInstrumentSample.java DefaultInstrumentManager.java InstrumentDescriptorLocalImpl.java InstrumentManagerClientLocalImpl.java InstrumentProxy.java InstrumentSample.java InstrumentSampleDescriptorLocalImpl.java InstrumentableDescriptorLocalImpl.java InstrumentableProxy.java instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces InstrumentDescriptor.java InstrumentManagerClient.java InstrumentSampleDescriptor.java InstrumentSampleSnapshot.java InstrumentableDescriptor.java Log: Add state versions to the nodes of the instrument tree to make it possible to be more efficient about discovering changes from a client. Revision Changes Path 1.2 +38 -3 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/AbstractInstrumentSample.java Index: AbstractInstrumentSample.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/AbstractInstrumentSample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractInstrumentSample.java 14 Aug 2002 14:58:21 -0000 1.1 +++ AbstractInstrumentSample.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -79,6 +79,9 @@ /** Array of registered InstrumentSampleListeners. */ private InstrumentSampleListener[] m_listeners; + /** State Version. */ + private int m_stateVersion; + /*--------------------------------------------------------------- * Constructors *-------------------------------------------------------------*/ @@ -291,7 +294,11 @@ if ( ( m_leaseExpirationTime > 0 ) && ( !m_expired ) ) { long newLeaseExpirationTime = System.currentTimeMillis() + lease; - m_leaseExpirationTime = Math.max( m_leaseExpirationTime, newLeaseExpirationTime ); + if ( newLeaseExpirationTime > m_leaseExpirationTime ) + { + m_leaseExpirationTime = newLeaseExpirationTime; + stateChanged(); + } } return m_leaseExpirationTime; @@ -328,11 +335,26 @@ m_interval, m_size, m_time, - getHistorySnapshot() ); + getHistorySnapshot(), + m_stateVersion ); } } /** + * Returns the stateVersion of the sample. The state version will be + * incremented each time any of the configuration of the sample is + * modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the sample. + */ + public int getStateVersion() + { + return m_stateVersion; + } + + /** * Registers a InstrumentSampleListener with a InstrumentSample given a name. * * @param listener The listener which should start receiving updates from the @@ -610,6 +632,8 @@ registerLeasedInstrumentSample( this ); } } + + stateChanged(); } /*--------------------------------------------------------------- @@ -791,6 +815,17 @@ history[ m_size - 1] = getValueInner(); return history; + } + + /** + * Called whenever the state of the sample is changed. + */ + protected void stateChanged() + { + m_stateVersion++; + + // Propagate to the parent + m_instrumentProxy.stateChanged(); } /** 1.2 +30 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/DefaultInstrumentManager.java Index: DefaultInstrumentManager.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/DefaultInstrumentManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DefaultInstrumentManager.java 14 Aug 2002 14:58:21 -0000 1.1 +++ DefaultInstrumentManager.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -116,6 +116,9 @@ /** Instrument used to profile the active thread count of the JVM. */ private ValueInstrument m_activeThreadCountInstrument; + + /** State Version. */ + private int m_stateVersion; /*--------------------------------------------------------------- * Constructors @@ -393,6 +396,8 @@ } } } + + stateChanged(); } @@ -442,6 +447,20 @@ return proxy.getDescriptor(); } + + /** + * Returns the stateVersion of the instrument manager. The state version + * will be incremented each time any of the configuration of the + * instrument manager or any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrument manager. + */ + int getStateVersion() + { + return m_stateVersion; + } /** * Returns an array of Descriptors for the Instrumentables managed by this @@ -549,6 +568,8 @@ instrumentableProxy.loadState( instrumentableConf ); } + + stateChanged(); } /** @@ -1251,6 +1272,14 @@ // Recurse to the child registerInstrumentableInner( child, proxy, fullChildName ); } + } + + /** + * Called whenever the state of the instrument manager is changed. + */ + protected void stateChanged() + { + m_stateVersion++; } } 1.2 +16 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentDescriptorLocalImpl.java Index: InstrumentDescriptorLocalImpl.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentDescriptorLocalImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentDescriptorLocalImpl.java 14 Aug 2002 14:58:21 -0000 1.1 +++ InstrumentDescriptorLocalImpl.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -158,6 +158,21 @@ return getInstrumentSampleDescriptorLocals(); } + + /** + * Returns the stateVersion of the instrument. The state version will be + * incremented each time any of the configuration of the instrument or + * any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrument. + */ + public int getStateVersion() + { + return m_instrumentProxy.getStateVersion(); + } + /*--------------------------------------------------------------- * InstrumentDescriptorLocal Methods *-------------------------------------------------------------*/ 1.2 +14 -4 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentManagerClientLocalImpl.java Index: InstrumentManagerClientLocalImpl.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentManagerClientLocalImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentManagerClientLocalImpl.java 14 Aug 2002 14:58:21 -0000 1.1 +++ InstrumentManagerClientLocalImpl.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -124,8 +124,18 @@ return m_manager.getInstrumentableDescriptors(); } - /*--------------------------------------------------------------- - * Methods - *-------------------------------------------------------------*/ + /** + * Returns the stateVersion of the instrument manager. The state version + * will be incremented each time any of the configuration of the + * instrument manager or any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrument manager. + */ + public int getStateVersion() + { + return m_manager.getStateVersion(); + } } 1.3 +35 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentProxy.java Index: InstrumentProxy.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentProxy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- InstrumentProxy.java 20 Aug 2002 03:27:12 -0000 1.2 +++ InstrumentProxy.java 6 Sep 2002 02:10:12 -0000 1.3 @@ -80,6 +80,9 @@ /** The most recent value set if this is a value instrument. */ private int m_lastValue; + /** State Version. */ + private int m_stateVersion; + /*--------------------------------------------------------------- * Constructors *-------------------------------------------------------------*/ @@ -570,6 +573,8 @@ "Don't know how to deal with the type: " + m_type ); } } + + stateChanged(); } /** @@ -604,6 +609,8 @@ m_sampleArray = null; m_sampleDescriptorArray = null; } + + stateChanged(); } /** @@ -722,6 +729,20 @@ } /** + * Returns the stateVersion of the instrument. The state version will be + * incremented each time any of the configuration of the instrument or + * any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrument. + */ + int getStateVersion() + { + return m_stateVersion; + } + + /** * Common code to add a listener to the list of listeners which will * receive updates of the value of the Instrument. * @@ -980,6 +1001,19 @@ } } } + + stateChanged(); + } + + /** + * Called whenever the state of the instrument is changed. + */ + protected void stateChanged() + { + m_stateVersion++; + + // Propagate to the parent + m_instrumentableProxy.stateChanged(); } /** 1.2 +12 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentSample.java Index: InstrumentSample.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentSample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentSample.java 14 Aug 2002 14:58:21 -0000 1.1 +++ InstrumentSample.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -149,6 +149,17 @@ InstrumentSampleSnapshot getSnapshot(); /** + * Returns the stateVersion of the sample. The state version will be + * incremented each time any of the configuration of the sample is + * modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the sample. + */ + int getStateVersion(); + + /** * Registers a InstrumentSampleListener with a InstrumentSample given a name. * * @param listener The listener which should start receiving updates from the 1.2 +15 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentSampleDescriptorLocalImpl.java Index: InstrumentSampleDescriptorLocalImpl.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentSampleDescriptorLocalImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentSampleDescriptorLocalImpl.java 14 Aug 2002 14:58:21 -0000 1.1 +++ InstrumentSampleDescriptorLocalImpl.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -174,6 +174,20 @@ return m_instrumentSample.getSnapshot(); } + /** + * Returns the stateVersion of the sample. The state version will be + * incremented each time any of the configuration of the sample is + * modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the sample. + */ + public int getStateVersion() + { + return m_instrumentSample.getStateVersion(); + } + /*--------------------------------------------------------------- * Methods InstrumentSampleDescriptorLocal *-------------------------------------------------------------*/ 1.2 +15 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentableDescriptorLocalImpl.java Index: InstrumentableDescriptorLocalImpl.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentableDescriptorLocalImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentableDescriptorLocalImpl.java 14 Aug 2002 14:58:21 -0000 1.1 +++ InstrumentableDescriptorLocalImpl.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -146,6 +146,20 @@ return getInstrumentDescriptorLocals(); } + /** + * Returns the stateVersion of the instrumentable. The state version + * will be incremented each time any of the configuration of the + * instrumentable or any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrumentable. + */ + public int getStateVersion() + { + return m_instrumentableProxy.getStateVersion(); + } + /*--------------------------------------------------------------- * InstrumentableDescriptorLocal Methods *-------------------------------------------------------------*/ 1.2 +43 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentableProxy.java Index: InstrumentableProxy.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/InstrumentableProxy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentableProxy.java 14 Aug 2002 14:58:21 -0000 1.1 +++ InstrumentableProxy.java 6 Sep 2002 02:10:12 -0000 1.2 @@ -72,6 +72,9 @@ /** Optimized array of the InstrumentDescriptorLocals. */ private InstrumentDescriptorLocal[] m_instrumentDescriptorArray; + + /** State Version. */ + private int m_stateVersion; /*--------------------------------------------------------------- * Constructors @@ -294,6 +297,8 @@ m_childInstrumentableProxyArray = null; m_childInstrumentableDescriptorArray = null; } + + stateChanged(); } /** @@ -456,6 +461,8 @@ m_instrumentProxyArray = null; m_instrumentDescriptorArray = null; } + + stateChanged(); } /** @@ -522,6 +529,20 @@ } return descriptors; } + + /** + * Returns the stateVersion of the instrumentable. The state version + * will be incremented each time any of the configuration of the + * instrumentable or any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrumentable. + */ + int getStateVersion() + { + return m_stateVersion; + } /** * Updates the cached array of InstrumentProxies taking @@ -693,6 +714,27 @@ } instrumentProxy.loadState( instrumentConf ); } + } + + stateChanged(); + } + + /** + * Called whenever the state of the instrumentable is changed. + */ + protected void stateChanged() + { + m_stateVersion++; + + // Propagate to the parent + if ( m_parentInstrumentableProxy == null ) + { + // This is a top level Instrumentable + m_instrumentManager.stateChanged(); + } + else + { + m_parentInstrumentableProxy.stateChanged(); } } } 1.2 +12 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentDescriptor.java Index: InstrumentDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentDescriptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentDescriptor.java 14 Aug 2002 14:58:24 -0000 1.1 +++ InstrumentDescriptor.java 6 Sep 2002 02:10:13 -0000 1.2 @@ -110,4 +110,15 @@ * Instrument. */ InstrumentSampleDescriptor[] getInstrumentSampleDescriptors(); + + /** + * Returns the stateVersion of the instrument. The state version will be + * incremented each time any of the configuration of the instrument or + * any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrument. + */ + int getStateVersion(); } 1.2 +12 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentManagerClient.java Index: InstrumentManagerClient.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentManagerClient.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentManagerClient.java 14 Aug 2002 14:58:24 -0000 1.1 +++ InstrumentManagerClient.java 6 Sep 2002 02:10:13 -0000 1.2 @@ -78,6 +78,17 @@ InstrumentableDescriptor[] getInstrumentableDescriptors(); /** + * Returns the stateVersion of the instrument manager. The state version + * will be incremented each time any of the configuration of the + * instrument manager or any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrument manager. + */ + int getStateVersion(); + + /** * Invokes garbage collection. */ void invokeGarbageCollection(); 1.2 +12 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentSampleDescriptor.java Index: InstrumentSampleDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentSampleDescriptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentSampleDescriptor.java 14 Aug 2002 14:58:24 -0000 1.1 +++ InstrumentSampleDescriptor.java 6 Sep 2002 02:10:13 -0000 1.2 @@ -115,5 +115,16 @@ * @return A static snapshot of the InstrumentSample. */ InstrumentSampleSnapshot getSnapshot(); + + /** + * Returns the stateVersion of the sample. The state version will be + * incremented each time any of the configuration of the sample is + * modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the sample. + */ + int getStateVersion(); } 1.2 +24 -2 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentSampleSnapshot.java Index: InstrumentSampleSnapshot.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentSampleSnapshot.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentSampleSnapshot.java 14 Aug 2002 14:58:24 -0000 1.1 +++ InstrumentSampleSnapshot.java 6 Sep 2002 02:10:13 -0000 1.2 @@ -18,6 +18,8 @@ public class InstrumentSampleSnapshot implements Serializable { + static final long serialVersionUID = -3284372358291073513L; + /** The name used to reference the InstrumentSample. */ private String m_InstrumentSampleName; @@ -33,6 +35,9 @@ /** The samples as an array of integers. */ private int[] m_samples; + /** State Version. */ + private int m_stateVersion; + /*--------------------------------------------------------------- * Constructors *-------------------------------------------------------------*/ @@ -42,18 +47,21 @@ * @param size The number of samples in the InstrumentSample. * @param time The time that the last sample starts. * @param samples The samples as an array of integers. + * @param stateVersion The current state version of the sample. */ public InstrumentSampleSnapshot( String InstrumentSampleName, long interval, int size, long time, - int[] samples ) + int[] samples, + int stateVersion ) { m_InstrumentSampleName = InstrumentSampleName; m_interval = interval; m_size = size; m_time = time; m_samples = samples; + m_stateVersion = stateVersion; } /*--------------------------------------------------------------- @@ -108,6 +116,20 @@ public int[] getSamples() { return m_samples; + } + + /** + * Returns the stateVersion of the sample. The state version will be + * incremented each time any of the configuration of the sample is + * modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the sample. + */ + public int getStateVersion() + { + return m_stateVersion; } } 1.2 +12 -1 jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentableDescriptor.java Index: InstrumentableDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/interfaces/InstrumentableDescriptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InstrumentableDescriptor.java 14 Aug 2002 14:58:24 -0000 1.1 +++ InstrumentableDescriptor.java 6 Sep 2002 02:10:13 -0000 1.2 @@ -95,4 +95,15 @@ * Instrumentable. */ InstrumentDescriptor[] getInstrumentDescriptors(); + + /** + * Returns the stateVersion of the instrumentable. The state version + * will be incremented each time any of the configuration of the + * instrumentable or any of its children is modified. + * Clients can use this value to tell whether or not anything has + * changed without having to do an exhaustive comparison. + * + * @return The state version of the instrumentable. + */ + int getStateVersion(); } -- To unsubscribe, e-mail: For additional commands, e-mail: