@@ -23,7 +23,7 @@ public abstract class XStreamClient {
23
23
private final INetworkInterface networkInterface ;
24
24
private final ObjectOutputStream out ;
25
25
private ObjectInputStream in ;
26
- private final Thread thread ;
26
+ private final Thread receiveThread ;
27
27
private DisconnectCause disconnectCause = DisconnectCause .NOT_DISCONNECTED ;
28
28
protected final XStream xStream ;
29
29
private boolean closed = false ;
@@ -60,8 +60,7 @@ public void start() {
60
60
}
61
61
}
62
62
63
- public XStreamClient (final XStream xstream ,
64
- final INetworkInterface networkInterface ) throws IOException {
63
+ public XStreamClient (final XStream xstream , final INetworkInterface networkInterface ) throws IOException {
65
64
if (networkInterface == null )
66
65
throw new IllegalArgumentException ("networkInterface must not be null." );
67
66
@@ -71,19 +70,19 @@ public XStreamClient(final XStream xstream,
71
70
this .xStream = xstream ;
72
71
this .networkInterface = networkInterface ;
73
72
this .out = xstream .createObjectOutputStream (networkInterface .getOutputStream (), "protocol" );
74
- this .thread = new Thread (new Runnable () {
73
+ this .receiveThread = new Thread (new Runnable () {
75
74
@ Override
76
75
public void run () {
77
76
try {
78
77
receiveThread ();
79
78
} catch (Exception e ) {
80
79
logger .error ("ReceiveThread caused an exception." , e );
81
80
}
82
- logger .debug ("Terminated thread with id {} and name {} " , thread . getId (), thread .getName ());
81
+ logger .debug ("Terminated {} " , receiveThread .getName ());
83
82
}
84
83
});
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 ();
87
86
}
88
87
89
88
protected abstract void onObject (ProtocolMessage o ) throws UnprocessedPacketException , InvalidGameStateException ;
@@ -228,15 +227,15 @@ public void stop() {
228
227
}
229
228
230
229
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" );
234
233
}
235
234
// unlock waiting threads
236
235
synchronized (this .readyLock ) {
237
236
this .readyLock .notifyAll ();
238
237
}
239
- this .thread .interrupt ();
238
+ this .receiveThread .interrupt ();
240
239
}
241
240
242
241
protected synchronized void close () {
0 commit comments