org.weakref.jmx.MBeanExporter Java Examples
The following examples show how to use
org.weakref.jmx.MBeanExporter.
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: CachingFileSystem.java From rubix with Apache License 2.0 | 6 votes |
public static void setLocalBookKeeper(BookKeeperService.Iface bookKeeper, String statsMbeanSuffix) { bookKeeperFactory = new BookKeeperFactory(bookKeeper); if (!Strings.isNullOrEmpty(statsMbeanSuffix)) { String mBeanName = statsMBeanBaseName + "," + statsMbeanSuffix; MBeanExporter exporter = new MBeanExporter(ManagementFactory.getPlatformMBeanServer()); try { if (ManagementFactory.getPlatformMBeanServer().isRegistered(new ObjectName(statsMBeanBaseName))) { exporter.unexport(statsMBeanBaseName); } if (!ManagementFactory.getPlatformMBeanServer().isRegistered(new ObjectName(mBeanName))) { exporter.export(mBeanName, statsMBean); } } catch (MalformedObjectNameException e) { log.error("Could not export stats mbean", e); } } }
Example #2
Source File: BackupModule.java From presto with Apache License 2.0 | 6 votes |
@Provides @Singleton private static Optional<BackupStore> createBackupStore( @Nullable BackupStore store, LifeCycleManager lifeCycleManager, MBeanExporter exporter, RaptorConnectorId connectorId, BackupConfig config) { if (store == null) { return Optional.empty(); } BackupStore proxy = new TimeoutBackupStore( store, connectorId.toString(), config.getTimeout(), config.getTimeoutThreads()); lifeCycleManager.addInstance(proxy); BackupStore managed = new ManagedBackupStore(proxy); exporter.exportWithGeneratedName(managed, BackupStore.class, connectorId.toString()); return Optional.of(managed); }
Example #3
Source File: OptimizerStatsRecorder.java From presto with Apache License 2.0 | 6 votes |
synchronized void export(MBeanExporter exporter) { checkState(mbeanExports.isEmpty(), "MBeans already exported"); for (Map.Entry<Class<?>, OptimizerStats> entry : stats.entrySet()) { verify(!entry.getKey().getSimpleName().isEmpty()); try { mbeanExports.add(exporter.exportWithGeneratedName(entry.getValue(), PlanOptimizer.class, ImmutableMap.<String, String>builder() .put("name", PlanOptimizer.class.getSimpleName()) .put("optimizer", entry.getKey().getSimpleName()) .build())); } catch (RuntimeException e) { throw new RuntimeException(format("Failed to export MBean with name '%s'", getName(entry.getKey())), e); } } }
Example #4
Source File: LocalQueryRunner.java From presto with Apache License 2.0 | 6 votes |
public List<PlanOptimizer> getPlanOptimizers(boolean forceSingleNode) { return new PlanOptimizers( metadata, new TypeAnalyzer(sqlParser, metadata), taskManagerConfig, forceSingleNode, new MBeanExporter(new TestingMBeanServer()), splitManager, pageSourceManager, statsCalculator, costCalculator, estimatedExchangesCostCalculator, new CostComparator(featuresConfig), taskCountEstimator).get(); }
Example #5
Source File: RuleStatsRecorder.java From presto with Apache License 2.0 | 6 votes |
synchronized void export(MBeanExporter exporter) { checkState(mbeanExports.isEmpty(), "MBeans already exported"); for (Map.Entry<Class<?>, RuleStats> entry : stats.entrySet()) { verify(!entry.getKey().getSimpleName().isEmpty()); try { mbeanExports.add(exporter.exportWithGeneratedName(entry.getValue(), IterativeOptimizer.class, ImmutableMap.<String, String>builder() .put("name", IterativeOptimizer.class.getSimpleName()) .put("rule", entry.getKey().getSimpleName()) .build())); } catch (RuntimeException e) { throw new RuntimeException(format("Failed to export MBean with for rule '%s'", entry.getKey().getSimpleName()), e); } } }
Example #6
Source File: RuleStatsRecorder.java From presto with Apache License 2.0 | 5 votes |
synchronized void unexport(MBeanExporter exporter) { for (MBeanExport mbeanExport : mbeanExports) { mbeanExport.unexport(); } mbeanExports.clear(); }
Example #7
Source File: DriftClientBinder.java From drift with Apache License 2.0 | 5 votes |
@Override public void configure(Binder binder) { newSetBinder(binder, ExceptionClassifier.class); newOptionalBinder(binder, MBeanExporter.class); newOptionalBinder(binder, MethodInvocationStatsFactory.class) .setDefault() .toProvider(DefaultMethodInvocationStatsFactoryProvider.class) .in(Scopes.SINGLETON); }
Example #8
Source File: DriftServerBinder.java From drift with Apache License 2.0 | 5 votes |
@Override public void configure(Binder binder) { binder.bind(DriftServer.class).in(SINGLETON); newSetBinder(binder, DriftService.class); newSetBinder(binder, MethodInvocationFilter.class); newOptionalBinder(binder, MBeanExporter.class); newOptionalBinder(binder, MethodInvocationStatsFactory.class) .setDefault() .toProvider(DefaultMethodInvocationStatsFactoryProvider.class) .in(SINGLETON); }
Example #9
Source File: AbstractTestQueryFramework.java From presto with Apache License 2.0 | 5 votes |
private QueryExplainer getQueryExplainer() { Metadata metadata = queryRunner.getMetadata(); FeaturesConfig featuresConfig = new FeaturesConfig().setOptimizeHashGeneration(true); boolean forceSingleNode = queryRunner.getNodeCount() == 1; TaskCountEstimator taskCountEstimator = new TaskCountEstimator(queryRunner::getNodeCount); CostCalculator costCalculator = new CostCalculatorUsingExchanges(taskCountEstimator); List<PlanOptimizer> optimizers = new PlanOptimizers( metadata, new TypeAnalyzer(sqlParser, metadata), new TaskManagerConfig(), forceSingleNode, new MBeanExporter(new TestingMBeanServer()), queryRunner.getSplitManager(), queryRunner.getPageSourceManager(), queryRunner.getStatsCalculator(), costCalculator, new CostCalculatorWithEstimatedExchanges(costCalculator, taskCountEstimator), new CostComparator(featuresConfig), taskCountEstimator).get(); return new QueryExplainer( optimizers, new PlanFragmenter(metadata, queryRunner.getNodePartitioningManager(), new QueryManagerConfig()), metadata, queryRunner.getAccessControl(), sqlParser, queryRunner.getStatsCalculator(), costCalculator, ImmutableMap.of()); }
Example #10
Source File: PlanOptimizers.java From presto with Apache License 2.0 | 5 votes |
@Inject public PlanOptimizers( Metadata metadata, TypeAnalyzer typeAnalyzer, TaskManagerConfig taskManagerConfig, MBeanExporter exporter, SplitManager splitManager, PageSourceManager pageSourceManager, StatsCalculator statsCalculator, CostCalculator costCalculator, @EstimatedExchanges CostCalculator estimatedExchangesCostCalculator, CostComparator costComparator, TaskCountEstimator taskCountEstimator) { this(metadata, typeAnalyzer, taskManagerConfig, false, exporter, splitManager, pageSourceManager, statsCalculator, costCalculator, estimatedExchangesCostCalculator, costComparator, taskCountEstimator); }
Example #11
Source File: OptimizerStatsRecorder.java From presto with Apache License 2.0 | 5 votes |
synchronized void unexport(MBeanExporter exporter) { for (MBeanExport mbeanExport : mbeanExports) { mbeanExport.unexport(); } mbeanExports.clear(); }
Example #12
Source File: NodeSchedulerExporter.java From presto with Apache License 2.0 | 5 votes |
@Inject public NodeSchedulerExporter(TopologyAwareNodeSelectorFactory nodeSelectorFactory, MBeanExporter exporter) { requireNonNull(nodeSelectorFactory, "nodeSelectorFactory is null"); requireNonNull(exporter, "exporter is null"); for (Map.Entry<String, CounterStat> entry : nodeSelectorFactory.getPlacementCountersByName().entrySet()) { try { mbeanExports.add(exporter.exportWithGeneratedName(entry.getValue(), NodeScheduler.class, ImmutableMap.of("segment", entry.getKey()))); } catch (JmxException e) { // ignored } } }
Example #13
Source File: InternalResourceGroupManager.java From presto with Apache License 2.0 | 5 votes |
@Inject public InternalResourceGroupManager(LegacyResourceGroupConfigurationManager legacyManager, ClusterMemoryPoolManager memoryPoolManager, NodeInfo nodeInfo, MBeanExporter exporter) { this.exporter = requireNonNull(exporter, "exporter is null"); this.configurationManagerContext = new ResourceGroupConfigurationManagerContextInstance(memoryPoolManager, nodeInfo.getEnvironment()); this.legacyManager = requireNonNull(legacyManager, "legacyManager is null"); this.configurationManager = new AtomicReference<>(cast(legacyManager)); }
Example #14
Source File: LocalMemoryManagerExporter.java From presto with Apache License 2.0 | 5 votes |
@Inject public LocalMemoryManagerExporter(LocalMemoryManager memoryManager, MBeanExporter exporter) { this.exporter = requireNonNull(exporter, "exporter is null"); for (MemoryPool pool : memoryManager.getPools()) { addPool(pool); } }
Example #15
Source File: ClusterMemoryManager.java From presto with Apache License 2.0 | 5 votes |
@Inject public ClusterMemoryManager( @ForMemoryManager HttpClient httpClient, InternalNodeManager nodeManager, LocationFactory locationFactory, MBeanExporter exporter, JsonCodec<MemoryInfo> memoryInfoCodec, JsonCodec<MemoryPoolAssignmentsRequest> assignmentsRequestJsonCodec, QueryIdGenerator queryIdGenerator, LowMemoryKiller lowMemoryKiller, ServerConfig serverConfig, MemoryManagerConfig config, NodeMemoryConfig nodeMemoryConfig, NodeSchedulerConfig schedulerConfig) { requireNonNull(config, "config is null"); requireNonNull(nodeMemoryConfig, "nodeMemoryConfig is null"); requireNonNull(serverConfig, "serverConfig is null"); requireNonNull(schedulerConfig, "schedulerConfig is null"); checkState(serverConfig.isCoordinator(), "ClusterMemoryManager must not be bound on worker"); this.nodeManager = requireNonNull(nodeManager, "nodeManager is null"); this.locationFactory = requireNonNull(locationFactory, "locationFactory is null"); this.httpClient = requireNonNull(httpClient, "httpClient is null"); this.exporter = requireNonNull(exporter, "exporter is null"); this.memoryInfoCodec = requireNonNull(memoryInfoCodec, "memoryInfoCodec is null"); this.assignmentsRequestJsonCodec = requireNonNull(assignmentsRequestJsonCodec, "assignmentsRequestJsonCodec is null"); this.lowMemoryKiller = requireNonNull(lowMemoryKiller, "lowMemoryKiller is null"); this.maxQueryMemory = config.getMaxQueryMemory(); this.maxQueryTotalMemory = config.getMaxQueryTotalMemory(); this.coordinatorId = queryIdGenerator.getCoordinatorId(); this.killOnOutOfMemoryDelay = config.getKillOnOutOfMemoryDelay(); this.isWorkScheduledOnCoordinator = schedulerConfig.isIncludeCoordinator(); verify(maxQueryMemory.toBytes() <= maxQueryTotalMemory.toBytes(), "maxQueryMemory cannot be greater than maxQueryTotalMemory"); this.pools = createClusterMemoryPools(!nodeMemoryConfig.isReservedPoolDisabled()); }
Example #16
Source File: DriftServerBinder.java From drift with Apache License 2.0 | 4 votes |
@Inject public DefaultMethodInvocationStatsFactoryProvider(Optional<MBeanExporter> mbeanExporter) { this.mbeanExporter = mbeanExporter; }
Example #17
Source File: JmxMethodInvocationStatsFactory.java From drift with Apache License 2.0 | 4 votes |
@Inject public JmxMethodInvocationStatsFactory(MBeanExporter exporter) { this.exporter = requireNonNull(exporter, "exporter is null"); }
Example #18
Source File: DriftClientBinder.java From drift with Apache License 2.0 | 4 votes |
@Inject public DefaultMethodInvocationStatsFactoryProvider(Optional<MBeanExporter> mbeanExporter) { this.mbeanExporter = mbeanExporter; }
Example #19
Source File: JmxMethodInvocationStatsFactory.java From drift with Apache License 2.0 | 4 votes |
@Inject public JmxMethodInvocationStatsFactory(MBeanExporter exporter) { this.exporter = requireNonNull(exporter, "exporter is null"); }