public static class RemoteProfiles.UncommittedProfile<T> extends Object
Contains references and exposes utility methods needed to update and commit a newly-created profile.
Modifier and Type | Method and Description |
---|---|
void |
closeProfile()
Close the profile.
|
void |
commitProfile()
Commit the profile.
|
ObjectName |
getObjectName()
Retrieve the ObjectName for the new profile.
|
ProfileMBean |
getProfileMBean()
Retrieve the ProfileMBean proxy instance for the new profile.
|
T |
getProfileProxy()
Retrieve a proxy instance for the profile itself, if this UncommittedProfile was created using
RemoteProfiles.createUncommittedProfile(javax.management.MBeanServerConnection,String,String,Class) . |
void |
restoreProfile()
Restore the profile.
|
void |
setAttribute(String name,
Object value)
Set a single attribute of this uncommitted profile.
|
void |
setAttributes(AttributeList attrs)
Set several attributes of this uncommitted profile using an
AttributeList . |
public ProfileMBean getProfileMBean()
Retrieve the ProfileMBean proxy instance for the new profile. This is needed to commit the profile.
public ObjectName getObjectName()
Retrieve the ObjectName for the new profile.
public T getProfileProxy()
Retrieve a proxy instance for the profile itself, if this UncommittedProfile was created using RemoteProfiles.createUncommittedProfile(javax.management.MBeanServerConnection,String,String,Class)
. This proxy can be used to set individual attributes by directly invoking their set method.
Note that this will make one remote MBean call per invocation of a set method and is not recommended in situations where performance is important. (RemoteProfiles.setAttributes(javax.management.MBeanServerConnection, javax.management.ObjectName, javax.management.AttributeList)
will set all attributes in one request, and is therefore more efficient.)
public void restoreProfile() throws ManagementException, InvalidStateException
Restore the profile.
Equivalent to calling getProfileMBean().restoreProfile()
.
public void commitProfile() throws InvalidStateException, ProfileVerificationException, ManagementException
Commit the profile.
Equivalent to calling getProfileMBean().commitProfile()
.
public void closeProfile() throws InvalidStateException, ManagementException
Close the profile.
Equivalent to calling getProfileMBean().closeProfile()
.
public void setAttribute(String name, Object value) throws AttributeNotFoundException, InvalidAttributeValueException, ManagementException
Set a single attribute of this uncommitted profile.
Equivalent to calling mBeanServerConnection.setAttribute(uncommmittedProfile.getObjectName(), new Attribute(name, value))
.
name
- the attribute namevalue
- value to setAttributeNotFoundException
InvalidAttributeValueException
ManagementException
- if the profile attributes could not be set due to a system-level failure.public void setAttributes(AttributeList attrs) throws ManagementException
Set several attributes of this uncommitted profile using an AttributeList
. Equivalent to calling mBeanServerConnection.setAttributes(uncommmittedProfile.getObjectName(), attrs)
.
attrs
- a JMX AttributeList object containing the attributes to be setManagementException
- if the profile attributes could not be set due to a system-level failure.