--- On Fri, 3/19/10, Igor Minar <iiminar_at_gmail.com> wrote:
From: Igor Minar <iiminar_at_gmail.com>
Subject: Re: Grizzly 2.0: monitoring memory consumption
To: dev_at_grizzly.dev.java.net
Date: Friday, March 19, 2010, 1:05 PM
looks good to me, except for the humongous class names. Is it really
necessary to call it MemoryManagerMonitoringProbe? Won't simply
MemoryProbe be enough? IMO Manager has nothing to do with a probe and
Monitoring is already implied.
Memory consumption is key feature should not be absent from NIO frame like Grizzly. Hope You can check codes in early!!
And one last thing, I'm not a big fan of static state, so I naturally
dislike "TransportFactory.getInstance().setDefaultMemoryManager(mm);".
Of course this problem is not specific to just this piece of code, but
to grizzly in general. I think that the lack of a dependency injection
and a common bootstrapping mechanism is going to bite the project
sooner or later and for that reason addressing this issue should
become a priority for 2.0.
Sooner or later, other developers will added spring integration or bootstrap features once they realize the goodness of Grizzly and start to embedded it into their codes. Memory consumption is a key feature to win developers' adopting Grizzly.
/i
On Fri, Mar 19, 2010 at 10:45 AM, Oleksiy Stashok
<Oleksiy.Stashok_at_sun.com> wrote:
> Hi,
>
> I've implemented simple interface MemoryManagerMonitoringProbe, using which
> it's possible to get statistics on Grizzly memory consumption.
> For example:
>
> MyMemoryMonitoringProbe probe = new MyMemoryMonitoringProbe();
> DefaultMemoryManager mm = new DefaultMemoryManager(probe);
>
> TransportFactory.getInstance().setDefaultMemoryManager(mm);
>
> // Start Grizzly
> ....................
>
> // Log the memory monitoring probe statistic
> log(probe.toString());
>
> //////////// Simple monitoring probe implementation
>
> public static class MyMemoryMonitoringProbe implements
> MemoryManagerMonitoringProbe {
> private final AtomicLong allocatedNew = new AtomicLong();
> private final AtomicLong allocatedFromPool = new AtomicLong();
> private final AtomicLong releasedToPool = new AtomicLong();
>
> public void allocateNewBufferEvent(int i) {
> allocatedNew.addAndGet(i);
> }
>
> public void allocateBufferFromPoolEvent(int i) {
> allocatedFromPool.addAndGet(i);
> }
>
> public void releaseBufferToPoolEvent(int i) {
> releasedToPool.addAndGet(i);
> }
>
> @Override
> public String toString() {
> StringBuilder sb = new StringBuilder();
> sb.append("allocated-memory=").append(allocatedNew.get());
> sb.append("
> allocated-from-pool=").append(allocatedFromPool.get());
> sb.append(" released-to-pool=").append(releasedToPool.get());
>
> return sb.toString();
> }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
For additional commands, e-mail: dev-help_at_grizzly.dev.java.net