Connection: Pass uid to executor service name

This commit is contained in:
Alva Swanson 2023-02-07 11:58:10 +01:00
parent b1e2cb03ad
commit b1e16f2748
No known key found for this signature in database
GPG Key ID: 004760E77F753090

View File

@ -47,7 +47,6 @@ import com.google.protobuf.InvalidProtocolBufferException;
import javax.inject.Inject;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.Uninterruptibles;
import javafx.beans.property.ObjectProperty;
@ -134,7 +133,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
private final NetworkFilter networkFilter;
@Getter
private final String uid;
private final ExecutorService singleThreadExecutor = SingleThreadExecutorUtils.getSingleThreadExecutor(runnable -> new Thread(runnable, "Connection.java executor-service"));
private final ExecutorService singleThreadExecutor;
@Getter
private final Statistic statistic;
@Getter
@ -180,7 +179,10 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
this.socket = socket;
this.connectionListener = connectionListener;
this.networkFilter = networkFilter;
uid = UUID.randomUUID().toString();
this.uid = UUID.randomUUID().toString();
this.singleThreadExecutor = SingleThreadExecutorUtils.getSingleThreadExecutor("Executor service for connection with uid " + uid);
statistic = new Statistic();
addMessageListener(messageListener);