List of usage examples for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClient AmazonCloudWatchAsyncClient
@Deprecated
public AmazonCloudWatchAsyncClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration, ExecutorService executorService)
From source file:com.intuit.tank.vmManager.environment.amazon.CloudwatchInstance.java
License:Open Source License
/** * //from w w w . j a v a 2 s . c om * @param request * @param vmRegion */ public CloudwatchInstance(VMRegion vmRegion) { // In case vmRegion is passed as null, use default region from settings file if (vmRegion == null) { vmRegion = config.getVmManagerConfig().getDefaultRegion(); } try { CloudCredentials creds = config.getVmManagerConfig().getCloudCredentials(CloudProvider.amazon); AWSCredentials credentials = new BasicAWSCredentials(creds.getKeyId(), creds.getKey()); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setMaxConnections(2); if (StringUtils.isNotBlank(creds.getProxyHost())) { try { clientConfig.setProxyHost(creds.getProxyHost()); if (StringUtils.isNotBlank(creds.getProxyPort())) { clientConfig.setProxyPort(Integer.valueOf(creds.getProxyPort())); } } catch (NumberFormatException e) { logger.error("invalid proxy setup."); } } if (StringUtils.isNotBlank(creds.getKeyId()) && StringUtils.isNotBlank(creds.getKey())) { asynchCloudWatchClient = new AmazonCloudWatchAsyncClient(credentials, clientConfig, Executors.newFixedThreadPool(2)); asyncSnsClient = new AmazonSNSAsyncClient(credentials, clientConfig, Executors.newFixedThreadPool(2)); } else { asynchCloudWatchClient = new AmazonCloudWatchAsyncClient(clientConfig); asyncSnsClient = new AmazonSNSAsyncClient(clientConfig); } asynchCloudWatchClient.setRegion(Region.getRegion(Regions.fromName(vmRegion.getRegion()))); asyncSnsClient.setRegion(Region.getRegion(Regions.fromName(vmRegion.getRegion()))); } catch (Exception ex) { logger.error(ex.getMessage()); throw new RuntimeException(ex); } }