Gradlew takes a long time to build "Waiting to acquire shared lock on daemon addresses registry"

My gradle tests are running and getting hung at 86% with the following message coming over and over again:

./gradlew clean build ===>>

DaemonExpirationPeriodicCheck running
Waiting to acquire shared lock on daemon addresses registry.
13:15:27.117 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
13:15:27.117 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.

below is the output for jps
993 GradleWrapperMain
1140 GradleWorkerMain
1511 Jps
2184 swarm-client-1.22-jar-with-dependencies.jar
1022 GradleDaemon
26847 – process information unavailable

When I did the stack trace on GradleDaemon it gave me the following output::

2017-05-30 13:02:19
Full thread dump OpenJDK 64-Bit Server VM (25.121-b13 mixed mode):

“Attach Listener” #40 daemon prio=9 os_prio=0 tid=0x00007f1b1c001800 nid=0x5bb waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

“/127.0.0.1:24037 to /127.0.0.1:13877 workers Thread 4” #39 prio=5 os_prio=0 tid=0x00007f1b50374000 nid=0x487 runnable [0x00007f1af9ff1000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked <0x00000000fe1bd780> (a sun.nio.ch.Util$3)
- locked <0x00000000fe1bd770> (a java.util.Collections$UnmodifiableSet)
- locked <0x00000000fe1bd568> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
at org.gradle.internal.remote.internal.inet.SocketConnection$SocketInputStream.read(SocketConnection.java:165)
at com.esotericsoftware.kryo.io.Input.fill(Input.java:139)
at com.esotericsoftware.kryo.io.Input.require(Input.java:159)
at com.esotericsoftware.kryo.io.Input.readByte(Input.java:255)
at org.gradle.internal.serialize.kryo.KryoBackedDecoder.readByte(KryoBackedDecoder.java:80)
at org.gradle.internal.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:63)
at org.gradle.internal.remote.internal.hub.InterHubMessageSerializer$MessageReader.read(InterHubMessageSerializer.java:52)
at org.gradle.internal.remote.internal.inet.SocketConnection.receive(SocketConnection.java:78)
at org.gradle.internal.remote.internal.hub.MessageHub$ConnectionReceive.run(MessageHub.java:250)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

“/127.0.0.1:24037 to /127.0.0.1:13877 workers Thread 3” #38 prio=5 os_prio=0 tid=0x00007f1b50372800 nid=0x486 waiting on condition [0x00007f1afa0f3000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000fe1d33c8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at org.gradle.internal.remote.internal.hub.queue.EndPointQueue.take(EndPointQueue.java:48)
at org.gradle.internal.remote.internal.hub.MessageHub$ConnectionDispatch.run(MessageHub.java:293)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

I need help in understanding this as I am new to Gradle and need to understand why my build is taking so much time and getting hung ?