[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13849114#comment-13849114
 ] 

Bruno Freudensprung commented on ZOOKEEPER-1835:
------------------------------------------------

Hi Ralesh,

Yes I will refactor the writer logic following your suggestion.
However I am not fond of the global "catch Exception": since it is re-thrown, 
either this will modify the signature of all caller methods (throws Exception), 
or caller methods will have to catch the Exception and rethrow an IOException 
(or any other one) embedding the Exception (that was an IOException anyway). 
This is odd.
Either the exception is checked and enforced by the compiler (here 
IOException), or it is unchecked and it will be a subclass of RuntimeException.
That's why, as catching a Throwable is never a good idea, we are sure that the 
double catch (IOException and RuntimeException) is necessary and sufficient. It 
induces a bit of code duplication, but it sanitizes the throws clause of the 
method. Would you agree if I left it like as is?

Bruno.


> dynamic configuration file renaming fails on Windows
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-1835
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1835
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: quorum
>    Affects Versions: 3.5.0
>         Environment: Windows 7 64-bit, Oracle Java  1.6.0_32-b05
>            Reporter: Bruno Freudensprung
>         Attachments: ZOOKEEPER-1835.patch
>
>
> On Windows, reconfig fails to rename the tmp dynamic config file to the real 
> dynamic config filename.
> Javadoc of java.io.File.renameTo says the behavior is highly plateform 
> dependent, so I guess this should not be a big surprise.
> The problem occurs in 
> src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java that 
> could be modified like this:
> + curFile.delete();
> if (!tmpFile.renameTo(curFile)) {
> + configFile.delete();
> if (!tmpFile.renameTo(configFile)) {
> As suggested by Alex in https://issues.apache.org/jira/browse/ZOOKEEPER-1691 
> (btw there is more information about my test scenario over there) it is a bit 
> "scary" to delete the current configuration file.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to