Browse files

Remove readingBuffers on client disconnects

Fix #21
  • Loading branch information...
1 parent 56e2a4c commit db29950e7c9eb5acd79140418ea1d0a024c7a9d6 @dgomezferro committed Jul 19, 2012
View
4 src/main/java/com/yahoo/omid/replication/SharedMessageBuffer.java
@@ -134,6 +134,10 @@ public ReadingBuffer getReadingBuffer(ChannelHandlerContext ctx) {
return rb;
}
+ public void removeReadingBuffer(ChannelHandlerContext ctx) {
+ readingBuffers.remove(new ReadingBuffer(ctx));
+ }
+
public void writeCommit(long startTimestamp, long commitTimestamp) {
checkBufferSpace();
zipper.encodeCommit(writeBuffer, startTimestamp, commitTimestamp);
View
7 src/main/java/com/yahoo/omid/tso/TSOHandler.java
@@ -146,6 +146,13 @@ public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) thr
channelGroup.add(ctx.getChannel());
}
+ @Override
+ public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
+ synchronized (sharedMsgBufLock) {
+ sharedState.sharedMessageBuffer.removeReadingBuffer(ctx);
+ }
+ }
+
/**
* Handle receieved messages
*/

0 comments on commit db29950

Please sign in to comment.