> > So, what do you think about the patch? I do believe it better > > encapsulates the dependence of Socket on Context, and it (probably) > > facilitates any future uses of the C interface: if Socket ever needs a > > new function to be added, which depends on the current Context, then it > > will be added to Socket.cpp, NOT to Context.cpp. > > Yes. It makes more sense to have to code in Socket.cpp. > > One thing troubles me though. I don't like the idea of allowing the > application to mess with underlying pointers. No other binding allows > for that and neither should Java binding. Isn't there a way to restrict > access to contextHandle property so that only Socket object can access it?
That is why Context::getContextHandle() and Socket::getSocketHandle() are declared as protected; they can only be accessed from Java classes belonging to the org.zmq package. I believe this provides enough protection. Ideally they should both be private; in fact, I was sure this would STOP things from working (since Socket needs to call getContextHandle()) but I just tested it and it works... Surprise! I don't know if the fact that you can call through JNI a private class member function from member functions in another class within the same package, is documented to always work in Java, but it SEEMS we could declare these functions private. -- Gonzalo Diethelm ----------------------------------------- Declaración de confidencialidad: Este Mensaje esta destinado para el uso de la o las personas o entidades a quien ha sido dirigido y puede contener información reservada y confidencial que no puede ser divulgada, difundida, ni aprovechada en forma alguna. El uso no autorizado de la información contenida en este correo podrá ser sancionado de conformidad con la ley chilena. Si usted ha recibido este correo electrónico por error, le pedimos eliminarlo junto con los archivos adjuntos y avisar inmediatamente al remitente, respondiendo este mensaje. "Before printing this e-mail think if is really necesary". Disclosure: This Message is to be used by the individual, individuals or entities that it is addressed to and may include private and confidential information that may not be disclosed, made public nor used in any way at all. Unauthorized use of the information in this electronic mail message may be subject to the penalties set forth by Chilean law. If you have received this electronic mail message in error, we ask you to destroy the message and its attached file(s) and to immediately notify the sender by answering this message. _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
