On 3/13/06, peter royal <proyal@apache.org> wrote:
On Mar 12, 2006, at 1:08 AM, trustin@apache.org wrote:
>       * Returns a new (or reusable) instance of {@link
> ProtocolEncoder} which
>       * encodes message objects into binary or protocol-specific data.
>       */
> -    ProtocolEncoder getEncoder();
> +    ProtocolEncoder getEncoder() throws Exception;
>
>      /**
>       * Returns a new (or reusable) instance of {@link
> ProtocolDecoder} which
>       * decodes binary or protocol-specific data into message objects.
>       */
> -    ProtocolDecoder getDecoder();
> +    ProtocolDecoder getDecoder() throws Exception;

Performance will suck if shared instances are returned due to
synchronization on the returned instances in the
ProtocolCodecFilter... Unless the synchronization is removed, it
would be unadvisable to return shared instances.

It depends on the implementation of codec.  Some codec might be stateless so they don't need any synchronization.  Of course, a codec factory usually returns a new instance.  It's a user's choice.

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6