/** * @return {@code True} if have cache stop requests. */ public boolean hasStop() { return !F.isEmpty(cachesToStop); }
/** * @return {@code True} if there are no cache change actions. */ public boolean empty() { return F.isEmpty(cachesToStart) && F.isEmpty(cachesToStop) && F.isEmpty(cacheGrpsToStart) && F.isEmpty(cacheGrpsToStop) && F.isEmpty(cachesToResetLostParts) && stateChangeReq == null && locJoinCtx == null; }
/** * @param prepared Prepared. * @param sql Remaining SQL. */ public PreparedWithRemaining(Prepared prepared, String sql) { this.prepared = prepared; if (sql != null) sql = sql.trim(); remainingSql = !F.isEmpty(sql) ? sql : null; }
/** {@inheritDoc} */ @Override public synchronized void unregisterAddresses(Collection<InetSocketAddress> addrs) { assert !F.isEmpty(addrs); this.addrs = new LinkedHashSet<>(this.addrs); this.addrs.removeAll(addrs); }
/** {@inheritDoc} */ @Override public Set<ClusterNode> nodes() { Set<ClusterNode> res = new HashSet<>(); for (int p = 0; p < assignment.size(); p++) { List<ClusterNode> nodes = assignment.get(p); if (!F.isEmpty(nodes)) res.addAll(nodes); } return Collections.unmodifiableSet(res); }
/** {@inheritDoc} */ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) { assert job != null : "Job null-check must be performed in native platform."; if (!F.isEmpty(subgrid)) { Map<ComputeJob, ClusterNode> map = new HashMap<>(1, 1); map.put(job, lb.getBalancedNode(job, null)); return map; } else return Collections.emptyMap(); }
/** {@inheritDoc} */ @Nullable @Override public R reduce(List<ComputeJobResult> results) { if (!F.isEmpty(results)) { ComputeJobResult res = results.get(0); return res.getData(); } else return null; }
/** * @param passwd Plain text password. * @return {@code true} If user authorized, otherwise returns {@code false}. */ public boolean authorize(String passwd) { if (F.isEmpty(passwd)) return hashedPasswd == null; return BCrypt.checkpw(passwd, hashedPasswd); }
/** {@inheritDoc} */ @Override public long getTotalAllocatedSize() { if (!metricsEnabled) return 0; Collection<DataRegionMetrics> regionMetrics0 = regionMetrics; if (F.isEmpty(regionMetrics0)) return 0; long totalAllocatedSize = 0L; for (DataRegionMetrics rm : regionMetrics0) totalAllocatedSize += rm.getTotalAllocatedSize(); return totalAllocatedSize; }
/** * @param alias Alias. * @param expr Expr. * @param useAs Use 'AS' keyword. */ public GridSqlAlias(String alias, GridSqlAst expr, boolean useAs) { super(new ArrayList<GridSqlAst>(1)); addChild(expr); assert !F.isEmpty(alias): alias; this.useAs = useAs; this.alias = alias; }
/** * @param arr Sorted array to search in. * @param val Value. * @return {@code True} if value has been found. */ private boolean binarySearch(@Nullable int[] arr, int val) { if (F.isEmpty(arr)) return false; // If length is relatively small, full iteration is faster. return arr.length <= 128 ? F.contains(arr, val) : Arrays.binarySearch(arr, val) >= 0; }
/** * Adds owned versions to map. * * @param vers Map of owned versions. */ public void ownedVersions(Map<IgniteTxKey, GridCacheVersion> vers) { if (F.isEmpty(vers)) return; if (owned == null) owned = new GridLeanMap<>(vers.size()); owned.putAll(vers); }
/** {@inheritDoc} */ @Override public int executeUpdate(String sql, String[] colNames) throws SQLException { ensureNotClosed(); if (!F.isEmpty(colNames)) throw new SQLFeatureNotSupportedException("Auto generated keys are not supported."); return executeUpdate(sql); }
/** {@inheritDoc} */ @Override public boolean execute(String sql, int[] colIndexes) throws SQLException { ensureNotClosed(); if (!F.isEmpty(colIndexes)) throw new SQLFeatureNotSupportedException("Auto generated keys are not supported."); return execute(sql); }
/** * Get number of local mappers. * * @param plan Plan. * @return Number of local mappers. */ private int localMappersCount(HadoopMapReducePlan plan) { Collection<HadoopInputSplit> locMappers = plan.mappers(ctx.localNodeId()); return F.isEmpty(locMappers) ? 0 : locMappers.size(); }
/** {@inheritDoc} */ @Override public String getState(String name) { if (F.isEmpty(name)) name = null; return G.state(name).toString(); }
/** {@inheritDoc} */ @Override public void writeBinary(BinaryWriterExImpl writer, ClientListenerProtocolVersion ver) throws BinaryObjectException { super.writeBinary(writer, ver); if (F.isEmpty(meta)) writer.writeInt(0); else { writer.writeInt(meta.size()); for(JdbcParameterMeta m : meta) m.writeBinary(writer, ver); } }
/** * Check that user has not added anything to this statement's batch prior to turning streaming on. * @throws SQLException if failed. */ void checkStatementBatchEmpty() throws SQLException { if (conn.isStream() && !F.isEmpty(batch)) throw new IgniteSQLException("Statement has non-empty batch (call executeBatch() or clearBatch() " + "before enabling streaming).", IgniteQueryErrorCode.UNSUPPORTED_OPERATION).toJdbcException(); }