For the maven inclined:
http://mvn.riptano.com/content/repositories/public/
My unit tests just exploded.
/Janne
http://github.com/rantav/hector/blob/master/CHANGELOG
... just realized I may have off-by-one'd the release number - my bad.
I think it would be better not to extend RuntimeException - or to be precise, create a special HectorRuntimeException for those exceptions that really need it.
/Janne
That said, perhaps returning a null from KeyspaceServiceImpl is not
appropriate at that level and we should propagate a wrapped Exception
to catch at the v2 layer in order to maintain a tighter contract with
the Thrift API.
Thoughts? Other folks?
I'm using the lower layer simply because that's what is in production, and that's what Hector used before. I'll switch to the higher layer API once it's been vetted by enough people so that I don't get surprises. There's a cost involved in rewriting code, you know :-)
/Janne
MyObject object;
try {
object = getObject("foo");
object.doSomething();
object.doSomethingElse();
} catch( NotFoundException e ) {
object = createObject("foo");
}
object.doSomethingAgain();
The point being that you _never have worry about object being null in your code_, therefore eliminating hard-to-find NPEs. Also, it eliminates the need for subroutines to do null checks; they can just propagate missing stuff as an error condition, reducing the amount of code you write. So it does have its uses, though it does mean that you have to interpret the word "exception" somewhat liberally. This same pattern is also used by e.g. OSCache. This is also the idea around returning an empty Collection when you do a get_slice or something similar: your object is never null, it's just empty.
There are examples of both ways - but I don't think throwing a RuntimeException is the best choice. Either it needs to be a regular, checked Exception, or return null. The advantage of not using a RuntimeException is that you never get surprises at upper levels. I like the fact that everything derives from a single HectorException, but I'm not sure whether a RuntimeException is the best choice here. You could still declare everything as "throws HectorException". ;-)
One possibility is to always return a Collection, but that reduces the simplicity of an API (and would incorporate one of my main annoyances of the JDBC - if I know there's exactly one value, why can't I just get it directly? :-P)
(And I don't really care for the Thrift API at all. I think it's pretty awful... I'm just rooting for consistency here :-)
/Janne
I still need to tweak the pom files in the repository for dependencies
(I just did the automatic thing in nexus which lacking in
flexibility). I'll fill those in for 0.7x in the next couple of days.