Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for ISPN cache removal commands to add the allow-resource-… #156

Merged
merged 1 commit into from
Mar 7, 2017

Conversation

jmartisk
Copy link
Contributor

@jmartisk jmartisk commented Mar 6, 2017

…service-restart header

https://issues.jboss.org/browse/JBEAP-8924 was rejected, as expected 😢 🎃

@rhatlapa rhatlapa self-requested a review March 6, 2017 14:04
@rhatlapa rhatlapa self-assigned this Mar 6, 2017
Copy link

@rhatlapa rhatlapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just fix the checkstyle issues.

@rhatlapa rhatlapa added this to the 1.6.0 milestone Mar 6, 2017
}

@Override
public void apply(OnlineCommandContext ctx) throws Exception {
Operations ops = new Operations(ctx.client);
if(allowResourceServiceRestart)
ops = ops.headers(Values.of("allow-resource-service-restart", "true"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the Headers class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, didn't notice. Will use that.

this(cacheContainer, cacheType, cacheName, false);
}

public RemoveCache(String cacheContainer, CacheType cacheType, String cacheName, boolean allowResourceServiceRestart) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a builder for this class yet, right? Bollean arguments are always a good sign that a builder would be a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but in this case it sounds a bit of an overkill to me, there are 3 required arguments and one optional, builders are suited for classes with a prevalence of optional arguments :) also for keeping backward compatibility we would need to keep the constructor as well, where it gets even weirder. But if you insist, I can do that...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I see where you're coming from, but the builder can have a constructor with the same 3 arguments and just 1 optional method, so not that big of an overkill IMHO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or possibly this could be automatic, if we detect the server isn't able to remove a cache without service restart (version check).

I know this goes against "restarts should be explicit", but it's an option worth considering. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version check sounds good, it will be a bit more difficult to remove a cache without automatically calling service restart, but who does that anyway?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just please add a comment to the class javadoc that with EAP 7.1+, this command enables the service restart header. That would be good enough from my POV. @rhatlapa, WDYT?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we try to have the javadoc upstream related => rather pointing out WildFly releases? Otherwise I am OK with both approaches (Builder one and constructor one with one optional argument.
Regarding having it based on Version seems probably better as user usually just wants to remove the cache and have it working on all EAP versions and not need to modify command attributes based on EAP version it is used with.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I agree, I always try to use upstream names and versions, unless there's something specific to EAP. So this is only WildFly 11+, I think? Which should be ServerVersion.VERSION_5_0_0.

@@ -17,6 +17,7 @@

import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and I wonder, how come this is now necessary? The apply method signature didn't change, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's a leftover from my feeble previous attempt where I called reload, I'll get rid of that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, that sounds like this will be a tiny PR in the end, I love those :-)

@jmartisk jmartisk force-pushed the ispn-caches-reload branch from 62ab875 to 388f132 Compare March 6, 2017 15:04
import org.wildfly.extras.creaper.core.online.operations.Operations;

/**
* Removes an Infinispan cache.
* Since WildFly 11 / EAP 7, this operation requires a reload, and this command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EAP 7.1, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! Fixed.

@jmartisk jmartisk force-pushed the ispn-caches-reload branch from 388f132 to e0e6b17 Compare March 7, 2017 12:10
@Ladicek Ladicek assigned Ladicek and unassigned rhatlapa Mar 7, 2017
@Ladicek Ladicek merged commit 7344ef4 into wildfly-extras:master Mar 7, 2017
@Ladicek
Copy link
Contributor

Ladicek commented Mar 7, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants