Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * COMSAT
   * Copyright (c) 2013-2014, Parallel Universe Software Co. All rights reserved.
   *
   * This program and the accompanying materials are dual-licensed under
   * either the terms of the Eclipse Public License v1.0 as published by
   * the Eclipse Foundation
   *
   *   or (per the licensee's choosing)
  *
  * under the terms of the GNU Lesser General Public License version 3.0
  * as published by the Free Software Foundation.
  */
 package co.paralleluniverse.fibers.ws.rs.client;
 
 import  com.google.common.util.concurrent.ThreadFactoryBuilder;
 import java.util.Map;
Main entry point to the client API used to bootstrap Client instances that integrate with Quasar fibers.
 
 public class AsyncClientBuilder extends ClientBuilder {
     private final ClientBuilder clientBuilder;
 
     protected AsyncClientBuilder(ClientBuilder clientBuilder) {
         this. = clientBuilder;
     }

    
Create a new ClientBuilder instance using the default client builder implementation class provided by the JAX-RS implementation provider.

Returns:
new client builder instance.
 
     public static ClientBuilder newBuilder() {
         return new AsyncClientBuilder(ClientBuilder.newBuilder());
     }

    
Create a new Client instance using the default client builder implementation class provided by the JAX-RS implementation provider.

Returns:
new client instance.
 
     public static Client newClient() {
         return newClient(null);
     }

    
Create a new custom-configured Client instance using the default client builder implementation class provided by the JAX-RS implementation provider.

Parameters:
configuration data used to provide initial configuration for the new client instance.
Returns:
a new, configured, client instance.
 
     public static Client newClient(Configuration configuration) {
         final RequestExecutorProvider singleThreadPool = new RequestExecutorProvider() {
             private ExecutorService tp = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setDaemon(true).setNameFormat("jersey-puniverse-single-worker-%d").build());
             @Override
             public ExecutorService getRequestingExecutor() {
                 return ;
             }
 
             @Override
             public void releaseRequestingExecutor(ExecutorService es) {
             }
         };
         final ClientConfig config = new ClientConfig().
                 register(singleThreadPoolRequestExecutorProvider.class).
                 property(., 20);
         if (configuration != null)
             config.loadFrom(configuration);
         if (config.getConnectorProvider() == null)
             config.connectorProvider(new JettyConnectorProvider());
 
         return new FiberClient(ClientBuilder.newClient(config));
     }
 
     @Override
     public Client build() {
         return new FiberClient(.build());
     }
 
     @Override
     public ClientBuilder withConfig(Configuration config) {
         .withConfig(config);
         return this;
    }
    @Override
    public ClientBuilder sslContext(SSLContext sslContext) {
        .sslContext(sslContext);
        return this;
    }
    @Override
    public ClientBuilder keyStore(KeyStore keyStorechar[] password) {
        .keyStore(keyStorepassword);
        return this;
    }
    @Override
    public ClientBuilder keyStore(KeyStore keyStoreString password) {
        .keyStore(keyStorepassword);
        return this;
    }
    @Override
    public ClientBuilder trustStore(KeyStore trustStore) {
        .trustStore(trustStore);
        return this;
    }
    @Override
    public ClientBuilder hostnameVerifier(HostnameVerifier verifier) {
        .hostnameVerifier(verifier);
        return this;
    }
    @Override
    public ClientBuilder property(String nameObject value) {
        .property(namevalue);
        return this;
    }
    @Override
    public ClientBuilder register(Class<?> componentClass) {
        .register(componentClass);
        return this;
    }
    @Override
    public ClientBuilder register(Class<?> componentClassint priority) {
        .register(componentClasspriority);
        return this;
    }
    @Override
    public ClientBuilder register(Class<?> componentClassClass<?>... contracts) {
        .register(componentClasscontracts);
        return this;
    }
    @Override
    public ClientBuilder register(Class<?> componentClassMap<Class<?>, Integercontracts) {
        .register(componentClasscontracts);
        return this;
    }
    @Override
    public ClientBuilder register(Object component) {
        .register(component);
        return this;
    }
    @Override
    public ClientBuilder register(Object componentint priority) {
        .register(componentpriority);
        return this;
    }
    @Override
    public ClientBuilder register(Object componentClass<?>... contracts) {
        .register(componentcontracts);
        return this;
    }
    @Override
    public ClientBuilder register(Object componentMap<Class<?>, Integercontracts) {
        .register(componentcontracts);
        return this;
    }
    @Override
    public Configuration getConfiguration() {
        return .getConfiguration();
    }
    @Override
    public int hashCode() {
        return .hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        return .equals(obj);
    }
    @Override
    public String toString() {
        return .toString();
    }
New to GrepCode? Check out our FAQ X