/** * Sets port range router will be allowed to try. * <p> * Note: zero-range means only user-specified port will be used. * * @param portRange Port range. * @see #DFLT_PORT_RANGE */ public void setPortRange(int portRange) { A.ensure(portRange >= 0, "portRange >= 0"); this.portRange = portRange; }
/** * Sets path to the key store file. This is a mandatory parameter since * ssl context could not be initialized without key manager. * * @param keyStoreFilePath Path to key store file. */ public void setKeyStoreFilePath(String keyStoreFilePath) { A.notNull(keyStoreFilePath, "keyStoreFilePath"); this.keyStoreFilePath = keyStoreFilePath; }
/** {@inheritDoc} */ @Override public void enableLocal(int[] types) { A.notEmpty(types, "types"); guard(); try { ctx.event().enableEvents(types); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public R get(long timeout, TimeUnit unit) throws IOException, GridException { A.ensure(timeout >= 0, "timeout cannot be negative: " + timeout); A.notNull(unit, "unit"); try { return get0(unit.toNanos(timeout)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new GridInterruptedException("Got interrupted while waiting for future to complete.", e); } }
/** {@inheritDoc} */ @Override public void disableLocal(int[] types) { A.notEmpty(types, "types"); guard(); try { ctx.event().disableEvents(types); } finally { unguard(); } }
/** * @param hosts New hosts. */ public void hosts(String[] hosts) { A.notNull(hosts, "hosts"); this.hosts = hosts; }
/** * Initializes tuple with given object count. * * @param cnt Count of objects to be stored in the tuple. */ public GridTupleV(int cnt) { A.ensure(cnt > 0, "cnt > 0"); vals = new Object[cnt]; }
/** {@inheritDoc} */ @Override public GridFuture<Collection<GridTuple3<String, Boolean, String>>> startNodes(File file, boolean restart, int timeout, int maxConn) throws GridException { A.notNull(file, "file"); A.ensure(file.exists(), "file doesn't exist."); A.ensure(file.isFile(), "file is a directory."); GridBiTuple<Collection<Map<String, Object>>, Map<String, Object>> t = parseFile(file); return startNodes(t.get1(), t.get2(), restart, timeout, maxConn); }
/** {@inheritDoc} */ @Override public GridFuture<?> run(Collection<? extends Runnable> jobs) { A.notEmpty(jobs, "jobs"); guard(); try { return ctx.closure().runAsync(BALANCE, jobs, prj.nodes()); } finally { unguard(); } }
/** * Checks whether this path is a sub-directory of argument. * * @param path Path to check. * @return {@code True} if argument is same or a sub-directory of this object. */ public boolean isSubDirectoryOf(GridGgfsPath path) { A.notNull(path, "path"); return this.path.startsWith(path.path.endsWith(SLASH) ? path.path : path.path + SLASH); }
/** * Retrieves value at given index. * * @param i Index of the value to get. * @param <V> Value type. * @return Value at given index. */ @SuppressWarnings({"unchecked"}) public <V> V get(int i) { A.ensure(i < vals.length, "i < vals.length"); return (V)vals[i]; }
/** {@inheritDoc} */ @Override public R get(long timeout, TimeUnit unit) throws GridException { A.ensure(timeout >= 0, "timeout cannot be negative: " + timeout); A.notNull(unit, "unit"); checkValid(); try { return get0(unit.toNanos(timeout)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new GridInterruptedException("Got interrupted while waiting for future to complete.", e); } }
/** {@inheritDoc} */ @Override public <R> GridFuture<Collection<R>> call(Collection<? extends Callable<R>> jobs) { A.notEmpty(jobs, "jobs"); guard(); try { return ctx.closure().callAsync(BALANCE, jobs, prj.nodes()); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public void setAttribute(Object key, @Nullable Object val) { A.notNull(key, "key"); synchronized (mux) { attrs.put( key, val); } }
/** * Sets read stripe size. Defines number of file channels to be used concurrently. Default is equal to number of * CPU cores available to this JVM. * * @param readStripesNum Read stripe number. */ public void setReadStripesNumber(int readStripesNum) { A.ensure(readStripesNum == -1 || (readStripesNum & (readStripesNum - 1)) == 0, "readStripesNum must be positive and power of two"); this.readStripesNum = readStripesNum; }
/** {@inheritDoc} */ @Override public void addEventsToStage(String stageName, Collection<?> evts) throws GridException { A.notNull(stageName, "stageName"); A.ensure(!F.isEmpty(evts), "evts cannot be empty or null"); ctx.gateway().readLock(); try { addEvents0(null, 0, U.currentTimeMillis(), null, Collections.singleton(ctx.localNodeId()), stageName, evts); } finally { ctx.gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public <K, V> GridClientFuture<Boolean> prependAsync(final K key, final V val) throws GridClientException { A.notNull(key, "key"); A.notNull(val, "val"); return withReconnectHandling(new ClientProjectionClosure<Boolean>() { @Override public GridClientFuture<Boolean> apply(GridClientConnection conn, UUID destNodeId) throws GridClientConnectionResetException, GridClientClosedException { return conn.cachePrepend(cacheName, key, val, flags, destNodeId); } }, cacheName, key); }