By bloid
via weblogs.java.net
Published: Sep 04 2007 / 14:11
I am very pleased to announce a most significant breakthrough from the the cajo project, in the ease with which distributed computing can be accomplished in Java; and in only 20 kilobytes. It works with all JREs, 1.3 and later. (And before you Rocket Scientists out there ask; yes, it's also 64-bit clean ;)
Tweet
SaveShareSend
Tags: announcement, frameworks, java
Comments
bloid replied ago:
cajo is an amazing project...
daniel replied ago:
That is pretty amazing, but wouldn't it be even nicer if generics were used to eliminate all the casting? I know they don't want to break compatibility with Java 1.4, but still - shouldn't it at least be considered?
bloid replied ago:
That's a good point, but then again, when you compare this code with the overhead of something like RMI, it really is a minimal amount of casting involved ;-)
I think John's trying to keep it as compatible with as many java versions as possible, and I guess there are still quite a few 1.4 installations out there
cajo replied ago:
Sorry to come into the dialogue late...
First off: Thanks for the compliments! It takes a lot of personal time to implement this; words like yours, really keep me going. :-)
Daniel, when you wrote "eliminate all the casting," frankly I was a bit confused by that.
The only cast in both example classes was:
ClientSet cs = (ClientSet)cajo.proxy(refs[0], ClientSet.class);
However, this instance method is a bit unusual; the type it returns, depends on the class of the methodSet argument it receives.
As far as I know, Java Generics does not have the ability to describe such a method.
If you know, please share.
All the best,
John
bloid replied ago:
You could do:
public T proxy( Object[] refs, Class clazz )
I *believe* to get the return value not requiring a cast...
[edit] I posted this on the blog entry as well, so we don't end up with 2 conversations going on at once ;-)
cajo replied ago:
Hey Tim,
Thanks for the suggestion!
If the proxy method in Grail.java is re-defined thus:
T proxy(Object reference, Class methodSetInterface);
The cast could be moved into Cajo.java:
return (T)TransparentItemProxy...
Very nice! :-)
Unfortunately, as I'm sure you've guessed; requiring users to migrate to Java 1.5+ is currently just not practical.
John
cajo replied ago:
Hey Tim,
Thanks for the suggestion!
If the proxy method in Grail.java is re-defined thus:
<T> T proxy(Object reference, Class methodSetInterface);
The cast could be moved into Cajo.java:
return (T)TransparentItemProxy...
Very nice! :-)
Unfortunately, as I'm sure you've guessed; requiring users to migrate to Java 1.5+ is currently just not practical.
John
Voters For This Link (9)
Voters Against This Link (0)