Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-04-08 05:10:49 -0400
committerEike Stepper2013-04-08 05:10:49 -0400
commit1d0c2afa773ccd0f241e6b2c9d288b3fd9e0f07b (patch)
treef9dd308114745820cead48c21474bdcdefcd183f
parent540e46582a4dc392c85569899ab1bbab36888872 (diff)
downloadcdo-1d0c2afa773ccd0f241e6b2c9d288b3fd9e0f07b.tar.gz
cdo-1d0c2afa773ccd0f241e6b2c9d288b3fd9e0f07b.tar.xz
cdo-1d0c2afa773ccd0f241e6b2c9d288b3fd9e0f07b.zip
Add Locks page to CDOServerBrowser
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerBrowser.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerBrowser.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerBrowser.java
index 76de357421..661ceeb4d9 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerBrowser.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerBrowser.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.lob.CDOLobHandler;
import org.eclipse.emf.cdo.common.lob.CDOLobInfo;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
import org.eclipse.emf.cdo.common.revision.CDOAllRevisionsProvider;
import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -34,8 +35,10 @@ import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.PointerCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.SyntheticCDORevision;
+import org.eclipse.emf.cdo.spi.server.InternalLockManager;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.InternalSession;
+import org.eclipse.emf.cdo.spi.server.InternalView;
import org.eclipse.net4j.util.HexUtil;
import org.eclipse.net4j.util.StringUtil;
@@ -72,6 +75,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
/**
@@ -359,6 +363,7 @@ public class CDOServerBrowser extends Worker
protected void initPages(List<Page> pages)
{
pages.add(new PackagesPage());
+ pages.add(new LocksPage());
pages.add(new RevisionsPage.FromCache());
pages.add(new RevisionsPage.FromStore());
pages.add(new LobsPage());
@@ -662,6 +667,66 @@ public class CDOServerBrowser extends Worker
}
/**
+ * A {@link Page server browser page} that renders the locking manager contents of a repository.
+ *
+ * @author Eike Stepper
+ * @since 4.2
+ */
+ public static class LocksPage extends AbstractPage
+ {
+ public static final String NAME = "locks";
+
+ public LocksPage()
+ {
+ super(NAME, "Locks");
+ }
+
+ public boolean canDisplay(InternalRepository repository)
+ {
+ return true;
+ }
+
+ public void display(CDOServerBrowser browser, InternalRepository repository, PrintStream out)
+ {
+ InternalLockManager lockingManager = repository.getLockingManager();
+ for (InternalSession session : repository.getSessionManager().getSessions())
+ {
+ boolean sessionRendered = false;
+ for (InternalView view : session.getViews())
+ {
+ Map<CDOID, LockGrade> locks = lockingManager.getLocks(view);
+ if (locks != null && !locks.isEmpty())
+ {
+ if (!sessionRendered)
+ {
+ int sessionID = session.getSessionID();
+ String userID = session.getUserID();
+ out.println("<h3>Session&nbsp;" + sessionID + "&nbsp;&nbsp;[" + userID + "]</h3>");
+ out.println("<ul>");
+ sessionRendered = true;
+ }
+
+ out.println("<li>" + view + "</li>");
+ out.println("<ul>");
+
+ for (Entry<CDOID, LockGrade> entry : locks.entrySet())
+ {
+ out.println("<li>" + entry.getKey() + " = " + entry.getValue() + "</li>");
+ }
+
+ out.println("</ul>");
+ }
+
+ if (sessionRendered)
+ {
+ out.println("</ul>");
+ }
+ }
+ }
+ }
+ }
+
+ /**
* A {@link Page server browser page} that renders {@link CDORevision revisions}.
*
* @author Eike Stepper

Back to the top