当前位置: 首页>>代码示例>>Java>>正文


Java InstanceAlreadyExistsException类代码示例

本文整理汇总了Java中javax.management.InstanceAlreadyExistsException的典型用法代码示例。如果您正苦于以下问题:Java InstanceAlreadyExistsException类的具体用法?Java InstanceAlreadyExistsException怎么用?Java InstanceAlreadyExistsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InstanceAlreadyExistsException类属于javax.management包,在下文中一共展示了InstanceAlreadyExistsException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReusingOldInstance

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
@Test
public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException,
        ValidationException {

    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createInstance(transaction, instanceName);

    transaction.commit();

    transaction = configRegistryClient.createTransaction();
    assertBeanCount(1, factory.getImplementationName());
    CommitStatus status = transaction.commit();

    assertBeanCount(1, factory.getImplementationName());
    assertStatus(status, 0, 0, 1);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ImmediateEventExecutorModuleTest.java

示例2: registerMBean

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
public static void registerMBean(final String mBeanObjectName,final Object mBean)
{
   try
   {
      final ObjectName name = new ObjectName(mBeanObjectName);
      mbs.registerMBean(mBean, name);
   }
   catch (MalformedObjectNameException badObjectName)
   {
 	  logger.error(badObjectName.getMessage());
   }
   catch (InstanceAlreadyExistsException duplicateMBeanInstance)
   {
 	  logger.error(duplicateMBeanInstance.getMessage());
   }
   catch (MBeanRegistrationException mbeanRegistrationProblem)
   {
 	  logger.error(mbeanRegistrationProblem.getMessage());
   }
   catch (NotCompliantMBeanException badMBean)
   {
 	  logger.error(badMBean.getMessage());
   }
}
 
开发者ID:vaimee,项目名称:sepatools,代码行数:25,代码来源:SEPABeans.java

示例3: init

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
public boolean init() throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, FileNotFoundException, NoSuchElementException, IOException {			
	//Initialize SPARQL 1.1 processing service properties
	endpointProperties = new SPARQL11Properties("endpoint.jpar");
	
	//Initialize SPARQL 1.1 SE processing service properties
	engineProperties = new EngineProperties("engine.jpar");
	
	//SPARQL 1.1 SE request processor
	processor = new Processor(endpointProperties);
	
	//SPARQL 1.1 SE request scheduler
	scheduler = new Scheduler(engineProperties,processor);
	
	//SPARQL 1.1 Protocol handlers
	httpGate = new HTTPGate(engineProperties,scheduler);
	httpsGate = new HTTPSGate(engineProperties,scheduler,am);
	
	//SPARQL 1.1 SE Protocol handler for WebSocket based subscriptions
	websocketApp = new WSGate(engineProperties,scheduler);
	secureWebsocketApp = new WSSGate(engineProperties,scheduler,am);
	        
       return true;
}
 
开发者ID:vaimee,项目名称:sepatools,代码行数:24,代码来源:Engine.java

示例4: registerAll

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
public synchronized void registerAll() throws InstanceNotFoundException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
	Iterator<RegisteredMBean> iter1 = unregisteredMBeans.iterator();
	while (iter1.hasNext()) {
		RegisteredMBean mBean = iter1.next();
		mBean.register();
		iter1.remove();
		mBeans.add(mBean);
	}
	Iterator<RegisteredListener> iter2 = unregisteredListeners.iterator();
	while (iter2.hasNext()) {
		RegisteredListener listener = iter2.next();
		listener.register();
		iter2.remove();
		if (listener instanceof Listener1) {
			listeners1.add((Listener1) listener);
		} else {
			listeners2.add((Listener2) listener);
		}
	}
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:21,代码来源:PogamutMBeanServer.java

示例5: register

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
@Override
public HierarchicalRuntimeBeanRegistrationImpl register(final String key,
        final String value, final RuntimeBean mxBean) {
    Map<String, String> currentProperties = new HashMap<>(properties);
    currentProperties.put(key, value);
    ObjectName on = ObjectNameUtil.createRuntimeBeanName(
            moduleIdentifier.getFactoryName(),
            moduleIdentifier.getInstanceName(), currentProperties);
    InternalJMXRegistrator child = internalJMXRegistrator.createChild();
    try {
        child.registerMBean(mxBean, on);
    } catch (final InstanceAlreadyExistsException e) {
        throw RootRuntimeBeanRegistratorImpl.sanitize(e, moduleIdentifier,
                on);
    }
    return new HierarchicalRuntimeBeanRegistrationImpl(moduleIdentifier,
            child, currentProperties);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:HierarchicalRuntimeBeanRegistrationImpl.java

示例6: registerMBean

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
/**
 * Register the MBean using our standard MBeanName format
 * "hadoop:service=<serviceName>,name=<nameName>"
 * Where the <serviceName> and <nameName> are the supplied parameters
 *    
 * @param serviceName
 * @param nameName
 * @param theMbean - the MBean to register
 * @return the named used to register the MBean
 */	
static public ObjectName registerMBean(final String serviceName, 
  							final String nameName,
  							final Object theMbean) {
  final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
  ObjectName name = getMBeanName(serviceName, nameName);
  try {
    mbs.registerMBean(theMbean, name);
    return name;
  } catch (InstanceAlreadyExistsException ie) {
    // Ignore if instance already exists 
  } catch (Exception e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:26,代码来源:MBeanUtil.java

示例7: createMBean

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object[] params, String[] signature)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException  {

    try {
        return createMBean(className, name, null, true,
                           params, signature);
    } catch (InstanceNotFoundException e) {
        /* Can only happen if loaderName doesn't exist, but we just
           passed null, so we shouldn't get this exception.  */
        throw EnvHelp.initCause(
            new IllegalArgumentException("Unexpected exception: " + e), e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:DefaultMBeanServerInterceptor.java

示例8: preRegister

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
private static ObjectName preRegister(
        DynamicMBean mbean, MBeanServer mbs, ObjectName name)
        throws InstanceAlreadyExistsException, MBeanRegistrationException {

    ObjectName newName = null;

    try {
        if (mbean instanceof MBeanRegistration)
            newName = ((MBeanRegistration) mbean).preRegister(mbs, name);
    } catch (Throwable t) {
        throwMBeanRegistrationException(t, "in preRegister method");
    }

    if (newName != null) return newName;
    else return name;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:DefaultMBeanServerInterceptor.java

示例9: createMBean

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
/**
 * Call <code>checkCreate(className)</code>, then forward this method to the
 * wrapped object.
 */
public ObjectInstance createMBean(String className, ObjectName name)
    throws
    ReflectionException,
    InstanceAlreadyExistsException,
    MBeanRegistrationException,
    MBeanException,
    NotCompliantMBeanException {
    checkCreate(className);
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
        Object object = getMBeanServer().instantiate(className);
        checkClassLoader(object);
        return getMBeanServer().registerMBean(object, name);
    } else {
        return getMBeanServer().createMBean(className, name);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:MBeanServerAccessController.java

示例10: doTest

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
private void doTest(JMXConnector connector) throws IOException,
MalformedObjectNameException, ReflectionException,
InstanceAlreadyExistsException, MBeanRegistrationException,
MBeanException, NotCompliantMBeanException, InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
    MBeanServerConnection  mbsc = connector.getMBeanServerConnection();


    ObjectName objName = new ObjectName("com.redhat.test.jmx:type=NameMBean");
    System.out.println("DEBUG: Calling createMBean");
    mbsc.createMBean(Name.class.getName(), objName);

    System.out.println("DEBUG: Calling setAttributes");
    AttributeList attList = new AttributeList();
    attList.add(new Attribute("FirstName", ANY_NAME));
    attList.add(new Attribute("LastName", ANY_NAME));
    mbsc.setAttributes(objName, attList);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:RMIConnectorLogAttributesTest.java

示例11: createMBean

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
/**
 * Call <code>checkCreate(className)</code>, then forward this method to the
 * wrapped object.
 */
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object params[], String signature[])
    throws
    ReflectionException,
    InstanceAlreadyExistsException,
    MBeanRegistrationException,
    MBeanException,
    NotCompliantMBeanException {
    checkCreate(className);
    SecurityManager sm = System.getSecurityManager();
    if (sm == null) {
        Object object = getMBeanServer().instantiate(className,
                                                     params,
                                                     signature);
        checkClassLoader(object);
        return getMBeanServer().registerMBean(object, name);
    } else {
        return getMBeanServer().createMBean(className, name,
                                            params, signature);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:MBeanServerAccessController.java

示例12: addDynamicMBean

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
/**
 * Registers a DynamicMBean.
 */
private static void addDynamicMBean(final MBeanServer mbs,
                                    final DynamicMBean dmbean,
                                    final ObjectName on) {
    try {
        AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
            @Override
            public Void run() throws InstanceAlreadyExistsException,
                                     MBeanRegistrationException,
                                     NotCompliantMBeanException {
                mbs.registerMBean(dmbean, on);
                return null;
            }
        });
    } catch (PrivilegedActionException e) {
        throw new RuntimeException(e.getException());
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:ManagementFactory.java

示例13: testReconfigure

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
@Test
public void testReconfigure() throws InstanceAlreadyExistsException, ConflictingVersionException,
        ValidationException, InstanceNotFoundException {

    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createInstance(transaction, instanceName, null);

    transaction.commit();

    transaction = configRegistryClient.createTransaction();
    assertBeanCount(1, factory.getImplementationName());
    NettyThreadgroupModuleMXBean mxBean = transaction.newMBeanProxy(
            transaction.lookupConfigBean(AbstractNettyThreadgroupModuleFactory.NAME, instanceName),
            NettyThreadgroupModuleMXBean.class);
    mxBean.setThreadCount(1);
    CommitStatus status = transaction.commit();

    assertBeanCount(1, factory.getImplementationName());
    assertStatus(status, 0, 1, 0);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:NettyThreadgroupModuleTest.java

示例14: registerMBean

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
public ObjectInstance registerMBean(Object object, ObjectName name)
    throws InstanceAlreadyExistsException, MBeanRegistrationException,
    NotCompliantMBeanException  {

    // ------------------------------
    // ------------------------------
    Class<?> theClass = object.getClass();

    Introspector.checkCompliance(theClass);

    final String infoClassName = getNewMBeanClassName(object);

    checkMBeanPermission(infoClassName, null, name, "registerMBean");
    checkMBeanTrustPermission(theClass);

    return registerObject(infoClassName, object, name);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:DefaultMBeanServerInterceptor.java

示例15: createModule

import javax.management.InstanceAlreadyExistsException; //导入依赖的package包/类
@Override
public synchronized ObjectName createModule(final String factoryName, final String instanceName)
        throws InstanceAlreadyExistsException {

    transactionStatus.checkNotCommitStarted();
    transactionStatus.checkNotAborted();
    ModuleIdentifier moduleIdentifier = new ModuleIdentifier(factoryName, instanceName);
    dependencyResolverManager.assertNotExists(moduleIdentifier);

    // find factory
    ModuleFactory moduleFactory = factoriesHolder.findByModuleName(factoryName);

    DependencyResolver dependencyResolver = dependencyResolverManager.getOrCreate(moduleIdentifier);
    BundleContext bundleContext = getModuleFactoryBundleContext(moduleFactory.getImplementationName());
    Module module = moduleFactory.createModule(instanceName, dependencyResolver, bundleContext);
    boolean defaultBean = false;
    return putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module, moduleFactory, null, dependencyResolver,
            defaultBean, bundleContext);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:ConfigTransactionControllerImpl.java


注:本文中的javax.management.InstanceAlreadyExistsException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。