c******n 发帖数: 4965 | 1 the following code is found from Hector Cassandra java API, I couldn't
understand why it compiles fine while I thought the execute() should
declare or catch exceptions, since the testtest() throws exceptions.
(I simplified the code by adding testtest() )
public QueryResult> execute() {
return new QueryResultImpl>(
ExecutingKeyspace.testtest( (java.util.List>) null)
);
}
public static ExecutionResult testtest(java.util.List x)
throws HectorException { throw new HectorException("fff"); //return
(ExecutionResult) null ;
}
but in comparison, the following hacked up code does give compile
error, but I thought these 2 are exactly the same????
import java.io.*;
import java.util.Random;
class MyGeneric {
}
class AA {
public MyGeneric fun(MyGeneric blah) throws IOException
{
if ( new Random().nextInt() > 10 )
System.out.println("OOO");
// throw new IOException("blah");
return (MyGeneric) null;
}
}
class CC {
int m ;
public CC(MyGeneric n) { m=1;}
}
public class BB {
public CC ttt () {
return new CC( new AA().fun( (MyGeneric) null ) );
}
}
|
g*****g 发帖数: 34805 | 2 public class HectorException extends RuntimeException {
that explains.
【在 c******n 的大作中提到】 : the following code is found from Hector Cassandra java API, I couldn't : understand why it compiles fine while I thought the execute() should : declare or catch exceptions, since the testtest() throws exceptions. : (I simplified the code by adding testtest() ) : public QueryResult> execute() { : return new QueryResultImpl>( : ExecutingKeyspace.testtest( (java.util.List>) null) : ); : } : public static ExecutionResult testtest(java.util.List x)
|
c******n 发帖数: 4965 | 3 fxxx, forget it,
public class HectorException extends RuntimeException {
【在 c******n 的大作中提到】 : the following code is found from Hector Cassandra java API, I couldn't : understand why it compiles fine while I thought the execute() should : declare or catch exceptions, since the testtest() throws exceptions. : (I simplified the code by adding testtest() ) : public QueryResult> execute() { : return new QueryResultImpl>( : ExecutingKeyspace.testtest( (java.util.List>) null) : ); : } : public static ExecutionResult testtest(java.util.List x)
|
c******n 发帖数: 4965 | 4 thanks, just found it too
【在 g*****g 的大作中提到】 : public class HectorException extends RuntimeException { : that explains.
|
c******n 发帖数: 4965 | 5 you work around Hector/Cassandra stuff too? just curious
【在 g*****g 的大作中提到】 : public class HectorException extends RuntimeException { : that explains.
|
g*****g 发帖数: 34805 | 6 I am working on Cassandra stuff lately.
【在 c******n 的大作中提到】 : you work around Hector/Cassandra stuff too? just curious
|
c******n 发帖数: 4965 | 7 btw, do u know anything about Cassandra authentication?
there is some login() API, but I can simply connect/use without passwd
there is some discussion:
http://www.riptano.com/docs/0.6.5/install/auth-config
http://cassandra-user-incubator-apache-
org.3065146.n2.nabble.com/Authentication-td5285013.html#a5285013
I tried but doesn't seem to have any effect
【在 g*****g 的大作中提到】 : I am working on Cassandra stuff lately.
|