private void createBeanProvider() { if (beanProvider != null) { beanProvider.removeNotificationListener(this); } beanProvider = new HibernateStatsMBeanProvider(clusterModel, persistenceUnit); beanProvider.addNotificationListener(this); }
private void init() { addMBeanServerDelegateListener(); }
private EhcacheHibernateMBean getBean() { return statsBeanProvider.getBean(); }
public void addNotificationListener(NotificationListener listener) { removeNotificationListener(listener); getBean(); // this smells: force the local notification listener to be added to bean. broadcaster.addNotificationListener(listener, null, null); }
public void setup(final ApplicationContext appContext, final IClusterModel clusterModel, final String persistenceUnit) { this.appContext = appContext; this.clusterModel = clusterModel; this.persistenceUnit = persistenceUnit; this.beanProvider = new HibernateStatsMBeanProvider(clusterModel, persistenceUnit); this.beanProvider.addNotificationListener(this); try { statsBeanObjectName = HibernateStatsUtils.getHibernateStatsBeanName(persistenceUnit); statsBeanPattern = new ObjectName(statsBeanObjectName.getCanonicalName() + ",*"); } catch (Exception e) { throw new RuntimeException(e); } setLayout(new BorderLayout()); add(createRegionTablePanel()); revalidate(); repaint(); clusterModel.addPropertyChangeListener(clusterListener = new ClusterListener(clusterModel)); if (clusterModel.isReady()) { init(); } }
@Override public void tearDown() { if (!tornDown.compareAndSet(false, true)) { return; } beanProvider.removeNotificationListener(this); clusterModel.removePropertyChangeListener(clusterListener); clusterListener.tearDown(); synchronized (this) { appContext = null; clusterModel = null; clusterListener = null; beanProvider = null; mainPanel = null; enableAllRegionsButton = null; disableAllRegionsButton = null; flushButton = null; toggleStatsEnabledButton = null; clearAllStatsButton = null; messagePanel = null; messageLabel = null; } super.tearDown(); } }
public HibernateStatsMBeanProvider(final IClusterModel clusterModel, final String persistenceUnit) { this.clusterModel = clusterModel; this.currBean = nullBean; this.unregisterNotificationListener = new UnRegistrationNotificationListener(); try { templateName = new ObjectName(HibernateStatsUtils.STATS_BEAN_NAME_PREFIX + ",instance=" + persistenceUnit + ",*"); } catch (Exception e) { throw new RuntimeException(e); } clusterModel.addPropertyChangeListener(new ClusterListener(clusterModel)); if (clusterModel.isReady()) { init(); } }
public HibernateStatsMBean getBean() { if (currBean != nullBean) { return currBean; } if (clusterModel.isReady()) { IServer activeCoord = clusterModel.getActiveCoordinator(); try { Set<ObjectName> onSet = activeCoord.queryNames(templateName, null); Iterator<ObjectName> onIter = onSet.iterator(); while (onIter.hasNext()) { ObjectName on = onIter.next(); HibernateStatsMBean statsBean = activeCoord.getMBeanProxy(on, HibernateStatsMBean.class); try { activeCoord.addNotificationListener(on, this); } catch (Exception e) { continue; } setCurrentBeanName(on); return currBean = statsBean; } } catch (IOException ioe) { /**/ } } return currBean = nullBean; }
public void setup(ApplicationContext appContext, IClusterModel clusterModel, String persistenceUnit) { this.appContext = appContext; this.clusterModel = clusterModel; this.persistenceUnit = persistenceUnit; mainPanel = createMainPanel(); messagePanel = createMessagePanel(); beanProvider = new HibernateStatsMBeanProvider(clusterModel, persistenceUnit); clusterModel.addPropertyChangeListener(clusterListener = new ClusterListener(clusterModel)); if (clusterModel.isReady()) { init(); removeAll(); add(mainPanel); } else { add(messagePanel); messageLabel.setText(appContext.getString("cluster.not.ready.msg")); } }
public void setup(final ApplicationContext appContext, final IClusterModel clusterModel, final String persistenceUnit) { this.appContext = appContext; this.clusterModel = clusterModel; this.persistenceUnit = persistenceUnit; this.beanProvider = new HibernateStatsMBeanProvider(clusterModel, persistenceUnit); this.beanProvider.addNotificationListener(this); try { statsBeanObjectName = HibernateStatsUtils.getHibernateStatsBeanName(persistenceUnit); statsBeanPattern = new ObjectName(statsBeanObjectName.getCanonicalName() + ",*"); } catch (Exception e) { throw new RuntimeException(e); } setLayout(new BorderLayout()); add(createRegionTablePanel()); revalidate(); repaint(); clusterModel.addPropertyChangeListener(clusterListener = new ClusterListener(clusterModel)); if (clusterModel.isReady()) { init(); } }
public void addNotificationListener(NotificationListener listener) { removeNotificationListener(listener); getBean(); // this smells: force the local notification listener to be added to bean. broadcaster.addNotificationListener(listener, null, null); }
@Override public void tearDown() { if (!tornDown.compareAndSet(false, true)) { return; } beanProvider.removeNotificationListener(this); clusterModel.removePropertyChangeListener(clusterListener); clusterListener.tearDown(); synchronized (this) { appContext = null; clusterModel = null; clusterListener = null; regionTable = null; regionTableModel.clear(); regionTableModel = null; refreshRegionsButton = null; beanProvider = null; } super.tearDown(); } }
public HibernateStatsMBeanProvider(final IClusterModel clusterModel, final String persistenceUnit) { this.clusterModel = clusterModel; this.currBean = nullBean; this.unregisterNotificationListener = new UnRegistrationNotificationListener(); try { templateName = new ObjectName(HibernateStatsUtils.getHibernateStatsBeanName(persistenceUnit).getCanonicalName() + ",*"); } catch (Exception e) { throw new RuntimeException(e); } clusterModel.addPropertyChangeListener(new ClusterListener(clusterModel)); if (clusterModel.isReady()) { init(); } }
public EhcacheHibernateMBean getBean() { if (currBean != nullBean) { return currBean; } if (clusterModel.isReady()) { IServer activeCoord = clusterModel.getActiveCoordinator(); try { Set<ObjectName> onSet = activeCoord.queryNames(templateName, null); Iterator<ObjectName> onIter = onSet.iterator(); while (onIter.hasNext()) { ObjectName on = onIter.next(); EhcacheHibernateMBean statsBean = activeCoord.getMBeanProxy(on, EhcacheHibernateMBean.class); try { activeCoord.addNotificationListener(on, this); } catch (Exception e) { continue; } setCurrentBeanName(on); return currBean = statsBean; } } catch (IOException ioe) { /**/ } } return currBean = nullBean; }
public void setup(ApplicationContext appContext, IClusterModel clusterModel, String persistenceUnit) { this.appContext = appContext; this.clusterModel = clusterModel; this.persistenceUnit = persistenceUnit; mainPanel = createMainPanel(); messagePanel = createMessagePanel(); beanProvider = new HibernateStatsMBeanProvider(clusterModel, persistenceUnit); clusterModel.addPropertyChangeListener(clusterListener = new ClusterListener(clusterModel)); if (clusterModel.isReady()) { init(); removeAll(); add(mainPanel); } else { add(messagePanel); messageLabel.setText(appContext.getString("cluster.not.ready.msg")); } }
public void setup(final ApplicationContext appContext, final IClusterModel clusterModel, final String persistenceUnit) { this.appContext = appContext; this.clusterModel = clusterModel; this.persistenceUnit = persistenceUnit; this.beanProvider = new HibernateStatsMBeanProvider(clusterModel, persistenceUnit); this.beanProvider.addNotificationListener(this); try { statsBeanObjectName = HibernateStatsUtils.getHibernateStatsBeanName(persistenceUnit); } catch (Exception e) { throw new RuntimeException(e); } setLayout(new BorderLayout()); add(createRegionTablePanel()); revalidate(); repaint(); clusterModel.addPropertyChangeListener(clusterListener = new ClusterListener(clusterModel)); if (clusterModel.isReady()) { init(); } }
private void createBeanProvider() { if (beanProvider != null) { beanProvider.removeNotificationListener(this); } beanProvider = new HibernateStatsMBeanProvider(clusterModel, persistenceUnit); beanProvider.addNotificationListener(this); }
private HibernateStatsMBean getBean() { return statsBeanProvider.getBean(); }
public void addNotificationListener(NotificationListener listener) { removeNotificationListener(listener); getBean(); // this smells: force the local notification listener to be added to bean. broadcaster.addNotificationListener(listener, null, null); }
@Override public void tearDown() { if (!tornDown.compareAndSet(false, true)) { return; } beanProvider.removeNotificationListener(this); clusterModel.removePropertyChangeListener(clusterListener); clusterListener.tearDown(); synchronized (this) { appContext = null; clusterModel = null; clusterListener = null; regionTable = null; regionTableModel.clear(); regionTableModel = null; refreshRegionsButton = null; beanProvider = null; } super.tearDown(); } }