Skip to content

Instantly share code, notes, and snippets.

@jfarcand
Created September 17, 2010 21:02
Show Gist options
  • Save jfarcand/584950 to your computer and use it in GitHub Desktop.
Save jfarcand/584950 to your computer and use it in GitHub Desktop.
</room>
package test;
import java.util.concurrent.Future;
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.Realm;
import com.ning.http.client.Request;
import com.ning.http.client.Response;
public class Test {
public static void main(String[] args) throws Exception {
AsyncHttpClient client = new AsyncHttpClient();
Realm realm = new Realm.RealmBuilder()
.setPrincipal(...)
.setPassword("X")
.build();
Request request = client
.prepareGet(String.format("https://inductiveautomation.campfirenow.com/rooms.xml"))
.setRealm(realm)
.build();
Future<String> f = client.executeRequest(request, new AsyncCompletionHandler<String>() {
@Override
public String onCompleted(Response response) throws Exception {
return response.getResponseBody();
}
});
System.out.println(f.get());
System.out.println("Exiting...");
client.close();
}
}
@jfarcand
Copy link
Author

Also removing line 37 gives a proper thread dumps as well.

Full thread dump Java HotSpot(TM) 64-Bit Server VM (16.3-b01-279 mixed mode):

"DestroyJavaVM" prio=5 tid=11a1d0800 nid=0x100501000 waiting on condition [00000000]
java.lang.Thread.State: RUNNABLE

"AsyncHttpClient-Reaper" prio=5 tid=101aad000 nid=0x11df04000 waiting on condition [11df03000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <108b3e740> (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:637)

"New I/O client worker #1-1" prio=5 tid=11b803800 nid=0x11de01000 runnable [11de00000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.KQueueArrayWrapper.kevent0(Native Method)
at sun.nio.ch.KQueueArrayWrapper.poll(KQueueArrayWrapper.java:136)
at sun.nio.ch.KQueueSelectorImpl.doSelect(KQueueSelectorImpl.java:69)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
- locked <10746a758> (a sun.nio.ch.Util$1)
- locked <10746a740> (a java.util.Collections$UnmodifiableSet)
- locked <10746a3e0> (a sun.nio.ch.KQueueSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:38)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:164)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)

"pool-3-thread-1" prio=5 tid=101a51800 nid=0x11db01000 waiting on condition [11db00000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <108bbea30> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:424)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:323)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:874)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:945)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:637)

"Hashed wheel timer #1" prio=5 tid=1028cc000 nid=0x11cd96000 waiting on condition [11cd95000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.jboss.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:436)
at org.jboss.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:367)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at java.lang.Thread.run(Thread.java:637)

"Poller SunPKCS11-Darwin" daemon prio=1 tid=10191e000 nid=0x119607000 waiting on condition [119606000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:692)
at java.lang.Thread.run(Thread.java:637)

"Low Memory Detector" daemon prio=5 tid=102800800 nid=0x119401000 runnable [00000000]
java.lang.Thread.State: RUNNABLE

"CompilerThread1" daemon prio=9 tid=101935000 nid=0x11910a000 waiting on condition [00000000]
java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=9 tid=101934800 nid=0x119007000 waiting on condition [00000000]
java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=9 tid=101933800 nid=0x118f04000 waiting on condition [00000000]
java.lang.Thread.State: RUNNABLE

"Surrogate Locker Thread (CMS)" daemon prio=5 tid=101933000 nid=0x118e01000 waiting on condition [00000000]
java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=101918800 nid=0x118afc000 in Object.wait() [118afb000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <1088f8200> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
- locked <1088f8200> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=101918000 nid=0x1189f9000 in Object.wait() [1189f8000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <108922028> (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 <108922028> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=9 tid=101915800 nid=0x1188f6000 runnable

"Gang worker#0 (Parallel GC Threads)" prio=9 tid=101802800 nid=0x102401000 runnable

"Gang worker#1 (Parallel GC Threads)" prio=9 tid=101803000 nid=0x102504000 runnable

"Gang worker#2 (Parallel GC Threads)" prio=9 tid=101803800 nid=0x102607000 runnable

"Gang worker#3 (Parallel GC Threads)" prio=9 tid=101804000 nid=0x10270a000 runnable

"Gang worker#4 (Parallel GC Threads)" prio=9 tid=101805000 nid=0x107102000 runnable

"Gang worker#5 (Parallel GC Threads)" prio=9 tid=101805800 nid=0x107205000 runnable

"Gang worker#6 (Parallel GC Threads)" prio=9 tid=101806000 nid=0x107308000 runnable

"Gang worker#7 (Parallel GC Threads)" prio=9 tid=101806800 nid=0x10740b000 runnable

"Concurrent Mark-Sweep GC Thread" prio=9 tid=1018c1000 nid=0x11840d000 runnable
"Gang worker#0 (Parallel CMS Threads)" prio=9 tid=1018c0000 nid=0x117a07000 runnable

"Gang worker#1 (Parallel CMS Threads)" prio=9 tid=1018c0800 nid=0x117b0a000 runnable

"VM Periodic Task Thread" prio=10 tid=102802000 nid=0x119504000 waiting on condition

"Exception Catcher Thread" prio=10 tid=101801800 nid=0x10171b000 runnable
JNI global references: 990

Heap
par new generation total 19136K, used 11394K [107410000, 1088d0000, 1088d0000)
eden space 17024K, 58% used [107410000, 107db8388, 1084b0000)
from space 2112K, 71% used [1084b0000, 1086286e8, 1086c0000)
to space 2112K, 0% used [1086c0000, 1086c0000, 1088d0000)
concurrent mark-sweep generation total 63872K, used 1637K [1088d0000, 10c730000, 10f210000)
concurrent-mark-sweep perm gen total 21248K, used 9214K [10f210000, 1106d0000, 114610000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment