Java Code Examples for org.apache.hadoop.metrics2.util.MBeans#unregister()

The following examples show how to use org.apache.hadoop.metrics2.util.MBeans#unregister() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SCMPipelineManager.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
@Override
public void close() throws IOException {
  if (scheduler != null) {
    scheduler.close();
    scheduler = null;
  }

  if(pmInfoBean != null) {
    MBeans.unregister(this.pmInfoBean);
    pmInfoBean = null;
  }

  SCMPipelineMetrics.unRegister();

  // shutdown pipeline provider.
  pipelineFactory.shutdown();
}
 
Example 2
Source File: MetricsSystemImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized boolean shutdown() {
  LOG.debug("refCount="+ refCount);
  if (refCount <= 0) {
    LOG.debug("Redundant shutdown", new Throwable());
    return true; // already shutdown
  }
  if (--refCount > 0) return false;
  if (monitoring) {
    try { stop(); }
    catch (Exception e) {
      LOG.warn("Error stopping the metrics system", e);
    }
  }
  allSources.clear();
  allSinks.clear();
  callbacks.clear();
  namedCallbacks.clear();
  if (mbeanName != null) {
    MBeans.unregister(mbeanName);
    mbeanName = null;
  }
  LOG.info(prefix +" metrics system shutdown complete.");
  return true;
}
 
Example 3
Source File: JournalNode.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Stop the daemon with the given status code
 * @param rc the status code with which to exit (non-zero
 * should indicate an error)
 */
public void stop(int rc) {
  this.resultCode = rc;
  
  if (rpcServer != null) { 
    rpcServer.stop();
  }

  if (httpServer != null) {
    try {
      httpServer.stop();
    } catch (IOException ioe) {
      LOG.warn("Unable to stop HTTP server for " + this, ioe);
    }
  }
  
  for (Journal j : journalsById.values()) {
    IOUtils.cleanup(LOG, j);
  }

  if (journalNodeInfoBeanName != null) {
    MBeans.unregister(journalNodeInfoBeanName);
    journalNodeInfoBeanName = null;
  }
}
 
Example 4
Source File: MetricsSystemImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized boolean shutdown() {
  LOG.debug("refCount="+ refCount);
  if (refCount <= 0) {
    LOG.debug("Redundant shutdown", new Throwable());
    return true; // already shutdown
  }
  if (--refCount > 0) return false;
  if (monitoring) {
    try { stop(); }
    catch (Exception e) {
      LOG.warn("Error stopping the metrics system", e);
    }
  }
  allSources.clear();
  allSinks.clear();
  callbacks.clear();
  namedCallbacks.clear();
  if (mbeanName != null) {
    MBeans.unregister(mbeanName);
    mbeanName = null;
  }
  LOG.info(prefix +" metrics system shutdown complete.");
  return true;
}
 
Example 5
Source File: RDBStore.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
@Override
public void close() throws IOException {

  for (final ColumnFamilyHandle handle : handleTable.values()) {
    handle.close();
  }

  if (statMBeanName != null) {
    MBeans.unregister(statMBeanName);
    statMBeanName = null;
  }

  RDBMetrics.unRegister();
  if (db != null) {
    db.close();
  }

  if (dbOptions != null) {
    dbOptions.close();
  }

  if (writeOptions != null) {
    writeOptions.close();
  }
}
 
Example 6
Source File: FsDatasetImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override // FsDatasetSpi
public void shutdown() {
  fsRunning = false;

  ((LazyWriter) lazyWriter.getRunnable()).stop();
  lazyWriter.interrupt();

  if (mbeanName != null) {
    MBeans.unregister(mbeanName);
  }
  
  if (asyncDiskService != null) {
    asyncDiskService.shutdown();
  }

  if (asyncLazyPersistService != null) {
    asyncLazyPersistService.shutdown();
  }
  
  if(volumes != null) {
    volumes.shutdown();
  }

  try {
    lazyWriter.join();
  } catch (InterruptedException ie) {
    LOG.warn("FsDatasetImpl.shutdown ignoring InterruptedException " +
             "from LazyWriter.join");
  }
}
 
Example 7
Source File: SCMConnectionManager.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@Override
public void close() throws IOException {
  getValues().forEach(endpointStateMachine
      -> IOUtils.cleanupWithLogger(LOG, endpointStateMachine));
  if (jmxBean != null) {
    MBeans.unregister(jmxBean);
    jmxBean = null;
  }
}
 
Example 8
Source File: NameNode.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Stop all NameNode threads and wait for all to finish.
 */
