• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JerseyDockerCmdExecFactory类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory的典型用法代码示例。如果您正苦于以下问题:Java JerseyDockerCmdExecFactory类的具体用法?Java JerseyDockerCmdExecFactory怎么用?Java JerseyDockerCmdExecFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

JerseyDockerCmdExecFactory类属于com.github.dockerjava.jaxrs包,在下文中一共展示了JerseyDockerCmdExecFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setupDockerClient

点赞 3

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
private void setupDockerClient() throws
    InvalidCredentialsException {
  if (dockerClient != null) {
    return;
  }

  final DockerClientConfig config = createClientConfig();

  final DockerCmdExecFactory dockerCmdExecFactory = new JerseyDockerCmdExecFactory();
  dockerClient = DockerClientBuilder.getInstance(config)
      .withDockerCmdExecFactory(dockerCmdExecFactory)
      .build();

  // Check if client was successfully created
  final AuthResponse response = dockerClient.authCmd().exec();
  if (!response.getStatus().equalsIgnoreCase("Login Succeeded")) {
    throw new InvalidCredentialsException("Could not create DockerClient");
  }
}
 

开发者ID:tsiq,
项目名称:magic-beanstalk,
代码行数:20,
代码来源:DockerClientManagerWithAuth.java

示例2: getClient

点赞 3

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
public DockerClient getClient() {
    if (cmdIT.getFactoryType() == NETTY) {
        if (nettyClient == null) {
            nettyClient = DockerClientBuilder.getInstance(config())
                    .withDockerCmdExecFactory((new NettyDockerCmdExecFactory())
                            .withConnectTimeout(10 * 1000))
                    .build();
        }

        return nettyClient;
    } else if (cmdIT.getFactoryType() == JERSEY) {
        if (jerseyClient == null) {
            jerseyClient = DockerClientBuilder.getInstance(config())
                    .withDockerCmdExecFactory((new JerseyDockerCmdExecFactory())
                            .withConnectTimeout(10 * 1000))
                    .build();
        }
        return jerseyClient;
    }

    throw new IllegalStateException("Why factory type is not set?");
}
 

开发者ID:docker-java
项目名称:docker-java
代码行数:23,
代码来源:DockerRule.java

示例3: getDockerClient

点赞 2

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
@Bean
	public DockerClient getDockerClient () {
		logger.info( "Creating pooled docker: {} ", docker.toString() );

		DockerClient client = null;
		try {
			DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
				.withDockerHost( docker.getUrl() )
				.build();

			DockerCmdExecFactory dockerCmdExecFactory = new JerseyDockerCmdExecFactory()
				.withReadTimeout( docker.getReadTimeoutSeconds() *1000 )
				.withConnectTimeout( docker.getConnectionTimeoutSeconds() *1000  )
				.withMaxTotalConnections( docker.getConnectionPool() )
				.withMaxPerRouteConnections( 3 );
			
//			DockerCmdExecFactory dockerCmdExecFactory = new NettyDockerCmdExecFactory()
//					.withConnectTimeout( docker.getReadTimeoutSeconds() *1000 ) ;

			client = DockerClientBuilder
				.getInstance( config )
				.withDockerCmdExecFactory( dockerCmdExecFactory )
				.build();

			// client = DefaultDockerClient.builder()
			// .uri( docker.getUrl() )
			// .connectionPoolSize( docker.getConnectionPool() )
			// .build();
		} catch (Throwable t) {
			logger.warn( "Failed connecting to docker: {}", CSAP.getCsapFilteredStackTrace( t ) );
		}

		return client;
	}
 

开发者ID:csap-platform,
项目名称:csap-core,
代码行数:35,
代码来源:CsapCoreService.java

示例4: buildDockerJerseyCommandFactory

点赞 2

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
private JerseyDockerCmdExecFactory buildDockerJerseyCommandFactory () {
	return new JerseyDockerCmdExecFactory()
		.withReadTimeout( MAX_WAIT_TIME_MS )
		.withConnectTimeout( MAX_WAIT_TIME_MS )
		.withMaxTotalConnections( dockerPoolSize )
		.withMaxPerRouteConnections( dockerPoolSize );
}
 

