@GuardedBy("hudson.model.Queue.lock") @Override public long check(Computer c) { return 60; } @Override
@NotThreadSafe public interface JoinFilterFunction { boolean filter(int leftPosition, int rightPosition, Page rightPage); }
/** * 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(); }
@Immutable private static class HashValue implements Serializable { private static final long serialVersionUID = 1L; /** * Allow to distinguish tokens from different versions easily to adapt the logic */ private final String version; /** * Only confidential information in this class. It's a SHA-256 hash stored in hex format */ private final String hash; private HashValue(String version, String hash) { this.version = version; this.hash = hash; } }
@GuardedBy("lock") private boolean hasAvailability(int totalLimit, int outputLimit, int inputLimit) { return numReservedOutputStreams < outputLimit && numReservedInputStreams < inputLimit && numReservedOutputStreams + numReservedInputStreams < totalLimit; }
/** * 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; }
/** * Model that is an abstract representation of the javadoc for a prop. */ @Immutable public final class PropJavadocModel { public final String propName; public final String javadoc; public PropJavadocModel(String propName, String javadoc) { this.propName = propName; this.javadoc = javadoc; } }
@NotThreadSafe private static class DictionarySourceIdFunction implements Function<DictionaryBlock, DictionaryId> { private final Map<DictionaryId, DictionaryId> dictionarySourceIds = new HashMap<>(); @Override public DictionaryId apply(DictionaryBlock block) { return dictionarySourceIds.computeIfAbsent(block.getDictionarySourceId(), ignored -> randomDictionaryId()); } public void reset() { dictionarySourceIds.clear(); } }
/** * @param cancel whether the CANCEL request is received */ @GuardedBy("AbstractReadHandler#mLock") public void setCancel(boolean cancel) { mCancel = cancel; }
/** * 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 }
@Immutable public static final class Translator { private final Function<Symbol, Optional<Symbol>> columnTranslator; private final Function<Symbol, Optional<NullableValue>> constantTranslator; private final Function<Expression, Optional<Symbol>> expressionTranslator; public Translator( Function<Symbol, Optional<Symbol>> columnTranslator, Function<Symbol, Optional<NullableValue>> constantTranslator, Function<Expression, Optional<Symbol>> expressionTranslator) { this.columnTranslator = requireNonNull(columnTranslator, "columnTranslator is null"); this.constantTranslator = requireNonNull(constantTranslator, "constantTranslator is null"); this.expressionTranslator = requireNonNull(expressionTranslator, "expressionTranslator is null"); } }
/** * @return true when a CANCEL request is received by the client, false otherwise */ @GuardedBy("AbstractReadHandler#mLock") public boolean isCancel() { return mCancel; }
@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(); } } }
/** * @param packetReaderActive packet reader state to set */ @GuardedBy("AbstractReadHandler#mLock") public void setDataReaderActive(boolean packetReaderActive) { mDataReaderActive = packetReaderActive; }
/** * A master registry. */ @ThreadSafe public final class MasterRegistry extends Registry<Master, Boolean> { /** * Creates a new instance of {@link MasterRegistry}. */ public MasterRegistry() {} }
/** * @param error the error */ @GuardedBy("AbstractReadHandler#mLock") public void setError(Error error) { mError = error; }
/** * @param eof whether SUCCESS response is replied */ @GuardedBy("AbstractReadHandler#mLock") public void setEof(boolean eof) { mEof = eof; }
/** * This method will be called periodically to allow this strategy to decide what to do with it's owning agent. * * @param c {@link Computer} for which this strategy is assigned. This computer may be online or offline. * This object also exposes a bunch of properties that the callee can use to decide what action to take. * @return The number of minutes after which the strategy would like to be checked again. The strategy may be * rechecked earlier or later that this! */ @GuardedBy("hudson.model.Queue.lock") public abstract long check(@Nonnull T c);
/** * Called by {@link NodeProvisioner#update()} to apply this strategy against the specified state. * Any provisioning activities should be recorded by calling * {@link hudson.slaves.NodeProvisioner.StrategyState#recordPendingLaunches(java.util.Collection)} * This method will be called by a thread that is holding {@link hudson.slaves.NodeProvisioner#provisioningLock} * @param state the current state. * @return the decision. */ @Nonnull @GuardedBy("NodeProvisioner.this") public abstract StrategyDecision apply(@Nonnull StrategyState state);
@GuardedBy("hudson.model.Queue.lock") public long check(SlaveComputer c) { if (c.isOffline() && !c.isConnecting() && c.isLaunchSupported()) c.tryReconnect(); return 1; }