require '/pengine/model/plugin'
require 'matrix'
require 'jlmatrix'

import com.approximatrix.draco.application.preferences.PreferencesManager
import java.lang.System

thread_count = nil
parallel_multiply = false

begin
  manager = PreferencesManager.new
  thread_count = manager.getPluginPrefs.getThreadLimit()
  parallel_multiply = manager.getPluginPrefs.isParallelMultiplyEnabled()
rescue
  System.err.println "Plugin preferences were unavailable"  
end

begin
  Matrix.set_thread_count(thread_count)
  Matrix.set_parallel_multiply(parallel_multiply)
rescue
  System.err.println "Failed to set Matrix settings"
end