Skip to content

Commit 87df0a9

Browse files
committed
Exposed underlying connection id
1 parent 65ab333 commit 87df0a9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/com/github/shyiko/mysql/binlog/BinaryLogClient.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public class BinaryLogClient implements BinaryLogClientMXBean {
8888
private long serverId = 65535;
8989
private volatile String binlogFilename;
9090
private volatile long binlogPosition = 4;
91+
private volatile long connectionId;
9192

9293
private GtidSet gtidSet;
9394
private final Object gtidSetAccessLock = new Object();
@@ -212,6 +213,13 @@ public void setBinlogPosition(long binlogPosition) {
212213
this.binlogPosition = binlogPosition;
213214
}
214215

216+
/**
217+
* @return thread id
218+
*/
219+
public long getConnectionId() {
220+
return connectionId;
221+
}
222+
215223
/**
216224
* @return GTID set. Note that this value changes with each received GTID event (provided client is in GTID mode).
217225
* @see #setGtidSet(String)
@@ -359,9 +367,10 @@ public void connect() throws IOException {
359367
throw e;
360368
}
361369
connected = true;
370+
connectionId = greetingPacket.getThreadId();
362371
if (logger.isLoggable(Level.INFO)) {
363372
logger.info("Connected to " + hostname + ":" + port + " at " + binlogFilename + "/" + binlogPosition +
364-
" (sid:" + serverId + ", cid:" + greetingPacket.getThreadId() + ")");
373+
" (sid:" + serverId + ", cid:" + connectionId + ")");
365374
}
366375
synchronized (lifecycleListeners) {
367376
for (LifecycleListener lifecycleListener : lifecycleListeners) {

0 commit comments

Comments
 (0)