Skip to content

Commit

Permalink
unregister mbean on flush. patch by daishi; reviewed by jbellis for C…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbellis committed May 12, 2009
1 parent 9307f62 commit 2fd856d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Expand Up @@ -38,6 +38,7 @@ public class DebuggableThreadPoolExecutor extends ThreadPoolExecutor implements
{
private static Logger logger_ = Logger.getLogger(DebuggableThreadPoolExecutor.class);

private ObjectName objName;
public DebuggableThreadPoolExecutor(String threadPoolName)
{
this(1, 1, Integer.MAX_VALUE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new ThreadFactoryImpl(threadPoolName));
Expand All @@ -55,7 +56,21 @@ public DebuggableThreadPoolExecutor(int corePoolSize,
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try
{
mbs.registerMBean(this, new ObjectName("org.apache.cassandra.concurrent:type=" + threadFactory.id_));
objName = new ObjectName("org.apache.cassandra.concurrent:type=" + threadFactory.id_);
mbs.registerMBean(this, objName);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}

public void unregisterMBean()
{
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try
{
mbs.unregisterMBean(objName);
}
catch (Exception e)
{
Expand Down
1 change: 1 addition & 0 deletions src/java/org/apache/cassandra/db/Memtable.java
Expand Up @@ -384,6 +384,7 @@ protected void terminated()
{
flushQueuer.run();
}
this.unregisterMBean();
}

public void flushWhenTerminated(final CommitLog.CommitLogContext cLogCtx)
Expand Down

0 comments on commit 2fd856d

Please sign in to comment.