Refine search
/** * Implementations of this interface must be thread safe. */ @ThreadSafe public interface NetworkTopology { NetworkLocation locate(HostAddress address); /** * Strings describing the meaning of each segment of a NetworkLocation returned from locate(). * This method must return a constant. */ List<String> getLocationSegmentNames(); }
@ThreadSafe public class DefaultWarningCollector implements WarningCollector { @GuardedBy("this") private final Map<WarningCode, PrestoWarning> warnings = new LinkedHashMap<>(); private final WarningCollectorConfig config; public DefaultWarningCollector(WarningCollectorConfig config) { this.config = requireNonNull(config, "config is null"); } @Override public synchronized void add(PrestoWarning warning) { requireNonNull(warning, "warning is null"); if (warnings.size() < config.getMaxWarnings()) { warnings.putIfAbsent(warning.getWarningCode(), warning); } } @Override public synchronized List<PrestoWarning> getWarnings() { return ImmutableList.copyOf(warnings.values()); } }
@ThreadSafe private static class SharedLookupOuterPositionIterator implements OuterPositionIterator { private final LookupSource lookupSource; private final boolean[] visitedPositions; @GuardedBy("this") private int currentPosition; public SharedLookupOuterPositionIterator(LookupSource lookupSource, boolean[] visitedPositions) { this.lookupSource = requireNonNull(lookupSource, "lookupSource is null"); this.visitedPositions = requireNonNull(visitedPositions, "visitedPositions is null"); checkArgument(lookupSource.getJoinPositionCount() == visitedPositions.length); } @Override public synchronized boolean appendToNext(PageBuilder pageBuilder, int outputChannelOffset) { while (currentPosition < visitedPositions.length) { if (!visitedPositions[currentPosition]) { lookupSource.appendTo(currentPosition, pageBuilder, outputChannelOffset); currentPosition++; return true; } currentPosition++; } return false; } }
/** * Classes implementing this interface must be thread safe. That is, all the methods listed below * may be called concurrently from any thread. */ @ThreadSafe public interface ResourceGroupManager<C> { void submit(Statement statement, ManagedQueryExecution queryExecution, SelectionContext<C> selectionContext, Executor executor); SelectionContext<C> selectGroup(SelectionCriteria criteria); ResourceGroupInfo getResourceGroupInfo(ResourceGroupId id); List<ResourceGroupInfo> getPathToRoot(ResourceGroupId id); void addConfigurationManagerFactory(ResourceGroupConfigurationManagerFactory factory); void loadConfigurationManager() throws Exception; }
@ThreadSafe public class ReferenceCount @GuardedBy("this") private int count;
/** * A worker registry. */ @ThreadSafe public final class WorkerRegistry extends Registry<Worker, WorkerNetAddress> { /** * Creates a new instance of {@link WorkerRegistry}. */ public WorkerRegistry() {} }
@ThreadSafe final class FileHolder implements Closeable @GuardedBy("this") private boolean deleted;
@ThreadSafe private static class IncrementalAverage { private long count; private final AtomicDouble average = new AtomicDouble(); synchronized void add(long value) { count++; double oldAverage = average.get(); average.set(oldAverage + ((value - oldAverage) / count)); } double get() { return average.get(); } } }
@ThreadSafe class BroadcastOutputBufferManager implements OutputBufferManager @GuardedBy("this") private OutputBuffers outputBuffers = createInitialEmptyOutputBuffers(BROADCAST);
/** * Constants for S3 northbound API. */ @ThreadSafe public final class S3Constants { public static final String S3_CONTENT_LENGTH_HEADER = "Content-Length"; public static final String S3_DATE_FORMAT_REGEXP = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; public static final int S3_DEFAULT_MAX_KEYS = 1000; public static final String S3_EMPTY_ETAG = ""; public static final String S3_STANDARD_STORAGE_CLASS = "STANDARD"; private S3Constants() {} // prevent instantiation }
@ThreadSafe private static class OuterPositionTracker @GuardedBy("this") private final boolean[] visitedPositions; @GuardedBy("this") private boolean finished;
/** * A master registry. */ @ThreadSafe public final class MasterRegistry extends Registry<Master, Boolean> { /** * Creates a new instance of {@link MasterRegistry}. */ public MasterRegistry() {} }
@ThreadSafe public class FutureStateChange<T> @GuardedBy("listeners") private final Set<SettableFuture<T>> listeners = new HashSet<>();
/** * Class that contains metrics about FileOutStream. */ @ThreadSafe private static final class Metrics { private static final Counter BYTES_WRITTEN_UFS = MetricsSystem.counter(WorkerMetrics.BYTES_WRITTEN_UFS); private Metrics() {} // prevent instantiation } }
@ThreadSafe public class TestingWarningCollector implements WarningCollector @GuardedBy("this") private final Map<WarningCode, PrestoWarning> warnings = new LinkedHashMap<>(); private final WarningCollectorConfig config;
@ThreadSafe public class AsyncPrettyPrinterRegistry { private final Map<String, AsyncPrettyPrinterFactory> mRegistry = new HashMap<>(); public synchronized void register(String headerName, AsyncPrettyPrinterFactory factory) { mRegistry.put(headerName, factory); } @Nullable public synchronized AsyncPrettyPrinterFactory lookup(String headerName) { return mRegistry.get(headerName); } public synchronized boolean unregister(String headerName) { return mRegistry.remove(headerName) != null; } }
@ThreadSafe public class LocalExchangeMemoryManager private final AtomicLong bufferedBytes = new AtomicLong(); @GuardedBy("this") private SettableFuture<?> notFullFuture = NOT_FULL;
/** * A noop version of the {@link UfsDeleter}. */ @ThreadSafe public final class NoopUfsDeleter implements UfsDeleter { public static final NoopUfsDeleter INSTANCE = new NoopUfsDeleter(); @Override public void delete(AlluxioURI alluxioUri, Inode inode) { // do nothing } }
/** * Just hold an object. * @param <T> the type of object */ private class ObjectHolder<T> { private T object; ObjectHolder() { } public T getObject() { return object; } public void setObject(T object) { this.object = object; } }
/** * Factory for creating {@link ProxyProcess}. */ @ThreadSafe final class Factory { /** * @return a new instance of {@link ProxyProcess} */ public static ProxyProcess create() { return new AlluxioProxyProcess(); } private Factory() {} // prevent instantiation }