/** * Transform session ID if ID transformer present. * * @param sesId Session ID to transform. * @return Transformed session ID or the same if no session transformer available. */ private String transformSessionId(final String sesId) { if (sesIdTransformer != null) return sesIdTransformer.apply(sesId); return sesId; }
/** {@inheritDoc} */ @Override public T next() { return trans.apply(cur = it.next()); }
/** {@inheritDoc} */ @Nullable @Override public Object execute() { return job.apply(arg); }
/** * Get IO policy for particular node with provided resolver. * * @param rslvr Resolver. * @param node Node. * @return IO policy. */ public static byte ioPolicy(@Nullable IgniteClosure<ClusterNode, Byte> rslvr, ClusterNode node) { assert node != null; Byte res = null; if (rslvr != null) res = rslvr.apply(node); if (res == null) res = DATA_STREAMER_POOL; return res; }
/** {@inheritDoc} */ @Nullable @Override public V1 get(Object key) { if (GridFunc.isAll((K)key, preds)) { V v = map.get(key); if (v != null) return clos.apply(v); } return null; }
/** * @param func Func. * @return Test builder. */ public JoinNodeTestPlanBuilder nodeConfiguration( IgniteClosure<IgniteConfiguration, IgniteConfiguration> func ) { nodeCfg = func.apply(nodeCfg); return this; }
/** {@inheritDoc} */ @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) { A.notNull(filePathClos, "filePathClos"); if (baseFileName == null) baseFileName = fileName; fileName = filePathClos.apply(baseFileName); }
@Override public T apply(IgniteInternalFuture<V> fut) { assert IgniteFutureImpl.this.fut == fut; try { return doneCb.apply(IgniteFutureImpl.this); } catch (Exception e) { throw new GridClosureException(e); } } };
/** {@inheritDoc} */ @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) { A.notNull(filePathClos, "filePathClos"); if (baseFileName == null) baseFileName = fileName; fileName = filePathClos.apply(baseFileName); }
/** {@inheritDoc} */ @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) { A.notNull(filePathClos, "filePathClos"); if (baseFileName == null) baseFileName = fileName; fileName = filePathClos.apply(baseFileName); } }
/** {@inheritDoc} */ @Nullable @Override public V get(Object key) { if (containsKey(key)) return clo.apply((K)key); return null; }
/** {@inheritDoc} */ @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) { A.notNull(filePathClos, "filePathClos"); if (baseFileName == null) baseFileName = fileName; fileName = filePathClos.apply(baseFileName); }
/** * @param trans Transformer. * @param evt Event. * @return Transformed value. */ private Object transform(IgniteClosure<CacheEntryEvent<? extends K, ? extends V>, ?> trans, CacheEntryEvent<? extends K, ? extends V> evt) { assert trans != null; Object transVal = null; try { transVal = trans.apply(evt); } catch (Exception e) { U.error(log, e); } return transVal; } }
/** {@inheritDoc} */ @SuppressWarnings({"SimplifiableIfStatement"}) @Override public boolean add(E e) { A.notNull(e, "e"); removeStale(); if (!contains(e)) return store.add(fact.apply(e)); return false; }
/** {@inheritDoc} */ @Override public PlatformProcessor start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx, long envPtr) { IgniteConfiguration cfg0 = closure(envPtr).apply(cfg); try { IgniteEx node = (IgniteEx)IgnitionEx.start(cfg0, springCtx); return node.context().platform(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public <R> IgniteInternalFuture<R> chain(final IgniteClosure<? super IgniteInternalFuture<T>, R> doneCb) { try { return new GridFinishedFuture<>(doneCb.apply(this)); } catch (GridClosureException e) { return new GridFinishedFuture<>(e.unwrap()); } catch (RuntimeException | Error e) { return new GridFinishedFuture<>(e); } }
/** {@inheritDoc} */ @SuppressWarnings({"SimplifiableIfStatement"}) @Override public boolean add(E e) { A.notNull(e, "e"); removeStale(); if (!contains(e)) return store.add(fact.apply(e)); return false; }
@Override public void run() { try { fut.onDone(doneCb.apply(GridFinishedFuture.this)); } catch (GridClosureException e) { fut.onDone(e.unwrap()); } catch (RuntimeException | Error e) { fut.onDone(e); throw e; } } });
@Override public void run() { c1.apply(msg); c2.apply(msg); c3.apply(); c4.reduce(); System.out.println("Test message: " + msg); } });