I need to start with JavaSpaces and I found this article. But I found JINI li开发者_如何转开发brary and downloaded it but couln't find JavaSpaces library. Is it moved to JINI or what?
There are two JavaSpaces implementations of any note: Blitz and GigaSpaces XAP. Blitz is open source; XAP is commercial, but has a community edition that's free for use.
I'm heavily biased towards XAP; I work for them. :) That said, there are a lot of reasons to consider XAP:
Space Aquisition
The mechanism for acquiring a space reference is far easier with GigaSpaces than it is with default JINI:
UrlSpaceConfigurer urlSpaceConfigurer = new UrlSpaceConfigurer("/./space");
IJSpace space = urlSpaceConfigurer.space();
// space is a close JavaSpaces analog, extended because the specification is rather limited
GigaSpace gigaSpace=new GigaSpaceConfigurer(space).gigaSpace();
// gigaSpace has **many** API improvements and is far more flexible.
API Improvements
The default JavaSpace API has no compensation for multiple tuple matches in the space. The more recent (i.e., 8 years old?) does, and Blitz implements it, but it's still not very flexible. Plus, you still get stuck with JINI Entries, which follow something like these rules:
- Every field must be public. (i.e., "public String foo")
- Every type must extend Entry.
- Every field must extend Object. (i.e., Long instead of long, etc.)
XAP allows you to use Entry, but doesn't require it; with XAP, you can use ordinary POJOs. You still want to prefer Object types, because of wildcards (null is the JavaSpaces wildcard) but that's up to you.
XAP also provides a SQL query mechanism, as well as a document-based model (schemaless) for entries, and can also use Spring to manage notifications and remoting.
精彩评论