Skip to content

Commit 7f74bb3

Browse files
zsxwingrxin
authored andcommitted
[SPARK-8025][Streaming]Add JavaDoc style deprecation for deprecated Streaming methods
Scala `deprecated` annotation actually doesn't show up in JavaDoc. Author: zsxwing <[email protected]> Closes #6564 from zsxwing/SPARK-8025 and squashes the following commits: 2faa2bb [zsxwing] Add JavaDoc style deprecation for deprecated Streaming methods
1 parent 75dda33 commit 7f74bb3

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ class StreamingContext private[streaming] (
271271
* Create an input stream with any arbitrary user implemented receiver.
272272
* Find more details at: http://spark.apache.org/docs/latest/streaming-custom-receivers.html
273273
* @param receiver Custom implementation of Receiver
274+
*
275+
* @deprecated As of 1.0.0", replaced by `receiverStream`.
274276
*/
275277
@deprecated("Use receiverStream", "1.0.0")
276278
def networkStream[T: ClassTag](receiver: Receiver[T]): ReceiverInputDStream[T] = {
@@ -617,6 +619,8 @@ class StreamingContext private[streaming] (
617619
* Wait for the execution to stop. Any exceptions that occurs during the execution
618620
* will be thrown in this thread.
619621
* @param timeout time to wait in milliseconds
622+
*
623+
* @deprecated As of 1.3.0, replaced by `awaitTerminationOrTimeout(Long)`.
620624
*/
621625
@deprecated("Use awaitTerminationOrTimeout(Long) instead", "1.3.0")
622626
def awaitTermination(timeout: Long) {
@@ -741,6 +745,10 @@ object StreamingContext extends Logging {
741745
}
742746
}
743747

748+
/**
749+
* @deprecated As of 1.3.0, replaced by implicit functions in the DStream companion object.
750+
* This is kept here only for backward compatibility.
751+
*/
744752
@deprecated("Replaced by implicit functions in the DStream companion object. This is " +
745753
"kept here only for backward compatibility.", "1.3.0")
746754
def toPairDStreamFunctions[K, V](stream: DStream[(K, V)])

streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaStreamingContext.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ class JavaStreamingContext(val ssc: StreamingContext) extends Closeable {
148148
/** The underlying SparkContext */
149149
val sparkContext = new JavaSparkContext(ssc.sc)
150150

151+
/**
152+
* @deprecated As of 0.9.0, replaced by `sparkContext`
153+
*/
151154
@deprecated("use sparkContext", "0.9.0")
152155
val sc: JavaSparkContext = sparkContext
153156

@@ -619,6 +622,7 @@ class JavaStreamingContext(val ssc: StreamingContext) extends Closeable {
619622
* Wait for the execution to stop. Any exceptions that occurs during the execution
620623
* will be thrown in this thread.
621624
* @param timeout time to wait in milliseconds
625+
* @deprecated As of 1.3.0, replaced by `awaitTerminationOrTimeout(Long)`.
622626
*/
623627
@deprecated("Use awaitTerminationOrTimeout(Long) instead", "1.3.0")
624628
def awaitTermination(timeout: Long): Unit = {
@@ -677,6 +681,7 @@ object JavaStreamingContext {
677681
*
678682
* @param checkpointPath Checkpoint directory used in an earlier JavaStreamingContext program
679683
* @param factory JavaStreamingContextFactory object to create a new JavaStreamingContext
684+
* @deprecated As of 1.4.0, replaced by `getOrCreate` without JavaStreamingContextFactor.
680685
*/
681686
@deprecated("use getOrCreate without JavaStreamingContextFactor", "1.4.0")
682687
def getOrCreate(
@@ -699,6 +704,7 @@ object JavaStreamingContext {
699704
* @param factory JavaStreamingContextFactory object to create a new JavaStreamingContext
700705
* @param hadoopConf Hadoop configuration if necessary for reading from any HDFS compatible
701706
* file system
707+
* @deprecated As of 1.4.0, replaced by `getOrCreate` without JavaStreamingContextFactor.
702708
*/
703709
@deprecated("use getOrCreate without JavaStreamingContextFactory", "1.4.0")
704710
def getOrCreate(
@@ -724,6 +730,7 @@ object JavaStreamingContext {
724730
* file system
725731
* @param createOnError Whether to create a new JavaStreamingContext if there is an
726732
* error in reading checkpoint data.
733+
* @deprecated As of 1.4.0, replaced by `getOrCreate` without JavaStreamingContextFactor.
727734
*/
728735
@deprecated("use getOrCreate without JavaStreamingContextFactory", "1.4.0")
729736
def getOrCreate(

streaming/src/main/scala/org/apache/spark/streaming/dstream/DStream.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ abstract class DStream[T: ClassTag] (
603603
/**
604604
* Apply a function to each RDD in this DStream. This is an output operator, so
605605
* 'this' DStream will be registered as an output stream and therefore materialized.
606+
*
607+
* @deprecated As of 0.9.0, replaced by `foreachRDD`.
606608
*/
607609
@deprecated("use foreachRDD", "0.9.0")
608610
def foreach(foreachFunc: RDD[T] => Unit): Unit = ssc.withScope {
@@ -612,6 +614,8 @@ abstract class DStream[T: ClassTag] (
612614
/**
613615
* Apply a function to each RDD in this DStream. This is an output operator, so
614616
* 'this' DStream will be registered as an output stream and therefore materialized.
617+
*
618+
* @deprecated As of 0.9.0, replaced by `foreachRDD`.
615619
*/
616620
@deprecated("use foreachRDD", "0.9.0")
617621
def foreach(foreachFunc: (RDD[T], Time) => Unit): Unit = ssc.withScope {

0 commit comments

Comments
 (0)