Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
timoninmaxim committed Nov 13, 2024
1 parent e6851de commit 4995763
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public IoTracker ioTracker() {
}

/**
* Instantiate an object contained a user defined function and inject resources into it.
* Return an object contained a user defined function. If not exist yet, then instantiate the object and inject resources into it.
* Used by {@link ReflectiveCallNotNullImplementor} while it is preparing user function call.
*
* @param udfClsName Classname of the class contained UDF.
Expand All @@ -381,7 +381,7 @@ public Object udfObject(String udfClsName) {
return target;
}
catch (Exception e) {
throw new IgniteException("Failed to construct object for UDF. " +
throw new IgniteException("Failed to instantiate an object for UDF. " +
"Class " + udfClsName + " must have public zero-args constructor.", e);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@
package org.apache.ignite.cache;

import org.apache.ignite.Ignite;
import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
import org.jetbrains.annotations.Nullable;

/**
* Provides access to attributes set with {@link Ignite#withApplicationAttributes} in functions:
* <ul>
* <li>{@link QuerySqlFunction}</li>
* </ul>
* Provides access to attributes set with {@link Ignite#withApplicationAttributes}.
*/
public interface SessionContext {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
/** Ignite instance aware of application attributes set with {@link Ignite#withApplicationAttributes(Map)}. */
public class IgniteApplicationAttributesAware implements Ignite {
/** */
private final IgniteEx delegate;
private final Ignite delegate;

/** Application attributes. */
private final Map<String, String> attrs;
Expand All @@ -78,14 +78,19 @@ public class IgniteApplicationAttributesAware implements Ignite {
* @param delegate Parent Ignite instance.
* @param attrs Application attributes.
*/
public IgniteApplicationAttributesAware(IgniteEx delegate, Map<String, String> attrs) {
public IgniteApplicationAttributesAware(Ignite delegate, Map<String, String> attrs) {
A.notNull(attrs, "application attributes");

this.delegate = delegate;
this.attrs = new HashMap<>(attrs);
}

/** */
/**
* Set application attributes to all returned caches.
*
* @param cache Cache.
* @return Cache with application attributes.
*/
private <K, V> IgniteCache<K, V> withApplicationAttributes(IgniteCache<K, V> cache) {
return ((IgniteCacheProxy<K, V>)cache).withApplicationAttributes(attrs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ public AutoCloseable withContext(@Nullable Map<String, String> sesAttrs) {
return ctx.get();
}

/** */
/** Clears session context for current thread. */
public void clear() {
ctx.remove();
}

/** @return Session attributes for current context. */
public @Nullable Map<String, String> attributes() {
SessionContextCloseable ses = (SessionContextCloseable)ctx.get();

Expand Down

0 comments on commit 4995763

Please sign in to comment.