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
ISPN-8670 Standalone Server Cache Storage #5666
ISPN-8670 Standalone Server Cache Storage #5666
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor comment.
@@ -1027,6 +1028,14 @@ else if (ch == 'f') | |||
return out.toString(); | |||
} | |||
|
|||
public static <T> Supplier<T> getInstanceSupplier(Class<T> klass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not Function
instead of Supplier
? By using a Supplier, you're capturing a variable outside the lambda (klass). Could you have a Function that takes Class<T>
and returns T
? Then the function would be pure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in the context of the server LocalConfigurationStorage, I need to be able to set a bunch of context.
return () -> getInstance(klass); | ||
} | ||
|
||
public static <T> Supplier<T> getInstanceSupplier(String className, ClassLoader classLoader) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing but with a BiFunction
.
Needs rebase |
06dfcdd
to
3589970
Compare
12d0dfd
to
7dca1d1
Compare
Failures are unrelated |
- add an enum-based ConfigurationStorage type for cleaner API/XML configuration - rename the EmbeddedLocalConfigurationStorage to OverlayLocalConfigurationStorage (as it can be used for servers too) - add a VolatileLocalConfigurationStorage
7dca1d1
to
8fb59d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, just a few minor remarks.
public class StandaloneServerLocalConfigurationStorage implements ServerLocalConfigurationStorage { | ||
private static final String[] CACHE_MODES = {"local-cache", "invalidation-cache", "replicated-cache", "distributed-cache", "scattered-cache"}; | ||
private ModelControllerClient modelControllerClient; | ||
PathAddress rootPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be private
private static final String[] CACHE_MODES = {"local-cache", "invalidation-cache", "replicated-cache", "distributed-cache", "scattered-cache"}; | ||
private ModelControllerClient modelControllerClient; | ||
PathAddress rootPath; | ||
private EmbeddedCacheManager embeddedCacheManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never used
} | ||
// Nothing found | ||
return null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we prevent caches/templates of different types having the same name? If not then this method will always retrieve the first template encountered based upon the CACHE_MODES
order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should prevent it (that's the behaviour in embedded anyway), but this is not the PR to do it
String cacheMode = findCacheMode(name, false); | ||
|
||
if (cacheMode == null) { | ||
throw new CacheConfigurationException("No such cache"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"No Such ..." doesn't sound right to me (although I think we have similar messages elsewhere), "Cache '%s' does not exist", name
is more informative and clear IMO. The same also applies in createCache(..)
.
this.globalConfiguration = cacheManager.getCacheManagerConfiguration(); | ||
this.cacheManager = cacheManager; | ||
this.parserRegistry = new ParserRegistry(); | ||
public OverlayLocalConfigurationStorage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant constructor
protected GlobalConfiguration globalConfiguration; | ||
|
||
public VolatileLocalConfigurationStorage() { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant constructor
private ConcurrentHashSet<String> persistentCaches = new ConcurrentHashSet<>(); | ||
|
||
public OverlayLocalConfigurationStorage() { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant constructor
globalStateBuilder.setConfigurationStorageClass(StandaloneServerLocalConfigurationStorage.class.getName()); | ||
break; | ||
case DOMAIN_SERVER: | ||
// TODO: warn that we won't be persisting the changes to the server model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is sufficient
8fb59d8
to
b7c8aeb
Compare
@ryanemerson I have addressed all issues. I have also converted the "throw new" to use i18n messages. |
…persistent location
- also adds an integration test to exercise securely invoking admin ops
b7c8aeb
to
92a8223
Compare
Failures unrelated |
@tristantarrant Merged, thanks! |
https://issues.jboss.org/browse/ISPN-8670
https://issues.jboss.org/browse/ISPN-8685