/** * @param supplier supplier for the property's default value * @param description description of the default value * @return the updated builder instance */ public Builder setDefaultSupplier(Supplier<Object> supplier, String description) { mDefaultSupplier = new DefaultSupplier(supplier, description); return this; }
protected long getRemoteServiceVersion() throws AlluxioStatusException { return retryRPC(new RpcCallable<Long>() { public Long call() { return mVersionService.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(getRemoteServiceType()).build()) .getVersion(); } }); }
/** * Convenience method for calling {@link #get(Class, int)} with a default timeout. * * @param clazz the class of the {@link Server} to get * @param <W> the type of the {@link Server} to get * @return the {@link Server} instance */ public <W extends T> W get(final Class<W> clazz) { return get(clazz, Constants.DEFAULT_REGISTRY_GET_TIMEOUT_MS); }
/** * @param path the path to strip the scheme from * @return the path, with the optional scheme stripped away */ private String stripPath(String path) { return new AlluxioURI(path).getPath(); } }
@Override public String toString() { return mUri.toString(); } }
/** * Creates a file system context with a subject. * * @param subject the parent subject, set to null if not present */ private FileSystemContext(Subject subject, AlluxioConfiguration alluxioConf) { this(ClientContext.create(subject, alluxioConf)); }
/** * This constructor does not create a copy of the configuration. */ protected ClientContext(ClientContext ctx) { mSubject = ctx.getSubject(); mConf = ctx.getConf(); }
/** * Call response. * * @param <T> the type parameter * @param callable the callable * @param alluxioConf the alluxio conf * @return the response */ public static <T> Response call(RestUtils.RestCallable<T> callable, AlluxioConfiguration alluxioConf) { return call(callable, alluxioConf, null); }
/** * Logs a fatal error and then exits the system. * * @param logger the logger to log to * @param format the error message format string * @param args args for the format string */ public static void fatalError(Logger logger, String format, Object... args) { fatalError(logger, null, format, args); }
/** * @return the {@link AlluxioConfiguration} backing this {@link FileSystemContext} */ public AlluxioConfiguration getConf() { return mClientContext.getConf(); }
private Comparator<String> getTierAliasComparator() { return new Comparator<String>() { private WorkerStorageTierAssoc mTierAssoc = new WorkerStorageTierAssoc(); @Override public int compare(String tier1, String tier2) { int ordinal1 = mTierAssoc.getOrdinal(tier1); int ordinal2 = mTierAssoc.getOrdinal(tier2); return Integer.compare(ordinal1, ordinal2); } }; }
/** * Stops all {@link Server}s in reverse dependency order. If A depends on B, B is stopped * before A. */ public void stop() throws IOException { for (T server : Lists.reverse(getServers())) { server.stop(); } }
@Override protected void after() { mRedirectOutputRule.after(); } }
/** * Makes the responseBuilder CORS compatible, assumes default methods. * * @param responseBuilder the modified response builder * @return response builder */ public static Response.ResponseBuilder makeCORS(Response.ResponseBuilder responseBuilder) { return makeCORS(responseBuilder, ""); }
/** * @param alluxioConf the specified {@link AlluxioConfiguration} to use * @return the client context with the given properties and an empty subject */ public static ClientContext create(AlluxioConfiguration alluxioConf) { return new ClientContext(null, alluxioConf); }
/** * Closes the connection with the remote permanently. This instance should be not be reused after * closing. */ @Override public synchronized void close() { disconnect(); mClosed = true; }
/** * @param name String of this property */ private PropertyKey(String name) { this(name, null, new DefaultSupplier(() -> null, "null"), null, false, false, ConsistencyCheckLevel.IGNORE, Scope.ALL, DisplayType.DEFAULT, true); }
/** * Creates a new instance of {@link BlockMetricsReporter}. */ public BlockMetricsReporter() { mStorageTierAssoc = new WorkerStorageTierAssoc(); }
@Override protected void after() { mRedirectOutputRule.after(); } }