2 Replies Latest reply on Sep 25, 2009 1:40 PM by User JBoss

    2 JBoss Cache questions

    User JBoss Newbie

      Hello,

      I'm a relatively new user to JBoss cache, and things generally seem to work well with JBoss cache while running inside of my application server. However, I am having 2 difficulties that I hope somebody out there can help me out with:

      1) when using a JBoss cache instance in a standalone Java client outside of my JBoss application server (which running in a clustered mode), I seem to be unable to get it to join the application server cluster and have the caches talk to each other. I want to have my Java client application invalidate the application server's cache by using the INVALIDATION_ASYNC mode. I've started the JBoss server with the following arguments:

      ./run.sh -c all -b 10.1.0.22 -u 228.1.2.3 -g testcluster
      


      My Java application code creates a cache like this:

      CacheFactory factory = DefaultCacheFactory.getInstance();
      Configuration config = new Configuration();
      config.setCacheMode(CacheMode.INVALIDATION_ASYNC);
      config.setClusterName("testcluster-query");
      jbCache = factory.createCache(config);
      jbCache.addCacheListener(new DebugCacheListener());
      jbCache.create();
      jbCache.start();
      


      If I start up 2 of my Java standalone applications, I can see that these caches do indeed talk to each other (through the use of annotations on my DebugCacheListener such as @NodeInvalidated etc.)

      2) in the same situation as #1 (using a cache instance in a standalone Java application), it seems that JBoss cache is creating lots of background threads that cause my application VM not to want to exit. Is there any way to have JBoss cache create these threads as daemon threads and not block the application VM from exiting automatically when my main() method finishes? I would like to avoid having to put System.exit() calls in my code to force a VM exit.

      Thanks for any help you can provide!

        • 1. Re: 2 JBoss Cache questions
          Manik Surtani Master

          Can you confirm the version of JBoss Cache used? It should be the same as what JBoss AS uses.

          re: 1, you also need to make sure you are using the same JGroups stack as the app server

          re: 2, which threads are these? Could you provide a thread dump?

          • 2. Re: 2 JBoss Cache questions
            User JBoss Newbie

            Hi Manik,

            Thanks for the reply...here is my info:

            1) yes, the Java client is using the same JGroups stack as the appserver (essentially just the jbossall-client.jar, jbosscache-core.jar and jgroups.jar files found in the JBoss server distribution). This is all under JBoss 5.1.0.GA.

            Also, if it helps, I'm running my client application with the following system properties to help it try to join the JGroups channel (though running with or without these properties doesn't seem to make any difference for me):

             -Djgroups.udp.mcast_addr=228.1.2.3 -Djgroups.mping.mcast_port=39472 -Djgroups.udp.mcast_port=34972 -Djgroups.bind_addr=10.1.0.22
            


            2) here's the thread dump:

            
            Full thread dump Java HotSpot(TM) Server VM (11.2-b01 mixed mode):
            
            "DestroyJavaVM" prio=10 tid=0x7627b000 nid=0x1317 waiting on condition [0x00000000..0xb7f51070]
             java.lang.Thread.State: RUNNABLE
            
            "Timer-4,10.1.0.22:34975" daemon prio=10 tid=0x762ff400 nid=0x1334 waiting on condition [0x75cba000..0x75cbae30]
             java.lang.Thread.State: TIMED_WAITING (parking)
             at sun.misc.Unsafe.park(Native Method)
             - parking to wait for <0xaed041a0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
             at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
             at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1963)
             at java.util.concurrent.DelayQueue.take(DelayQueue.java:164)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:583)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:576)
             at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
             at java.lang.Thread.run(Thread.java:619)
            
            "Timer-3,10.1.0.22:34975" daemon prio=10 tid=0x75e1c800 nid=0x1333 waiting on condition [0x75d0b000..0x75d0c0b0]
             java.lang.Thread.State: TIMED_WAITING (parking)
             at sun.misc.Unsafe.park(Native Method)
             - parking to wait for <0xaed041a0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
             at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
             at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1963)
             at java.util.concurrent.DelayQueue.take(DelayQueue.java:164)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:583)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:576)
             at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
             at java.lang.Thread.run(Thread.java:619)
            
            "OOB-1,10.1.0.22:34975" prio=10 tid=0x09fcc400 nid=0x1332 waiting on condition [0x75d5c000..0x75d5d130]
             java.lang.Thread.State: WAITING (parking)
             at sun.misc.Unsafe.park(Native Method)
             - parking to wait for <0xaed07f78> (a java.util.concurrent.SynchronousQueue$TransferStack)
             at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
             at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:422)
             at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:323)
             at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:857)
             at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
             at java.lang.Thread.run(Thread.java:619)
            
            "Timer-2,10.1.0.22:34975" daemon prio=10 tid=0x762b7c00 nid=0x1331 waiting on condition [0x75dad000..0x75dadfb0]
             java.lang.Thread.State: TIMED_WAITING (parking)
             at sun.misc.Unsafe.park(Native Method)
             - parking to wait for <0xaed041a0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
             at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
             at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1963)
             at java.util.concurrent.DelayQueue.take(DelayQueue.java:164)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:583)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:576)
             at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
             at java.lang.Thread.run(Thread.java:619)
            
            "UDP mcast,10.1.0.22:34975" prio=10 tid=0x762ea800 nid=0x1330 runnable [0x75dfe000..0x75dff030]
             java.lang.Thread.State: RUNNABLE
             at java.net.PlainDatagramSocketImpl.receive0(Native Method)
             - locked <0xaed40628> (a java.net.PlainDatagramSocketImpl)
             at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
             - locked <0xaed40628> (a java.net.PlainDatagramSocketImpl)
             at java.net.DatagramSocket.receive(DatagramSocket.java:712)
             - locked <0xaedec960> (a java.net.DatagramPacket)
             - locked <0xaed405f0> (a java.net.MulticastSocket)
             at org.jgroups.protocols.UDP.run(UDP.java:262)
             at java.lang.Thread.run(Thread.java:619)
            
            "UDP ucast,10.1.0.22:34975" prio=10 tid=0x75e0a400 nid=0x132f runnable [0x75f5c000..0x75f5ceb0]
             java.lang.Thread.State: RUNNABLE
             at java.net.PlainDatagramSocketImpl.receive0(Native Method)
             - locked <0xaed3ff40> (a java.net.PlainDatagramSocketImpl)
             at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
             - locked <0xaed3ff40> (a java.net.PlainDatagramSocketImpl)
             at java.net.DatagramSocket.receive(DatagramSocket.java:712)
             - locked <0xaedc39f0> (a java.net.DatagramPacket)
             - locked <0xaed3f938> (a java.net.DatagramSocket)
             at org.jgroups.protocols.UDP$UcastReceiver.run(UDP.java:946)
             at java.lang.Thread.run(Thread.java:619)
            
            "DiagnosticsHandler,10.1.0.22:34975" daemon prio=10 tid=0x762a8400 nid=0x132e runnable [0x75fad000..0x75fadf30]
             java.lang.Thread.State: RUNNABLE
             at java.net.PlainDatagramSocketImpl.receive0(Native Method)
             - locked <0xaed4be90> (a java.net.PlainDatagramSocketImpl)
             at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
             - locked <0xaed4be90> (a java.net.PlainDatagramSocketImpl)
             at java.net.DatagramSocket.receive(DatagramSocket.java:712)
             - locked <0xaed9b2f8> (a java.net.DatagramPacket)
             - locked <0xaed4be40> (a java.net.MulticastSocket)
             at org.jgroups.protocols.TP$DiagnosticsHandler.run(TP.java:2199)
             at java.lang.Thread.run(Thread.java:619)
            
            "FD_SOCK server socket acceptor,null" daemon prio=10 tid=0x762fd400 nid=0x132d runnable [0x75ffe000..0x75ffedb0]
             java.lang.Thread.State: RUNNABLE
             at java.net.PlainSocketImpl.socketAccept(Native Method)
             at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
             - locked <0xaed3f0d8> (a java.net.SocksSocketImpl)
             at java.net.ServerSocket.implAccept(ServerSocket.java:453)
             at java.net.ServerSocket.accept(ServerSocket.java:421)
             at org.jgroups.protocols.FD_SOCK$ServerSocketHandler.run(FD_SOCK.java:1022)
             at java.lang.Thread.run(Thread.java:619)
            
            "Timer-1,10.1.0.22:34975" daemon prio=10 tid=0x762b8400 nid=0x132c waiting on condition [0x7615c000..0x7615ce30]
             java.lang.Thread.State: TIMED_WAITING (parking)
             at sun.misc.Unsafe.park(Native Method)
             - parking to wait for <0xaed041a0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
             at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
             at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1963)
             at java.util.concurrent.DelayQueue.take(DelayQueue.java:164)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:583)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:576)
             at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
             at java.lang.Thread.run(Thread.java:619)
            
            "RMI Scheduler(0)" daemon prio=10 tid=0x76237400 nid=0x1327 waiting on condition [0x761ad000..0x761ae130]
             java.lang.Thread.State: TIMED_WAITING (parking)
             at sun.misc.Unsafe.park(Native Method)
             - parking to wait for <0x7b662188> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
             at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
             at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1963)
             at java.util.concurrent.DelayQueue.take(DelayQueue.java:164)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:583)
             at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:576)
             at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
             at java.lang.Thread.run(Thread.java:619)
            
            "GC Daemon" daemon prio=10 tid=0x76231400 nid=0x1326 in Object.wait() [0x761fe000..0x761fefb0]
             java.lang.Thread.State: TIMED_WAITING (on object monitor)
             at java.lang.Object.wait(Native Method)
             - waiting on <0x7b61d6f8> (a sun.misc.GC$LatencyLock)
             at sun.misc.GC$Daemon.run(GC.java:100)
             - locked <0x7b61d6f8> (a sun.misc.GC$LatencyLock)
            
            "RMI RenewClean-[10.1.0.22:1098]" daemon prio=10 tid=0x76278800 nid=0x1325 in Object.wait() [0x76665000..0x76666030]
             java.lang.Thread.State: TIMED_WAITING (on object monitor)
             at java.lang.Object.wait(Native Method)
             - waiting on <0x7b61d000> (a java.lang.ref.ReferenceQueue$Lock)
             at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
             - locked <0x7b61d000> (a java.lang.ref.ReferenceQueue$Lock)
             at sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(DGCClient.java:516)
             at java.lang.Thread.run(Thread.java:619)
            
            "Low Memory Detector" daemon prio=10 tid=0x09dacc00 nid=0x1322 runnable [0x00000000..0x00000000]
             java.lang.Thread.State: RUNNABLE
            
            "CompilerThread1" daemon prio=10 tid=0x09daac00 nid=0x1321 waiting on condition [0x00000000..0x76a5a268]
             java.lang.Thread.State: RUNNABLE
            
            "CompilerThread0" daemon prio=10 tid=0x09da8000 nid=0x1320 waiting on condition [0x00000000..0x76adb2e8]
             java.lang.Thread.State: RUNNABLE
            
            "Signal Dispatcher" daemon prio=10 tid=0x09da6800 nid=0x131f waiting on condition [0x00000000..0x00000000]
             java.lang.Thread.State: RUNNABLE
            
            "Finalizer" daemon prio=10 tid=0x09d93000 nid=0x131e in Object.wait() [0x76d7d000..0x76d7e130]
             java.lang.Thread.State: WAITING (on object monitor)
             at java.lang.Object.wait(Native Method)
             - waiting on <0x7b61d930> (a java.lang.ref.ReferenceQueue$Lock)
             at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
             - locked <0x7b61d930> (a java.lang.ref.ReferenceQueue$Lock)
             at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
             at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
            
            "Reference Handler" daemon prio=10 tid=0x09d91800 nid=0x131d in Object.wait() [0x76dce000..0x76dcefb0]
             java.lang.Thread.State: WAITING (on object monitor)
             at java.lang.Object.wait(Native Method)
             - waiting on <0x7b61d6f0> (a java.lang.ref.Reference$Lock)
             at java.lang.Object.wait(Object.java:485)
             at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
             - locked <0x7b61d6f0> (a java.lang.ref.Reference$Lock)
            
            "VM Thread" prio=10 tid=0x09d8e400 nid=0x131c runnable
            
            "GC task thread#0 (ParallelGC)" prio=10 tid=0x09cf1400 nid=0x1318 runnable
            
            "GC task thread#1 (ParallelGC)" prio=10 tid=0x09cf2c00 nid=0x1319 runnable
            
            "GC task thread#2 (ParallelGC)" prio=10 tid=0x09cf4000 nid=0x131a runnable
            
            "GC task thread#3 (ParallelGC)" prio=10 tid=0x09cf5800 nid=0x131b runnable
            
            "VM Periodic Task Thread" prio=10 tid=0x09dae800 nid=0x1323 waiting on condition