public void unregisterMBean() { try { if (registered) { LOG.info("Unregistering MBean {}", name); ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(name)); timer.stop(); } this.registered = false; } catch (Exception e) { LOG.warn("Exception:", e); } }
public void enablePolicyExecution(boolean aEnable) { if(!isTimerRunning && aEnable) { isTimerRunning = true; mTimer.start(); } if(isTimerRunning && !aEnable) { isTimerRunning = false; mTimer.stop(); } }
public synchronized void stopUpdates() { if (timerStarted) { try { timer.removeNotifications("tickTimer"); this.timerStarted = false; } catch (InstanceNotFoundException ex) { } timer.stop(); } }
private synchronized void manageTimer() { if (!timer.isActive()) { if ((perfTimerStarted && perfTimerListeners > 0) || (structuralTimerStarted && structuralTimerListeners > 0)) timer.start(); } else { if ((!perfTimerStarted || perfTimerListeners == 0) && (!structuralTimerStarted || structuralTimerListeners == 0)) timer.stop(); } }
private synchronized void manageTimer() { if (!timer.isActive()) { if ((perfTimerStarted && perfTimerListeners > 0) || (structuralTimerStarted && structuralTimerListeners > 0)) timer.start(); } else { if ((!perfTimerStarted || perfTimerListeners == 0) && (!structuralTimerStarted || structuralTimerListeners == 0)) timer.stop(); } }
@Override public void handleNotification(Notification notification, Object handback) { final ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); int tCount = mbean.getThreadCount(); int dCount = mbean.getDaemonThreadCount(); if (tCount - dCount <= 2) { boolean stop = true; Thread[] ts; for (;;) { ts = new Thread[mbean.getThreadCount() + 3]; if (Thread.enumerate(ts) < ts.length) break; } for (Thread t : ts) { if(t == null) break; if (t.isDaemon() || t == Thread.currentThread()) continue; if (!t.getName().equals("DestroyJavaVM")) stop = false; } if (stop) timer.stop(); } } }, new NotificationFilter() {
public void unRegisterTimerService(){ mTargetCheckTimer.stop(); unHookFromTimerService(); try{ if ( mMBeanServer.isRegistered(mTargetCheckTimerObjectName) ) { mMBeanServer.unregisterMBean(mTargetCheckTimerObjectName); } }catch(Exception e){ String bundleKey = "caps.management.server.alert.instance.check.timer.shutdown.error.log.msg"; String message = AlertUtil.constructLogMessage(bundleKey); mLogger.log(Level.WARNING, message, e); } }
public void unRegisterTimerService(){ if(!mPlatformContext.isAdminServer()) { return; // not init. on instances therefore not need to unregister. } else { if(((MBeanServer) mMBeanServer).isRegistered(mTimerObjectName)== false) { return; // was already unreg. on the DAS } } mTimer.stop(); unHookFromTimerService(); synchronized(mShutdownInProgress) { mShutdownInProgress = true; } try{ ObjectName name = new ObjectName(EventManagementConstants.EVENT_MANAGEMENT_REMOVAL_POLICY_TIMER_MBEAN_NAME); if ( mMBeanServer.isRegistered(name) ) { mMBeanServer.unregisterMBean(name); } }catch(Exception e){ String bundleKey = "caps.management.server.alert.persistence.removal.policy.shutdown.error.log.msg"; String message = AlertUtil.constructLogMessage(bundleKey); mLogger.log(Level.WARNING, message, e); } }
} else if(aAttribute.getName().equals(TARGET_CHECK_INTERVAL_ATTRIBUTE_NAME) == true) { mTargetCheckInterval = (Long)aAttribute.getValue(); mTargetCheckTimer.stop(); unHookFromTimerService(); hookUpToTimerService(mTargetCheckInterval);
public void UpdatePolicyExecutionInterval(Long aNewInterval) { if(isTimerRunning) { mTimer.stop(); unHookFromTimerService(); hookUpToTimerService(aNewInterval); mTimer.start(); } else { unHookFromTimerService(); hookUpToTimerService(aNewInterval); } }
this.mTargetCheckTimer.stop(); updateTargetsIfNeeded(); this.mTargetCheckTimer.start();