|
|
||
John Catherino's BlogCommunity ArchivesMessaging is degenerate RPCPosted by cajo on June 25, 2006 at 01:28 PM | Permalink | Comments (35)Allow me to start with a small disclaimer: For those who do not already know; I lead the cajo project, where we promote the idea that the internet can be a collection of World Wide Virtual Machines; where remote objects are used just as local objects. Yet there is a small, but rather vocal community, who wish to espouse that distributed object RPC is somehow flawed, and that 'messaging' is a superior solution. Being a somewhat more mature developer; I remember old tales from my childhood, where 'modern' twentieth century businessmen were admonished: "Avoid the telephone; the network is unreliable: the post is superior."Clearly they were wrong then; yet surprisingly this ideology is again being promulgated as fact. To be sure, synchronous invocations are odious, and they are difficult to scale. For example; I actually prefer email to the telephone, since I am not required to respond immediately. Email does not disrupt my work, and I can deal with it when I am ready. However, it is easy to forget: sending email is still synchronous RPC! No matter how you slice it: data must be sent from one computer to another; over the network. A brand new class has just been added to the cajo project; in less than 30 lines of code, it clearly illustrates that 'messaging' can be trivially implemented, including queueing, in a synchronous RPC environment:
public final class Queue implements gnu.cajo.invoke.Invoke {
private java.util.LinkedList list;
private final Object object;
public Queue(Object object) { this.object = object; }
public synchronized Object invoke(String method, Object args) {
if (list == null) {
list = new java.util.LinkedList();
new Thread(new Runnable() {
public void run() {
try {
while (list.size() == 0)
synchronized(Queue.this) { Queue.this.wait(); }
String method = (String)list.removeFirst();
Object args = list.removeFirst();
gnu.cajo.invoke.Remote.invoke(object, method, args);
} catch(Exception x) { return(); }
}
}).start();
}
list.add(method);
list.add(args);
notify();
return Boolean.TRUE;
}
}
Here any object reference, either local or remote, can be made remotely invokable, in any JVM. Yet every method invocation on a Queue object is executed asynchronously, on its member object, in a separate thread. If result data is desired, one could simply provide a callback object reference, as one of the method arguments. The boolean true is returned simply to 'guanantee' that the message has been successfully received.If you want messaging, by all means, go for it! It is a very useful technique. However, it must be seen for what it is; degenerate synchronous RPC: i.e. a tiny subset of the functionality that is possible with distributed objects. Take that .NET!Posted by cajo on June 08, 2006 at 10:21 AM | Permalink | Comments (18)I felt as if a gauntlet had been thrown down before me. How could I profess that Java truly makes the network the computer, if it can not match the functionality of .NET remoting? While I am not yet convinced .NET is going about remoting in the best way, it is definitely very intuitive. Surely Java must be able to do it like that too... right? Well friends, I am happy to say that the challenge has been both accepted, and met! I welcome you to have a look at the newest wiki page of the cajo project. Even if you have never developed using distributed computing before, this can literally have you up and running, in minutes. For those of you who are tired of hearing about how new and powerful .NET is, and how Java cannot possibly match its "advanced" functionality; this page will certainly bring a smile to your face. Take that .NET! ;-) Thanks... and good luck Bruce!Posted by cajo on May 28, 2006 at 09:54 AM | Permalink | Comments (9)I guess that means I should start: I sincerely hope you find what you are looking for Bruce. It would be an amazing discovery for sure: Now people can develop sophisticated solutions, with little effort, time, skill, or even knowledge!It is a Holy Grail; and to be sure, you are not the only one questing for it. It has been quested for ages actually, harking back to the dawn of computers. Unfortunately, some of us have begun to doubt its existence. However, if it exists; Bruce, I genuinely hope you are the one to discover it. (At least I would buy that book!) Best wishes, and thank-you for your participation in the Java community. The cajo what?Posted by cajo on August 30, 2005 at 07:44 PM | Permalink | Comments (2)The cajo project is a very compact framework to enable completely transparent use, and transport of, ordinary unmodified Java objects; between Java Virtual Machines. It allows distributed computers to effectively coalesce; into a seamless, Virtual Virtual Machine. Its ease of use is undoubtedly its most intriguing feature. The foundation of its operation is its transparent method invocation mechanism. It allows dynamic interchangeability of local and remote objects, with no source impact. As a result, the framework requires no interfaces, no XML, no annotations, and works with all JREs; 1.2 and higher. This makes cajo a unique, 'drop-in' technology; which can distribute literally any application, without re-designing it. The framework applies four basic technologies; referred to as IPMB. Click on the links below, for more detailed information. Items – Remote objects: An item is an ordinary object, which is made remotely accessible. This can be done with as little as one line of code. The framework allows the public methods of the object to be invoked remotely. Proxies – Mobile objects: A proxy is an ordinary object, which is transparently duplicated inside another VM. A proxy allows otherwise remote code, and data, to be accessed locally. Multicast – Object discovery: Multicasting provides a mechanism whereby a remote object reference can be broadcast, and be received, by all listening VMs. It provides the ability to both transmit, and to receive these broadcasts. BeanShell – Object scripting: BeanShell provides an interactive, or file driven scripting environment, using pure Java. It is extremely useful; for quick jobs, experiments, and debugging. Items and Proxies integrate cleanly, as regular objects. All these capabilities, and several more very interesting classes, come in its 38kB codebase jar. It has no dependencies on any frameworks; other than a Java Runtime Environment 1.2+, and optionally, the BeanShell jar. Inside the World Wide Virtual MachinePosted by cajo on August 01, 2004 at 10:08 AM | Permalink | Comments (0)As I mentioned in my previous blog, the World WideVirtual Machine is a very exciting free space for the development of robust scalable fault-tolerant distributed applications. The cajo project is a small free framework defined to simply and easily realize this vision. Its reception by the java.net community has been both strong and positive. So in response to this, I thought it would be worthwhile take a little time to explain the philosophical concepts of the WWVM. For the developers of the World Wide Virtual Machine, there is a fundamental viewpoint, which can be stated as follows: The network is a vast collection of objects, ready to be used to create other objects.If you stop to think about it, this is not too different from what exists in a typical single Virtual Machine design: There is the runtime library, and a collection of other local objects, both used to create applications. In fact, any application can be defined as follows: An application is an object, which itself is composed of, a collection of objects.As you can see, the WWVM is not a really large conceptual jump, especially considering all the exciting possibilities it enables. So let's take a look at some more WWVM fundamentals. It has been stated that an application is a collection of objects, and it has also been stated that the network is a collection of objects; so necessarily the WWVM must have a very clear definition of what an object is:
In the WWVM there are no primitive types per se; such as char and int. These are considered purely special case optimizations, of value solely within a local Virtual Machine. Also there is no inheritence of network objects. The WWVM focus is solely on the use of objects, by objects. Distributed objects are used solely via their public method interface. The following security philosophy is inherent in the WWVM: It is expected that all proxy objects will be hosted in a JNLP/Applet-type sandbox.This makes the development and use of the WWVM no more risky than using ordinary applets, or WebStart applications; in fact, proxy codebases are typically unsigned. In other words; using the WWVM is safe. At the cajo project, we are delighted to welcome new developers into the WWVM. It is a fascinating free environment that will only grow richer with greater participation. We welcome you to come look inside. It really does create some very exciting opportunities for an entirely new type of Internet. (And of course, it also works equally well for the development of powerful distributed LAN applications :-) The World Wide Virtual MachinePosted by cajo on March 17, 2004 at 08:29 AM | Permalink | Comments (4)Disclaimer: This entry is in no way meant to slight the many other fine distributed frameworks out there. Its just that this one is designed for us non-rocket scientists. :-) I host a free project here on java.net called the cajo project. It allows any Virtual Machine to easily expose access to any of its selected objects to Remote Virtual Machines, as well as to send any of its selected objects to RVMs. It offers a very simple yet highly flexible framework for applications to work together. Most importantly, any existing object can be made remotely usable, with no changes to its source; an application simply adds this framework, not restructures around its requirements. I have found this unique amongst distributed frameworks. A client can obtain a remote reference to an exposed object in one of two ways. It can request one explicitly, using just the name of the server, and the name under which the exposed object is registered, if it knows these things. In the framework, this is called static binding. It can also listen for object reference broadcasts, sent from RVMs. This is called dynamic binding. The references can then be freely shared in turn with other remote objects. Exposing an object for remote reference is done conversely; it can be bound locally under a name, or be broadcast to all listening VMs, even both. Clients can invoke the remote objects methods, and receive the resulting return, just as though it was a local object. How does the client know how to use a remote object? The object can implement a getDescription() method, it would provide detailed usage information. The object often implements a getProxy() method, it would generally return a graphical user interface component with which to interact with the remote object. The framework also features a standard generic client, which can be run as applet in a browser, or as an application via JNLP, to remotely host the GUI component. Any VM can send an object (or remote object reference) to an RVM, as an argument to one of its methods, or by returning it as a method result. The objects will physically exist locally in the RVM, i.e. in the same address space, as its own objects. These objects are known as proxies in the context of this project, as they exist to act in a remote location, on behalf of their sender. The previously mentioned the getProxy() method is used to return a GUI proxy object. The framework borrows from the best concepts of Jini, CORBA, and DCOM, but it is far smaller, as powerful, and much simpler to use. The core framework consists of only two packages; a total of only 13 small class files. It can be so small and easy to use, as it does not impose any application semantics beyond those outlined above. It comes with a detailed example file, ample documentation, and several support fora. It is completely free, licensed under the GNU LGPL, to allow both free and proprietary applications to operate together. The framework is currently running on all Java Runtime Environments; J2EE, J2SE, and even J2ME. It is in active use on Linux, Windows, Solaris, and OSX systems. The goal of the project is to foster the creation of a WWVM. This is an exciting shared space of applications and object libraries, where they all appear and are used as though they were local, to foster the creation of new dynamic, interactive application networks. All VMs are free to join, from big mainframes, to tiny PDAs. (You can use any JVM compatible language, even Java) Please come visit the WWVM community, all are welcome. Participants needed. :-)
Java raised to the power LinuxPosted by cajo on March 13, 2004 at 07:03 PM | Permalink | Comments (9)For passionate Java developers, the network is the computer. However Java, and in particular its runtime environment, require a highly sophisticated operating system on which to run. Enter Linux; you would be hard pressed to find any system with more features. So, how does Linux increase the power of Java? First lets look at what Linux represents; it is a free, heterogeneous, network-integrated operating system. It runs on many hardware architectures (RISC, CISC ) and many platforms (ARM, PPC, x86, SPARC ). On the other hand, Java is a heterogeneous, network-integrated language. It is architecture agnostic, meaning no recompiling, and its code is network loadable. Together they can provide a ubiquitous standard environment, on a diversity of platforms. Next look at all of the fine Java projects here at java.net, and other places, like Sourceforge and Savannah. Not only are our numbers increasing, but also another interesting thing is happening. Youll see all sorts of projects to develop standard utility applications; browsers, mail clients, office suites, and even media players. Are we reinventing the wheel? No. We are inventing the ubiquitous wheel. Very soon all major utility applications will have been rewritten in Java. Finally consider how easy it will be to make useful new devices. Design the hardware, bring up Linux, add in Java, and presto! A multitude of pre-written software, from enthusiastic developers, all dynamically loadable. Innovation and platform diversity is an exciting vision. Would all this flexibility require Java to be open source? I believe yes, to be as adaptive as would be required for this scenario. Linux combined with Java create the opportunity to easily and quickly create JVMlets, i.e. small fully functional runtime environments, on multitudes of devices, all working together. There is no question, Java is huge, and I truly believe Java will reach even greater heights, standing on the exceptionally broad shoulders of Linux. Essentially, Linux abstracts the hardware, and Java abstracts the network. This is where I want to go today, how about you? | ||
|
|