Hi,

It is not easy to override bindings in Guice modules. The common way to do
that is by using the "Modules.override" helper but in this case, since the
module that defines the binding is a default module in the api metadata and
it is jclouds who instantiates it, you won't be able to use that.

What you can do is a linked binding from the default implementation to your
custom one. Something like:

bind(RetryOnRenew.class).to(YourImpl.class);

(If I'm not wrong this is the handler that is already registered)
Your impl will have to extend the jclouds default one, apply your logic
and/or fallback to the superclass.

HTH!

I.

El 13 sept. 2016 4:37 p. m., "Dileep Dixith" <dil022dix...@gmail.com>
escribió:

>

> Hi All,
>
> For our project we need to write a custom retry handler for jclouds
during PUT Operation.. We want to override default
BackoffLimitedRetryHandler.
>
> I want to know whether it is possible to write custom retry handler for
PUT operation or not.
>
> Our Code snippet goes as below.
>
> modules = ImmutableSet.<Module> builder()
> .addAll(modules)
> .add(new AbstractModule()
> {
> @Override
> public void configure()
> {
> bind(HttpRetryHandler.class).annotatedWith(Redirection.class).to(<our
custom class>.class);
> }
> })
> .build();
>
> <our custom class> implements HttpRetryHandler,IOExceptionRetryHandler
similar to
>
>
http://grepcode.com/file/repo1.maven.org/maven2/org.jclouds/jclouds-core/1.5.1/org/jclouds/http/handlers/BackoffLimitedRetryHandler.java
<http://grepcode.com/file/repo1.maven.org/maven2/org.jclouds/jclouds-core/1.5.1/org/jclouds/http/handlers/BackoffLimitedRetryHandler.java>
>
> But even after failure, our custom retry handler never called, instead
jclouds still makes call to   BackoffLimitedRetryHandler
>
> 2016-09-12@07:38:51.812 E            [mcstore-01          ]
koffLimitedRetryHandler:logError - Cannot retry after server error, command
has exceeded retry limit 5:
[method=org.jclouds.openstack.swift.SwiftKeystoneClient.public abstract
java.lang.String
org.jclouds.openstack.swift.CommonSwiftClient.putObject(java.lang.String,org.jclouds.openstack.swift.domain.SwiftObject)[multinode,

>
> Notes:
>
> a. If I change
bind(HttpRetryHandler.class).annotatedWith(Redirection.class).to(ICStoreRetryHandler.class);
to
bind(HttpRetryHandler.class).annotatedWith(ClientEroor.class).to(ICStoreRetryHandler.class);
got error stating
> HttpRetryHandler already registered with ClientError and can not be
binded again at
>
>
https://github.com/jclouds/jclouds/blob/master/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
<https://github.com/jclouds/jclouds/blob/master/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java>
>
> b. Even tried  bind(HttpRetryHandler.class).to(ICStoreRetryHandler.class)
and still custom handler not executed.
>
> Need your help to resolve this issue.
>

Reply via email to