@@ -23,7 +23,7 @@ public abstract class XStreamClient {
2323 private final INetworkInterface networkInterface ;
2424 private final ObjectOutputStream out ;
2525 private ObjectInputStream in ;
26- private final Thread thread ;
26+ private final Thread receiveThread ;
2727 private DisconnectCause disconnectCause = DisconnectCause .NOT_DISCONNECTED ;
2828 protected final XStream xStream ;
2929 private boolean closed = false ;
@@ -60,8 +60,7 @@ public void start() {
6060 }
6161 }
6262
63- public XStreamClient (final XStream xstream ,
64- final INetworkInterface networkInterface ) throws IOException {
63+ public XStreamClient (final XStream xstream , final INetworkInterface networkInterface ) throws IOException {
6564 if (networkInterface == null )
6665 throw new IllegalArgumentException ("networkInterface must not be null." );
6766
@@ -71,19 +70,19 @@ public XStreamClient(final XStream xstream,
7170 this .xStream = xstream ;
7271 this .networkInterface = networkInterface ;
7372 this .out = xstream .createObjectOutputStream (networkInterface .getOutputStream (), "protocol" );
74- this .thread = new Thread (new Runnable () {
73+ this .receiveThread = new Thread (new Runnable () {
7574 @ Override
7675 public void run () {
7776 try {
7877 receiveThread ();
7978 } catch (Exception e ) {
8079 logger .error ("ReceiveThread caused an exception." , e );
8180 }
82- logger .debug ("Terminated thread with id {} and name {} " , thread . getId (), thread .getName ());
81+ logger .debug ("Terminated {} " , receiveThread .getName ());
8382 }
8483 });
85- this .thread .setName (String .format ("XStreamClient Receive Thread %d %s" , thread .getId (), getClass ().getSimpleName ()));
86- this .thread .start ();
84+ this .receiveThread .setName (String .format ("XStreamClient ReceiveThread id: %d client: %s" , receiveThread .getId (), getClass ().getSimpleName ()));
85+ this .receiveThread .start ();
8786 }
8887
8988 protected abstract void onObject (ProtocolMessage o ) throws UnprocessedPacketException , InvalidGameStateException ;
@@ -228,15 +227,15 @@ public void stop() {
228227 }
229228
230229 protected synchronized void stopReceiver () {
231- logger .info ("Stopping receiver thread {}" , Thread . currentThread () .getName ());
232- if (this .thread .getId () == Thread .currentThread ().getId ()) {
233- logger .warn ("Receiver thread is stopping itself" );
230+ logger .info ("Stopping {}" , receiveThread .getName ());
231+ if (this .receiveThread .getId () == Thread .currentThread ().getId ()) {
232+ logger .warn ("ReceiveThread is stopping itself" );
234233 }
235234 // unlock waiting threads
236235 synchronized (this .readyLock ) {
237236 this .readyLock .notifyAll ();
238237 }
239- this .thread .interrupt ();
238+ this .receiveThread .interrupt ();
240239 }
241240
242241 protected synchronized void close () {
0 commit comments