public void stop() {
  synchronized(this) {
    if (stopRequested)
      return;
    stopRequested = true;
  }
  try {
    if (state != null) {
      state.exitState(haContext);
    }
  } catch (ServiceFailedException e) {
    LOG.warn("Encountered exception while exiting state ", e);
  } finally {
    stopCommonServices();
    if (metrics != null) {
      metrics.shutdown();
    }
    if (namesystem != null) {
      namesystem.shutdown();
    }
    if (nameNodeStatusBeanName != null) {
      MBeans.unregister(nameNodeStatusBeanName);
      nameNodeStatusBeanName = null;
    }
    if (this.spanReceiverHost != null) {
      this.spanReceiverHost.closeReceivers();
    }
  }
}
 
Example 9
Source File: FsDatasetImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override // FsDatasetSpi
public void shutdown() {
  fsRunning = false;

  ((LazyWriter) lazyWriter.getRunnable()).stop();
  lazyWriter.interrupt();

  if (mbeanName != null) {
    MBeans.unregister(mbeanName);
  }
  
  if (asyncDiskService != null) {
    asyncDiskService.shutdown();
  }

  if (asyncLazyPersistService != null) {
    asyncLazyPersistService.shutdown();
  }
  
  if(volumes != null) {
    volumes.shutdown();
  }

  try {
    lazyWriter.join();
  } catch (InterruptedException ie) {
    LOG.warn("FsDatasetImpl.shutdown ignoring InterruptedException " +
             "from LazyWriter.join");
  }
}
 
Example 10
Source File: NameNode.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Stop all NameNode threads and wait for all to finish.
 */
public void stop() {
  synchronized(this) {
    if (stopRequested)
      return;
    stopRequested = true;
  }
  try {
    if (state != null) {
      state.exitState(haContext);
    }
  } catch (ServiceFailedException e) {
    LOG.warn("Encountered exception while exiting state ", e);
  } finally {
    stopCommonServices();
    if (metrics != null) {
      metrics.shutdown();
    }
    if (namesystem != null) {
      namesystem.shutdown();
    }
    if (nameNodeStatusBeanName != null) {
      MBeans.unregister(nameNodeStatusBeanName);
      nameNodeStatusBeanName = null;
    }
    if (this.spanReceiverHost != null) {
      this.spanReceiverHost.closeReceivers();
    }
  }
}
 
Example 11
Source File: BlockManagerImpl.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
/**
 * Close the resources for BlockManager.
 *
 * @throws IOException
 */
@Override
public void close() throws IOException {
  if (deletedBlockLog != null) {
    deletedBlockLog.close();
  }
  blockDeletingService.shutdown();
  if (mxBean != null) {
    MBeans.unregister(mxBean);
    mxBean = null;
  }
}
 
Example 12
Source File: OzoneManager.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
private void unregisterMXBean() {
  if (this.omInfoBeanName != null) {
    MBeans.unregister(this.omInfoBeanName);
    this.omInfoBeanName = null;
  }
}
 
Example 13
Source File: SimulatedFSDataset.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void shutdown() {
  if (mbeanName != null) MBeans.unregister(mbeanName);
}
 
Example 14
Source File: MetricsSourceAdapter.java    From big-c with Apache License 2.0 4 votes vote down vote up
synchronized void stopMBeans() {
  if (mbeanName != null) {
    MBeans.unregister(mbeanName);
    mbeanName = null;
  }
}
 
Example 15
Source File: SCMNodeManager.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
private void unregisterMXBean() {
  if (this.nmInfoBean != null) {
    MBeans.unregister(this.nmInfoBean);
    this.nmInfoBean = null;
  }
}
 
Example 16
Source File: SimulatedFSDataset.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public void shutdown() {
  if (mbeanName != null) MBeans.unregister(mbeanName);
}
 
Example 17
Source File: MetricsSourceAdapter.java    From hadoop with Apache License 2.0 4 votes vote down vote up
synchronized void stopMBeans() {
  if (mbeanName != null) {
    MBeans.unregister(mbeanName);
    mbeanName = null;
  }
}
 
Example 18
Source File: ReplicationActivityStatus.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
@Override
public void close() throws IOException {
  if (this.jmxObjectName != null) {
    MBeans.unregister(jmxObjectName);
  }
}
 
Example 19
Source File: StorageContainerManager.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
private void unregisterMXBean() {
  if (this.scmInfoBeanName != null) {
    MBeans.unregister(this.scmInfoBeanName);
    this.scmInfoBeanName = null;
  }
}
 
Example 20
Source File: SnapshotManager.java    From big-c with Apache License 2.0 4 votes vote down vote up
public void shutdown() {
  MBeans.unregister(mxBeanName);
  mxBeanName = null;
}