Skip to content
Snippets Groups Projects
Commit 8778aea0 authored by Brutzman, Don's avatar Brutzman, Don
Browse files

small refinements in logging

parent f6a1bdbf
No related branches found
No related tags found
No related merge requests found
......@@ -553,17 +553,24 @@ public class DisThreadedNetworkInterface
}
/** Tell sendingThread and receiveThread to stop. */
public void setKillSentinelAndInterrupts()
{
killed = true; // set loop sentinel for threads to finish
// https://stackoverflow.com/questions/26647840/how-do-i-interrupt-kill-a-hung-thread-in-java
sendingThread.interrupt();
receiveThread.interrupt();
if (hasVerboseOutput())
public synchronized void setKillSentinelAndInterrupts()
{
sleep(1000l); // finish sending, receiving
System.out.flush();
System.err.flush();
killed = true; // set loop sentinel for threads to finish
// https://stackoverflow.com/questions/26647840/how-do-i-interrupt-kill-a-hung-thread-in-java
sendingThread.interrupt();
receiveThread.interrupt();
if (hasVerboseOutput())
{
System.out.println ("*** setKillSentinelAndInterrupts() killed=" + killed +
" sendingThread.isInterrupted()=" + sendingThread.isInterrupted() +
" receiveThread.isInterrupted()=" + receiveThread.isInterrupted());
" sendingThread.isInterrupted()=" + sendingThread.isInterrupted() +
" receiveThread.isInterrupted()=" + receiveThread.isInterrupted());
System.out.flush();
System.err.flush();
}
}
/** Terminate the instance after completion of pending send/receive activity.
......
ant -f C:\\x3d-github\\open-dis7-java -Dnb.internal.action.name=run.single -Djavac.includes=edu/nps/moves/dis7/utilities/DisThreadedNetworkInterface.java -Drun.class=edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface run-single
ant -f C:\\x3d-github\\opendis7-java -Dnb.internal.action.name=run.single -Djavac.includes=edu/nps/moves/dis7/utilities/DisThreadedNetworkInterface.java -Drun.class=edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface run-single
init:
Deleting: C:\x3d-github\open-dis7-java\build\built-jar.properties
Deleting: C:\x3d-github\opendis7-java\build\built-jar.properties
deps-jar:
Updating property file: C:\x3d-github\open-dis7-java\build\built-jar.properties
Compiling 1 source file to C:\x3d-github\open-dis7-java\build\classes
Updating property file: C:\x3d-github\opendis7-java\build\built-jar.properties
Compiling 1 source file to C:\x3d-github\opendis7-java\build\classes
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning
compile-single:
run-single:
[DisThreadedNetworkInterface] main() started...
......@@ -13,14 +15,14 @@ run-single:
[DisThreadedNetworkInterface main() self test] createThreads() sendingThread.isAlive()=true
[DisThreadedNetworkInterface main() self test] main() self test initialized...
[DisThreadedNetworkInterface main() self test] self test sending espdu...
[DisThreadedNetworkInterface main() self test] [sending 1] DisPduType 01 ENTITY_STATE self test, size 144 bytes)
[DisThreadedNetworkInterface main() self test] [receipt 1] DisPduType 01 ENTITY_STATE self test, size 144 bytes)
[DisThreadedNetworkInterface main() self test] main() pduListener.incomingPdu() received newPdu DisPduType 01 ENTITY_STATE
[DisThreadedNetworkInterface main() self test] [sending 1] DisPduType 01 ENTITY_STATE self test, size 144 bytes)
*** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=true receiveThread.isInterrupted()=true
*** setKillSentinelAndInterrupts() killed=true sendingThread.isInterrupted()=false receiveThread.isInterrupted()=true
[DisThreadedNetworkInterface main() self test] close(): pdus2send.size()=0 baos.size()=0 dos.size()=144
[DisThreadedNetworkInterface main() self test] datagramSocket.leaveGroup address=239.1.2.3 port=3000 isClosed()=true close() complete.
*** killThread() status: sendingThread.isAlive()=false sendingThread.isInterrupted()=true
*** killThread() status: receiveThread.isAlive()=false receiveThread.isInterrupted()=true
*** Thread close status: sendingThread.isAlive()=false receiveThread.isAlive()=false
[DisThreadedNetworkInterface] main() self test complete.
BUILD SUCCESSFUL (total time: 2 seconds)
BUILD SUCCESSFUL (total time: 3 seconds)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment