Abstract method in Enums

Did you know that you can do that? private static enum DynamicProperty { cacheManagerName { @Override void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) { config.cacheManagerName = (Str…

Did you know that you can do that?

private static enum DynamicProperty {

    cacheManagerName {
        @Override
        void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
            config.cacheManagerName = (String) evt.getNewValue();
        }
    },
    defaultCacheConfiguration {
        @Override
        void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
            LOG.debug("Default Cache Configuration has changed, previously created caches remain untouched");
        }
    };

    abstract void applyChange(PropertyChangeEvent evt, RuntimeCfg config);
}

I think it’s nice because it allows you to customize Enum’s behavior or perform other actions on use.

Piece of code taken from EhCache Configuration (line 118 and further).

You May Also Like

Distributed scans with HBase

HBase is by design a columnar store, that is optimized for random reads. You just ask for a row using rowId as an identifier and you get your data instantaneously. Performing a scan on part or whole table is a completely different thing. First of all, it is sequential. Meaning it is rather slow, because it doesn't use all the RegionServers at the same time. It is implemented that way to realize the contract of Scan command - which has to return results sorted by key. So, how to do this efficiently?HBase is by design a columnar store, that is optimized for random reads. You just ask for a row using rowId as an identifier and you get your data instantaneously. Performing a scan on part or whole table is a completely different thing. First of all, it is sequential. Meaning it is rather slow, because it doesn't use all the RegionServers at the same time. It is implemented that way to realize the contract of Scan command - which has to return results sorted by key. So, how to do this efficiently?

ODEO new release

Recently, I released a new version 1.1.34 of ODEO (it's ODE tuned for Oracle and ServiceMix).You can check details (and downloads) here: http://top.touk.pl/confluence/display/top/ODEO.This version contains yet another set of fixes, which drive your BPE...Recently, I released a new version 1.1.34 of ODEO (it's ODE tuned for Oracle and ServiceMix).You can check details (and downloads) here: http://top.touk.pl/confluence/display/top/ODEO.This version contains yet another set of fixes, which drive your BPE...