An annotation-based Java library for creating Thrift serializable types and services.

Related tags

Networking drift
Overview

Drift

Maven Central Build Status

Drift is an easy-to-use, annotation-based Java library for creating Thrift clients and serializable types. The client library is similar to JAX-RS (HTTP Rest) and the serialization library is similar to JaxB (XML) and Jackson (JSON), but for Thrift.

Example

The following interface defines a client for a Scribe server:

@ThriftService
public interface Scribe
{
    @ThriftMethod
    ResultCode log(List<LogEntry> messages);
}

The log method above uses the LogEntry Thrift struct which is defined as follows:

@ThriftStruct
public class LogEntry
{
    private final String category;
    private final String message;

    @ThriftConstructor
    public LogEntry(String category, String message)
    {
        this.category = category;
        this.message = message;
    }

    @ThriftField(1)
    public String getCategory()
    {
        return category;
    }

    @ThriftField(2)
    public String getMessage()
    {
        return message;
    }
}

An instance of the Scribe client can be created using a DriftClientFactory:

// create a client
Scribe scribe = clientFactory.createDriftClient(Scribe.class);

// use client
scribe.log(Arrays.asList(new LogEntry("category", "message")));

Detailed Documentation

Comments
  • Use netty resource tracking in TestingPooledByteBufAllocator to print leak details.

    Use netty resource tracking in TestingPooledByteBufAllocator to print leak details.

    Use netty resource tracking in TestingPooledByteBufAllocator to print leak details.

    Test plan:

    • commented out a ByteBuf.release() call in SimpleFrameCodec.java
    • ran mvn test
    • as expected, the test failed with an AssertionError("FAIL")
    • as expected, details about the leaked buffer were printed before the failure
    • all tests pass when the release() call is restored
    opened by ivmaykov 11
  • python server throw

    python server throw "No protocol version header"

    i use java client and python server. when i use drift,it throw error. but when i use thrift-api,it work.

    the following code is mine. can u help me? thanks

    Interface NLU

    @ThriftService
    public interface NLU {
    
        @ThriftMethod("parse")
        String parse(String scene, String version, String text);
    
        @ThriftMethod("status")
        String status();
    }
    

    Main

    DriftClientFactory clientFactory = new DriftClientFactory(
            new ThriftCodecManager(),
            createStaticDriftNettyMethodInvokerFactory(new DriftNettyClientConfig()),
            new SimpleAddressSelector(ImmutableList.<HostAndPort>of(HostAndPort.fromParts("10.250.250.240", 6000))),
            ExceptionClassifier.NORMAL_RESULT);
    DriftClient<NLU> driftClient = clientFactory.createDriftClient(NLU.class);
    NLU nlu = driftClient.get();
    System.out.println(nlu.status());
    

    Exception

    /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=52074:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/lib/tools.jar:/Users/naah/Documents/projects/thrift-demo/drift-demo/target/classes:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/drift/drift-server/1.8/drift-server-1.8.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/drift/drift-api/1.8/drift-api-1.8.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/drift/drift-codec/1.8/drift-codec-1.8.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/parameternames/1.3/parameternames-1.3.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/drift/drift-transport-spi/1.8/drift-transport-spi-1.8.jar:/Users/naah/software/apache-maven-3.5.3/repository/com/google/guava/guava/21.0/guava-21.0.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/configuration/0.159/configuration-0.159.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/apache/bval/bval-jsr/1.1.1/bval-jsr-1.1.1.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/apache/bval/bval-core/1.1.1/bval-core-1.1.1.jar:/Users/naah/software/apache-maven-3.5.3/repository/commons-beanutils/commons-beanutils-core/1.8.3/commons-beanutils-core-1.8.3.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar:/Users/naah/software/apache-maven-3.5.3/repository/javax/xml/bind/jaxb-api/2.2.6/jaxb-api-2.2.6.jar:/Users/naah/software/apache-maven-3.5.3/repository/com/sun/xml/bind/jaxb-impl/2.2.6/jaxb-impl-2.2.6.jar:/Users/naah/software/apache-maven-3.5.3/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/Users/naah/software/apache-maven-3.5.3/repository/com/google/inject/guice/4.0/guice-4.0.jar:/Users/naah/software/apache-maven-3.5.3/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/naah/software/apache-maven-3.5.3/repository/com/google/inject/extensions/guice-multibindings/4.0/guice-multibindings-4.0.jar:/Users/naah/software/apache-maven-3.5.3/repository/cglib/cglib-nodep/2.2.2/cglib-nodep-2.2.2.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/stats/0.159/stats-0.159.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/naah/software/apache-maven-3.5.3/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.1/jackson-annotations-2.8.1.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/slice/0.10/slice-0.10.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/openjdk/jol/jol-core/0.1/jol-core-0.1.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/units/1.0/units-1.0.jar:/Users/naah/software/apache-maven-3.5.3/repository/javax/annotation/javax.annotation-api/1.3.1/javax.annotation-api-1.3.1.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/weakref/jmxutils/1.19/jmxutils-1.19.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/drift/drift-client/1.8/drift-client-1.8.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/drift/drift-protocol/1.8/drift-protocol-1.8.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/log/0.159/log-0.159.jar:/Users/naah/software/apache-maven-3.5.3/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/drift/drift-transport-netty/1.8/drift-transport-netty-1.8.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/airlift/concurrent/0.159/concurrent-0.159.jar:/Users/naah/software/apache-maven-3.5.3/repository/io/netty/netty-all/4.1.8.Final/netty-all-4.1.8.Final.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/apache/thrift/libthrift/0.11.0/libthrift-0.11.0.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/apache/httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar:/Users/naah/software/apache-maven-3.5.3/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/naah/software/apache-maven-3.5.3/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar:/Users/naah/software/apache-maven-3.5.3/repository/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar com.example.Main
    [main] INFO com.example.Main - Running server on port 52077
    Exception in thread "main" io.airlift.drift.client.UncheckedTTransportException: Client was disconnected by server
    	at io.airlift.drift.client.DriftInvocationHandler.invoke(DriftInvocationHandler.java:125)
    	at com.sun.proxy.$Proxy7.status(Unknown Source)
    	at com.example.Main.main(Main.java:26)
    Caused by: io.airlift.drift.protocol.TTransportException: Client was disconnected by server
    	at io.airlift.drift.transport.netty.client.ThriftClientHandler.channelInactive(ThriftClientHandler.java:203)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:246)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:232)
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:225)
    	at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:246)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:232)
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:225)
    	at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:360)
    	at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:325)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:246)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:232)
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:225)
    	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1329)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:246)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:232)
    	at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:908)
    	at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:744)
    	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
    	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
    	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:445)
    	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
    	at java.lang.Thread.run(Thread.java:748)
    	Suppressed: io.airlift.drift.client.RetriesFailedException: Invocation retries failed (invocationAttempts: 1, duration: 70.27ms, connectionAttempts: 1, overloadedRejects: 0)
    		at io.airlift.drift.client.DriftMethodInvocation.fail(DriftMethodInvocation.java:265)
    		at io.airlift.drift.client.DriftMethodInvocation.handleFailure(DriftMethodInvocation.java:205)
    		at io.airlift.drift.client.DriftMethodInvocation.access$100(DriftMethodInvocation.java:51)
    		at io.airlift.drift.client.DriftMethodInvocation$1.onFailure(DriftMethodInvocation.java:171)
    		at com.google.common.util.concurrent.Futures$4.run(Futures.java:1126)
    		at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    		at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:902)
    		at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:813)
    		at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:677)
    		at com.google.common.util.concurrent.AbstractCatchingFuture.run(AbstractCatchingFuture.java:123)
    		at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    		at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:902)
    		at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:813)
    		at com.google.common.util.concurrent.AbstractFuture.setFuture(AbstractFuture.java:713)
    		at com.google.common.util.concurrent.TimeoutFuture$Fire.run(TimeoutFuture.java:115)
    		at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    		at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:902)
    		at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:813)
    		at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:677)
    		at io.airlift.drift.transport.netty.client.InvocationResponseFuture.fatalError(InvocationResponseFuture.java:153)
    		at io.airlift.drift.transport.netty.client.InvocationResponseFuture.access$200(InvocationResponseFuture.java:33)
    		at io.airlift.drift.transport.netty.client.InvocationResponseFuture$1.onFailure(InvocationResponseFuture.java:122)
    		at com.google.common.util.concurrent.Futures$4.run(Futures.java:1126)
    		at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    		at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:902)
    		at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:813)
    		at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:677)
    		at io.airlift.drift.transport.netty.client.ThriftClientHandler$ThriftRequest.failed(ThriftClientHandler.java:282)
    		at io.airlift.drift.transport.netty.client.ThriftClientHandler$RequestHandler.onChannelError(ThriftClientHandler.java:470)
    		at io.airlift.drift.transport.netty.client.ThriftClientHandler.lambda$onError$2(ThriftClientHandler.java:233)
    		at java.util.Collection.removeIf(Collection.java:414)
    		at io.airlift.drift.transport.netty.client.ThriftClientHandler.onError(ThriftClientHandler.java:232)
    		... 23 more
    
    opened by naah69 5
  • Nested generics support for Structs

    Nested generics support for Structs

    For a class Bean<T>(as Thrift struct) when we try to serialize/de-serialize for Bean<String> drift codec generates the code for the type String and maintains it the generated DriftCodec in a cache. But now if we try to do the same operation for Bean<Long> it tries to use the code generated for Bean<String>. This patch makes sure that we generate a separate DriftCodec for different type of T in Bean<T>.

    opened by Praveen2112 3
  • thrift.client.retry-same-address=true  leads to infinite loop

    thrift.client.retry-same-address=true leads to infinite loop

    In case all hosts are down, retrying the same hosts over and over again creates an infinite loop. That creates a lot of CPU pressure, as there is no delay between retrying in case of a ConnectionFailedException.

    opened by arhimondr 3
  • ConnectionPool cachedConnections::cleanUp? Why?

    ConnectionPool cachedConnections::cleanUp? Why?

    maintenanceThread.scheduleWithFixedDelay(cachedConnections::cleanUp, 1, 1, TimeUnit.SECONDS);
    
    I can't understand the comments...
    
    /**
       * Performs any pending maintenance operations needed by the cache. Exactly which activities are
       * performed -- if any -- is implementation-dependent.
       */
      void cleanUp();
    
    opened by juaby 3
  • maybe to support other dyn proxy tool, not jdk proxy.

    maybe to support other dyn proxy tool, not jdk proxy.

    public <T> DriftClient<T> createDriftClient(
                Class<T> clientInterface,
                Optional<Class<? extends Annotation>> qualifierAnnotation,
                List<MethodInvocationFilter> filters,
                DriftClientConfig config)
        {
            ThriftServiceMetadata serviceMetadata = serviceMetadataCache.computeIfAbsent(
                    clientInterface,
                    clazz -> new ThriftServiceMetadata(clazz, codecManager.getCatalog()));
    
            MethodInvoker invoker = createFilteredMethodInvoker(filters, methodInvokerSupplier.get());
    
            Optional<String> qualifier = qualifierAnnotation.map(Class::getSimpleName);
    
            ImmutableMap.Builder<Method, DriftMethodHandler> builder = ImmutableMap.builder();
            for (ThriftMethodMetadata method : serviceMetadata.getMethods().values()) {
                MethodMetadata metadata = toMethodMetadata(codecManager, method);
    
                RetryPolicy retryPolicy = new RetryPolicy(config, exceptionClassifier);
    
                MethodInvocationStat statHandler;
                if (config.isStatsEnabled()) {
                    statHandler = methodInvocationStatsFactory.getStat(serviceMetadata, qualifier, metadata);
                }
                else {
                    statHandler = new NullMethodInvocationStat();
                }
    
                DriftMethodHandler handler = new DriftMethodHandler(metadata, method.getHeaderParameters(), invoker, method.isAsync(), addressSelector, retryPolicy, statHandler);
                builder.put(method.getMethod(), handler);
            }
            Map<Method, DriftMethodHandler> methods = builder.build();
    
            return (context, headers) -> newProxy(clientInterface, new DriftInvocationHandler(serviceMetadata.getName(), methods, context, headers));
        }
    
    opened by juaby 3
  • Invocation problems about asynchronous and non-asynchronous calls

    Invocation problems about asynchronous and non-asynchronous calls

    Here is my confusion:

    Server side

    I have a class :ConcreteService which is of a concrete implementation of an interface: HelloService which is annotated by @ThriftService.

    public class ConcreteService implements HelloService {
    
        @Override
        public String hello(String from) {
            return String.format("Hello %s, greeting from RPC server!", from);
        }
    
        @Override
        public ListenableFuture<String> helloAsync(String from) {
            return MoreExecutors.newDirectExecutorService().submit(() -> {
                try {
                    // Going to mock a time consuming operation
                    Thread.sleep(10 * 1000);
                } catch (InterruptedException ignore) {
                }
                return String.format("Hello %s, greeting from RPC server asynchronous call !", 
                        from);
            });
        }
    
    }
    

    Client side

    I create a HelloService with DriftClientFactory without any special configuration.

    
    public class ClientTest {
    
        public static void main(String[] args) {
            HelloService service = new DriftClientFactory(...).create(HelloService.class).get();
    
            // Make an async call
            ListenableFuture<String> asyncResult = service.helloAsync("derrick");
            asyncResult.addListener(() -> {
                try {
                    String result = asyncResult.get();
                } catch (Exception ignore) {
                }
            }, executor);
            
            // Make a non-async call
            String result = helloService.hello("derrick");
        }
    }
    

    Seems like the non-async method invocation will not be executed at the server side until the completion of the async invocation.

    It looks like the server side takes the request sequentially, one by one, no matter the request is async or non-async.

    My questions

    • Is it a misusage or a deliberate implementation of drift?

    • If it does a misusage, how can I fix it properly?

    opened by dxGuan 2
  • Check if pooled connection is still open

    Check if pooled connection is still open

    Closing a netty channel is an asynchronous operation. Before the connection is closed, a new request may come in and grab a connection that is about to be closed by the previous request.

    opened by arhimondr 2
  • Protocol parity of apache Thrift

    Protocol parity of apache Thrift

    I am using drift as client side library to make call(s) to different thrift servers which are implemented by different language.

    For Java server, it uses drift as underlying library to serve any thrift calls and everything goes well.

    However, calls keep failing if the server is implemented by Go, which used apache thrift library.

    I am wondering if drift's thrift protocol is not compatible with apache thrift?

    opened by dxGuan 1
  • 'io.airlift.drift' vs 'com.facebook.drift'

    'io.airlift.drift' vs 'com.facebook.drift'

    This is rather a question than an issue. I see that io.airlift.drift versions stopped at 1.18 and then there is com.facebook.drift with its version starting at 1.19. Is this the way new versions will be released going forward or is com.facebook.drift a fork of this lib with its own path?

    opened by edudar 1
  • why the request is requestTimeout,but it didn't throw exception

    why the request is requestTimeout,but it didn't throw exception

    i had set connectTimeout and requestTimeout in DriftNettyClientConfig.

    driftNettyClientConfig.setConnectTimeout(new Duration(connectTimeout, TimeUnit.MILLISECONDS));
    driftNettyClientConfig.setRequestTimeout(new Duration(requestTimeout, TimeUnit.MILLISECONDS));
    

    but it didn't work;

    i use 1000 threads to pressure test for 1 minutes,it always like the below: image

    and the result is like below: image

    opened by naah69 1
  • Same method name in difference services lead to error:

    Same method name in difference services lead to error: "Multiple methods named 'send' are annotated with @ThriftMethod in the given services"

    Given two services:

    @ThriftService
    public interface ServiceOne {
        @ThriftMethod
        boolean send(String message);
    }
    
    @ThriftService
    public interface ServiceTwo {
        @ThriftMethod
        boolean send(String message);
    }
    

    DriftServer will throw an exception complains that ""Multiple methods named 'send' are annotated with @ThriftMethod in the given services"".

    It seems that difference services can't have a method with the same name?

    Relative code (io/airlift/drift/server/DriftServerMethodInvoker.java:58):

    package io.airlift.drift.server;
    class DriftServerMethodInvoker implements ServerMethodInvoker {
        ...
        public DriftServerMethodInvoker(
                ThriftCodecManager codecManager,
                Collection<DriftService> services,
                List<MethodInvocationFilter> filters,
                MethodInvocationStatsFactory methodInvocationStatsFactory)
        {
            Map<String, ServiceMethod> processorMap = new HashMap<>();
            ImmutableMap.Builder<String, MethodInvocationStat> stats = ImmutableMap.builder();
            for (DriftService service : services) {
                ThriftServiceMetadata serviceMetadata = new ThriftServiceMetadata(service.getService().getClass(), codecManager.getCatalog());
                for (ThriftMethodMetadata thriftMethodMetadata : serviceMetadata.getMethods().values()) {
                    if (processorMap.containsKey(thriftMethodMetadata.getName())) {
    
                        throw new IllegalArgumentException(format("Multiple methods named '%s' are annotated with @ThriftMethod in the given services", thriftMethodMetadata.getName()));
    --------------------^  HERE
    
                    }
                    ServiceMethod serviceMethod = new ServiceMethod(codecManager, service.getService(), thriftMethodMetadata, filters);
                    processorMap.put(thriftMethodMetadata.getName(), serviceMethod);
                    if (service.isStatsEnabled()) {
                        stats.put(thriftMethodMetadata.getName(), methodInvocationStatsFactory.getStat(serviceMetadata, service.getQualifier(), serviceMethod.getMethodMetadata()));
                    }
                }
            }
            ...
        }
    ` 
    opened by symfu 2
Owner
null
Nifty is an implementation of Thrift clients and servers on Netty

his project is archived and no longer maintained. At the time of archiving, open issues and pull requests were clo

Meta Archive 902 Sep 9, 2022
Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation

Apache Thrift Introduction Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation. Thrift provides clean a

The Apache Software Foundation 9.5k Jan 4, 2023
Mats3: Message-based Asynchronous Transactional Staged Stateless Services

Mats3: Message-based Asynchronous Transactional Staged Stateless Services

null 17 Dec 28, 2022
Intra is an experimental tool that allows you to test new DNS-over-HTTPS services that encrypt domain name lookups and prevent manipulation by your network

Intra Intra is an experimental tool that allows you to test new DNS-over-HTTPS services that encrypt domain name lookups and prevent manipulation by y

Jigsaw 1.2k Jan 1, 2023
SCG used as as proxy to connect gRPC-Web and back end gRPC services

gRPC-Web Spring Cloud Gateway Spring Cloud Gateway 3.1.1 supports for gRPC and HTTP/2. It is possible to use Spring Cloud Gateway to connect gRPC-Web

null 1 Apr 4, 2022
Unconventional Java code for building web servers / services without a framework.

Unconventional Java code for building web servers / services without a framework. Think dropwizard but as a seed project instead of a framework. If this project had a theme it would be break the rules but be mindful of your decisions.

StubbornJava 227 Nov 15, 2022
TCP/UDP client/server library for Java, based on Kryo

KryoNet can be downloaded on the releases page. Please use the KryoNet discussion group for support. Overview KryoNet is a Java library that provides

Esoteric Software 1.7k Jan 2, 2023
An netty based asynchronous socket library for benchion java applications

Benchion Sockets Library An netty based asynchronous socket library for benchion java applications ?? Documents ?? Report Bug · Request Feature Conten

Fitchle 3 Dec 25, 2022
A Java event based WebSocket and HTTP server

Webbit - A Java event based WebSocket and HTTP server Getting it Prebuilt JARs are available from the central Maven repository or the Sonatype Maven r

null 808 Dec 23, 2022
Java library for representing, parsing and encoding URNs as in RFC2141 and RFC8141

urnlib Java library for representing, parsing and encoding URNs as specified in RFC 2141 and RFC 8141. The initial URN RFC 2141 of May 1997 was supers

SLUB 24 May 10, 2022
Telegram API Client and Telegram BOT API Library and Framework in Pure java.

Javagram Telegram API Client and Telegram Bot API library and framework in pure Java. Hello Telegram You can use Javagram for both Telegram API Client

Java For Everything 3 Oct 17, 2021
Apache Dubbo is a high-performance, java based, open source RPC framework.

Apache Dubbo Project Apache Dubbo is a high-performance, Java-based open-source RPC framework. Please visit official site for quick start and document

The Apache Software Foundation 38.2k Dec 31, 2022
The Java gRPC implementation. HTTP/2 based RPC

gRPC-Java - An RPC library and framework gRPC-Java works with JDK 7. gRPC-Java clients are supported on Android API levels 16 and up (Jelly Bean and l

grpc 10.2k Jan 1, 2023
jRT measures the response time of a java application to socket-based requests

jRT Version: 0.0.1 jRT is a instrumentation tool that logs and records networking I/O operations "response times" (applicaion response time if be corr

null 45 May 19, 2022
Experimental Netty-based Java 16 application/web framework

Experimental Netty-based application/web framework. An example application can be seen here. Should I use this? Probably not! It's still incredibly ea

amy null 8 Feb 17, 2022
A Java library for capturing, crafting, and sending packets.

Japanese Logos Pcap4J Pcap4J is a Java library for capturing, crafting and sending packets. Pcap4J wraps a native packet capture library (libpcap, Win

Kaito Yamada 1k Dec 30, 2022
Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.

Socket.IO-client Java This is the Socket.IO Client Library for Java, which is simply ported from the JavaScript client. See also: Android chat demo en

Socket.IO 5k Jan 4, 2023
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Dec 31, 2022
A Java library that implements a ByteChannel interface over SSLEngine, enabling easy-to-use (socket-like) TLS for Java applications.

TLS Channel TLS Channel is a library that implements a ByteChannel interface over a TLS (Transport Layer Security) connection. It delegates all crypto

Mariano Barrios 149 Dec 31, 2022