mostafa created DIRAPI-249:
------------------------------

             Summary: Performance issue LDAP API 1.0.0-M31
                 Key: DIRAPI-249
                 URL: https://issues.apache.org/jira/browse/DIRAPI-249
             Project: Directory Client API
          Issue Type: Bug
    Affects Versions: 1.0.0-M31
         Environment: - java version : jrockit_160_05
-ldap api version: LDAP API 1.0.0-M31
-server version : windows server 2008 r2 active directory
            Reporter: mostafa


I am using LDAP API 1.0.0-M31 to build a simple java application.
My application flow is:
 Bind() to ldap using credentials
 UnBind()
 Close()
What I have noticed is that when calling Unbind () or close () CPU 
usage increases and the after some time it become 100% utilized which leads to 
a bad performance I appreciate if you can help ...


===========================================================
Thread dump:
--------------------

===== FULL THREAD DUMP ===============
Mon Sep 21 14:11:04 2015
BEA JRockit(R) R27.6.0-50_o-100423-1.6.0_05-20080626-2105-windows-ia32

"Main Thread" id=1 idx=0x4 tid=2920 prio=5 alive, in native, waiting
    -- Waiting for notification on: weblogic/t3/srvr/T3Srvr@0x8EB82E28[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/lang/Object.wait(Object.java:485)
    at weblogic/t3/srvr/T3Srvr.waitForDeath(T3Srvr.java:811)
    ^-- Lock released while waiting: weblogic/t3/srvr/T3Srvr@0x8EB82E28[fat 
lock]
    at weblogic/t3/srvr/T3Srvr.run(T3Srvr.java:459)
    at weblogic/Server.main(Server.java:67)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"(Signal Handler)" id=2 idx=0x8 tid=6012 prio=5 alive, in native, daemon

"(GC Main Thread)" id=3 idx=0xc tid=656 prio=5 alive, in native, 
native_waiting, daemon

"(GC Worker Thread 1)" id=? idx=0x10 tid=4040 prio=5 alive, in native, daemon

"(GC Worker Thread 2)" id=? idx=0x14 tid=4804 prio=5 alive, in native, daemon

"(Code Generation Thread 1)" id=4 idx=0x18 tid=2328 prio=5 alive, in native, 
native_waiting, daemon

"(Code Optimization Thread 1)" id=5 idx=0x1c tid=1212 prio=5 alive, in native, 
native_waiting, daemon

"(VM Periodic Task)" id=6 idx=0x20 tid=3364 prio=10 alive, in native, daemon

"(Attach Listener)" id=7 idx=0x24 tid=5544 prio=5 alive, in native, daemon

"Finalizer" id=8 idx=0x28 tid=5172 prio=8 alive, in native, native_waiting, 
daemon
    at jrockit/memory/Finalizer.waitForFinalizees([Ljava/lang/Object;)I(Native 
Method)
    at jrockit/memory/Finalizer.access$500(Finalizer.java:12)
    at jrockit/memory/Finalizer$4.run(Finalizer.java:159)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"Reference Handler" id=9 idx=0x2c tid=2892 prio=10 alive, in native, 
native_waiting, daemon
    at 
java/lang/ref/Reference.waitForActivatedQueue()Ljava/lang/ref/Reference;(Native 
Method)
    at java/lang/ref/Reference.access$100(Reference.java:11)
    at java/lang/ref/Reference$ReferenceHandler.run(Reference.java:79)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"(Sensor Event Thread)" id=10 idx=0x30 tid=4320 prio=5 alive, in native, daemon

"JDWP Transport Listener: dt_socket" id=11 idx=0x34 tid=3092 prio=10 alive, in 
native, daemon

"JDWP Event Helper Thread" id=12 idx=0x38 tid=3932 prio=10 alive, in native, 
native_waiting, daemon

"Timer-0" id=15 idx=0x3c tid=4928 prio=5 alive, in native, waiting, daemon
    -- Waiting for notification on: java/util/TaskQueue@0x8D783818[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/lang/Object.wait(Object.java:485)
    at java/util/TimerThread.mainLoop(Timer.java:483)
    ^-- Lock released while waiting: java/util/TaskQueue@0x8D783818[fat lock]
    at java/util/TimerThread.run(Timer.java:462)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"Timer-1" id=16 idx=0x40 tid=3184 prio=5 alive, in native, waiting, daemon
    -- Waiting for notification on: java/util/TaskQueue@0x8D783880[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/util/TimerThread.mainLoop(Timer.java:509)
    ^-- Lock released while waiting: java/util/TaskQueue@0x8D783880[fat lock]
    at java/util/TimerThread.run(Timer.java:462)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default 
(self-tuning)'" id=17 idx=0x44 tid=2948 prio=5 alive, in native,
waiting, daemon
    -- Waiting for notification on: weblogic/work/ExecuteThread@0x8EF82B60[fat 
lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/lang/Object.wait(Object.java:485)
    at weblogic/work/ExecuteThread.waitForRequest(ExecuteThread.java:157)
    ^-- Lock released while waiting: weblogic/work/ExecuteThread@0x8EF82B60[fat 
lock]
    at weblogic/work/ExecuteThread.run(ExecuteThread.java:178)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"weblogic.time.TimeEventGenerator" id=18 idx=0x48 tid=4220 prio=9 alive, in 
native, waiting, daemon
    -- Waiting for notification on: 
weblogic/time/common/internal/TimeTable@0x8D3A5F00[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at weblogic/time/common/internal/TimeTable.snooze(TimeTable.java:286)
    ^-- Lock released while waiting: 
weblogic/time/common/internal/TimeTable@0x8D3A5F00[fat lock]
    at 
weblogic/time/common/internal/TimeEventGenerator.run(TimeEventGenerator.java:117)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"JMAPI event thread" id=19 idx=0x4c tid=5472 prio=5 alive, in native, 
native_waiting, daemon

"weblogic.timers.TimerThread" id=20 idx=0x50 tid=2344 prio=9 alive, in native, 
waiting, daemon
    -- Waiting for notification on: 
weblogic/timers/internal/TimerThread@0x8D7839F8[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at weblogic/timers/internal/TimerThread$Thread.run(TimerThread.java:267)
    ^-- Lock released while waiting: 
weblogic/timers/internal/TimerThread@0x8D7839F8[fat lock]
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default 
(self-tuning)'" id=21 idx=0x54 tid=2568 prio=5 alive, in native,
waiting, daemon
    -- Waiting for notification on: 
com/sun/jmx/remote/internal/ArrayNotificationBuffer@0x9617E900[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at 
com/sun/jmx/remote/internal/ArrayNotificationBuffer.fetchNotifications(ArrayNotificationBuffer.java:417)
    ^-- Lock released while waiting: 
com/sun/jmx/remote/internal/ArrayNotificationBuffer@0x9617E900[fat lock]
    at 
com/sun/jmx/remote/internal/ArrayNotificationBuffer$ShareBuffer.fetchNotifications(ArrayNotificationBuffer.java:209)
    at 
com/sun/jmx/remote/internal/ServerNotifForwarder.fetchNotifs(ServerNotifForwarder.java:258)
    at 
javax/management/remote/rmi/RMIConnectionImpl$2.run(RMIConnectionImpl.java:1227)
    at 
javax/management/remote/rmi/RMIConnectionImpl$2.run(RMIConnectionImpl.java:1225)
    at jrockit/vm/AccessController.doPrivileged(AccessController.java:233)
    at 
javax/management/remote/rmi/RMIConnectionImpl.fetchNotifications(RMIConnectionImpl.java:1233)
    at 
javax/management/remote/rmi/RMIConnectionImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundRes
ponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
    at weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:589)
    at weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:477)
    at 
weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at 
weblogic/security/service/SecurityManager.runAs(Lweblogic/security/acl/internal/AuthenticatedSubject;Lweblogic/security/acl
/internal/AuthenticatedSubject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(Unknown
 Source)
    at 
weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:473)
    at 
weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic/work/ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic/work/ExecuteThread.run(ExecuteThread.java:173)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"Thread-7" id=24 idx=0x58 tid=4896 prio=5 alive, in native, parked, daemon
    -- Parking to wait for: 
java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject@0x8C9292E8
    at jrockit/vm/Locks.park0(J)V(Native Method)
    at jrockit/vm/Locks.park(Locks.java:2506)
    at sun/misc/Unsafe.park(ZJ)V(Native Method)
    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 
weblogic/utils/concurrent/JDK15ConcurrentBlockingQueue.take(JDK15ConcurrentBlockingQueue.java:89)
    at 
weblogic/store/internal/PersistentStoreImpl.getOutstandingWork(PersistentStoreImpl.java:567)
    at 
weblogic/store/internal/PersistentStoreImpl.run(PersistentStoreImpl.java:615)
    at 
weblogic/store/internal/PersistentStoreImpl$2.run(PersistentStoreImpl.java:383)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" id=25 idx=0x5c tid=5532 
prio=5 alive, in native, daemon
    at 
weblogic/socket/NTSocketMuxer.getIoCompletionResult(Lweblogic/socket/NTSocketMuxer$IoCompletionData;)Z(Native
 Method)
    at weblogic/socket/NTSocketMuxer.processSockets(NTSocketMuxer.java:81)
    at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=26 idx=0x60 tid=5688 
prio=5 alive, in native, daemon
    at 
weblogic/socket/NTSocketMuxer.getIoCompletionResult(Lweblogic/socket/NTSocketMuxer$IoCompletionData;)Z(Native
 Method)
    at weblogic/socket/NTSocketMuxer.processSockets(NTSocketMuxer.java:81)
    at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=27 idx=0x64 tid=5208 
prio=5 alive, in native, daemon
    at 
weblogic/socket/NTSocketMuxer.getIoCompletionResult(Lweblogic/socket/NTSocketMuxer$IoCompletionData;)Z(Native
 Method)
    at weblogic/socket/NTSocketMuxer.processSockets(NTSocketMuxer.java:81)
    at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)
    at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)
    at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)
    at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"VDE Transaction Processor Thread" id=30 idx=0x68 tid=5012 prio=2 alive, in 
native, waiting, daemon
    -- Waiting for notification on: 
com/octetstring/vde/backend/standard/TransactionProcessor@0x8D516010[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/lang/Object.wait(Object.java:485)
    at 
com/octetstring/vde/backend/standard/TransactionProcessor.waitChange(TransactionProcessor.java:367)
    ^-- Lock released while waiting: 
com/octetstring/vde/backend/standard/TransactionProcessor@0x8D516010[fat lock]
    at 
com/octetstring/vde/backend/standard/TransactionProcessor.run(TransactionProcessor.java:212)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"DoSManager" id=32 idx=0x70 tid=2984 prio=6 alive, in native, sleeping, 
native_waiting, daemon
    at java/lang/Thread.sleep(J)V(Native Method)
    at com/octetstring/vde/DoSManager.run(DoSManager.java:433)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"Thread-11" id=33 idx=0x74 tid=1428 prio=5 alive, in native, parked, daemon
    -- Parking to wait for: 
java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject@0x8D578240
    at jrockit/vm/Locks.park0(J)V(Native Method)
    at jrockit/vm/Locks.park(Locks.java:2506)
    at sun/misc/Unsafe.park(ZJ)V(Native Method)
    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 
weblogic/utils/concurrent/JDK15ConcurrentBlockingQueue.take(JDK15ConcurrentBlockingQueue.java:89)
    at 
weblogic/store/internal/PersistentStoreImpl.getOutstandingWork(PersistentStoreImpl.java:567)
    at 
weblogic/store/internal/PersistentStoreImpl.run(PersistentStoreImpl.java:615)
    at 
weblogic/store/internal/PersistentStoreImpl$2.run(PersistentStoreImpl.java:383)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"Thread-12" id=34 idx=0x78 tid=5024 prio=5 alive, in native, parked, daemon
    -- Parking to wait for: 
java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject@0x91B2DA98
    at jrockit/vm/Locks.park0(J)V(Native Method)
    at jrockit/vm/Locks.park(Locks.java:2506)
    at sun/misc/Unsafe.park(ZJ)V(Native Method)
    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 
weblogic/utils/concurrent/JDK15ConcurrentBlockingQueue.take(JDK15ConcurrentBlockingQueue.java:89)
    at 
weblogic/store/internal/PersistentStoreImpl.getOutstandingWork(PersistentStoreImpl.java:567)
    at 
weblogic/store/internal/PersistentStoreImpl.run(PersistentStoreImpl.java:615)
    at 
weblogic/store/internal/PersistentStoreImpl$2.run(PersistentStoreImpl.java:383)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default 
(self-tuning)'" id=35 idx=0x7c tid=4836 prio=5 alive, in native,
 waiting, daemon
    -- Waiting for notification on: weblogic/work/ExecuteThread@0x944AF350[fat 
lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/lang/Object.wait(Object.java:485)
    at weblogic/work/ExecuteThread.waitForRequest(ExecuteThread.java:157)
    ^-- Lock released while waiting: weblogic/work/ExecuteThread@0x944AF350[fat 
lock]
    at weblogic/work/ExecuteThread.run(ExecuteThread.java:178)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default 
(self-tuning)'" id=36 idx=0x80 tid=4388 prio=5 alive, in native,
 waiting, daemon
    -- Waiting for notification on: weblogic/work/ExecuteThread@0x9442EB88[fat 
lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/lang/Object.wait(Object.java:485)
    at weblogic/work/ExecuteThread.waitForRequest(ExecuteThread.java:157)
    ^-- Lock released while waiting: weblogic/work/ExecuteThread@0x9442EB88[fat 
lock]
    at weblogic/work/ExecuteThread.run(ExecuteThread.java:178)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"[STANDBY] ExecuteThread: '4' for queue: 'weblogic.kernel.Default 
(self-tuning)'" id=37 idx=0x84 tid=4772 prio=5 alive, in native,
 waiting, daemon
    -- Waiting for notification on: weblogic/work/ExecuteThread@0x9432E4E8[fat 
lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native 
Method)
    at java/lang/Object.wait(J)V(Native Method)
    at java/lang/Object.wait(Object.java:485)
    at weblogic/work/ExecuteThread.waitForRequest(ExecuteThread.java:157)
    ^-- Lock released while waiting: weblogic/work/ExecuteThread@0x9432E4E8[fat 
lock]
    at weblogic/work/ExecuteThread.run(ExecuteThread.java:178)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"DynamicListenThread[Default]" id=38 idx=0x88 tid=4868 prio=9 alive, in native, 
daemon
    at java/net/PlainSocketImpl.socketAccept(Ljava/net/SocketImpl;)V(Native 
Method)
    at java/net/PlainSocketImpl.accept(PlainSocketImpl.java:384)
    ^-- Holding lock: java/net/SocksSocketImpl@0x9627FB98[thin lock]
    at java/net/ServerSocket.implAccept(ServerSocket.java:453)
    at java/net/ServerSocket.accept(ServerSocket.java:421)
    at weblogic/socket/WeblogicServerSocket.accept(WeblogicServerSocket.java:38)
    at 
weblogic/server/channels/DynamicListenThread$SocketAccepter.accept(DynamicListenThread.java:523)
    at 
weblogic/server/channels/DynamicListenThread$SocketAccepter.access$200(DynamicListenThread.java:415)
    at 
weblogic/server/channels/DynamicListenThread.run(DynamicListenThread.java:166)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"DynamicListenThread[Default[1]]" id=39 idx=0x8c tid=1740 prio=9 alive, in 
native, daemon
    at java/net/PlainSocketImpl.socketAccept(Ljava/net/SocketImpl;)V(Native 
Method)
    at java/net/PlainSocketImpl.accept(PlainSocketImpl.java:384)
    ^-- Holding lock: java/net/SocksSocketImpl@0x9647ECC8[thin lock]
    at java/net/ServerSocket.implAccept(ServerSocket.java:453)
    at java/net/ServerSocket.accept(ServerSocket.java:421)
    at weblogic/socket/WeblogicServerSocket.accept(WeblogicServerSocket.java:38)
    at 
weblogic/server/channels/DynamicListenThread$SocketAccepter.accept(DynamicListenThread.java:523)
    at 
weblogic/server/channels/DynamicListenThread$SocketAccepter.access$200(DynamicListenThread.java:415)
    at 
weblogic/server/channels/DynamicListenThread.run(DynamicListenThread.java:166)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"NioSocketConnector-1" id=40 idx=0x90 tid=4052 prio=5 alive, in native, 
interrupted
    at jrockit/vm/Reflect.fillInStackTrace0(Ljava/lang/Throwable;)V(Native 
Method)
    at java/lang/Throwable.fillInStackTrace()Ljava/lang/Throwable;(Native 
Method)
    at java/lang/Throwable.<init>(Throwable.java:181)
    at java/lang/Exception.<init>(Exception.java:29)
    at java/io/IOException.<init>(IOException.java:30)
    at 
java/nio/channels/ClosedChannelException.<init>(ClosedChannelException.java:33)
    at sun/nio/ch/SocketChannelImpl.ensureReadOpen(SocketChannelImpl.java:113)
    ^-- Holding lock: java/lang/Object@0x960E9C80[thin lock]
    at sun/nio/ch/SocketChannelImpl.read(SocketChannelImpl.java:156)
    ^-- Holding lock: java/lang/Object@0x960E9C70[thin lock]
    at sun/nio/ch/SourceChannelImpl.read(SourceChannelImpl.java:95)
    at 
sun/nio/ch/WindowsSelectorImpl.clearInterrupt(WindowsSelectorImpl.java:102)
    ^-- Holding lock: java/lang/Object@0x960E9EE8[thin lock]
    at sun/nio/ch/WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:68)
    at sun/nio/ch/SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
    ^-- Holding lock: sun/nio/ch/Util$1@0x960E9EC8[thin lock]
    ^-- Holding lock: java/util/Collections$UnmodifiableSet@0x960E9EB8[thin 
lock]
    ^-- Holding lock: sun/nio/ch/WindowsSelectorImpl@0x960E9E18[thin lock]
    at sun/nio/ch/SelectorImpl.select(SelectorImpl.java:80)
    at 
org/apache/mina/transport/socket/nio/NioSocketConnector.select(NioSocketConnector.java:290)
    at 
org/apache/mina/core/polling/AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:505)
    at 
org/apache/mina/util/NamePreservingRunnable.run(NamePreservingRunnable.java:64)
    at 
java/util/concurrent/ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at 
java/util/concurrent/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"pool-1-thread-1" id=41 idx=0x94 tid=1452 prio=5 alive, in native, parked
    at jrockit/vm/Locks.park0(J)V(Native Method)
    at jrockit/vm/Locks.park(Locks.java:2506)
    at sun/misc/Unsafe.park(ZJ)V(Native Method)
    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:944)
    at 
java/util/concurrent/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:906)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"NioSocketConnector-2" id=42 idx=0x98 tid=5028 prio=5 alive, in native, 
interrupted
    at jrockit/vm/Reflect.fillInStackTrace0(Ljava/lang/Throwable;)V(Native 
Method)
    at java/lang/Throwable.fillInStackTrace()Ljava/lang/Throwable;(Native 
Method)
    at java/lang/Throwable.<init>(Throwable.java:181)
    at java/lang/Exception.<init>(Exception.java:29)
    at java/io/IOException.<init>(IOException.java:30)
    at 
java/nio/channels/ClosedChannelException.<init>(ClosedChannelException.java:33)
    at sun/nio/ch/SocketChannelImpl.ensureReadOpen(SocketChannelImpl.java:113)
    ^-- Holding lock: java/lang/Object@0x9E13A378[thin lock]
    at sun/nio/ch/SocketChannelImpl.read(SocketChannelImpl.java:156)
    ^-- Holding lock: java/lang/Object@0x9E13A368[thin lock]
    at sun/nio/ch/SourceChannelImpl.read(SourceChannelImpl.java:95)
    at 
sun/nio/ch/WindowsSelectorImpl.clearInterrupt(WindowsSelectorImpl.java:102)
    ^-- Holding lock: java/lang/Object@0x9E13A568[thin lock]
    at sun/nio/ch/WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:68)
    at sun/nio/ch/SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
    ^-- Holding lock: sun/nio/ch/Util$1@0x9E13A548[thin lock]
    ^-- Holding lock: java/util/Collections$UnmodifiableSet@0x9E13A538[thin 
lock]
    ^-- Holding lock: sun/nio/ch/WindowsSelectorImpl@0x9E13A498[thin lock]
    at sun/nio/ch/SelectorImpl.select(SelectorImpl.java:80)
    at 
org/apache/mina/transport/socket/nio/NioSocketConnector.select(NioSocketConnector.java:290)
    at 
org/apache/mina/core/polling/AbstractPollingIoConnector$Connector.run(AbstractPollingIoConnector.java:505)
    at 
org/apache/mina/util/NamePreservingRunnable.run(NamePreservingRunnable.java:64)
    at 
java/util/concurrent/ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at 
java/util/concurrent/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

"pool-3-thread-1" id=43 idx=0x9c tid=2944 prio=5 alive, in native, parked
    at jrockit/vm/Locks.park0(J)V(Native Method)
    at jrockit/vm/Locks.park(Locks.java:2506)
    at sun/misc/Unsafe.park(ZJ)V(Native Method)
    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:944)
    at 
