Looking for help with JINI 2.0? - Check this out
Whilst I do not consider myself to be a JINI zealot, I do feel that, for various reasons, JINI has been given a raw deal and merits a second look. In this article, I am going to attempt to redress the balance so, without further delay......
Update 8/4/04: Revised to include commentary on additional JINI fallacies such as it's dependency on RMI, JINI's inability to run on devices, JINI's dependency on multicast and various integration issues.
The JINI approach makes no such assumptions about it's deployment environment. SUN's initial attempt at articulating the JINI vision certainly concentrated developer focus in the area of devices but I think that a crucial piece of information was lost in the translation.
Some years ago, the IETF predicted a substantial growth in demand for Internet access which would likely exhaust the available (IP) address space given the limits of IPv4. In response, they created IPv6 which, it was felt, would ensure that there were sufficient IP addresses available to cope with the expected growth in Internet usage. IPv6 expands addresses from 32-bit under IPv4 to 128-bit. This increases the number of available IP addresses from 4.2 billion to 340 trillion trillion trillion. This provides 67 billion addresses per square centimeter of the earth.
Now, ask yourself just how could we possibly make use of that many addresses? Even if every human on the planet had several network-aware devices and a couple of PC's, there are still a lot of spare addresses! The answer lies in the expected increase in the use of EmNets (large numbers of network-aware devices) for factory automation, farming, transport etc. For more detailed information, see Embedded, Everywhere.
Okay, so there will be a lot of computers (aka devices) out there and the vast majority of them will not be designed to interact with human beings. Rather they will be deployed in groups and required to work together to achieve some goal.From a simplistic point of view, these devices, just like enterprise servers and, increasingly, home PC's all run services. In some cases, these services interact with humans, in a lot of cases, these services interact with each other. Enterprises have been struggling for years to handle the need for spontaneous deployment of new services or additional instances of existing ones to cope with spikes in load. This exact same scenario (deploying software services) will be played out with the deployment of additional devices in a factory or the adding of an entertainment device to a car.
Thus, we have a technological world which is moving towards a proliferation of software services running on a variety of hardware (enterprise servers, wrist watches, in car entertainment systems, engine management systems). New services will be deployed, old ones will be retired. Services will rely on each other and need to be able to cope with this constant changing of deployed services as well as classic distributed computing issues such as partial failure.
JINI was designed with this sort of world in mind. SUN, IMHO, were trying to convey this story but the world ended up concentrating too much on devices, rather than on the services these devices would provide and the external services these devices would be dependent upon. In addition, the assumed type of device was far too narrow and focused very much on the immediate rather than the future.
In conclusion, JINI was designed with spontaneous networking of services in mind rather than devices.
This conclusion is supported by a JavaOne 2001 presentation by Jim Waldo - JINI Networking Technology and Service-Based Architectures (TS-1137) which can be found at The JavaOne 2001 web-site.
JINI certainly requires some aspects of Java to work. In particular, it needs support for mobile code but not much else. This requirement results in a JINI proxy needing to be, at least in part, Java-based. But the back-end that the proxy is associated with need not be Java at all. In fact, the JINI community has long recognised that legacy integration issues are important resulting in the creation of project such as Surrogate.
Whilst this could be claimed of previous versions of JINI, version 2.0 was targeted specifically at addressing these issues. I don't propose to say a lot more, as the changes have been discussed heavily elsewhere by people far more qualified than myself:
This view is often formed as the result of examining JINI from the perspective of experience in implementing distributed systems using some other technology e.g. CORBA, RMI, EJB etc. (Note: I don't consider EJB to be a distributed systems technology as it encapsulates a number of API's only some of which address distributed co-ordination).
Looking at JINI from this perspective tends to result in a feature comparison where the programmer checks that all the features they're used to using are available under JINI. Typically, this centres around the Lookup Service, Transaction Manager, Event Mailbox etc. This kind of comparison does not favour JINI, which adopts a philosophy of having each of it's base services be simple and do just one thing well. This philosophical approach is very much at odds with most of it's "competition" which attempts to cram in a multitude of features to cover all styles of usage (Note: I'm not saying this is good or bad, just different).
A programmer performing this kind of comparison will, almost inevitably, conclude that JINI is nothing new. Many a new technology has had trouble with this kind of thinking. Gaining a proper perspective requires the programmer to, at least temporarily, suspend this need to compare until they've studied it in isolation.
At this point, I'd request that you review "It's Just For Devices". Ready? We're going to consider two different perspectives:Step (1) can be troublesome - how does one get a reference to a lookup service? Normally, one hardwires an address into the client. After a little consideration, one decides to hardwire a number of addresses to account for failure and load balancing. What happens when the load gets too high for even a few addresses? How do you ensure sufficient geographical distribution of the lookup services such that all clients around the world get dependable and scalable access?
Clearly, a static scheme such as hardwiring is inadequate. JINI has an in-built mechanism for coping with this issue called Discovery and Join which allows a JINI-based client to locate nearby lookup services without any prior knowledge of their existence.
Step (2) also presents challenges. One needs to ensure that each lookup service has a remote reference identified in whatever manner the client is expecting (e.g. a particular name). What if the remote service reference is invalid because of some form of network or server failure? What if the remote service reference relates to a system on the other side of the world from the client?
JINI services identify themselves not by name but by the type of service they offer - e.g. Printer, BookSeller or DryCleaner. Thus a client locates a suitable service by asking the lookup service for a particular type. The lookup service allows for each service to provide further information about itself which may be useful to the client in selecting which service it uses. For example, a DryCleaner service implementation might wish to advertise that it's available 24 hours. Further, should a new service be deployed, it will automatically register with nearby lookup services and be "visible" to clients of that lookup service. A client can register interest in a particular kind of service such that, should a new one appear it will automatically be informed giving it the option to switch services should it wish to do so.
[ Implementation note: SUN's JINI implementation, of course, uses multicast to implement it's dynamic lookup mechanism. Obviously, it's not desirable to use multicast across the entire Internet. This problem can be solved by federation of lookup services such that each lookup service knows about a number of others (these other lookup services could be a large number of network hops away). This allows a deployer to build a more hierarchical type lookup structure similar to DNS with the crucial difference being that a client can dynamically locate a nearby lookup service thus avoiding the hardwiring problems discussed earlier.]
Step (3) is most often considered from a client perspective - "what if the service fails?". The client is concerned with ensuring that it's work is atomic - it all gets done or none of it does.
This is certainly important, but what about the service's perspective - "what if the client crashes?"
The client may crash halfway through performing a transaction leaving the server, for example, holding locks on particular resources. How does the server know that the client has crashed? Maybe a temporary network problem is preventing the client closing the transaction? In the meantime, other clients may be impacted by these no longer valid locks still being held?
There are several solutions one may adopt to handling this problem:JINI adopts the leasing approach and makes it available via suitable API's to all clients and services.
Examples:Perhaps, but certainly JINI has enough differences (and for brevity, I've left some out) from other approaches to merit examining it without preconceptions.
Which brings us to........
[I recommend that you review "It's Nothing New" before reading this section]
I believe that the reason many find JINI "too complex" is because it's somewhat different from more "traditional" approaches to building distributed systems. Thus getting to grips with JINI requires the programmer to learn some new concepts and adopt a different perspective on distributed systems design. The programmer will make this more difficult for themselves if they lean upon the knowledge they have accrued from building distributed systems using other technologies. (Note: I am not saying that JINI is better or worse, I'm saying it's different and recognising that fact can speed up the learning process).
JINI tends to encourage a more granular approach to the construction of distributed systems (a service should do one small thing well) which gives the programmer great flexibility but can make deployment and testing more difficult. The JINI 2.0 starter kit has taken steps to reduce these difficulties and there are now a number of commercial and non-commercial container implementations available which support deployment of services in groups making deployment much easier.
Writing a JINI service for the first time is certainly daunting but tools are beginning to appear which make this much less arduous (see Inca X). In addition there is a very active community with a number of mailing lists you can mail to for advice. The Blitz Project also provides a number of useful resources.
There is no requirement for RMI in JINI. The specifications are such that certain classes such as Remote and RemoteException would need to be available but there is no requirement for RMI itself. It's a common mistake to assume that because an interface extends Remote or a method throws RemoteException there's a dependency on RMI. This is plain wrong - the presence of these exceptions or Remote constitutes a contract stating that the underlying implementation is possibly using remote resources. The nature of the underlying implementation could be socket based, RMI, CORBA, XML-RPC or any number of other transports. For more details on this, see The End of Protocols.
It's also important to realize that the specifications permit multiple implementations of JINI. SUN's version happens to make use of RMI but there's nothing preventing other companies from doing things differently.
This will always be true of some devices that are simply too low-powered to run JINI but they'll likely be extremely simple, low-cost devices doing trivial tasks. However, Moore's Law will ensure that a growing number of devices can run JINI. There are a number of projects examining wide-area sensor deployment scenarios which could easily end up using JINI for their infrastructure. Several examples were presented at the 7th JINI Community Meeting including work on RFID and a project at The Johns Hopkins University Applied Physics Lab concerning autonomous vehicles and swarm technology.
Firstly, JINI has a number of lookup facilities that do not require the use of multicast. Secondly, multicast is not the only means by which the dynamic networking property of JINI can be realized. The standard broadcast facilities could also be used (though they'd be less optimal) and limited solutions based on UDP could also be deployed. It might also be possible to build on top of the infrastructure provided by ZeroConf
Quite simply not true. Once upon a time there might have been threading issues but with the arrival of JCA, these problems disappear. Further, JINI supports various methods of lookup which do not require use/manipulation of threads and can be done using familiar constructs such as URL's. This provides developer's with options for developing hybrid systems with some parts based on JINI and other parts based on J2EE API's.
Before reading this you should probably read "It's dependent on RMI". JINI services can be implemented using WebServices if desired. An obvious approach would be to implement your service in Java and take advantage of all the WebServices frameworks available. The steps in such an implementation are:
In the world of distributed systems, JINI is no panacea. However, at least in some application areas, it has some unique features which make it a much better choice than other more established technologies. There is a learning curve but it's not nearly as steep as many believe given the right perspective and the much improved quality of information available from the JINI community in the form of books, web-sites, mailing lists etc.
SUN took the brave step of developing JINI in public at a time when few companies were aware of concepts such as open-source. I believe that JINI has suffered as a consequence, with various parties classifying it as nothing more than a research project. With the release of version 2.0 of the starter kit, JINI deserves to be considered a product and those same parties should now give it a second look.
© Copyright 2003 Dan Creswell
Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U. S. and other countries