how to pass unique value with message

Gregory Gerard ggerard at mac.com
Thu Jul 15 17:09:57 EDT 2010


I'm a fan of a ScoreBoard kind of class that's shared by all.

Put a bunch of Spring StopWatch instances and let it keep time for each step. Even if you're not using Spring in general you can extract just that class -- it has few if any dependencies on anything.

Roughly, it's a synchronized Map<Object,StopWatch>.

Clean it out later either with a background thread or explicitly through something like JMX.

Having it more globally available makes it easy for hooking into JMX or other monitoring tool to see trending.

On Jul 15, 2010, at 14:00, Johnny Luong wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> anthony_w wrote:
> | I have a problem I can't seem to figure out how to solve.  I can't tell if
> | the answer is staring me in the face and I'm just not seeing it.
> |
> | I have a server app with handlers in the pipeline like this.
> |
> | H[A] -> H[B] -> H[C] -> H[D]
> |
> | I need to calculate the elapsed time from A to D on a per-message basis.
> | I'm ok with storing the starting time in a map somewhere when I'm in
> handler
> | A.  Is there a way to uniquely identify each message within Netty so
> that I
> | could retrieve the starting time when I get to handler D?  Having the
> client
> | include a unique value in the message is not an option.  Thanks.
> |
> | anthony
> 
> If you have some way of relating D to C, C to B, B to A, then you can
> find the elapse time upon completion of handler D with your starting
> time in a map for handler A by walking through the relationship.  In my
> application, I do a variation on that internally by passing along my
> POJO from handler A, a starting timestamp which negates the need for a
> separate Map.  In other words, I'm simply manipulating the same object
> just from different interfaces.
> 
> Best,
> Johnny
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkw/dwcACgkQg7TIS7A9isd6KQCgzCSl3ShGfBs2HrbAePbIrmFj
> 6u0Anie6EC7n+rZpA7X0TTLYdtRwoI4O
> =e3oG
> -----END PGP SIGNATURE-----
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users



More information about the netty-users mailing list