开发者ID:csap-platform,
项目名称:csap-core,
代码行数:8,
代码来源:Docker_Java.java

示例5: get

点赞 2

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
@SuppressWarnings("resource")
@Override
public DockerCmdExecFactory get() {
  JerseyDockerCmdExecFactory factory = new JerseyDockerCmdExecFactory()
      .withMaxTotalConnections(config.getMaxTotalConnections())
      .withMaxPerRouteConnections(config.getMaxPerRouteConnections())
      .withClientRequestFilters(config.getClientRequestFilters())
      .withClientResponseFilters(config.getClientResponseFilters());

  config.getReadTimeout().ifPresent(value -> factory.withReadTimeout(value));
  config.getConnectTimeout().ifPresent(value -> factory.withConnectTimeout(value));
  config.getConnectionRequestTimeout().ifPresent(value -> factory.withConnectionRequestTimeout(value));

  return factory;
}
 

开发者ID:Qorr,
项目名称:Hvalspik,
代码行数:16,
代码来源:DockerCmdExecFactoryProvider.java

示例6: initDockerConnection

点赞 2

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
private DockerClient initDockerConnection() {
    JerseyDockerCmdExecFactory dockerFactory = new JerseyDockerCmdExecFactory()
            .withMaxPerRouteConnections(config.maxPerRouteConnections())
            .withMaxTotalConnections(config.maxTotalConnections())
            .withConnectTimeout(config.connectTimeoutMillis())
            .withReadTimeout(config.readTimeoutMillis());
    RemoteApiVersion remoteApiVersion;
    try {
        remoteApiVersion = RemoteApiVersion.parseConfig(DockerClientImpl.getInstance(
                buildDockerClientConfig(config).build())
                .withDockerCmdExecFactory(dockerFactory).versionCmd().exec().getApiVersion());
        logger.info("Found version of remote docker API: " + remoteApiVersion);
        // From version 1.24 a field was removed which causes trouble with the current docker java code.
        // When this is fixed, we can remove this and do not specify version.
        if (remoteApiVersion.isGreaterOrEqual(RemoteApiVersion.VERSION_1_24)) {
            remoteApiVersion = RemoteApiVersion.VERSION_1_23;
            logger.info("Found version 1.24 or newer of remote API, using 1.23.");
        }
    } catch (Exception e) {
        if (!fallbackTo123OnErrors) {
            throw e;
        }
        logger.log(LogLevel.ERROR, "Failed when trying to figure out remote API version of docker, using 1.23", e);
        remoteApiVersion = RemoteApiVersion.VERSION_1_23;
    }

    return DockerClientImpl.getInstance(
            buildDockerClientConfig(config)
                    .withApiVersion(remoteApiVersion)
                    .build())
            .withDockerCmdExecFactory(dockerFactory);
}
 

开发者ID:vespa-engine,
项目名称:vespa,
代码行数:33,
代码来源:DockerImpl.java

示例7: initializeDockerClient

点赞 2

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
private DockerClient initializeDockerClient(int port) {
    DefaultDockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
            .withRegistryUrl("https://index.docker.io/v1/")
            .withDockerHost("tcp://localhost:" + port).build();
    return DockerClientBuilder.getInstance(config)
            .withDockerCmdExecFactory(getFactoryType() == FactoryType.NETTY ? new NettyDockerCmdExecFactory() : new JerseyDockerCmdExecFactory())
            .build();
}
 

开发者ID:docker-java,
项目名称:docker-java,
代码行数:9,
代码来源:SwarmCmdIT.java

示例8: getDefaultDockerCmdExecFactory

点赞 2

import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory; //导入依赖的package包/类
public static DockerCmdExecFactory getDefaultDockerCmdExecFactory() {
    return new JerseyDockerCmdExecFactory();
}
 

开发者ID:docker-java,
项目名称:docker-java,
代码行数:4,
代码来源:DockerClientBuilder.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)