Link Details

Link 39106 thumbnail
User 111696 avatar

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 ;)
  • 9
  • 0
  • 6225
  • 86

Comments

Add your comment
User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

cajo is an amazing project...

User 107114 avatar

daniel replied ago:

0 votes Vote down Vote up Reply

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?

User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

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

User 109072 avatar

cajo replied ago:

0 votes Vote down Vote up Reply

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

User 111696 avatar

bloid replied ago:

0 votes Vote down Vote up Reply

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 ;-)

User 109072 avatar

cajo replied ago:

0 votes Vote down Vote up Reply

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

User 109072 avatar

cajo replied ago:

0 votes Vote down Vote up Reply

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

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (9)



Voters Against This Link (0)



    Apache Hadoop
    Written by: Piotr Krewski
    Featured Refcardz: Top Refcardz:
    1. Play
    2. Akka
    3. Design Patterns
    4. OO JS
    5. Cont. Delivery
    1. Play
    2. Java Performance
    3. Akka
    4. REST
    5. Java