Skip to content

Commit

Permalink
[SPARK-2924] Required by scala 2.11, only one fun/ctor amongst overri…
Browse files Browse the repository at this point in the history
…den alternatives, can have default argument(s).

...riden alternatives, can have default argument.

Author: Prashant Sharma <prashant.s@imaginea.com>

Closes apache#2750 from ScrapCodes/SPARK-2924/default-args-removed and squashes the following commits:

d9785c3 [Prashant Sharma] [SPARK-2924] Required by scala 2.11, only one function/ctor amongst overriden alternatives, can have default argument.
  • Loading branch information
ScrapCodes authored and aarondav committed Oct 17, 2014
1 parent 2c5d9dc commit 5b5dbe6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
19 changes: 17 additions & 2 deletions core/src/main/scala/org/apache/spark/util/FileLogger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,27 @@ private[spark] class FileLogger(
def this(
logDir: String,
sparkConf: SparkConf,
compress: Boolean = false,
overwrite: Boolean = true) = {
compress: Boolean,
overwrite: Boolean) = {
this(logDir, sparkConf, SparkHadoopUtil.get.newConfiguration(sparkConf), compress = compress,
overwrite = overwrite)
}

def this(
logDir: String,
sparkConf: SparkConf,
compress: Boolean) = {
this(logDir, sparkConf, SparkHadoopUtil.get.newConfiguration(sparkConf), compress = compress,
overwrite = true)
}

def this(
logDir: String,
sparkConf: SparkConf) = {
this(logDir, sparkConf, SparkHadoopUtil.get.newConfiguration(sparkConf), compress = false,
overwrite = true)
}

private val dateFormat = new ThreadLocal[SimpleDateFormat]() {
override def initialValue(): SimpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ class FileLoggerSuite extends FunSuite with BeforeAndAfter {

test("Logging when directory already exists") {
// Create the logging directory multiple times
new FileLogger(logDirPathString, new SparkConf, overwrite = true).start()
new FileLogger(logDirPathString, new SparkConf, overwrite = true).start()
new FileLogger(logDirPathString, new SparkConf, overwrite = true).start()
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = true).start()
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = true).start()
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = true).start()

// If overwrite is not enabled, an exception should be thrown
intercept[IOException] {
new FileLogger(logDirPathString, new SparkConf, overwrite = false).start()
new FileLogger(logDirPathString, new SparkConf, compress = false, overwrite = false).start()
}
}

Expand Down

0 comments on commit 5b5dbe6

Please sign in to comment.