Blogs : Latest entries
|
|
| < Previous page |
|
We've all been there, you start with a class and a simple constructor that makes total sense. As time goes by, you keep adding features and the list of constructor arguments grows … and grows … until … it becomes unusable. This is exactly what happened with the The version 1.0 constructor looked like this:
public Cache(String name, int maxElementsInMemory,
boolean overflowToDisk, boolean eternal,
long timeToLiveSeconds, long timeToIdleSeconds)However, with version 1.7 this turned into:
public Cache(String name, int maxElementsInMemory,
MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
boolean overflowToDisk, String diskStorePath,
boolean eternal, long timeToLiveSeconds,
long timeToIdleSeconds, boolean diskPersistent,
long diskExpiryThreadIntervalSeconds,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoader bootstrapCacheLoader,
int maxElementsOnDisk, int diskSpoolBufferSizeMB,
boolean clearOnFlush,
boolean isTerracottaClustered,
String terracottaValueMode,
boolean terracottaCoherentReads)There are a lot of downsides to relying on constructor parameters like this:
new Cache("myCache", 10000, MemoryStoreEvictionPolicy.LRU, false,
null, true, 60, 30, false, 0, null, null, 0, 0, false,
true, "identity", true)However there some advantages:
So, we decided to change the The version 2.0 constructor looks like this:
new Cache(CacheConfiguration config)We then created a constructor in
public CacheConfiguration(String name, int maxElementsInMemory)All the other parameters are implemented as fluent interface methods as well as regular setters and getters so that instances of the class can be used as beans:
public final CacheConfiguration clearOnFlush(boolean clearOnFlush) {
setClearOnFlush(clearOnFlush);
return this;
}This allows the example above to be rewritten like this:
new Cache(new CacheConfiguration("myCache", 10000)
.eternal(true)
.timeToLiveSeconds(60)
.timeToIdleSeconds(30)
.terracotta(new TerracottaConfiguration()
.clustered(true)
.valueMode(ValueMode.IDENTITY)));The end results are that:
|
|
Ever since I upgraded to Snow Leopard 10.6.1, my MacBook Pro startup and shutdown was much slower than before. I searched for a quite a while on forums to find the solution, but nobody seemed to know a solution. I finally figured out what it was. It seems that somehow the ownership of my startup volume's root directory (/) wasn't assigned to the root account anymore, but to my account instead. This made the kernel prelinking fail since it requires that root is the owner. This is how you solve this after launching the Terminal app: sudo chown root:admin /You'll have to enter your password after the first command. Hope this helps someone, since it was really frustrating to have these slower startup/shutdown times for me. |
|
Terracotta 3.1GA was released a few days ago and sports some interesting new features that are specifically geared towards clustering Hibernate second level caches. I decided to create a series of video tutorials and presentations about Terracotta's new clustered caching capabilities and will demonstrate most of this from our Examinator reference application. The first video highlights how to install, setup and use Examinator as a basis for the next videos. Enjoy! |
|
I picked music back up after a loooong hiatus of 7 years. I decided to evolve together with the world and to broadcast myself Did the first one last night. The song is "All The Kings Horses" from Robert Plant and the Strange Sensation. When I heard it playing last afternoon from my iTunes collection, I couldn't help picking up my guitar to figure out the chords and such. This recording is the result of a couple of hours searching and rehearsing. I'm considering adding it to a concert repertoire I'm preparing, as one of the few cover songs. Anyways, my YouTube channel is located at http://www.youtube.com/gbevin and I'll be posting new entries as I learn and compose songs. Hope you enjoy it, and if you don't, still be nice |
|
Hi everyone, Calling all hands on deck here, we're participating in a music contest and they finally opened internet voting. If you can't see the 'vote' button it's because they tie individual votes to IP addresses and someone behind the same firewall has already voted. Please vote for my band Flytecase at http://vote.flytecase.beThanks a lot for your support, Geert |
| < Previous page |


