How to reuse spark RDD after stopping the Context
<p>I have created an RDD, Below is my Program.</p>

<pre><code>public static void main(String[] args) throws JSONException, IOException, InterruptedException {

         SparkConf conf1 = new SparkConf().setAppName("SparkAutomation").setMaster("local");

         app.run(conf1);

}


private void run(SparkConf conf) throws JSONException, IOException,    InterruptedException {
JavaSparkContext sc = new JavaSparkContext(conf);

getDataFrom(sc);
sc.stop();   

}

 void getDataFrom(JavaSparkContext sc) throws JSONException, IOException, InterruptedException {

JavaRDD&lt;String&gt; Data = sc.textFile("/path/to/File");

}
</code></pre>

<p>I want to use the RDD created above in the other part of the application , I have to stop the context , I need to create another Context , and will use the above RDD there. My question is will I be able to use the RDD if I persist that to Memory ?</p>

<pre><code>  Data.persist(StorageLevel.MEMORY_ONLY());
</code></pre>

<p>Or do I have to persist that to Disk.</p>

<pre><code>  Data.persist(StorageLevel.DISK_ONLY());
</code></pre>