import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
+import eu.etaxonomy.taxeditor.session.NullSession;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
Collection<ICdmEntitySession> sessions = cdmEntitySessionManager.getSessions();
txtNoOfSessions.setText(String.valueOf(sessions.size()));
for(ICdmEntitySession session : sessions) {
- if(session.getOwner() != null) {
- TableItem item = new TableItem(tableSessions, SWT.NULL);
- item.setText(session.getOwner().toString());
- String activePrefix = "";
- if(session.isActive()) {
- activePrefix = "*";
- }
- item.setText(0, activePrefix + session.getOwner().toString());
- LiveCacheStatistics cacheStatistics = session.getCacheStatistics();
- item.setText(1, getInMemoryStats(cacheStatistics));
- item.setText(2, getOnDiskStats(cacheStatistics));
- }
+ addSession(session);
+ }
+ ICdmEntitySession nullSession = cdmEntitySessionManager.getNullSession();
+ if(nullSession != null) {
+ addSession(nullSession);
}
for (int i=0; i<titles.length; i++) {
tableSessions.getColumn (i).pack ();
}
+ private void addSession(ICdmEntitySession session) {
+
+ TableItem item = new TableItem(tableSessions, SWT.NULL);
+
+ String activePrefix = "";
+ if(session.isActive()) {
+ activePrefix = "*";
+ }
+ String sessionOwnerString = "";
+ if(session instanceof NullSession) {
+ sessionOwnerString = "Null Session";
+ } else {
+ if(session.getOwner() != null) {
+ sessionOwnerString = session.getOwner().toString();
+ }
+ }
+ item.setText(0, activePrefix + sessionOwnerString);
+ LiveCacheStatistics cacheStatistics = session.getCacheStatistics();
+ item.setText(1, getInMemoryStats(cacheStatistics));
+ item.setText(2, getOnDiskStats(cacheStatistics));
+ }
+
private String getInMemoryStats(LiveCacheStatistics statistics) {
if(statistics != null) {
long localHeapSize = statistics.getLocalHeapSize();