MNEMONIC-499: The refBreak function should be prevented from reclaimable referred durable object
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/AnnotatedDurableEntityClass.java b/mnemonic-core/src/main/java/org/apache/mnemonic/AnnotatedDurableEntityClass.java
index 5bc877a..be5763d 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/AnnotatedDurableEntityClass.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/AnnotatedDurableEntityClass.java
@@ -865,6 +865,10 @@
           case "refbreak":
             for (FieldInfo fldinfo : m_dynfieldsinfo.values()) {
               if (fldinfo.refbreak && !isUnboxPrimitive(fldinfo.type)) {
+                code.beginControlFlow("if ($1N != null && $1N.autoReclaim())", fldinfo.name);
+                code.addStatement(
+                    "throw new ReferenceBreakingException(\"Not be able to break reference if it is reclaimable.\")");
+                code.endControlFlow();
                 code.addStatement("$1N = null", fldinfo.name);
               }
             }
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/ReferenceBreakingException.java b/mnemonic-core/src/main/java/org/apache/mnemonic/ReferenceBreakingException.java
new file mode 100644
index 0000000..fca3de2
--- /dev/null
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/ReferenceBreakingException.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.mnemonic;
+
+/**
+ * this Exception will be thrown once cache pool has been out of space.
+ *
+ */
+public class ReferenceBreakingException extends RuntimeException {
+
+  /**
+   * accept a exception message to describe specific condition.
+   *
+   * @param message
+   *          exception message
+   */
+  public ReferenceBreakingException(String message) {
+    super(message);
+  }
+}