Skip to content

Commit aa69062

Browse files
author
Myron Scott
committed
add some comments about referencing
1 parent 3ef19b9 commit aa69062

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

common/src/main/java/com/tc/net/protocol/transport/ConnectionWatcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class ConnectionWatcher implements MessageTransportListener {
3939
* Listens to events from a MessageTransport, acts on them, and passes events through to target
4040
*/
4141
public ConnectionWatcher(ClientMessageChannel target, ClientConnectionEstablisher cce) {
42+
// this the channel is no longer reachable, make sure all the the connection threads are cleaned up
4243
this.targetHolder = new WeakReference<>(target, stopQueue);
4344
this.cce = cce;
4445
this.connection = target.getConnectionID();

tc-client/src/main/java/com/tc/object/DistributedObjectClientFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ public Void call() throws Exception {
7474

7575
DistributedObjectClient client = ClientFactory.createClient(serverAddresses, builder, group, uuid, name);
7676
client.addShutdownHook(shutdown);
77+
78+
// weak reference to make sure threads associated with the client aren't preventing
79+
// garbage collection of the client
7780
Reference<DistributedObjectClient> ref = new WeakReference<>(client);
7881

7982
throwableHandler.addCallbackOnExitDefaultHandler(state->{

0 commit comments

Comments
 (0)