I am currently working on a academic project experimenting a new approach for tuning privacy and performance in P2P systems. I am using JKAD as the base for the test software and I can say it's amazingly well written. The only problem is that adding functionality without modifying the JKAD code is really painful.
The problem seems to come from the fact that singleton components are referred in other classes as private, which complicate the use of a derived classes.For example, if I want to use a subclass of kad.Kad, I have either to change KadUDPConnection in the Jar file, or copy the whole source file only because of the unique call Kad.getSingelton().receivePacket(rawPacket) .
If you see the potential issues I am talking about, I can contribute to the project to make the small changes needed to fix it.
Regards, aureshy
I just realized that singleton classes can't be sub-classed.Never mind.
I can propose a wrapper approach to allow creation of different form of the some singleton though
Hello,
There is no KadUDPConnection class in our source code, probably you refer to http://jmule.org/files/jkad-alpha-0.1.tar.gz, this is a very old experimental implementation of kad, the things has been changed a lot over time since then. We do not maintain that source code anymore. Take a look at the package org.jmule.jkad from the main source code of JMule
JKadManager is written as a part of JMuleCore, for performance reasons these components strongly depend on each other and the only way to add a new core functionality is to modify the source code of JMule core. Through "core functionality" I mean something related do eDonkey2000 protocol, traffic encryption, security, kad, etc
- javajox, JMule developer
The JMule core has been designed to allow such things that you are talking about. Now each manager of JMule is a singleton, but can be easily transformed into a factory pattern. In other words each manager can have many implementations, the given implementation will be returned when certain conditions will be met
Remark : this ticket has been reopened per user request
version of JkadManager singleton with the change proposed
The interface defining factories which creates JKadManager Objects
Like you said, I saw that almost all components can be modified to allow different implementations. In the attached file, there is one example, for the JKadManagerSingleton.
The good thing is that with the way you wrote your code, no changes will be needed in the other classes.
cheers,aureshy