Hi Sankalp, On 5/5/06, Sankalp Acharya <[EMAIL PROTECTED]> wrote:
Hi, I have some basic questions regarding best practices (or, I suppose, intended best practices) for implementation of an IoHandler and/or IoHandlerAdapter. Currently, my application is following the guidelines laid out by the tutorials, and I have a separate session handler class, say MyServerSessionHandler, that implements IoHandler. I then have a singleton class to manage my server's business logic, say MyServer, which has initialization and uninitialization methods. In its initialization routine, it instantiates a MyServerSessionHandler and binds it to its IoAcceptor. My question is fairly simple - wouldn't it perhaps make more sense for MyServer to directly implement IoHandler, instead of containing one?
Who acesses MyServer? Is MyServer exposed to other parties which don't know the existance of the usage of MINA? Does MyServer encapsulate MINA? Then you shouldn't expose IoHandler's handler methods because it breaks up OO principle. If not, you can. If your handler implementation is too simple, then you can just move the handler inside MyServer as an inner class. HTH, 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
