예제 #1
0
 private void LogUnknownProtocol <IMPL, T>(Org.Neo4j.causalclustering.protocol.Protocol_Category <T> category, Pair <IMPL, Optional <T> > protocolWithImplementation) where IMPL : IComparable <IMPL> where T : Org.Neo4j.causalclustering.protocol.Protocol <IMPL>
 {
     if (!protocolWithImplementation.Other().Present)
     {
         _log.warn("Configured %s protocol implementation %s unknown. Ignoring.", category, protocolWithImplementation.First());
     }
 }
예제 #2
0
        public virtual ProtocolSelection <U, T> GetAll(Org.Neo4j.causalclustering.protocol.Protocol_Category <T> category, ICollection <U> versions)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            ISet <U> selectedVersions = _protocolMap.SetOfKeyValuePairs().Select(DictionaryEntry.getKey).Where(pair => pair.first().Equals(category.CanonicalName())).Select(Pair::other).Where(version => versions.Count == 0 || versions.Contains(version)).collect(Collectors.toSet());

            if (selectedVersions.Count == 0)
            {
                throw new System.ArgumentException(string.Format("Attempted to select protocols for {0} versions {1} but no match in known protocols {2}", category, versions, _protocolMap));
            }
            else
            {
                return(_protocolSelectionFactory.apply(category.CanonicalName(), selectedVersions));
            }
        }
예제 #3
0
        private IList <IMPL> ProtocolsForConfig <IMPL, T>(Org.Neo4j.causalclustering.protocol.Protocol_Category <T> category, IList <IMPL> implementations, System.Func <IMPL, Optional <T> > finder) where IMPL : IComparable <IMPL> where T : Org.Neo4j.causalclustering.protocol.Protocol <IMPL>
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            return(implementations.Select(impl => Pair.of(impl, finder(impl))).peek(protocolWithImplementation => logUnknownProtocol(category, protocolWithImplementation)).Select(Pair::other).flatMap(Streams.ofOptional).Select(Protocol::implementation).ToList());
        }
예제 #4
0
 /// <param name="category"> The protocol category. </param>
 /// <param name="versions"> List of supported versions. An empty list means that every version is supported. </param>
 internal SupportedProtocols(Org.Neo4j.causalclustering.protocol.Protocol_Category <T> category, IList <U> versions)
 {
     this._category = category;
     this._versions = Collections.unmodifiableList(versions);
 }