[ 
https://issues.apache.org/jira/browse/HADOOP-5000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662902#action_12662902
 ] 

Alejandro Abdelnur commented on HADOOP-5000:
--------------------------------------------

Another options:

3. add a constructor that takes an InputStream
4. add a {{readXML(InputStream)}} method

Looking at when this was added, it was added as part of HADOOP-3702 (I did part 
of it) based on suggestions on how to serialize/deserialize configurations 
to/from a string.

But is seems that a later refactoring changed how this is done.

My problem is that we've started using this method because we need to stream 
configurations and recreate them from the stream on the other end.

I would be happy with #2, #3 or #4. Maybe be for symmetry #4 is the most 
appropriate approach.


> A Configuration instance cannot be reloaded if the configuration has 
> InputStream resources
> ------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-5000
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5000
>             Project: Hadoop Core
>          Issue Type: Bug
>         Environment: all
>            Reporter: Alejandro Abdelnur
>
> If a {{Configuration}} instance as a stream resource, on an reload of 
> configuration values, the {{loadResource}} method will fail because the 
> stream has been already read in the first {{loadResource}} invocation.
> For example:
> {code}
> InputStream is = ....
> Configuration conf = new Configuration();
> conf.addResource(is);
> conf.set("a", "A");
> conf.reloadConfiguration();
> conf.set("a","B");
> {code}
> This example will fail on {{conf.set("b", "B");}} because it a 
> {{loadResources()}} will be done and the {{InputStream}} has been already 
> consumed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to