I'm using Hibernate Search (3.1 GA).
Everything works great, except when I'm using it outside the context of a web app. I have a process which synchronizes data from a SQL database provided by an outside vendor. This process adds entities to our database via Hibernate. When new objects are persisted, or existing objects are updated and the lucene index is updated, the process never terminates. All the code is executed properly, data is committed properly, the indexes are written properly, but the process never ends. I have looked at the thread dump but nothing jumps out at me. Here's the thread dump:
Code:
Full thread dump Java HotSpot(TM) 64-Bit Server VM (11.0-b15 mixed mode):
"DestroyJavaVM" prio=10 tid=0x0000000041b88000 nid=0x170 waiting on condition [0x0000000000000000..0x0000000040733cf0]
java.lang.Thread.State: RUNNABLE
"pool-1-thread-1" prio=10 tid=0x00007f8537d0c400 nid=0x1a3 waiting on condition [0x0000000040935000..0x0000000040935a00]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00007f85429b6540> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
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)
"MySQL Statement Cancellation Timer" daemon prio=10 tid=0x00007f85370f5000 nid=0x17c in Object.wait() [0x0000000040a4e000..0x0000000040a4ed80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00007f854279f9f0> (a java.util.TaskQueue)
at java.lang.Object.wait(Object.java:485)
at java.util.TimerThread.mainLoop(Timer.java:483)
- locked <0x00007f854279f9f0> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:462)
"Low Memory Detector" daemon prio=10 tid=0x0000000041c3ec00 nid=0x17a runnable [0x0000000000000000..0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"CompilerThread1" daemon prio=10 tid=0x0000000041c3c000 nid=0x179 waiting on condition [0x0000000000000000..0x00000000413cb490]
java.lang.Thread.State: RUNNABLE
"CompilerThread0" daemon prio=10 tid=0x0000000041c38400 nid=0x178 waiting on condition [0x0000000000000000..0x00000000412ca410]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" daemon prio=10 tid=0x0000000041c36400 nid=0x177 waiting on condition [0x0000000000000000..0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" daemon prio=10 tid=0x0000000041c17400 nid=0x176 in Object.wait() [0x0000000040834000..0x0000000040834a80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00007f8542630730> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
- locked <0x00007f8542630730> (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=0x0000000041c10400 nid=0x175 in Object.wait() [0x0000000040209000..0x0000000040209a00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00007f85426306e8> (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 <0x00007f85426306e8> (a java.lang.ref.Reference$Lock)
"VM Thread" prio=10 tid=0x0000000041c0ac00 nid=0x174 runnable
"GC task thread#0 (ParallelGC)" prio=10 tid=0x0000000041b92c00 nid=0x171 runnable
"GC task thread#1 (ParallelGC)" prio=10 tid=0x0000000041b94400 nid=0x172 runnable
"GC task thread#2 (ParallelGC)" prio=10 tid=0x0000000041b96000 nid=0x173 runnable
"VM Periodic Task Thread" prio=10 tid=0x0000000041c41000 nid=0x17b waiting on condition
JNI global references: 1049
Heap
PSYoungGen total 65984K, used 43268K [0x00007f856b6e0000, 0x00007f85712a0000, 0x00007f85800e0000)
eden space 64640K, 64% used [0x00007f856b6e0000,0x00007f856dfd8fd0,0x00007f856f600000)
from space 1344K, 97% used [0x00007f8571150000,0x00007f85712980c8,0x00007f85712a0000)
to space 2048K, 0% used [0x00007f8570ea0000,0x00007f8570ea0000,0x00007f85710a0000)
PSOldGen total 42240K, used 28889K [0x00007f85422e0000, 0x00007f8544c20000, 0x00007f856b6e0000)
object space 42240K, 68% used [0x00007f85422e0000,0x00007f8543f16700,0x00007f8544c20000)
PSPermGen total 53184K, used 26373K [0x00007f853cee0000, 0x00007f85402d0000, 0x00007f85422e0000)
object space 53184K, 49% used [0x00007f853cee0000,0x00007f853e8a1678,0x00007f85402d0000)