From 5e76035caa617e1da2e01d5d86c5068ca13ca608 Mon Sep 17 00:00:00 2001 From: vozerov-gridgain Date: Wed, 1 Jul 2015 11:30:44 +0300 Subject: [PATCH] IGNITE-1059: Adopting the patch from Atri. --- .../processors/cache/IgniteCacheFutureImpl.java | 42 ++++++++++++++++++++++ .../processors/cache/IgniteCacheProxy.java | 2 +- .../internal/util/future/IgniteFutureImpl.java | 18 +++++++--- 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheFutureImpl.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheFutureImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheFutureImpl.java new file mode 100644 index 0000000..06c28e6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheFutureImpl.java @@ -0,0 +1,42 @@ +/* + * 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; + +import org.apache.ignite.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.util.future.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +/** + * Implementation of public API future for cache. + */ +public class IgniteCacheFutureImpl extends IgniteFutureImpl { + /** + * Constructor. + * + * @param fut Internal future. + */ + public IgniteCacheFutureImpl(IgniteInternalFuture fut) { + super(fut); + } + + /** {@inheritDoc} */ + @Override protected RuntimeException convertException(IgniteCheckedException e) { + return CU.convertToCacheException(e); + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index 48fd259..3360727 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -1555,7 +1555,7 @@ public class IgniteCacheProxy extends AsyncSupportAdapter void setFuture(IgniteInternalFuture fut) { - curFut.set(new IgniteFutureImpl<>(fut)); + curFut.set(new IgniteCacheFutureImpl<>(fut)); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java index 86ad438..764e0ea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java @@ -100,7 +100,7 @@ public class IgniteFutureImpl implements IgniteFuture { return fut.cancel(); } catch (IgniteCheckedException e) { - throw U.convertException(e); + throw convertException(e); } } @@ -110,7 +110,7 @@ public class IgniteFutureImpl implements IgniteFuture { return fut.get(); } catch (IgniteCheckedException e) { - throw U.convertException(e); + throw convertException(e); } } @@ -120,7 +120,7 @@ public class IgniteFutureImpl implements IgniteFuture { return fut.get(timeout); } catch (IgniteCheckedException e) { - throw U.convertException(e); + throw convertException(e); } } @@ -130,10 +130,20 @@ public class IgniteFutureImpl implements IgniteFuture { return fut.get(timeout, unit); } catch (IgniteCheckedException e) { - throw U.convertException(e); + throw convertException(e); } } + /** + * Convert internal exception to public exception. + * + * @param e Internal exception. + * @return Public excpetion. + */ + protected RuntimeException convertException(IgniteCheckedException e) { + return U.convertException(e); + } + /** {@inheritDoc} */ @Override public String toString() { return "IgniteFuture [orig=" + fut + ']'; -- 1.9.5.msysgit.0