java/util/concurrent/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:906)
    at java/lang/Thread.run(Thread.java:619)
    at jrockit/vm/RNI.c2java(IIIII)V(Native Method)
    -- end of trace

===== END OF THREAD DUMP ===============



===========================================================
code sample:
------------------

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import javax.net.ssl.TrustManagerFactory;
import javax.security.auth.login.Configuration;
import org.apache.directory.api.ldap.model.cursor.CursorException;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.DefaultModification;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
import org.apache.directory.api.ldap.model.entry.ModificationOperation;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.message.AddRequest;
import org.apache.directory.api.ldap.model.message.AddRequestImpl;
import org.apache.directory.api.ldap.model.message.AddResponse;
import org.apache.directory.api.ldap.model.message.BindResponse;
import org.apache.directory.api.ldap.model.message.DeleteRequest;
import org.apache.directory.api.ldap.model.message.DeleteRequestImpl;
import org.apache.directory.api.ldap.model.message.DeleteResponse;
import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.ldap.client.api.LdapConnectionConfig;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.ldap.client.api.SaslGssApiRequest;

public class LDAPConTest {
        
        public String bindusername= "ETHIXNet01";   
        public String bindpassword = "get@get1";
        public LdapNetworkConnection ldapNetworkConnection;
        public boolean connectionStatus = true; 
        public LdapConnectionConfig config;
        public boolean kerberos = true;
        public SaslGssApiRequest saslGssApiRequest;
        
