Code example for MapMaker

0
 
    @Inject 
    public MBeanExporter(MBeanServer server)
    { 
        this.server = server;
        exportedObjects = new MapMaker().weakValues().makeMap();
    } 
 
    public void export(String name, Object object)
    { 
        ObjectName objectName;
        try { 
            objectName = new ObjectName(name);
        } 
        catch (MalformedObjectNameException e) {
            throw new JmxException(Reason.MALFORMED_OBJECT_NAME, e.getMessage());
        } 
 
        export(objectName, object);
    }