marcuspocus / hazelcast

Hazelcast is a dropin replacement for the Play! Framework cache. Hazelcast provide also some other services like Clustered Executors, Maps, AtomicNumbers, Topics, Queues, etc...
http://www.playframework.com/modules/hazelcast
22 stars 9 forks source link

Cache override does not work after app reload #1

Closed psartini closed 13 years ago

psartini commented 13 years ago

In DEV mode if you change a managed class, the hazel system is completely reinitialized. (onApplicationStop -> onApplicationStart)

After the first reload, the cache implementation is not overridden.

19:41:29,361 INFO  ~ Replacing EhCacheImpl with HazelcastCacheImpl...
19:41:29,361 INFO  ~ Cache Impl: play.cache.EhCacheImpl

Note that after application start everything is OK - the problem occurs only after app reload.

marcuspocus commented 13 years ago

Fixed in v0.2 => Already on Play! modules list:

play install hazelcast-0.2

Here's log output at start:

21:03:03,339 INFO  ~ Replacing EhCacheImpl with HazelcastCacheImpl...
21:03:03,355 INFO  ~ Cache Impl: play.modules.hazelcast.HazelcastCacheImpl

here's after a restart in DEV mode:

21:04:25,809 INFO  ~ Hazelcast Services are now started...
21:04:25,810 INFO  ~ Replacing EhCacheImpl with HazelcastCacheImpl...
21:04:25,810 INFO  ~ Cache Impl: play.cache.EhCacheImpl

Could you test?

psartini commented 13 years ago

looks like this problem is gone - Cache Impl show HazelcastCacheImpl after a reload.

But now there is another one: My Class has a commented out Cache.add("key", "value) statement. If I uncomment it to trigger a reload, the following stacktrace is thrown:

Execution exception (In /app/controllers/Application.java around line 18)
RuntimeException occured : java.lang.reflect.InvocationTargetException

play.exceptions.JavaExecutionException: java.lang.reflect.InvocationTargetException
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:227)
        at Invocation.HTTP Request(Play!)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.hazelcast.impl.FactoryImpl$MProxyImpl$DynamicInvoker.invoke(FactoryImpl.java:1900)
        at $Proxy52.putIfAbsent(Unknown Source)
        at com.hazelcast.impl.FactoryImpl$MProxyImpl.putIfAbsent(FactoryImpl.java:2038)
        at play.modules.hazelcast.HazelcastCacheImpl.add(HazelcastCacheImpl.java:39)
        at play.cache.Cache.add(Cache.java:58)
        at controllers.Application.index(Application.java:18)
        at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:540)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:498)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:474)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:469)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:157)
        ... 1 more
Caused by: java.lang.reflect.InvocationTargetException
        at com.hazelcast.impl.FactoryImpl$MProxyImpl$DynamicInvoker.invoke(FactoryImpl.java:1893)
        ... 11 more
Caused by: java.lang.IllegalStateException: Hazelcast Instance is not active!
        at com.hazelcast.impl.Node.checkNodeState(Node.java:303)
        at com.hazelcast.impl.BaseManager$ResponseQueueCall.waitAndGetResult(BaseManager.java:474)
        at com.hazelcast.impl.BaseManager$ResponseQueueCall.getRedoAwareResult(BaseManager.java:496)
        at com.hazelcast.impl.BaseManager$ResponseQueueCall.getResult(BaseManager.java:491)
        at com.hazelcast.impl.BaseManager$RequestBasedCall.getResultAsObject(BaseManager.java:373)
        at com.hazelcast.impl.BaseManager$ResponseQueueCall.getResultAsObject(BaseManager.java:445)
        at com.hazelcast.impl.BaseManager$RequestBasedCall.getResultAsObject(BaseManager.java:369)
        at com.hazelcast.impl.BaseManager$ResponseQueueCall.getResultAsObject(BaseManager.java:445)
        at com.hazelcast.impl.ConcurrentMapManager$MPut.txnalPut(ConcurrentMapManager.java:978)
        at com.hazelcast.impl.ConcurrentMapManager$MPut.putIfAbsent(ConcurrentMapManager.java:845)
        at com.hazelcast.impl.FactoryImpl$MProxyImpl$MProxyReal.putIfAbsent(FactoryImpl.java:2394)
        at com.hazelcast.impl.FactoryImpl$MProxyImpl$MProxyReal.putIfAbsent(FactoryImpl.java:2386)
        ... 12 more

Line 18 in Application.java is my Cache.put() statement.

marcuspocus commented 13 years ago

v0.2.1 fixed all issues...