All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.kristofa.brave.zipkin.ThriftClientProvider Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.github.kristofa.brave.zipkin;

import org.apache.thrift.TException;

/**
 * The {@link ThriftClientProvider} is introduced mainly to be able to cope with temporary network connection issues.
 * 
 * @author kristof
 * @param  Client instance type.
 */
interface ThriftClientProvider {

    /**
     * Initializes the client connection. This should only be done initially.. The idea is that if we end up with an issue
     * during initial connection setup the user can choose to abort.
     */
    void setup() throws TException;

    /**
     * Gets our client instance.
     * 
     * @return Client instance.
     */
    T getClient();

    /**
     * Logs an exception as a result of using the returned client. 

Based on the exception we can decide to re-initialize * the client/connection to deal with for example temporary network connectivity issues. * * @param exception Thrift exception. * @return New client instance in case we decided the exception could be dealt with by making a new client insance. * null in case we decided a new client would not resolve the exception. */ T exception(TException exception); /** * Closes the client. Once closed it will probably not be usable anymore. */ void close(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy