mirror of https://github.com/apache/jclouds.git
added timeout parameter for builders
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1951 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
4e4ef14ace
commit
b3a9e76d21
|
@ -90,6 +90,11 @@ public class S3ContextBuilder extends
|
||||||
return (S3ContextBuilder) super.relaxSSLHostname();
|
return (S3ContextBuilder) super.relaxSSLHostname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public S3ContextBuilder withRequestTimeout(long milliseconds) {
|
||||||
|
return (S3ContextBuilder) super.withRequestTimeout(milliseconds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public S3ContextBuilder withExecutorService(ExecutorService service) {
|
public S3ContextBuilder withExecutorService(ExecutorService service) {
|
||||||
return (S3ContextBuilder) super.withExecutorService(service);
|
return (S3ContextBuilder) super.withExecutorService(service);
|
||||||
|
|
|
@ -145,6 +145,11 @@ public class AzureBlobContextBuilder extends
|
||||||
return (AzureBlobContextBuilder) super.withPoolMaxConnections(poolMaxConnections);
|
return (AzureBlobContextBuilder) super.withPoolMaxConnections(poolMaxConnections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AzureBlobContextBuilder withRequestTimeout(long milliseconds) {
|
||||||
|
return (AzureBlobContextBuilder) super.withRequestTimeout(milliseconds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AzureBlobContextBuilder withPoolMaxSessionFailures(int poolMaxSessionFailures) {
|
public AzureBlobContextBuilder withPoolMaxSessionFailures(int poolMaxSessionFailures) {
|
||||||
return (AzureBlobContextBuilder) super.withPoolMaxSessionFailures(poolMaxSessionFailures);
|
return (AzureBlobContextBuilder) super.withPoolMaxSessionFailures(poolMaxSessionFailures);
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.util.concurrent.ExecutorService;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.blobstore.domain.BlobMetadata;
|
import org.jclouds.blobstore.domain.BlobMetadata;
|
||||||
import org.jclouds.blobstore.domain.ContainerMetadata;
|
import org.jclouds.blobstore.domain.ContainerMetadata;
|
||||||
|
import org.jclouds.blobstore.reference.BlobStoreConstants;
|
||||||
import org.jclouds.cloud.CloudContextBuilder;
|
import org.jclouds.cloud.CloudContextBuilder;
|
||||||
|
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
|
@ -54,6 +55,14 @@ public abstract class BlobStoreContextBuilder<S, C extends ContainerMetadata, M
|
||||||
return (BlobStoreContextBuilder<S, C, M, B>) super.withHttpMaxRedirects(httpMaxRedirects);
|
return (BlobStoreContextBuilder<S, C, M, B>) super.withHttpMaxRedirects(httpMaxRedirects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* longest time a single synchronous operation can take before throwing an exception.
|
||||||
|
*/
|
||||||
|
public BlobStoreContextBuilder<S, C, M, B> withRequestTimeout(long milliseconds) {
|
||||||
|
properties.setProperty(BlobStoreConstants.PROPERTY_BLOBSTORE_TIMEOUT, Long.toString(milliseconds));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public BlobStoreContextBuilder<S, C, M, B> withHttpMaxRetries(int httpMaxRetries) {
|
public BlobStoreContextBuilder<S, C, M, B> withHttpMaxRetries(int httpMaxRetries) {
|
||||||
|
|
|
@ -52,8 +52,8 @@ public class BaseContainerIntegrationTest<S, C extends ContainerMetadata, M exte
|
||||||
public void testPutTwiceIsOk() throws Exception {
|
public void testPutTwiceIsOk() throws Exception {
|
||||||
String containerName = getContainerName();
|
String containerName = getContainerName();
|
||||||
try {
|
try {
|
||||||
context.getBlobStore().createContainer(containerName).get(10, TimeUnit.SECONDS);
|
context.getBlobStore().createContainer(containerName).get(60, TimeUnit.SECONDS);
|
||||||
context.getBlobStore().createContainer(containerName).get(10, TimeUnit.SECONDS);
|
context.getBlobStore().createContainer(containerName).get(60, TimeUnit.SECONDS);
|
||||||
} finally {
|
} finally {
|
||||||
returnContainer(containerName);
|
returnContainer(containerName);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public class BaseContainerIntegrationTest<S, C extends ContainerMetadata, M exte
|
||||||
String containerName = getContainerName();
|
String containerName = getContainerName();
|
||||||
try {
|
try {
|
||||||
addBlobToContainer(containerName, "test");
|
addBlobToContainer(containerName, "test");
|
||||||
context.getBlobStore().deleteContainer(containerName).get(10, TimeUnit.SECONDS);
|
context.getBlobStore().deleteContainer(containerName).get(60, TimeUnit.SECONDS);
|
||||||
assertNotExists(containerName);
|
assertNotExists(containerName);
|
||||||
} finally {
|
} finally {
|
||||||
recycleContainer(containerName);
|
recycleContainer(containerName);
|
||||||
|
@ -85,7 +85,7 @@ public class BaseContainerIntegrationTest<S, C extends ContainerMetadata, M exte
|
||||||
public void deleteContainerIfEmpty() throws Exception {
|
public void deleteContainerIfEmpty() throws Exception {
|
||||||
final String containerName = getContainerName();
|
final String containerName = getContainerName();
|
||||||
try {
|
try {
|
||||||
context.getBlobStore().deleteContainer(containerName).get(10, TimeUnit.SECONDS);
|
context.getBlobStore().deleteContainer(containerName).get(60, TimeUnit.SECONDS);
|
||||||
assertNotExists(containerName);
|
assertNotExists(containerName);
|
||||||
} finally {
|
} finally {
|
||||||
// this container is now deleted, so we can't reuse it directly
|
// this container is now deleted, so we can't reuse it directly
|
||||||
|
@ -112,7 +112,7 @@ public class BaseContainerIntegrationTest<S, C extends ContainerMetadata, M exte
|
||||||
String containerName = getContainerName();
|
String containerName = getContainerName();
|
||||||
try {
|
try {
|
||||||
add15UnderRoot(containerName);
|
add15UnderRoot(containerName);
|
||||||
SortedSet<M> container = context.getBlobStore().listBlobs(containerName).get(10,
|
SortedSet<M> container = context.getBlobStore().listBlobs(containerName).get(60,
|
||||||
TimeUnit.SECONDS);
|
TimeUnit.SECONDS);
|
||||||
assertEquals(container.size(), 15);
|
assertEquals(container.size(), 15);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -126,7 +126,7 @@ public class BaseContainerIntegrationTest<S, C extends ContainerMetadata, M exte
|
||||||
for (char letter = 'a'; letter <= 'z'; letter++) {
|
for (char letter = 'a'; letter <= 'z'; letter++) {
|
||||||
B blob = context.newBlob(letter + "");
|
B blob = context.newBlob(letter + "");
|
||||||
blob.setData(letter + "content");
|
blob.setData(letter + "content");
|
||||||
context.getBlobStore().putBlob(containerName, blob).get(10, TimeUnit.SECONDS);
|
context.getBlobStore().putBlob(containerName, blob).get(60, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class BaseContainerIntegrationTest<S, C extends ContainerMetadata, M exte
|
||||||
for (int i = 0; i < 15; i++) {
|
for (int i = 0; i < 15; i++) {
|
||||||
B blob = context.newBlob(i + "");
|
B blob = context.newBlob(i + "");
|
||||||
blob.setData(i + "content");
|
blob.setData(i + "content");
|
||||||
context.getBlobStore().putBlob(containerName, blob).get(10, TimeUnit.SECONDS);
|
context.getBlobStore().putBlob(containerName, blob).get(60, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class BaseContainerIntegrationTest<S, C extends ContainerMetadata, M exte
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
B blob = context.newBlob(prefix + "/" + i);
|
B blob = context.newBlob(prefix + "/" + i);
|
||||||
blob.setData(i + "content");
|
blob.setData(i + "content");
|
||||||
context.getBlobStore().putBlob(containerName, blob).get(10, TimeUnit.SECONDS);
|
context.getBlobStore().putBlob(containerName, blob).get(60, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,9 +68,14 @@ public class CloudFilesContextBuilder
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudFilesContextBuilder relaxSSLHostname() {
|
public CloudFilesContextBuilder relaxSSLHostname() {
|
||||||
return (CloudFilesContextBuilder) (CloudFilesContextBuilder) super.relaxSSLHostname();
|
return (CloudFilesContextBuilder) super.relaxSSLHostname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudFilesContextBuilder withRequestTimeout(long milliseconds) {
|
||||||
|
return (CloudFilesContextBuilder) super.withRequestTimeout(milliseconds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudFilesContextBuilder withExecutorService(ExecutorService service) {
|
public CloudFilesContextBuilder withExecutorService(ExecutorService service) {
|
||||||
return (CloudFilesContextBuilder) super.withExecutorService(service);
|
return (CloudFilesContextBuilder) super.withExecutorService(service);
|
||||||
|
@ -160,7 +165,7 @@ public class CloudFilesContextBuilder
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudFilesContextBuilder withEndpoint(URI endpoint) {
|
public CloudFilesContextBuilder withEndpoint(URI endpoint) {
|
||||||
return (CloudFilesContextBuilder) (CloudFilesContextBuilder) RackspaceContextBuilder
|
return (CloudFilesContextBuilder) RackspaceContextBuilder
|
||||||
.withEndpoint(this, endpoint);
|
.withEndpoint(this, endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue