|
I have big problem in my java code, when i use thread to access my dataqueue. i create communication program with socket, run in spesific sub system, as a batch program. My program listenning incoming connection, and when receive new connection, it will create new thread to handle the connection. -- my code start ---- Socket s = ss.accept(); try { iThread++; (new OpenSocket(s, iThread)).start(); -- break public OpenSocket(Socket s, int iTh) throws IOException { this.s = s; nSock = iTh; System.out.println("Socket-" + Integer.toString(iTh)); System.out.println("Accepting new connection ..."); } public void run() { try { int iTH = 0; iTH = Thread.currentThread().hashCode(); -- break (until here, no problem , the problem begin when i try to access my resources) This following code create new another thread, and i can't handle this thread, so when the client close connection, i only can destroy the primary thread, (new connection thread), but this thread still alive. -- break AS400 sys = null; sys = new AS400("S65F3CBA", "SSSDNR", "widi012"); System.out.println("AS400 is ok ..."); QSYSObjectPathName dqName = new QSYSObjectPathName ("DNRLIB","KEYQUEUE","DTAQ"); KeyedDataQueue dq = new KeyedDataQueue(sys, dqName.getPath()); ~~~~ dq.write(xxx2, xxx1); -- break How I can handle this new thread, so i can destroy it ??? _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.