Skip to content

Commit 2faa2bb

Browse files
committed
Add JavaDoc style deprecation for deprecated Streaming methods
1 parent 90c6069 commit 2faa2bb

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
@@ -270,6 +270,8 @@ class StreamingContext private[streaming] (
270270
* Create an input stream with any arbitrary user implemented receiver.
271271
* Find more details at: http://spark.apache.org/docs/latest/streaming-custom-receivers.html
272272
* @param receiver Custom implementation of Receiver
273+
*
274+
* @deprecated As of 1.0.0", replaced by `receiverStream`.
273275
*/
274276
@deprecated("Use receiverStream", "1.0.0")
275277
def networkStream[T: ClassTag](receiver: Receiver[T]): ReceiverInputDStream[T] = {
@@ -608,6 +610,8 @@ class StreamingContext private[streaming] (
608610
* Wait for the execution to stop. Any exceptions that occurs during the execution
609611
* will be thrown in this thread.
610612
* @param timeout time to wait in milliseconds
613+
*
614+
* @deprecated As of 1.3.0, replaced by `awaitTerminationOrTimeout(Long)`.
611615
*/
612616
@deprecated("Use awaitTerminationOrTimeout(Long) instead", "1.3.0")
613617
def awaitTermination(timeout: Long) {
@@ -732,6 +736,10 @@ object StreamingContext extends Logging {
732736
}
733737
}
734738

739+
/**
740+
* @deprecated As of 1.3.0, replaced by implicit functions in the DStream companion object.
741+
* This is kept here only for backward compatibility.
742+
*/
735743
@deprecated("Replaced by implicit functions in the DStream companion object. This is " +
736744
"kept here only for backward compatibility.", "1.3.0")
737745
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)