        public static void main(String[] args) throws LdapException, 
CursorException, IOException, NoSuchAlgorithmException, CertificateException, 
KeyStoreException {
                
                String keystore = 
"C:\\bea\\jrockit_160_05\\jre\\lib\\security\\ETHIXNetAdmin.pfx";
                System.setProperty("javax.net.ssl.keyStore",keystore);
                System.setProperty("javax.net.ssl.keyStorePassword","P@ssw0rd");
                System.setProperty("javax.net.ssl.keyStoreType","PKCS12");
                
                String username = "RCW0000016";
                String password = "P@ssw0rd";
                LDAPConTest ldapconn = new LDAPConTest();
                ldapconn.connectAndBind();
                ldapconn.closeConnection();
        }


        
        public void connectAndBind()
        {
                config = new LdapConnectionConfig();
            config.setLdapHost("BMRKDC02.bmrk.com");
            config.setLdapPort(389);
            config.setName(bindusername);
            config.setCredentials(bindpassword);
         
            TrustManagerFactory tmf=null;
                try {
                        tmf = 
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
                         tmf.init((KeyStore)null);
                } catch (NoSuchAlgorithmException e) {
                        e.printStackTrace();
                } catch (KeyStoreException e) {
                        e.printStackTrace();
                }
            
           
            config.setTrustManagers(tmf.getTrustManagers());
            config.setUseTls(true);
                config.setSslProtocol("TLSv1");
            ldapNetworkConnection = new LdapNetworkConnection(config);
          
            try {
                 connectionStatus = ldapNetworkConnection.connect();
                 System.out.println((connectionStatus)?"Connection 
Established":"Connection ERROR");
                } catch (LdapException e) {
                        e.printStackTrace();
                }
           
          if(connectionStatus && kerberos){
                        saslGssApiRequest = new SaslGssApiRequest();
                    System.setProperty("java.security.auth.login.config", 
"bcsLogin.conf");
                    saslGssApiRequest.setLoginModuleConfiguration( 
Configuration.getConfiguration() );
                    
saslGssApiRequest.setLoginContextName("org.apache.directory.ldap.client.api.SaslGssApiRequest");

                    saslGssApiRequest.setKrb5ConfFilePath("C:\\krb5.ini");
                    saslGssApiRequest.setMutualAuthentication(false);
                    
                    saslGssApiRequest.setUsername(bindusername);
                    saslGssApiRequest.setCredentials(bindpassword);
                    
                        BindResponse br;
                        try {
                                br = 
ldapNetworkConnection.bind(saslGssApiRequest);
                                ldapNetworkConnection.startTls();
                                
System.out.println(br.getLdapResult().getResultCode().SUCCESS);
                        } catch (LdapException e) {
                                e.printStackTrace();
                        }
                }
        }
        
        public void closeConnection()
        {
                try {
                        ldapNetworkConnection.unBind();
                        ldapNetworkConnection.close();
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (LdapException e) {
                        e.printStackTrace();
                }
        }

}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to