public void setAttributes(Map<String, Object> attrs) { this.enabled = booleanAttr(attrs, "Enabled"); this.loggingEnabled = booleanAttr(attrs, "LoggingEnabled"); this.tti = integerAttr(attrs, "MaxTTISeconds"); this.ttl = integerAttr(attrs, "MaxTTLSeconds"); this.targetMaxTotalCount = integerAttr(attrs, "TargetMaxTotalCount"); this.targetMaxInMemoryCount = integerAttr(attrs, "TargetMaxInMemoryCount"); }
public void setTargetMaxInMemoryCount(int targetMaxInMemoryCount) { int oldVal = getTargetMaxTotalCount(); synchronized (this) { this.targetMaxInMemoryCount = targetMaxInMemoryCount; if (oldVal != targetMaxInMemoryCount) { getBean().setRegionCacheTargetMaxInMemoryCount(regionName, targetMaxInMemoryCount); } } firePropertyChange(TARGET_MAX_IN_MEMORY_COUNT_PROP, oldVal, targetMaxInMemoryCount); }
public Boolean call() throws Exception { boolean currState = regionInfo.isEnabled(); regionInfo.setEnabled(!currState); if (currState && flushRegion) { regionInfo.flush(); } return regionInfo.isEnabled(); } });
void _setEnabled(boolean enabled_foo) { boolean oldEnabled = isEnabled(); synchronized (this) { this.enabled = enabled_foo; } firePropertyChange(ENABLED_PROP, oldEnabled, enabled_foo); }
public void setCacheRegion(final CacheRegionInfo regionInfo) { if ((this.regionInfo = regionInfo) != null) { titledBorder.setTitle(regionInfo.getRegionName()); tti.getModel().setValue(regionInfo.getTTI()); ttl.getModel().setValue(regionInfo.getTTL()); targetMaxTotalCount.getModel().setValue(regionInfo.getTargetMaxTotalCount()); targetMaxInMemoryCount.getModel().setValue(regionInfo.getTargetMaxInMemoryCount()); loggingToggle.setSelected(regionInfo.isLoggingEnabled()); enablementButton.setText(bundle.getString(regionInfo.isEnabled() ? "disable.region" : "enable.region")); revalidate(); repaint(); } }
public void setTTL(int seconds) { int oldTTL = getTTL(); synchronized (this) { this.ttl = seconds; if (oldTTL != ttl) { getBean().setRegionCacheMaxTTLSeconds(regionName, seconds); } } firePropertyChange(TTL_PROP, oldTTL, ttl); }
public void setTTI(int seconds) { int oldTTI = getTTI(); synchronized (this) { this.tti = seconds; if (oldTTI != tti) { getBean().setRegionCacheMaxTTISeconds(regionName, seconds); } } firePropertyChange(TTI_PROP, oldTTI, tti); }
public void setEnabled(boolean enabled) { boolean oldEnabled = isEnabled(); synchronized (this) { this.enabled = enabled; if (oldEnabled != enabled) { getBean().setRegionCacheEnabled(regionName, enabled); } } firePropertyChange(ENABLED_PROP, oldEnabled, enabled); }
public void setLoggingEnabled(boolean enabled) { boolean oldLoggingEnabled = isLoggingEnabled(); synchronized (this) { this.loggingEnabled = enabled; if (oldLoggingEnabled != loggingEnabled) { getBean().setRegionCacheLoggingEnabled(regionName, enabled); } } firePropertyChange(LOGGING_ENABLED_PROP, oldLoggingEnabled, loggingEnabled); }
private void queryToggleRegionEnabled() { String currLabel = enablementButton.getText(); String msgKey = regionInfo.isEnabled() ? "disable.region.confirm" : "enable.region.confirm"; XLabel msg = new XLabel(MessageFormat.format(bundle.getString(msgKey), regionInfo.getRegionName())); Frame frame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, this); int answer = JOptionPane.showConfirmDialog(this.getParent(), msg, frame.getTitle(), JOptionPane.OK_CANCEL_OPTION); if (answer == JOptionPane.OK_OPTION) { appContext.submit(new ToggleEnabledWorker()); } else { enablementButton.setText(currLabel); enablementButton.setSelected(false); enablementButton.setEnabled(true); } }
public void handleNotification(Notification notif, Object handBack) { if (tornDown.get()) { return; } String type = notif.getType(); String msg = notif.getMessage(); Object userData = notif.getUserData(); if (EhcacheStats.CACHE_ENABLED.equals(type)) { boolean enabled = (Boolean) userData; Iterator<CacheRegionInfo> iter = regionInfoMap.values().iterator(); while (iter.hasNext()) { iter.next()._setEnabled(enabled); } tableModel.fireTableRowsUpdated(0, tableModel.getRowCount() - 1); detailPanel.updateRegion(); updateSummaryLabel(determineClusteredRegionCount()); } else if (EhcacheStats.CACHE_REGION_CHANGED.equals(type)) { CacheRegionInfo regionInfo = regionInfoMap.get(msg); if (regionInfo != null) { regionInfo.setAttributes((Map<String, Object>) userData); int row = tableModel.getObjectIndex(regionInfo); tableModel.fireTableRowsUpdated(row, row); if (table.isRowSelected(row)) { detailPanel.setCacheRegion(regionInfo); } updateSummaryLabel(determineClusteredRegionCount()); } } }
public Map<String, CacheRegionInfo> call() throws Exception { Map<String, CacheRegionInfo> result = new LinkedHashMap<String, CacheRegionInfo>(); IServer activeCoord = clusterModel.getActiveCoordinator(); ObjectName tmpl = HibernateStatsUtils.getHibernateStatsBeanName(persistenceUnit + ",*"); Set<ObjectName> onSet = activeCoord.queryNames(tmpl, null); Iterator<ObjectName> onIter = onSet.iterator(); createBeanProvider(); while (onIter.hasNext()) { EhcacheHibernateMBean statsBean = activeCoord.getMBeanProxy(onIter.next(), EhcacheHibernateMBean.class); if (result.size() == 0) { Map<String, Map<String, Object>> regionAttrs = statsBean.getRegionCacheAttributes(); Iterator<String> regionNameIter = regionAttrs.keySet().iterator(); while (regionNameIter.hasNext()) { String regionName = regionNameIter.next(); if (!regionName.endsWith("org.hibernate.cache.UpdateTimestampsCache")) { CacheRegionInfo regionInfo = new CacheRegionInfo(regionName, regionAttrs.get(regionName), beanProvider); result.put(regionName, regionInfo); regionInfo.addPropertyChangeListener(CacheRegionsPanel.this); } } } } return result; } });
public void clearStats() { getBean().clearStats(); }
public Void call() throws Exception { regionInfo.flush(); return null; } });
private void queryFlushRegion() { XLabel msg = new XLabel(MessageFormat.format(bundle.getString("evict.all.entries.in.region.confirm"), regionInfo .getRegionName())); Frame frame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, this); int answer = JOptionPane.showConfirmDialog(this.getParent(), msg, frame.getTitle(), JOptionPane.OK_CANCEL_OPTION); if (answer == JOptionPane.OK_OPTION) { appContext.submit(new FlushRegionWorker()); } else { flushButton.setSelected(false); flushButton.setEnabled(true); } }
public void setCacheRegion(final CacheRegionInfo regionInfo) { if ((this.regionInfo = regionInfo) != null) { titledBorder.setTitle(regionInfo.getRegionName()); tti.getModel().setValue(regionInfo.getTTI()); ttl.getModel().setValue(regionInfo.getTTL()); targetMaxTotalCount.getModel().setValue(regionInfo.getTargetMaxTotalCount()); targetMaxInMemoryCount.getModel().setValue(regionInfo.getTargetMaxInMemoryCount()); loggingToggle.setSelected(regionInfo.isLoggingEnabled()); enablementButton.setText(bundle.getString(regionInfo.isEnabled() ? "disable.region" : "enable.region")); revalidate(); repaint(); } }
public void setTTL(int seconds) { int oldTTL = getTTL(); synchronized (this) { this.ttl = seconds; if (oldTTL != ttl) { getBean().setRegionCacheMaxTTLSeconds(regionName, seconds); } } firePropertyChange(TTL_PROP, oldTTL, ttl); }
public void setTTI(int seconds) { int oldTTI = getTTI(); synchronized (this) { this.tti = seconds; if (oldTTI != tti) { getBean().setRegionCacheMaxTTISeconds(regionName, seconds); } } firePropertyChange(TTI_PROP, oldTTI, tti); }
public void setEnabled(boolean enabled) { boolean oldEnabled = isEnabled(); synchronized (this) { this.enabled = enabled; if (oldEnabled != enabled) { getBean().setRegionCacheEnabled(regionName, enabled); } } firePropertyChange(ENABLED_PROP, oldEnabled, enabled); }
public void setLoggingEnabled(boolean enabled) { boolean oldLoggingEnabled = isLoggingEnabled(); synchronized (this) { this.loggingEnabled = enabled; if (oldLoggingEnabled != loggingEnabled) { getBean().setRegionCacheLoggingEnabled(regionName, enabled); } } firePropertyChange(LOGGING_ENABLED_PROP, oldLoggingEnabled, loggingEnabled); }