> On June 27, 2012, 7:34 p.m., Mubarak Seyed wrote:
> > flume-ng-sdk/src/main/java/org/apache/flume/api/NettyAvroRpcClient.java, 
> > line 215
> > <https://reviews.apache.org/r/5614/diff/1/?file=116818#file116818line215>
> >
> >     I think JavaDoc is confusing, it says two different things.
> >     
> >     get
> >     
> >     V get(long timeout,
> >           TimeUnit unit)
> >           throws InterruptedException,
> >                  ExecutionException,
> >                  TimeoutException
> >     Waits if necessary for at most the given time for the computation to 
> > complete, and then retrieves its result, if available.
> >     Parameters:
> >     timeout - the maximum time to wait
> >     unit - the time unit of the timeout argument
> >     Returns:
> >     the computed result
> >     Throws:
> >     CancellationException - if the computation was cancelled
> >     ExecutionException - if the computation threw an exception
> >     InterruptedException - if the current thread was interrupted while 
> > waiting
> >     TimeoutException - if the wait timed out
> >     
> >     but the code FutureTask throws only 3 exceptions (except 
> > CancellationException)
> >     
> >      /**
> >          * @throws CancellationException {@inheritDoc}
> >          */
> >         public V get(long timeout, TimeUnit unit)
> >             throws InterruptedException, ExecutionException, 
> > TimeoutException {
> >             return sync.innerGet(unit.toNanos(timeout));
> >         }
> >     
> >     Line # 302 waitForStatusOK() catches CancellationException

Mubarak,

The reason for this is that CancellationException is a runtime exception, so it 
need not be mentioned in the method's signature. Javadoc generates the method's 
signature as is, and the throws section from @throws. Often, people do add 
Runtime exceptions to the javadocs to show that it will be thrown. get() does 
throw CancellationException if the task is cancelled by another thread or 
service shutdown. So I think it is ok to catch the CancellationException.


- Hari


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/5614/#review8665
-----------------------------------------------------------


On June 27, 2012, 12:03 p.m., Mike Percy wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/5614/
> -----------------------------------------------------------
> 
> (Updated June 27, 2012, 12:03 p.m.)
> 
> 
> Review request for Flume.
> 
> 
> Description
> -------
> 
> Avro RPC has an issue where the Avro sink can hang during the RPC handshake. 
> This patch is a workaround for the problem (as opposed to a fix for the 
> underlying problem). I still think we should fix the underlying problem and 
> remove this workaround at a later date.
> 
> While I was in the RPC client fixing stuff and improving the exception 
> messages, I went ahead and improved the exception/log messages in the avro 
> sink as well.
> 
> 
> This addresses bug FLUME-1329.
>     https://issues.apache.org/jira/browse/FLUME-1329
> 
> 
> Diffs
> -----
> 
>   flume-ng-core/src/main/java/org/apache/flume/sink/AvroSink.java 80b1d27 
>   flume-ng-sdk/src/main/java/org/apache/flume/api/NettyAvroRpcClient.java 
> b7eca53 
>   flume-ng-sdk/src/main/java/org/apache/flume/api/RpcClientFactory.java 
> 5b289e7 
> 
> Diff: https://reviews.apache.org/r/5614/diff/
> 
> 
> Testing
> -------
> 
> Unit tests pass.
> 
> 
> Thanks,
> 
> Mike Percy
> 
>

Reply via email to