當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。