Repository: incubator-ignite Updated Branches: refs/heads/ignite-sprint-4 d20d29b56 -> 5bf4734a7
# IGNITE-693: Done. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5bf4734a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5bf4734a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5bf4734a Branch: refs/heads/ignite-sprint-4 Commit: 5bf4734a7cee9b6ed0004a05b0099a922827aa80 Parents: d20d29b Author: vozerov-gridgain <[email protected]> Authored: Tue Apr 7 12:37:07 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Tue Apr 7 12:37:07 2015 +0300 ---------------------------------------------------------------------- .../CacheQueryCloseableScanBiPredicate.java | 30 ++++++++++++++++++++ .../cache/query/GridCacheQueryManager.java | 8 +++++- 2 files changed, 37 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5bf4734a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryCloseableScanBiPredicate.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryCloseableScanBiPredicate.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryCloseableScanBiPredicate.java new file mode 100644 index 0000000..fe2fb8e --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryCloseableScanBiPredicate.java @@ -0,0 +1,30 @@ +/* + * 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.ignite.internal.processors.cache.query; + +import org.apache.ignite.lang.*; + +/** + * Special version of bi-predicate for cache scan queries with close callback. + */ +public interface CacheQueryCloseableScanBiPredicate<K, V> extends IgniteBiPredicate<K, V> { + /** + * Callback invoked when predicate is not longer needed. + */ + public void onClose(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5bf4734a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java index d571243..4991691 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java @@ -900,7 +900,13 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte } @Override protected void onClose() throws IgniteCheckedException { - heapIt.close(); + try { + heapIt.close(); + } + finally { + if (keyValFilter instanceof CacheQueryCloseableScanBiPredicate) + ((CacheQueryCloseableScanBiPredicate)keyValFilter).onClose(); + } } }; }
