Q. When I create an application with jtapi, then it will never exit.
I've even created a simple program which just uses the provider, but the program won't exit.
import javax.telephony.*; public class Startup { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(null); String providerString = "<server>;login=<user>;passwd=<password>;appinfo=BusyLamp"; Provider provider = peer.getProvider(providerString); System.out.format("Started Provider"); provider.shutdown(); System.out.format("Provider Shutdown"); }catch( Exception e) { } } }
The main function will return, but the program will never exit.
Am I missing something here or is this a bug?
A. You may want to try 'System.exit(0);' at the end.
If you have JDK installed, you can run jconsole to check if there are any threads running.
Q. This didn't really work well =(.I've also tried this with OpenJDK & ikvm (.NET Wrapper)
This is the Callstack with .NET
- mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext) + 0x16 bytes
- mscorlib.dll!System.Threading.Monitor.Wait(object obj) + 0xa bytes
- IKVM.OpenJDK.Core.dll!java.lang.Thread.objectWait() + 0x116 bytes
- IKVM.OpenJDK.Core.dll!java.lang.Object.instancehelper_wait(object this = {java.lang.Object}) + 0x28 bytes
- jtapi.dll!com.cisco.cti.util.BlockingQueue.take() + 0x4c2 bytes
- jtapi.dll!com.cisco.cti.util.MessageThread.run() + 0x31d bytes
- IKVM.OpenJDK.Core.dll!java.lang.Thread.threadProc2() + 0x47 bytes
- IKVM.OpenJDK.Core.dll!java.lang.Thread.threadProc() + 0x47 bytes
- IKVM.OpenJDK.Core.dll!java.lang.Thread$1.Invoke() + 0x23 bytes
- mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes
- mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes
- mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes
- mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes
- mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes
A. Another way is to disable logger thread. Try adding jtapi.ini file with following configuration:
UseLogFileTraceWriteThread=0
Final Answer:
I've just disabled logging via
var properties = peer.getJtapiProperties(); properties.setUseFileTrace(false); properties.setUseJavaConsoleTrace(false);
and now it is working as expected
Comments
0 comments
Please sign in to leave a comment.