Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[SNAp-2084] Added a check to set Snappy UMM if found in classpath.
  • Loading branch information
rmishra committed Nov 14, 2017
commit a6c40837aa14268ac915a8ad623d70f395c5b16e
38 changes: 38 additions & 0 deletions core/src/main/scala/org/apache/spark/SparkSnappyUtils.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2017 SnappyData, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package org.apache.spark

import org.apache.spark.memory.MemoryManager
import org.apache.spark.util.Utils


object SparkSnappyUtils {

val SNAPPY_UNIFIED_MEMORY_MANAGER_CLASS = "org.apache.spark.memory.SnappyUnifiedMemoryManager"

def loadSnappyManager(conf: SparkConf, numUsableCores: Int): Option[MemoryManager] = {
try {
Some(Utils.classForName(SNAPPY_UNIFIED_MEMORY_MANAGER_CLASS)
.getConstructor(classOf[SparkConf], classOf[Int])
.newInstance(conf, Int.box(numUsableCores))
.asInstanceOf[MemoryManager])
} catch {
case ex: ClassNotFoundException => None
}
}

}