Package javax.management

Examples of javax.management.InstanceAlreadyExistsException


            // Add instance if not already present
            String cstr = name.getCanonicalKeyPropertyListString();
            NamedObject elmt= moiTb.get(cstr);
            if (elmt != null) {
                throw new InstanceAlreadyExistsException(name.toString());
            } else {
                nbElements++;
                moiTb.put(cstr, new NamedObject(name, object));
            }
View Full Code Here


        synchronized (lock) {
            if (this.objectName != null) {
                final String msg =
                    "MXBean already registered with name " + this.objectName;
                throw new InstanceAlreadyExistsException(msg);
            }
            this.mxbeanLookup = MXBeanLookup.lookupFor(server);
            this.mxbeanLookup.addReference(name, getResource());
            this.objectName = name;
        }
View Full Code Here

    public ObjectName preRegister(MBeanServer server, ObjectName name)
            throws Exception {
        // Allow only one initialization of the MIB.
        //
        if (isInitialized == true) {
            throw new InstanceAlreadyExistsException();
        }

        // Initialize MBeanServer information.
        //
        this.server = server;
View Full Code Here

      for (Iterator it = mbeans.iterator(); it.hasNext();) {
    final ObjectName sourceName = (ObjectName)it.next();
    final ObjectName targetName = getTargetName(sourceName);
    if (mbs.isRegistered(targetName) && !conflictAllowed) {
        nameConflictDetected("start",targetName);
        throw new InstanceAlreadyExistsException(
               String.valueOf(targetName));
    } else names[count++]=sourceName;
      }

      for (int i=0;i<count;i++)
View Full Code Here

      // Create a properties -> entry map if we don't have one
      Map mbeanMap = getMBeanMap(domain, true);

      // Make sure we aren't already registered
      if (mbeanMap.get(props) != null)
         throw new InstanceAlreadyExistsException(name + " already registered.");

      // Ok, we are registered
      mbeanMap.put(props, entry);
   }
View Full Code Here

    {
        if (name == null) {
            throw new UnsupportedOperationException("Only explicit name supported at this time");
        }
        if (reportedBeans.putIfAbsent(name, reportedBean) != null) {
            throw new InstanceAlreadyExistsException(name + " is already registered");
        }
    }
View Full Code Here

/* 760 */     String props = name.getCanonicalKeyPropertyListString();
/*     */
/* 763 */     Map mbeanMap = getMBeanMap(domain, true);
/*     */
/* 766 */     if (mbeanMap.get(props) != null) {
/* 767 */       throw new InstanceAlreadyExistsException(name + " already registered.");
/*     */     }
/*     */
/* 770 */     mbeanMap.put(props, entry);
/*     */   }
View Full Code Here

        }

        DynamicMBean mbean = (DynamicMBean) object;

        if (mbeans.containsKey(name)) {
            throw new InstanceAlreadyExistsException(format("MBean already registered: %s", name));
        }

        mbeans.put(name, mbean);

        return new ObjectInstance(name, mbean.getMBeanInfo().getClassName());
View Full Code Here

    field.setAccessible(true);
    field.set(testClass, mockMbs);
    expect(mockConfig.getPoolName()).andReturn(null).anyTimes();
    ObjectInstance mockInstance = EasyMock.createNiceMock(ObjectInstance.class);
    expect(mockMbs.isRegistered((ObjectName)anyObject())).andReturn(false).anyTimes();
    expect(mockMbs.registerMBean(anyObject(), (ObjectName)anyObject())).andReturn(mockInstance).once().andThrow(new InstanceAlreadyExistsException()).once();
    replay(mockMbs, mockInstance, mockConfig);
    testClass.registerUnregisterJMX(true);
    verify(mockMbs);
  }
View Full Code Here

    field.setAccessible(true);
    field.set(testClass, mockMbs);
    expect(mockConfig.getPoolName()).andReturn("poolName").anyTimes();
    ObjectInstance mockInstance = EasyMock.createNiceMock(ObjectInstance.class);
    expect(mockMbs.isRegistered((ObjectName)anyObject())).andReturn(false).anyTimes();
    expect(mockMbs.registerMBean(anyObject(), (ObjectName)anyObject())).andReturn(mockInstance).once().andThrow(new InstanceAlreadyExistsException()).once();
    replay(mockMbs, mockInstance, mockConfig);
    testClass.registerUnregisterJMX(true);
    verify(mockMbs);
  }
View Full Code Here

TOP

Related Classes of javax.management.InstanceAlreadyExistsException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.