public virtual Org.Apache.Hadoop.Util.Bloom.BloomFilterCommonTester <T> WithTestCases
     (ImmutableSet <BloomFilterCommonTester.BloomFilterTestStrategy> filterTestStrateges
     )
 {
     this.filterTestStrateges = ImmutableSet.CopyOf(filterTestStrateges);
     return(this);
 }
        /// <summary>Check whether requested SASL Qop contains privacy.</summary>
        /// <param name="saslProps">properties of SASL negotiation</param>
        /// <returns>boolean true if privacy exists</returns>
        public static bool RequestedQopContainsPrivacy(IDictionary <string, string> saslProps
                                                       )
        {
            ICollection <string> requestedQop = ImmutableSet.CopyOf(Arrays.AsList(saslProps[Javax.Security.Sasl.Sasl
                                                                                            .Qop].Split(",")));

            return(requestedQop.Contains("auth-conf"));
        }
Beispiel #3
0
 public SchedulerNode(RMNode node, bool usePortForNodeName, ICollection <string> labels
                      )
 {
     /* set of containers that are allocated containers */
     this.rmNode                  = node;
     this.availableResource       = Resources.Clone(node.GetTotalCapability());
     this.totalResourceCapability = Resources.Clone(node.GetTotalCapability());
     if (usePortForNodeName)
     {
         nodeName = rmNode.GetHostName() + ":" + node.GetNodeID().GetPort();
     }
     else
     {
         nodeName = rmNode.GetHostName();
     }
     this.labels = ImmutableSet.CopyOf(labels);
 }
        /// <summary>
        /// Checks that SASL negotiation has completed for the given participant, and
        /// the negotiated quality of protection is included in the given SASL
        /// properties and therefore acceptable.
        /// </summary>
        /// <param name="sasl">participant to check</param>
        /// <param name="saslProps">properties of SASL negotiation</param>
        /// <exception cref="System.IO.IOException">for any error</exception>
        public static void CheckSaslComplete(SaslParticipant sasl, IDictionary <string, string
                                                                                > saslProps)
        {
            if (!sasl.IsComplete())
            {
                throw new IOException("Failed to complete SASL handshake");
            }
            ICollection <string> requestedQop = ImmutableSet.CopyOf(Arrays.AsList(saslProps[Javax.Security.Sasl.Sasl
                                                                                            .Qop].Split(",")));
            string negotiatedQop = sasl.GetNegotiatedQop();

            Log.Debug("Verifying QOP, requested QOP = {}, negotiated QOP = {}", requestedQop,
                      negotiatedQop);
            if (!requestedQop.Contains(negotiatedQop))
            {
                throw new IOException(string.Format("SASL handshake completed, but " + "channel does not have acceptable quality of protection, "
                                                    + "requested = %s, negotiated = %s", requestedQop, negotiatedQop));
            }
        }
        private void UpdateResourceMappings(IDictionary <string, CommonNodeLabelsManager.Host
                                                         > before, IDictionary <string, CommonNodeLabelsManager.Host> after)
        {
            // Get NMs in before only
            ICollection <NodeId> allNMs = new HashSet <NodeId>();

            foreach (KeyValuePair <string, CommonNodeLabelsManager.Host> entry in before)
            {
                Sharpen.Collections.AddAll(allNMs, entry.Value.nms.Keys);
            }
            foreach (KeyValuePair <string, CommonNodeLabelsManager.Host> entry_1 in after)
            {
                Sharpen.Collections.AddAll(allNMs, entry_1.Value.nms.Keys);
            }
            // Map used to notify RM
            IDictionary <NodeId, ICollection <string> > newNodeToLabelsMap = new Dictionary <NodeId
                                                                                             , ICollection <string> >();

            // traverse all nms
            foreach (NodeId nodeId in allNMs)
            {
                CommonNodeLabelsManager.Node oldNM;
                if ((oldNM = GetNMInNodeSet(nodeId, before, true)) != null)
                {
                    ICollection <string> oldLabels = GetLabelsByNode(nodeId, before);
                    // no label in the past
                    if (oldLabels.IsEmpty())
                    {
                        // update labels
                        NodeLabel label = labelCollections[NoLabel];
                        label.RemoveNode(oldNM.resource);
                        // update queues, all queue can access this node
                        foreach (RMNodeLabelsManager.Queue q in queueCollections.Values)
                        {
                            Resources.SubtractFrom(q.resource, oldNM.resource);
                        }
                    }
                    else
                    {
                        // update labels
                        foreach (string labelName in oldLabels)
                        {
                            NodeLabel label = labelCollections[labelName];
                            if (null == label)
                            {
                                continue;
                            }
                            label.RemoveNode(oldNM.resource);
                        }
                        // update queues, only queue can access this node will be subtract
                        foreach (RMNodeLabelsManager.Queue q in queueCollections.Values)
                        {
                            if (IsNodeUsableByQueue(oldLabels, q))
                            {
                                Resources.SubtractFrom(q.resource, oldNM.resource);
                            }
                        }
                    }
                }
                CommonNodeLabelsManager.Node newNM;
                if ((newNM = GetNMInNodeSet(nodeId, after, true)) != null)
                {
                    ICollection <string> newLabels = GetLabelsByNode(nodeId, after);
                    newNodeToLabelsMap[nodeId] = ImmutableSet.CopyOf(newLabels);
                    // no label in the past
                    if (newLabels.IsEmpty())
                    {
                        // update labels
                        NodeLabel label = labelCollections[NoLabel];
                        label.AddNode(newNM.resource);
                        // update queues, all queue can access this node
                        foreach (RMNodeLabelsManager.Queue q in queueCollections.Values)
                        {
                            Resources.AddTo(q.resource, newNM.resource);
                        }
                    }
                    else
                    {
                        // update labels
                        foreach (string labelName in newLabels)
                        {
                            NodeLabel label = labelCollections[labelName];
                            label.AddNode(newNM.resource);
                        }
                        // update queues, only queue can access this node will be subtract
                        foreach (RMNodeLabelsManager.Queue q in queueCollections.Values)
                        {
                            if (IsNodeUsableByQueue(newLabels, q))
                            {
                                Resources.AddTo(q.resource, newNM.resource);
                            }
                        }
                    }
                }
            }
            // Notify RM
            if (rmContext != null && rmContext.GetDispatcher() != null)
            {
                rmContext.GetDispatcher().GetEventHandler().Handle(new NodeLabelsUpdateSchedulerEvent
                                                                       (newNodeToLabelsMap));
            }
        }
Beispiel #6
0
 public virtual Org.Apache.Hadoop.IO.Compress.CompressDecompressTester <T, E> WithTestCases
     (ImmutableSet <CompressDecompressTester.CompressionTestStrategy> stateges)
 {
     this.stateges = ImmutableSet.CopyOf(stateges);
     return(this);
 }