You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2007/05/14 18:39:44 UTC

Re: svn commit: r537737 [1/2] - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/bus/ rt/core/src/test/java/org/apache/cxf/bus/ rt/management/src/main/java/org/apache/cxf/management/ rt/management/src/main/java/org/apache/cxf/management/counte...

Willem,

Just a quick note....

Did you give any thought of using an 
java.util.concurrent.atomic.AtomicInteger for the invocations count?    
You could then avoid the synchronized stuff.


Dan


On Monday 14 May 2007 03:11, ningjiang@apache.org wrote:
> +public class PerformanceCounter implements PerformanceCounterMBean,
> Counter { +    private int invocations;
> +    private ObjectName objectName;
> +
> +    public PerformanceCounter(ObjectName on) {
> +        objectName = on;
> +    }
> +
> +    public Number getNumInvocations() {        
> +        return invocations;
> +    }
> +
> +    public synchronized void increase(MessageHandlingTimeRecorder
> mhtr) { +        invocations++;
> +    }
> +
> +    public ObjectName getObjectName() throws JMException {        
> +        return objectName;
> +    }

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: svn commit: r537737 [1/2]

Posted by Willem Jiang <ni...@iona.com>.
Hi Dan,

Thanks for your note.
I will do a quick update for it.

Cheers,

Willem.
Daniel Kulp wrote:
> Willem,
>
> Just a quick note....
>
> Did you give any thought of using an 
> java.util.concurrent.atomic.AtomicInteger for the invocations count?    
> You could then avoid the synchronized stuff.
>
>
> Dan
>
>
> On Monday 14 May 2007 03:11, ningjiang@apache.org wrote:
>   
>> +public class PerformanceCounter implements PerformanceCounterMBean,
>> Counter { +    private int invocations;
>> +    private ObjectName objectName;
>> +
>> +    public PerformanceCounter(ObjectName on) {
>> +        objectName = on;
>> +    }
>> +
>> +    public Number getNumInvocations() {        
>> +        return invocations;
>> +    }
>> +
>> +    public synchronized void increase(MessageHandlingTimeRecorder
>> mhtr) { +        invocations++;
>> +    }
>> +
>> +    public ObjectName getObjectName() throws JMException {        
>> +        return objectName;
>> +    }
>>     
>
>