From d097624a657897f5222690c974b7ed9b67128a82 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com>
Date: Mon, 12 Dec 2016 01:32:35 -0500
Subject: [PATCH] Changed caching into a is/setter. Bumped snapshot version to
 1.4.0 since this change effects the interface.

---
 CHANGELOG.md                                         |  4 ++++
 pom.xml                                              |  2 +-
 .../aparapi/internal/kernel/KernelPreferences.java   |  8 ++++----
 .../com/aparapi/internal/kernel/KernelRunner.java    | 12 ++++++++++--
 .../com/aparapi/internal/opencl/OpenCLLoader.java    |  8 ++++----
 5 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24b97031..3184c227 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Aparapi Changelog
 
+## 1.4.0
+
+* KernelRunner.BINARY_CACHEING_DISABLED is no longer availible, is/setter is to be used instead.
+
 ## 1.3.2
 
 * Added Windows 64bit support.
diff --git a/pom.xml b/pom.xml
index 4a674fd8..0d92774f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
 
     <groupId>com.aparapi</groupId>
     <artifactId>aparapi</artifactId>
-    <version>1.3.3-SNAPSHOT</version>
+    <version>1.4.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <properties>
diff --git a/src/main/java/com/aparapi/internal/kernel/KernelPreferences.java b/src/main/java/com/aparapi/internal/kernel/KernelPreferences.java
index 7b9922cd..d5e103b7 100644
--- a/src/main/java/com/aparapi/internal/kernel/KernelPreferences.java
+++ b/src/main/java/com/aparapi/internal/kernel/KernelPreferences.java
@@ -1,12 +1,12 @@
 /**
  * Copyright (c) 2016 - 2017 Syncleus, Inc.
- * <p>
+ *
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *     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.
diff --git a/src/main/java/com/aparapi/internal/kernel/KernelRunner.java b/src/main/java/com/aparapi/internal/kernel/KernelRunner.java
index bc35600e..a91bcdec 100644
--- a/src/main/java/com/aparapi/internal/kernel/KernelRunner.java
+++ b/src/main/java/com/aparapi/internal/kernel/KernelRunner.java
@@ -108,7 +108,7 @@ import java.util.logging.Logger;
  */
 public class KernelRunner extends KernelRunnerJNI{
 
-   public static final boolean BINARY_CACHING_DISABLED = false;
+   private static boolean binaryCacheing = true;
 
    private static final int MINIMUM_ARRAY_SIZE = 1;
 
@@ -188,6 +188,14 @@ public class KernelRunner extends KernelRunnerJNI{
       KernelManager.instance(); // ensures static initialization of KernelManager
    }
 
+   public static boolean isBinaryCacheing() {
+      return binaryCacheing;
+   }
+
+   public static void setBinaryCacheing(boolean binaryCacheing) {
+      KernelRunner.binaryCacheing = binaryCacheing;
+   }
+
    /**
     * @see Kernel#cleanUpArrays().
     */
@@ -1370,7 +1378,7 @@ public class KernelRunner extends KernelRunnerJNI{
 
                   // Send the string to OpenCL to compile it, or if the compiled binary is already cached on JNI side just empty string to use cached binary
                   long handle;
-                  if (BINARY_CACHING_DISABLED) {
+                  if (!isBinaryCacheing()) {
                      handle = buildProgramJNI(jniContextHandle, openCL, "");
                   } else {
                      synchronized (seenBinaryKeys) {
diff --git a/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java b/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java
index c417d905..520c5a12 100644
--- a/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java
+++ b/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java
@@ -1,12 +1,12 @@
 /**
  * Copyright (c) 2016 - 2017 Syncleus, Inc.
- * <p>
+ *
  * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *     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.
-- 
GitLab