@JsonProperty public Map<String, String> getConfig() { return ImmutableMap.copyOf(config); }
private RpcConfig(String name, Map<EnumLite, RpcMessageType<?, ?, ?>> sendMap, Map<Integer, RpcMessageType<?, ?, ?>> receiveMap, int timeout, Executor executor) { Preconditions.checkNotNull(executor, "Executor must be defined."); this.name = name; this.timeout = timeout; this.sendMap = ImmutableMap.copyOf(sendMap); this.receiveMap = ImmutableMap.copyOf(receiveMap); this.executor = executor; }
public ConnectionInfo(String url, Properties params) { this(url, ImmutableMap.copyOf(params)); }
private ParallelizationInfo(int minWidth, int maxWidth, Map<DrillbitEndpoint, EndpointAffinity> affinityMap) { this.minWidth = minWidth; this.maxWidth = maxWidth; this.affinityMap = ImmutableMap.copyOf(affinityMap); }
public Map<RexNode, LogicalExpression> getIndexableExpression() { return ImmutableMap.copyOf(desiredExpressions); }
public Map<RexNode, LogicalExpression> getEqualOnCastChar() { return ImmutableMap.copyOf(equalOnCastChar); }
public Map<RexNode, String> getFieldAndPos() { return ImmutableMap.copyOf(desiredFields); }
@JsonProperty public Map<String, String> getConfig() { return ImmutableMap.copyOf(config); }
static <N, V> UndirectedGraphConnections<N, V> ofImmutable(Map<N, V> adjacentNodeValues) { return new UndirectedGraphConnections<N, V>(ImmutableMap.copyOf(adjacentNodeValues)); }
static <N, E> UndirectedMultiNetworkConnections<N, E> ofImmutable(Map<E, N> incidentEdges) { return new UndirectedMultiNetworkConnections<N, E>(ImmutableMap.copyOf(incidentEdges)); }
static <N, V> DirectedGraphConnections<N, V> ofImmutable( Set<N> predecessors, Map<N, V> successorValues) { Map<N, Object> adjacentNodeValues = new HashMap<N, Object>(); adjacentNodeValues.putAll(successorValues); for (N predecessor : predecessors) { Object value = adjacentNodeValues.put(predecessor, PRED); if (value != null) { adjacentNodeValues.put(predecessor, new PredAndSucc(value)); } } return new DirectedGraphConnections<N, V>( ImmutableMap.copyOf(adjacentNodeValues), predecessors.size(), successorValues.size()); }
@Override public ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionException { Map<K, V> result = Maps.newLinkedHashMap(); for (K key : keys) { if (!result.containsKey(key)) { result.put(key, get(key)); } } return ImmutableMap.copyOf(result); }
private void refresh() { final Enumeration<SaslServerFactory> factories = Sasl.getSaslServerFactories(); final Map<String, List<SaslServerFactory>> map = Maps.newHashMap(); while (factories.hasMoreElements()) { final SaslServerFactory factory = factories.nextElement(); // Passing null so factory is populated with all possibilities. Properties passed when // instantiating a server are what really matter. See createSaslServer. for (final String mechanismName : factory.getMechanismNames(null)) { if (!map.containsKey(mechanismName)) { map.put(mechanismName, new ArrayList<SaslServerFactory>()); } map.get(mechanismName).add(factory); } } serverFactories = ImmutableMap.copyOf(map); if (logger.isDebugEnabled()) { logger.debug("Registered sasl server factories: {}", serverFactories.keySet()); } }
private void refresh() { final Enumeration<SaslClientFactory> factories = Sasl.getSaslClientFactories(); final Map<String, List<SaslClientFactory>> map = Maps.newHashMap(); while (factories.hasMoreElements()) { final SaslClientFactory factory = factories.nextElement(); // Passing null so factory is populated with all possibilities. Properties passed when // instantiating a client are what really matter. See createSaslClient. for (final String mechanismName : factory.getMechanismNames(null)) { if (!map.containsKey(mechanismName)) { map.put(mechanismName, new ArrayList<SaslClientFactory>()); } map.get(mechanismName).add(factory); } } clientFactories = ImmutableMap.copyOf(map); if (logger.isDebugEnabled()) { logger.debug("Registered sasl client factories: {}", clientFactories.keySet()); } }
ProjectPushInfo getInfo() { return new ProjectPushInfo(ImmutableList.copyOf(newFields), ImmutableMap.copyOf(desiredFields)); }
/** * Returns type mappings using type parameters and type arguments found in the generic * superclass and the super interfaces of {@code contextClass}. */ static ImmutableMap<TypeVariableKey, Type> getTypeMappings(Type contextType) { TypeMappingIntrospector introspector = new TypeMappingIntrospector(); introspector.visit(wildcardCapturer.capture(contextType)); return ImmutableMap.copyOf(introspector.mappings); }
public IncomingBuffers(PlanFragment fragment, FragmentContext context) { this.context = context; Map<Integer, DataCollector> collectors = Maps.newHashMap(); remainingRequired = new AtomicInteger(fragment.getCollectorCount()); for(int i =0; i < fragment.getCollectorCount(); i++){ Collector collector = fragment.getCollector(i); DataCollector newCollector = collector.getSupportsOutOfOrder() ? new MergingCollector(remainingRequired, collector, context) : new PartitionedCollector(remainingRequired, collector, context); collectors.put(collector.getOppositeMajorFragmentId(), newCollector); } logger.debug("Came up with a list of {} required fragments. Fragments {}", remainingRequired.get(), collectors); collectorMap = ImmutableMap.copyOf(collectors); // Determine the total number of incoming streams that will need to be completed before we are finished. int totalStreams = 0; for (DataCollector bc : collectorMap.values()) { totalStreams += bc.getTotalIncomingFragments(); } assert totalStreams >= remainingRequired.get() : String.format("Total Streams %d should be more than the minimum number of streams to commence (%d). It isn't.", totalStreams, remainingRequired.get()); streamsRemaining.set(totalStreams); }
/** * Builds a mapping of Drillbit endpoints to hostnames */ private static ImmutableMap<String, DrillbitEndpoint> buildEndpointMap(Collection<DrillbitEndpoint> endpoints) { Stopwatch watch = Stopwatch.createStarted(); HashMap<String, DrillbitEndpoint> endpointMap = Maps.newHashMap(); for (DrillbitEndpoint d : endpoints) { String hostName = d.getAddress(); endpointMap.put(hostName, d); } watch.stop(); logger.debug("Took {} ms to build endpoint map", watch.elapsed(TimeUnit.MILLISECONDS)); return ImmutableMap.copyOf(endpointMap); } }
ImmutableMap<K, V> getAllPresent(Iterable<?> keys) { int hits = 0; int misses = 0; Map<K, V> result = Maps.newLinkedHashMap(); for (Object key : keys) { V value = get(key); if (value == null) { misses++; } else { // TODO(fry): store entry key instead of query key @SuppressWarnings("unchecked") K castKey = (K) key; result.put(castKey, value); hits++; } } globalStatsCounter.recordHits(hits); globalStatsCounter.recordMisses(misses); return ImmutableMap.copyOf(result); }