Skip to content

Commit

Permalink
Automagically add the allow-resource-service-restart header when remo…
Browse files Browse the repository at this point in the history
…ving Infinispan caches on WF11+ and EAP7.1+
  • Loading branch information
jmartisk authored and Ladicek committed Mar 7, 2017
1 parent 7281a2d commit 7344ef4
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package org.wildfly.extras.creaper.commands.infinispan.cache;

import org.wildfly.extras.creaper.core.ServerVersion;
import org.wildfly.extras.creaper.core.online.OnlineCommand;
import org.wildfly.extras.creaper.core.online.OnlineCommandContext;
import org.wildfly.extras.creaper.core.online.operations.Address;
import org.wildfly.extras.creaper.core.online.operations.Headers;
import org.wildfly.extras.creaper.core.online.operations.Operations;

/**
* Removes an Infinispan cache.
* Since WildFly 11 / EAP 7.1, this operation requires a reload, and this command
* automatically appends the allow-resource-service-restart header.
*/
public final class RemoveCache implements OnlineCommand {
private final Address address;

Expand All @@ -27,6 +34,8 @@ public RemoveCache(String cacheContainer, CacheType cacheType, String cacheName)
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
Operations ops = new Operations(ctx.client);
if (ctx.version.greaterThanOrEqualTo(ServerVersion.VERSION_5_0_0))
ops = ops.headers(Headers.allowResourceServiceRestart());
ops.remove(address);
}
}

0 comments on commit 7344ef4

Please sign in to comment.