Merge
This commit is contained in:
commit
093ae7bee7
@ -1,3 +1,4 @@
|
||||
37a05a11f281b4d238e2f9e7ebb67c63f64d0e77 jdk7-b24
|
||||
75fca0b0ab83ab1392e615910cea020f66535390 jdk7-b25
|
||||
fb57027902e04ecafceae31a605e69b436c23d57 jdk7-b26
|
||||
3e599d98875ddf919c8ea11cff9b3a99ba631a9b jdk7-b27
|
||||
|
@ -148,13 +148,15 @@ ifeq ($(PLATFORM),windows)
|
||||
ECHO = $(UNIXCOMMAND_PATH)echo -e
|
||||
ZIPEXE = $(UNIXCOMMAND_PATH)zip
|
||||
UNZIP = $(UNIXCOMMAND_PATH)unzip
|
||||
# Some CYGWIN nawk versions require BINMODE=w for proper '\r' interpretation
|
||||
NAWK = $(UNIXCOMMAND_PATH)awk -v BINMODE=w
|
||||
else
|
||||
ZIPEXE = $(UTILS_DEVTOOL_PATH)zip
|
||||
UNZIP = $(UTILS_DEVTOOL_PATH)unzip
|
||||
NAWK = $(UNIXCOMMAND_PATH)awk
|
||||
endif
|
||||
# Re-define some utilities
|
||||
LEX =# override GNU Make intrinsic: no lex on windows
|
||||
NAWK = $(UNIXCOMMAND_PATH)awk
|
||||
endif
|
||||
|
||||
# Linux specific
|
||||
|
@ -394,7 +394,7 @@ LOCALES_GEN_SH = localelist.sh
|
||||
$(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \
|
||||
$(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java $(LOCALES_GEN_SH)
|
||||
@$(prep-target)
|
||||
NAWK=$(NAWK) SED=$(SED) $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
|
||||
NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
|
||||
$< $@
|
||||
clean::
|
||||
$(RM) $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java
|
||||
|
@ -191,7 +191,7 @@ sources: $(SPP) $(FILES_genout)
|
||||
|
||||
GEN_BUFFER_SH = genBuffer.sh
|
||||
|
||||
GEN_BUFFER_CMD = SPP="$(SPP_CMD)" NAWK=$(NAWK) SED=$(SED) SH=$(SH) \
|
||||
GEN_BUFFER_CMD = SPP="$(SPP_CMD)" NAWK="$(NAWK)" SED="$(SED)" SH="$(SH)" \
|
||||
$(SH) $(GEN_BUFFER_SH)
|
||||
|
||||
# Public abstract buffer classes
|
||||
@ -582,7 +582,7 @@ $(BUF_GEN)/ByteBufferAsDoubleBuffer%L.java: $(BUF_SRC)/ByteBufferAs-X-Buffer.jav
|
||||
|
||||
GEN_CODER_SH = genCoder.sh
|
||||
|
||||
GEN_CODER_CMD = SPP="$(SPP_CMD)" SED=$(SED) NAWK=$(NAWK) SH=$(SH) $(SH) $(GEN_CODER_SH)
|
||||
GEN_CODER_CMD = SPP="$(SPP_CMD)" SED="$(SED)" NAWK="$(NAWK)" SH="$(SH)" $(SH) $(GEN_CODER_SH)
|
||||
|
||||
$(CS_GEN)/CharsetDecoder.java: $(CS_SRC)/Charset-X-Coder.java $(GEN_CODER_SH)
|
||||
$(prep-target)
|
||||
@ -602,7 +602,7 @@ $(CS_GEN)/CharsetEncoder.java: $(CS_SRC)/Charset-X-Coder.java $(GEN_CODER_SH)
|
||||
|
||||
GEN_EX_SH = genExceptions.sh
|
||||
|
||||
GEN_EX_CMD = NAWK=$(NAWK) SH=$(SH) $(SH) $(GEN_EX_SH)
|
||||
GEN_EX_CMD = NAWK="$(NAWK)" SH="$(SH)" $(SH) $(GEN_EX_SH)
|
||||
|
||||
$(CH_GEN)/%Exception.java: genExceptions.sh $(CH_SRC)/exceptions
|
||||
$(prep-target)
|
||||
@ -635,7 +635,7 @@ $(SCS_GEN)/StandardCharsets.java: genCharsetProvider.sh \
|
||||
$(HASHER_JARFILE) $(SCS_SRC)/standard-charsets
|
||||
$(prep-target)
|
||||
@$(RM) $@.temp
|
||||
NAWK=$(NAWK) TEMPDIR=$(TEMPDIR) SH=$(SH) \
|
||||
NAWK="$(NAWK)" TEMPDIR="$(TEMPDIR)" SH="$(SH)" \
|
||||
HASHER="$(BOOT_JAVA_CMD) -jar $(HASHER_JARFILE)" \
|
||||
$(SH) -e genCharsetProvider.sh $(SCS_SRC)/standard-charsets $(SCS_GEN)
|
||||
|
||||
|
@ -233,7 +233,6 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
|
||||
MBeanRegistrationException, MBeanException,
|
||||
NotCompliantMBeanException, InstanceNotFoundException {
|
||||
|
||||
ObjectName logicalName = name;
|
||||
Class theClass;
|
||||
|
||||
if (className == null) {
|
||||
@ -519,8 +518,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
|
||||
QueryExp query) {
|
||||
// Query the MBeans on the repository
|
||||
//
|
||||
Set<NamedObject> list = null;
|
||||
list = repository.query(name, query);
|
||||
Set<NamedObject> list = repository.query(name, query);
|
||||
|
||||
if (queryByRepo) {
|
||||
// The repository performs the filtering
|
||||
@ -576,8 +574,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
|
||||
private Set<ObjectName> queryNamesImpl(ObjectName name, QueryExp query) {
|
||||
// Query the MBeans on the repository
|
||||
//
|
||||
Set<NamedObject> list = null;
|
||||
list = repository.query(name, query);
|
||||
Set<NamedObject> list = repository.query(name, query);
|
||||
|
||||
if (queryByRepo) {
|
||||
// The repository performs the filtering
|
||||
@ -1042,7 +1039,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
|
||||
if (registerFailed && moi instanceof DynamicMBean2)
|
||||
((DynamicMBean2) moi).registerFailed();
|
||||
try {
|
||||
moi.postRegister(new Boolean(registrationDone));
|
||||
moi.postRegister(registrationDone);
|
||||
} catch (RuntimeException e) {
|
||||
throw new RuntimeMBeanException(e,
|
||||
"RuntimeException thrown in postRegister method");
|
||||
@ -1094,8 +1091,7 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
|
||||
IllegalArgumentException("Object name cannot be null"),
|
||||
"Exception occurred trying to get an MBean");
|
||||
}
|
||||
DynamicMBean obj = null;
|
||||
obj = repository.retrieve(name);
|
||||
DynamicMBean obj = repository.retrieve(name);
|
||||
if (obj == null) {
|
||||
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
|
||||
MBEANSERVER_LOGGER.logp(Level.FINER,
|
||||
@ -1568,7 +1564,6 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
|
||||
query.setMBeanServer(server);
|
||||
try {
|
||||
for (NamedObject no : list) {
|
||||
final DynamicMBean obj = no.getObject();
|
||||
boolean res;
|
||||
try {
|
||||
res = query.apply(no.getName());
|
||||
|
@ -205,7 +205,7 @@ public class MBeanInstantiator {
|
||||
*/
|
||||
public Object instantiate(Class theClass)
|
||||
throws ReflectionException, MBeanException {
|
||||
Object moi = null;
|
||||
Object moi;
|
||||
|
||||
|
||||
// ------------------------------
|
||||
@ -265,7 +265,7 @@ public class MBeanInstantiator {
|
||||
// ------------------------------
|
||||
// ------------------------------
|
||||
final Class[] tab;
|
||||
Object moi= null;
|
||||
Object moi;
|
||||
try {
|
||||
// Build the signature of the method
|
||||
//
|
||||
@ -283,8 +283,7 @@ public class MBeanInstantiator {
|
||||
}
|
||||
|
||||
// Query the metadata service to get the right constructor
|
||||
Constructor cons = null;
|
||||
cons = findConstructor(theClass, tab);
|
||||
Constructor cons = findConstructor(theClass, tab);
|
||||
|
||||
if (cons == null) {
|
||||
throw new ReflectionException(new
|
||||
@ -408,7 +407,7 @@ public class MBeanInstantiator {
|
||||
throw new RuntimeOperationsException(new
|
||||
IllegalArgumentException(), "Null className passed in parameter");
|
||||
}
|
||||
Class theClass = null;
|
||||
Class theClass;
|
||||
if (loaderName == null) {
|
||||
// Load the class using the agent class loader
|
||||
theClass = findClass(className, loader);
|
||||
@ -621,7 +620,7 @@ public class MBeanInstantiator {
|
||||
static Class loadClass(String className, ClassLoader loader)
|
||||
throws ReflectionException {
|
||||
|
||||
Class theClass = null;
|
||||
Class theClass;
|
||||
if (className == null) {
|
||||
throw new RuntimeOperationsException(new
|
||||
IllegalArgumentException("The class name cannot be null"),
|
||||
|
@ -89,7 +89,6 @@ public class Repository {
|
||||
|
||||
/* This class is used to match an ObjectName against a pattern. */
|
||||
private final static class ObjectNamePattern {
|
||||
private final char[] domain;
|
||||
private final String[] keys;
|
||||
private final String[] values;
|
||||
private final String properties;
|
||||
@ -106,8 +105,7 @@ public class Repository {
|
||||
* @param pattern The ObjectName pattern under examination.
|
||||
**/
|
||||
public ObjectNamePattern(ObjectName pattern) {
|
||||
this(pattern.getDomain(),
|
||||
pattern.isPropertyListPattern(),
|
||||
this(pattern.isPropertyListPattern(),
|
||||
pattern.isPropertyValuePattern(),
|
||||
pattern.getCanonicalKeyPropertyListString(),
|
||||
pattern.getKeyPropertyList(),
|
||||
@ -124,13 +122,11 @@ public class Repository {
|
||||
* @param keyPropertyList pattern.getKeyPropertyList().
|
||||
* @param pattern The ObjectName pattern under examination.
|
||||
**/
|
||||
ObjectNamePattern(String domain,
|
||||
boolean propertyListPattern,
|
||||
ObjectNamePattern(boolean propertyListPattern,
|
||||
boolean propertyValuePattern,
|
||||
String canonicalProps,
|
||||
Map<String,String> keyPropertyList,
|
||||
ObjectName pattern) {
|
||||
this.domain = domain.toCharArray();
|
||||
this.isPropertyListPattern = propertyListPattern;
|
||||
this.isPropertyValuePattern = propertyValuePattern;
|
||||
this.properties = canonicalProps;
|
||||
@ -538,7 +534,7 @@ public class Repository {
|
||||
// "domain:*", "domain:[key=value],*" : names in the specified domain
|
||||
|
||||
// Surely one of the most frequent case ... query on the whole world
|
||||
ObjectName name = null;
|
||||
ObjectName name;
|
||||
if (pattern == null ||
|
||||
pattern.getCanonicalName().length() == 0 ||
|
||||
pattern.equals(ObjectName.WILDCARD))
|
||||
@ -660,7 +656,7 @@ public class Repository {
|
||||
* @return Number of MBeans.
|
||||
*/
|
||||
public Integer getCount() {
|
||||
return new Integer(nbElements);
|
||||
return nbElements;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -669,7 +665,7 @@ public class Repository {
|
||||
*
|
||||
* @return A string giving the name of the default domain name.
|
||||
*/
|
||||
public String getDefaultDomain() {
|
||||
public String getDefaultDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,6 @@ public abstract class ClientNotifForwarder {
|
||||
|
||||
clientSequenceNumber = nr.getNextSequenceNumber();
|
||||
|
||||
final int size = infoList.size();
|
||||
listeners = new HashMap<Integer, ClientListenerInfo>();
|
||||
|
||||
for (int i = 0 ; i < len ; i++) {
|
||||
@ -792,9 +791,6 @@ public abstract class ClientNotifForwarder {
|
||||
|
||||
private Thread currentFetchThread;
|
||||
|
||||
// admin stuff
|
||||
private boolean inited = false;
|
||||
|
||||
// state
|
||||
/**
|
||||
* This state means that a thread is being created for fetching and forwarding notifications.
|
||||
|
@ -269,7 +269,7 @@ public class ServerNotifForwarder {
|
||||
", the maxNotifications is " + maxNotifications);
|
||||
}
|
||||
|
||||
NotificationResult nr = null;
|
||||
NotificationResult nr;
|
||||
final long t = Math.min(connectionTimeout, timeout);
|
||||
try {
|
||||
nr = notifBuffer.fetchNotifications(bufferFilter,
|
||||
@ -322,7 +322,7 @@ public class ServerNotifForwarder {
|
||||
|
||||
private Integer getListenerID() {
|
||||
synchronized(listenerCounterLock) {
|
||||
return new Integer(listenerCounter++);
|
||||
return listenerCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ public class ServerNotifForwarder {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
AccessControlContext acc = AccessController.getContext();
|
||||
ObjectInstance oi = null;
|
||||
ObjectInstance oi;
|
||||
try {
|
||||
oi = AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<ObjectInstance>() {
|
||||
|
@ -437,7 +437,7 @@ public class FileLoginModule implements LoginModule {
|
||||
// get the username and password
|
||||
getUsernamePassword(usePasswdFromSharedState);
|
||||
|
||||
String localPassword = null;
|
||||
String localPassword;
|
||||
|
||||
// userCredentials is initialized in login()
|
||||
if (((localPassword = userCredentials.getProperty(username)) == null) ||
|
||||
@ -487,10 +487,14 @@ public class FileLoginModule implements LoginModule {
|
||||
throw ace;
|
||||
}
|
||||
}
|
||||
BufferedInputStream bis = new BufferedInputStream(fis);
|
||||
userCredentials = new Properties();
|
||||
userCredentials.load(bis);
|
||||
bis.close();
|
||||
try {
|
||||
BufferedInputStream bis = new BufferedInputStream(fis);
|
||||
userCredentials = new Properties();
|
||||
userCredentials.load(bis);
|
||||
bis.close();
|
||||
} finally {
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -295,7 +295,7 @@ private final class JMXCallbackHandler implements CallbackHandler {
|
||||
private static class FileLoginConfig extends Configuration {
|
||||
|
||||
// The JAAS configuration for file-based authentication
|
||||
private static AppConfigurationEntry[] entries;
|
||||
private AppConfigurationEntry[] entries;
|
||||
|
||||
// The classname of the login module for file-based authentication
|
||||
private static final String FILE_LOGIN_MODULE =
|
||||
|
@ -231,10 +231,13 @@ public class MBeanServerFileAccessController
|
||||
private static Properties propertiesFromFile(String fname)
|
||||
throws IOException {
|
||||
FileInputStream fin = new FileInputStream(fname);
|
||||
Properties p = new Properties();
|
||||
p.load(fin);
|
||||
fin.close();
|
||||
return p;
|
||||
try {
|
||||
Properties p = new Properties();
|
||||
p.load(fin);
|
||||
return p;
|
||||
} finally {
|
||||
fin.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAccessLevel(String accessLevel) {
|
||||
|
@ -83,7 +83,7 @@ class NumericValueExp extends QueryEval implements ValueExp {
|
||||
* <p>The <b>serialVersionUID</b> of this class is <code>-4679739485102359104L</code>.
|
||||
*/
|
||||
private static final ObjectStreamField[] serialPersistentFields;
|
||||
private Number val = new Double(0);
|
||||
private Number val = 0.0;
|
||||
|
||||
private static boolean compat = false;
|
||||
static {
|
||||
@ -213,11 +213,11 @@ class NumericValueExp extends QueryEval implements ValueExp {
|
||||
}
|
||||
if (isLong)
|
||||
{
|
||||
this.val = new Long(longVal);
|
||||
this.val = longVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.val = new Double(doubleVal);
|
||||
this.val = doubleVal;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -449,7 +449,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
||||
// parses domain part
|
||||
domain_parsing:
|
||||
while (index < len) {
|
||||
switch (c = name_chars[index]) {
|
||||
switch (name_chars[index]) {
|
||||
case ':' :
|
||||
_domain_length = index++;
|
||||
break domain_parsing;
|
||||
@ -619,7 +619,7 @@ public class ObjectName implements Comparable<ObjectName>, QueryExp {
|
||||
case '\n' :
|
||||
final String ichar = ((c1=='\n')?"\\n":""+c1);
|
||||
throw new MalformedObjectNameException(
|
||||
"Invalid character '" + c1 +
|
||||
"Invalid character '" + ichar +
|
||||
"' in value part of property");
|
||||
default :
|
||||
in_index++;
|
||||
|
@ -750,7 +750,7 @@ public class StandardMBean implements DynamicMBean, MBeanRegistration {
|
||||
* @return the Descriptor for the new MBeanInfo.
|
||||
*/
|
||||
Descriptor getDescriptor(MBeanInfo info, boolean immutableInfo) {
|
||||
ImmutableDescriptor desc = null;
|
||||
ImmutableDescriptor desc;
|
||||
if (info == null ||
|
||||
info.getDescriptor() == null ||
|
||||
info.getDescriptor().getFieldNames().length == 0) {
|
||||
|
@ -591,8 +591,8 @@ public class MLet extends java.net.URLClassLoader
|
||||
// Instantiate the class specified in the
|
||||
// CODE or OBJECT section of the MLet tag
|
||||
//
|
||||
Object o = null;
|
||||
ObjectInstance objInst = null;
|
||||
Object o;
|
||||
ObjectInstance objInst;
|
||||
|
||||
if (code != null && serName != null) {
|
||||
final String msg =
|
||||
@ -1131,11 +1131,17 @@ public class MLet extends java.net.URLClassLoader
|
||||
return null;
|
||||
} finally {
|
||||
// Cleanup ...
|
||||
if (tmpFile!=null) try {
|
||||
tmpFile.delete();
|
||||
} catch (Exception x) {
|
||||
MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
|
||||
"getTmpDir", "Failed to delete temporary file", x);
|
||||
if (tmpFile!=null) {
|
||||
try {
|
||||
boolean deleted = tmpFile.delete();
|
||||
if (!deleted) {
|
||||
MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
|
||||
"getTmpDir", "Failed to delete temp file");
|
||||
}
|
||||
} catch (Exception x) {
|
||||
MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
|
||||
"getTmpDir", "Failed to delete temporary file", x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1178,25 +1184,8 @@ public class MLet extends java.net.URLClassLoader
|
||||
* Removes any white space from a string. This is used to
|
||||
* convert strings such as "Windows NT" to "WindowsNT".
|
||||
*/
|
||||
private String removeSpace(String s) {
|
||||
s = s.trim();
|
||||
int j = s.indexOf(' ');
|
||||
if (j == -1) {
|
||||
return s;
|
||||
}
|
||||
String temp = "";
|
||||
int k = 0;
|
||||
while (j != -1) {
|
||||
s = s.substring(k);
|
||||
j = s.indexOf(' ');
|
||||
if (j != -1) {
|
||||
temp = temp + s.substring(0, j);
|
||||
} else {
|
||||
temp = temp + s.substring(0);
|
||||
}
|
||||
k = j + 1;
|
||||
}
|
||||
return temp;
|
||||
private static String removeSpace(String s) {
|
||||
return s.trim().replace(" ", "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,14 +240,12 @@ class MLetParser {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, requiresCodeWarning);
|
||||
atts = null;
|
||||
throw new IOException(requiresCodeWarning);
|
||||
}
|
||||
if (atts.get("archive") == null) {
|
||||
MLET_LOGGER.logp(Level.FINER,
|
||||
MLetParser.class.getName(),
|
||||
mth, requiresJarsWarning);
|
||||
atts = null;
|
||||
throw new IOException(requiresJarsWarning);
|
||||
}
|
||||
}
|
||||
@ -265,7 +263,7 @@ class MLetParser {
|
||||
public List<MLetContent> parseURL(String urlname) throws IOException {
|
||||
// Parse the document
|
||||
//
|
||||
URL url = null;
|
||||
URL url;
|
||||
if (urlname.indexOf(':') <= 1) {
|
||||
String userDir = System.getProperty("user.dir");
|
||||
String prot;
|
||||
|
@ -591,8 +591,6 @@ public class DescriptorSupport
|
||||
Set returnedSet = descriptorMap.entrySet();
|
||||
|
||||
int i = 0;
|
||||
Object currValue = null;
|
||||
Map.Entry currElement = null;
|
||||
|
||||
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
|
||||
MODELMBEAN_LOGGER.logp(Level.FINEST,
|
||||
@ -600,7 +598,7 @@ public class DescriptorSupport
|
||||
"getFields()", "Returning " + numberOfEntries + " fields");
|
||||
}
|
||||
for (Iterator iter = returnedSet.iterator(); iter.hasNext(); i++) {
|
||||
currElement = (Map.Entry) iter.next();
|
||||
Map.Entry currElement = (Map.Entry) iter.next();
|
||||
|
||||
if (currElement == null) {
|
||||
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
|
||||
@ -609,7 +607,7 @@ public class DescriptorSupport
|
||||
"getFields()", "Element is null");
|
||||
}
|
||||
} else {
|
||||
currValue = currElement.getValue();
|
||||
Object currValue = currElement.getValue();
|
||||
if (currValue == null) {
|
||||
responseFields[i] = currElement.getKey() + "=";
|
||||
} else {
|
||||
@ -1127,7 +1125,7 @@ public class DescriptorSupport
|
||||
final char c = entities[i].charAt(0);
|
||||
final String entity = entities[i].substring(1);
|
||||
charToEntityMap[c] = entity;
|
||||
entityToCharMap.put(entity, new Character(c));
|
||||
entityToCharMap.put(entity, c);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1325,13 +1323,11 @@ public class DescriptorSupport
|
||||
// utility to convert to int, returns -2 if bogus.
|
||||
|
||||
private long toNumeric(String inStr) {
|
||||
long result = -2;
|
||||
try {
|
||||
result = java.lang.Long.parseLong(inStr);
|
||||
return java.lang.Long.parseLong(inStr);
|
||||
} catch (Exception e) {
|
||||
return -2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -432,7 +432,7 @@ public class ModelMBeanAttributeInfo
|
||||
*/
|
||||
private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
|
||||
|
||||
Descriptor clone = null;
|
||||
Descriptor clone;
|
||||
if (in == null) {
|
||||
clone = new DescriptorSupport();
|
||||
MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
|
||||
|
@ -393,7 +393,7 @@ public class ModelMBeanConstructorInfo
|
||||
* @exception RuntimeOperationsException if Descriptor is invalid
|
||||
*/
|
||||
private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
|
||||
Descriptor clone = null;
|
||||
Descriptor clone;
|
||||
if (in == null) {
|
||||
clone = new DescriptorSupport();
|
||||
MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
|
||||
|
@ -944,7 +944,7 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo {
|
||||
* @exception RuntimeOperationsException if Descriptor is invalid
|
||||
*/
|
||||
private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
|
||||
Descriptor clone = null;
|
||||
Descriptor clone;
|
||||
if (in == null) {
|
||||
clone = new DescriptorSupport();
|
||||
MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
|
||||
|
@ -328,7 +328,7 @@ public class ModelMBeanNotificationInfo
|
||||
* @exception RuntimeOperationsException if Descriptor is invalid
|
||||
*/
|
||||
private Descriptor validDescriptor(final Descriptor in) throws RuntimeOperationsException {
|
||||
Descriptor clone = null;
|
||||
Descriptor clone;
|
||||
if (in == null) {
|
||||
clone = new DescriptorSupport();
|
||||
MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
|
||||
|
@ -424,7 +424,7 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo
|
||||
*/
|
||||
private Descriptor validDescriptor(final Descriptor in)
|
||||
throws RuntimeOperationsException {
|
||||
Descriptor clone = null;
|
||||
Descriptor clone;
|
||||
if (in == null) {
|
||||
clone = new DescriptorSupport();
|
||||
MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
|
||||
|
@ -1425,9 +1425,7 @@ public class RequiredModelMBean
|
||||
}
|
||||
|
||||
/* Check attributeDescriptor for getMethod */
|
||||
ModelMBeanAttributeInfo attrInfo=null;
|
||||
Descriptor attrDescr=null;
|
||||
Object response = null;
|
||||
Object response;
|
||||
|
||||
try {
|
||||
if (modelMBeanInfo == null)
|
||||
@ -1435,14 +1433,14 @@ public class RequiredModelMBean
|
||||
"getAttribute failed: ModelMBeanInfo not found for "+
|
||||
attrName);
|
||||
|
||||
attrInfo = modelMBeanInfo.getAttribute(attrName);
|
||||
ModelMBeanAttributeInfo attrInfo = modelMBeanInfo.getAttribute(attrName);
|
||||
Descriptor mmbDesc = modelMBeanInfo.getMBeanDescriptor();
|
||||
|
||||
if (attrInfo == null)
|
||||
throw new AttributeNotFoundException("getAttribute failed:"+
|
||||
" ModelMBeanAttributeInfo not found for " + attrName);
|
||||
|
||||
attrDescr = attrInfo.getDescriptor();
|
||||
Descriptor attrDescr = attrInfo.getDescriptor();
|
||||
if (attrDescr != null) {
|
||||
if (!attrInfo.isReadable())
|
||||
throw new AttributeNotFoundException(
|
||||
@ -1684,14 +1682,13 @@ public class RequiredModelMBean
|
||||
"getAttributes(String[])","Entry");
|
||||
}
|
||||
|
||||
AttributeList responseList = null;
|
||||
if (attrNames == null)
|
||||
throw new RuntimeOperationsException(new
|
||||
IllegalArgumentException("attributeNames must not be null"),
|
||||
"Exception occurred trying to get attributes of a "+
|
||||
"RequiredModelMBean");
|
||||
|
||||
responseList = new AttributeList();
|
||||
AttributeList responseList = new AttributeList();
|
||||
for (int i = 0; i < attrNames.length; i++) {
|
||||
try {
|
||||
responseList.add(new Attribute(attrNames[i],
|
||||
@ -1833,8 +1830,6 @@ public class RequiredModelMBean
|
||||
throw new AttributeNotFoundException("setAttribute failed: "
|
||||
+ attrName + " is not writable ");
|
||||
|
||||
Object setResponse = null;
|
||||
|
||||
String attrSetMethod = (String)
|
||||
(attrDescr.getFieldValue("setMethod"));
|
||||
String attrGetMethod = (String)
|
||||
@ -1873,9 +1868,9 @@ public class RequiredModelMBean
|
||||
}
|
||||
updateDescriptor = true;
|
||||
} else {
|
||||
setResponse = invoke(attrSetMethod,
|
||||
(new Object[] {attrValue}),
|
||||
(new String[] {attrType}) );
|
||||
invoke(attrSetMethod,
|
||||
(new Object[] {attrValue}),
|
||||
(new String[] {attrType}) );
|
||||
}
|
||||
|
||||
/* change cached value */
|
||||
@ -2023,8 +2018,6 @@ public class RequiredModelMBean
|
||||
private synchronized void writeToLog(String logFileName,
|
||||
String logEntry) throws Exception {
|
||||
|
||||
PrintStream logOut = null;
|
||||
FileOutputStream fos = null;
|
||||
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
|
||||
MODELMBEAN_LOGGER.logp(Level.FINER,
|
||||
RequiredModelMBean.class.getName(),
|
||||
@ -2041,9 +2034,9 @@ public class RequiredModelMBean
|
||||
return;
|
||||
}
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(logFileName, true);
|
||||
try {
|
||||
fos = new FileOutputStream(logFileName, true);
|
||||
logOut = new PrintStream(fos);
|
||||
PrintStream logOut = new PrintStream(fos);
|
||||
logOut.println(logEntry);
|
||||
logOut.close();
|
||||
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
|
||||
@ -2062,6 +2055,8 @@ public class RequiredModelMBean
|
||||
logFileName);
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
fos.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -740,16 +740,16 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean {
|
||||
//
|
||||
switch (o.getType()) {
|
||||
case INTEGER:
|
||||
o.setThreshold(new Integer((int)threshold_value));
|
||||
o.setThreshold(Integer.valueOf((int)threshold_value));
|
||||
break;
|
||||
case BYTE:
|
||||
o.setThreshold(new Byte((byte)threshold_value));
|
||||
o.setThreshold(Byte.valueOf((byte)threshold_value));
|
||||
break;
|
||||
case SHORT:
|
||||
o.setThreshold(new Short((short)threshold_value));
|
||||
o.setThreshold(Short.valueOf((short)threshold_value));
|
||||
break;
|
||||
case LONG:
|
||||
o.setThreshold(new Long(threshold_value));
|
||||
o.setThreshold(Long.valueOf(threshold_value));
|
||||
break;
|
||||
default:
|
||||
// Should never occur...
|
||||
@ -810,10 +810,10 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean {
|
||||
derived += modulus.longValue();
|
||||
|
||||
switch (o.getType()) {
|
||||
case INTEGER: o.setDerivedGauge(new Integer((int) derived)); break;
|
||||
case BYTE: o.setDerivedGauge(new Byte((byte) derived)); break;
|
||||
case SHORT: o.setDerivedGauge(new Short((short) derived)); break;
|
||||
case LONG: o.setDerivedGauge(new Long(derived)); break;
|
||||
case INTEGER: o.setDerivedGauge(Integer.valueOf((int) derived)); break;
|
||||
case BYTE: o.setDerivedGauge(Byte.valueOf((byte) derived)); break;
|
||||
case SHORT: o.setDerivedGauge(Short.valueOf((short) derived)); break;
|
||||
case LONG: o.setDerivedGauge(Long.valueOf(derived)); break;
|
||||
default:
|
||||
// Should never occur...
|
||||
MONITOR_LOGGER.logp(Level.FINEST, CounterMonitor.class.getName(),
|
||||
|
@ -636,28 +636,28 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean {
|
||||
Number der;
|
||||
switch (o.getType()) {
|
||||
case INTEGER:
|
||||
der = new Integer(((Integer)scanGauge).intValue() -
|
||||
((Integer)prev).intValue());
|
||||
der = Integer.valueOf(((Integer)scanGauge).intValue() -
|
||||
((Integer)prev).intValue());
|
||||
break;
|
||||
case BYTE:
|
||||
der = new Byte((byte)(((Byte)scanGauge).byteValue() -
|
||||
((Byte)prev).byteValue()));
|
||||
der = Byte.valueOf((byte)(((Byte)scanGauge).byteValue() -
|
||||
((Byte)prev).byteValue()));
|
||||
break;
|
||||
case SHORT:
|
||||
der = new Short((short)(((Short)scanGauge).shortValue() -
|
||||
((Short)prev).shortValue()));
|
||||
der = Short.valueOf((short)(((Short)scanGauge).shortValue() -
|
||||
((Short)prev).shortValue()));
|
||||
break;
|
||||
case LONG:
|
||||
der = new Long(((Long)scanGauge).longValue() -
|
||||
((Long)prev).longValue());
|
||||
der = Long.valueOf(((Long)scanGauge).longValue() -
|
||||
((Long)prev).longValue());
|
||||
break;
|
||||
case FLOAT:
|
||||
der = new Float(((Float)scanGauge).floatValue() -
|
||||
((Float)prev).floatValue());
|
||||
der = Float.valueOf(((Float)scanGauge).floatValue() -
|
||||
((Float)prev).floatValue());
|
||||
break;
|
||||
case DOUBLE:
|
||||
der = new Double(((Double)scanGauge).doubleValue() -
|
||||
((Double)prev).doubleValue());
|
||||
der = Double.valueOf(((Double)scanGauge).doubleValue() -
|
||||
((Double)prev).doubleValue());
|
||||
break;
|
||||
default:
|
||||
// Should never occur...
|
||||
|
@ -367,7 +367,7 @@ public abstract class Monitor
|
||||
/**
|
||||
* Constant used to initialize all the numeric values.
|
||||
*/
|
||||
static final Integer INTEGER_ZERO = new Integer(0);
|
||||
static final Integer INTEGER_ZERO = 0;
|
||||
|
||||
|
||||
/*
|
||||
@ -1122,12 +1122,12 @@ public abstract class Monitor
|
||||
*/
|
||||
private void monitor(ObservedObject o, int index, int an[]) {
|
||||
|
||||
String attribute = null;
|
||||
String attribute;
|
||||
String notifType = null;
|
||||
String msg = null;
|
||||
Object derGauge = null;
|
||||
Object trigger = null;
|
||||
ObjectName object = null;
|
||||
ObjectName object;
|
||||
Comparable<?> value = null;
|
||||
MonitorNotification alarm = null;
|
||||
|
||||
@ -1565,7 +1565,7 @@ public abstract class Monitor
|
||||
final ThreadGroup group;
|
||||
final AtomicInteger threadNumber = new AtomicInteger(1);
|
||||
final String namePrefix;
|
||||
final String nameSuffix = "]";
|
||||
static final String nameSuffix = "]";
|
||||
|
||||
public DaemonThreadFactory(String poolName) {
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
|
@ -726,7 +726,7 @@ public class ArrayType<T> extends OpenType<T> {
|
||||
value += dimension;
|
||||
value += elementType.hashCode();
|
||||
value += Boolean.valueOf(primitiveArray).hashCode();
|
||||
myHashCode = new Integer(value);
|
||||
myHashCode = Integer.valueOf(value);
|
||||
}
|
||||
|
||||
// return always the same hash code for this instance (immutable)
|
||||
|
@ -426,7 +426,7 @@ public class CompositeType extends OpenType<CompositeData> {
|
||||
value += key.hashCode();
|
||||
value += this.nameToType.get(key).hashCode();
|
||||
}
|
||||
myHashCode = new Integer(value);
|
||||
myHashCode = Integer.valueOf(value);
|
||||
}
|
||||
|
||||
// return always the same hash code for this instance (immutable)
|
||||
|
@ -769,7 +769,6 @@ public class OpenMBeanAttributeInfoSupport
|
||||
"array with same dimensions";
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
Class<?> targetComponentClass = targetArrayClass.getComponentType();
|
||||
OpenType<?> componentOpenType;
|
||||
if (dim == 1)
|
||||
componentOpenType = baseType;
|
||||
|
@ -252,7 +252,7 @@ public class OpenMBeanConstructorInfoSupport
|
||||
int value = 0;
|
||||
value += this.getName().hashCode();
|
||||
value += Arrays.asList(this.getSignature()).hashCode();
|
||||
myHashCode = new Integer(value);
|
||||
myHashCode = Integer.valueOf(value);
|
||||
}
|
||||
|
||||
// return always the same hash code for this instance (immutable)
|
||||
|
@ -347,7 +347,7 @@ public class OpenMBeanInfoSupport
|
||||
value += arraySetHash(this.getConstructors());
|
||||
value += arraySetHash(this.getOperations());
|
||||
value += arraySetHash(this.getNotifications());
|
||||
myHashCode = new Integer(value);
|
||||
myHashCode = Integer.valueOf(value);
|
||||
}
|
||||
|
||||
// return always the same hash code for this instance (immutable)
|
||||
|
@ -352,7 +352,7 @@ public class OpenMBeanOperationInfoSupport
|
||||
value += Arrays.asList(this.getSignature()).hashCode();
|
||||
value += this.getReturnOpenType().hashCode();
|
||||
value += this.getImpact();
|
||||
myHashCode = new Integer(value);
|
||||
myHashCode = Integer.valueOf(value);
|
||||
}
|
||||
|
||||
// return always the same hash code for this instance (immutable)
|
||||
|
@ -257,7 +257,7 @@ public final class SimpleType<T> extends OpenType<T> {
|
||||
// Calculate the hash code value if it has not yet been done (ie 1st call to hashCode())
|
||||
//
|
||||
if (myHashCode == null) {
|
||||
myHashCode = new Integer(this.getClassName().hashCode());
|
||||
myHashCode = Integer.valueOf(this.getClassName().hashCode());
|
||||
}
|
||||
|
||||
// return always the same hash code for this instance (immutable)
|
||||
|
@ -332,7 +332,7 @@ public class TabularType extends OpenType<TabularData> {
|
||||
for (Iterator k = indexNames.iterator(); k.hasNext(); ) {
|
||||
value += k.next().hashCode();
|
||||
}
|
||||
myHashCode = new Integer(value);
|
||||
myHashCode = Integer.valueOf(value);
|
||||
}
|
||||
|
||||
// return always the same hash code for this instance (immutable)
|
||||
|
@ -369,7 +369,7 @@ public class RelationNotification extends Notification {
|
||||
* @return a {@link List} of {@link ObjectName}.
|
||||
*/
|
||||
public List<ObjectName> getMBeansToUnregister() {
|
||||
List<ObjectName> result = null;
|
||||
List<ObjectName> result;
|
||||
if (unregisterMBeanList != null) {
|
||||
result = new ArrayList<ObjectName>(unregisterMBeanList);
|
||||
} else {
|
||||
@ -397,7 +397,7 @@ public class RelationNotification extends Notification {
|
||||
* @return the old value of the updated role.
|
||||
*/
|
||||
public List<ObjectName> getOldRoleValue() {
|
||||
List<ObjectName> result = null;
|
||||
List<ObjectName> result;
|
||||
if (oldRoleValue != null) {
|
||||
result = new ArrayList<ObjectName>(oldRoleValue);
|
||||
} else {
|
||||
@ -412,7 +412,7 @@ public class RelationNotification extends Notification {
|
||||
* @return the new value of the updated role.
|
||||
*/
|
||||
public List<ObjectName> getNewRoleValue() {
|
||||
List<ObjectName> result = null;
|
||||
List<ObjectName> result;
|
||||
if (newRoleValue != null) {
|
||||
result = new ArrayList<ObjectName>(newRoleValue);
|
||||
} else {
|
||||
|
@ -35,6 +35,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.management.Attribute;
|
||||
@ -122,7 +123,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Internal counter to provide sequence numbers for notifications sent by:
|
||||
// - the Relation Service
|
||||
// - a relation handled by the Relation Service
|
||||
private Long myNtfSeqNbrCounter = new Long(0);
|
||||
private final AtomicLong atomicSeqNo = new AtomicLong();
|
||||
|
||||
// ObjectName used to register the Relation Service in the MBean Server
|
||||
private ObjectName myObjName = null;
|
||||
@ -256,19 +257,6 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
return;
|
||||
}
|
||||
|
||||
// Returns internal counter to be used for Sequence Numbers of
|
||||
// notifications to be raised by:
|
||||
// - a relation handled by this Relation Service (when updated)
|
||||
// - the Relation Service
|
||||
private Long getNotificationSequenceNumber() {
|
||||
Long result = null;
|
||||
synchronized(myNtfSeqNbrCounter) {
|
||||
result = new Long(myNtfSeqNbrCounter.longValue() + 1);
|
||||
myNtfSeqNbrCounter = new Long(result.longValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Relation type handling
|
||||
//
|
||||
@ -369,7 +357,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
* @return ArrayList of relation type names (Strings)
|
||||
*/
|
||||
public List<String> getAllRelationTypeNames() {
|
||||
ArrayList<String> result = null;
|
||||
ArrayList<String> result;
|
||||
synchronized(myRelType2ObjMap) {
|
||||
result = new ArrayList<String>(myRelType2ObjMap.keySet());
|
||||
}
|
||||
@ -684,7 +672,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw InstanceNotFoundException (but detected above)
|
||||
// No MBeanException as no exception raised by this method, and no
|
||||
// ReflectionException
|
||||
String relId = null;
|
||||
String relId;
|
||||
try {
|
||||
relId = (String)(myMBeanServer.getAttribute(relationObjectName,
|
||||
"RelationId"));
|
||||
@ -707,7 +695,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw InstanceNotFoundException (but detected above)
|
||||
// No MBeanException as no exception raised by this method, no
|
||||
// ReflectionException
|
||||
ObjectName relServObjName = null;
|
||||
ObjectName relServObjName;
|
||||
try {
|
||||
relServObjName = (ObjectName)
|
||||
(myMBeanServer.getAttribute(relationObjectName,
|
||||
@ -737,7 +725,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw InstanceNotFoundException (but detected above)
|
||||
// No MBeanException as no exception raised by this method, no
|
||||
// ReflectionException
|
||||
String relTypeName = null;
|
||||
String relTypeName;
|
||||
try {
|
||||
relTypeName = (String)(myMBeanServer.getAttribute(relationObjectName,
|
||||
"RelationTypeName"));
|
||||
@ -758,7 +746,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw InstanceNotFoundException (but detected above)
|
||||
// No MBeanException as no exception raised by this method, no
|
||||
// ReflectionException
|
||||
RoleList roleList = null;
|
||||
RoleList roleList;
|
||||
try {
|
||||
roleList = (RoleList)(myMBeanServer.invoke(relationObjectName,
|
||||
"retrieveAllRoles",
|
||||
@ -912,7 +900,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
* @return ArrayList of String
|
||||
*/
|
||||
public List<String> getAllRelationIds() {
|
||||
List<String> result = null;
|
||||
List<String> result;
|
||||
synchronized(myRelId2ObjMap) {
|
||||
result = new ArrayList<String>(myRelId2ObjMap.keySet());
|
||||
}
|
||||
@ -948,7 +936,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
RELATION_LOGGER.entering(RelationService.class.getName(),
|
||||
"checkRoleReading", new Object[] {roleName, relationTypeName});
|
||||
|
||||
Integer result = null;
|
||||
Integer result;
|
||||
|
||||
// Can throw a RelationTypeNotFoundException
|
||||
RelationType relType = getRelationType(relationTypeName);
|
||||
@ -965,7 +953,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
false);
|
||||
|
||||
} catch (RoleInfoNotFoundException exc) {
|
||||
result = new Integer(RoleStatus.NO_ROLE_WITH_NAME);
|
||||
result = Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
|
||||
}
|
||||
|
||||
RELATION_LOGGER.exiting(RelationService.class.getName(),
|
||||
@ -1021,13 +1009,13 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
writeChkFlag = false;
|
||||
}
|
||||
|
||||
RoleInfo roleInfo = null;
|
||||
RoleInfo roleInfo;
|
||||
try {
|
||||
roleInfo = relType.getRoleInfo(roleName);
|
||||
} catch (RoleInfoNotFoundException exc) {
|
||||
RELATION_LOGGER.exiting(RelationService.class.getName(),
|
||||
"checkRoleWriting");
|
||||
return new Integer(RoleStatus.NO_ROLE_WITH_NAME);
|
||||
return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
|
||||
}
|
||||
|
||||
Integer result = checkRoleInt(2,
|
||||
@ -1436,7 +1424,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
|
||||
// Relation id to relation type name map
|
||||
// First retrieves the relation type name
|
||||
String relTypeName = null;
|
||||
String relTypeName;
|
||||
synchronized(myRelId2RelTypeMap) {
|
||||
relTypeName = myRelId2RelTypeMap.get(relationId);
|
||||
myRelId2RelTypeMap.remove(relationId);
|
||||
@ -1641,7 +1629,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
|
||||
// List of relation ids of interest regarding the selected
|
||||
// relation type
|
||||
List<String> relIdList = null;
|
||||
List<String> relIdList;
|
||||
if (relationTypeName == null) {
|
||||
// Considers all relations
|
||||
relIdList = new ArrayList<String>(allRelIdSet);
|
||||
@ -1655,7 +1643,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
for (String currRelId : allRelIdSet) {
|
||||
|
||||
// Retrieves its relation type
|
||||
String currRelTypeName = null;
|
||||
String currRelTypeName;
|
||||
synchronized(myRelId2RelTypeMap) {
|
||||
currRelTypeName =
|
||||
myRelId2RelTypeMap.get(currRelId);
|
||||
@ -1952,7 +1940,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw a RelationNotFoundException
|
||||
Object relObj = getRelation(relationId);
|
||||
|
||||
RoleResult result = null;
|
||||
RoleResult result;
|
||||
|
||||
if (relObj instanceof RelationSupport) {
|
||||
// Internal relation
|
||||
@ -2022,7 +2010,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw a RelationNotFoundException
|
||||
Object relObj = getRelation(relationId);
|
||||
|
||||
RoleResult result = null;
|
||||
RoleResult result;
|
||||
|
||||
if (relObj instanceof RelationSupport) {
|
||||
// Internal relation
|
||||
@ -2073,7 +2061,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw a RelationNotFoundException
|
||||
Object relObj = getRelation(relationId);
|
||||
|
||||
Integer result = null;
|
||||
Integer result;
|
||||
|
||||
if (relObj instanceof RelationSupport) {
|
||||
// Internal relation
|
||||
@ -2268,7 +2256,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw a RelationNotFoundException
|
||||
Object relObj = getRelation(relationId);
|
||||
|
||||
RoleResult result = null;
|
||||
RoleResult result;
|
||||
|
||||
if (relObj instanceof RelationSupport) {
|
||||
// Internal relation
|
||||
@ -2390,7 +2378,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Can throw a RelationNotFoundException
|
||||
Object relObj = getRelation(relationId);
|
||||
|
||||
String result = null;
|
||||
String result;
|
||||
|
||||
if (relObj instanceof RelationSupport) {
|
||||
// Internal relation
|
||||
@ -2473,7 +2461,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
|
||||
// Note: do both tests as a relation can be an MBean and be
|
||||
// itself referenced in another relation :)
|
||||
String relId = null;
|
||||
String relId;
|
||||
synchronized(myRelMBeanObjName2RelIdMap){
|
||||
relId = myRelMBeanObjName2RelIdMap.get(mbeanName);
|
||||
}
|
||||
@ -2511,9 +2499,6 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
RELATION_LOGGER.entering(RelationService.class.getName(),
|
||||
"getNotificationInfo");
|
||||
|
||||
MBeanNotificationInfo[] ntfInfoArray =
|
||||
new MBeanNotificationInfo[1];
|
||||
|
||||
String ntfClass = "javax.management.relation.RelationNotification";
|
||||
|
||||
String[] ntfTypes = new String[] {
|
||||
@ -2615,7 +2600,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
"getRelationType", relationTypeName);
|
||||
|
||||
// No null relation type accepted, so can use get()
|
||||
RelationType relType = null;
|
||||
RelationType relType;
|
||||
synchronized(myRelType2ObjMap) {
|
||||
relType = (myRelType2ObjMap.get(relationTypeName));
|
||||
}
|
||||
@ -2659,7 +2644,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
"getRelation", relationId);
|
||||
|
||||
// No null relation accepted, so can use get()
|
||||
Object rel = null;
|
||||
Object rel;
|
||||
synchronized(myRelId2ObjMap) {
|
||||
rel = myRelId2ObjMap.get(relationId);
|
||||
}
|
||||
@ -3077,7 +3062,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Retrieves corresponding role info
|
||||
// Can throw a RoleInfoNotFoundException to be converted into a
|
||||
// RoleNotFoundException
|
||||
RoleInfo roleInfo = null;
|
||||
RoleInfo roleInfo;
|
||||
try {
|
||||
roleInfo = relType.getRoleInfo(currRoleName);
|
||||
} catch (RoleInfoNotFoundException exc) {
|
||||
@ -3227,7 +3212,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
if (!(roleName.equals(expName))) {
|
||||
RELATION_LOGGER.exiting(RelationService.class.getName(),
|
||||
"checkRoleInt");
|
||||
return new Integer(RoleStatus.NO_ROLE_WITH_NAME);
|
||||
return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
|
||||
}
|
||||
|
||||
// Checks read access if required
|
||||
@ -3236,7 +3221,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
if (!isReadable) {
|
||||
RELATION_LOGGER.exiting(RelationService.class.getName(),
|
||||
"checkRoleInt");
|
||||
return new Integer(RoleStatus.ROLE_NOT_READABLE);
|
||||
return Integer.valueOf(RoleStatus.ROLE_NOT_READABLE);
|
||||
} else {
|
||||
// End of check :)
|
||||
RELATION_LOGGER.exiting(RelationService.class.getName(),
|
||||
@ -3572,7 +3557,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Relation type name
|
||||
// Note: do not use getRelationTypeName() as if it is a relation MBean
|
||||
// it is already unregistered.
|
||||
String relTypeName = null;
|
||||
String relTypeName;
|
||||
synchronized(myRelId2RelTypeMap) {
|
||||
relTypeName = (myRelId2RelTypeMap.get(relationId));
|
||||
}
|
||||
@ -3609,7 +3594,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
}
|
||||
|
||||
// Sequence number
|
||||
Long seqNbr = getNotificationSequenceNumber();
|
||||
Long seqNo = atomicSeqNo.incrementAndGet();
|
||||
|
||||
// Timestamp
|
||||
Date currDate = new Date();
|
||||
@ -3625,7 +3610,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Creation or removal
|
||||
ntf = new RelationNotification(ntfType,
|
||||
this,
|
||||
seqNbr.longValue(),
|
||||
seqNo.longValue(),
|
||||
timeStamp,
|
||||
message,
|
||||
relationId,
|
||||
@ -3640,7 +3625,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
// Update
|
||||
ntf = new RelationNotification(ntfType,
|
||||
this,
|
||||
seqNbr.longValue(),
|
||||
seqNo.longValue(),
|
||||
timeStamp,
|
||||
message,
|
||||
relationId,
|
||||
@ -3732,7 +3717,7 @@ public class RelationService extends NotificationBroadcasterSupport
|
||||
//
|
||||
// Shall not throw RelationTypeNotFoundException or
|
||||
// RoleInfoNotFoundException
|
||||
RoleInfo currRoleInfo = null;
|
||||
RoleInfo currRoleInfo;
|
||||
try {
|
||||
currRoleInfo = getRoleInfo(currRelTypeName,
|
||||
currRoleName);
|
||||
|
@ -34,6 +34,7 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import static com.sun.jmx.defaults.JmxProperties.RELATION_LOGGER;
|
||||
import static com.sun.jmx.mbeanserver.Util.cast;
|
||||
import javax.management.InstanceNotFoundException;
|
||||
@ -110,7 +111,7 @@ public class RelationSupport
|
||||
private Map<String,Role> myRoleName2ValueMap = new HashMap<String,Role>();
|
||||
|
||||
// Flag to indicate if the object has been added in the Relation Service
|
||||
private Boolean myInRelServFlg = null;
|
||||
private final AtomicBoolean myInRelServFlg = new AtomicBoolean();
|
||||
|
||||
//
|
||||
// Constructors
|
||||
@ -403,7 +404,7 @@ public class RelationSupport
|
||||
"getRoleCardinality", roleName);
|
||||
|
||||
// Try to retrieve the role
|
||||
Role role = null;
|
||||
Role role;
|
||||
synchronized(myRoleName2ValueMap) {
|
||||
// No null Role is allowed, so direct use of get()
|
||||
role = (myRoleName2ValueMap.get(roleName));
|
||||
@ -427,7 +428,7 @@ public class RelationSupport
|
||||
|
||||
RELATION_LOGGER.exiting(RelationSupport.class.getName(),
|
||||
"getRoleCardinality");
|
||||
return new Integer(roleValue.size());
|
||||
return roleValue.size();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -701,11 +702,7 @@ public class RelationSupport
|
||||
* the Relation Service.
|
||||
*/
|
||||
public Boolean isInRelationService() {
|
||||
Boolean result = null;
|
||||
synchronized(myInRelServFlg) {
|
||||
result = Boolean.valueOf(myInRelServFlg.booleanValue());
|
||||
}
|
||||
return result;
|
||||
return myInRelServFlg.get();
|
||||
}
|
||||
|
||||
public void setRelationServiceManagementFlag(Boolean flag)
|
||||
@ -715,10 +712,7 @@ public class RelationSupport
|
||||
String excMsg = "Invalid parameter.";
|
||||
throw new IllegalArgumentException(excMsg);
|
||||
}
|
||||
synchronized(myInRelServFlg) {
|
||||
myInRelServFlg = Boolean.valueOf(flag.booleanValue());
|
||||
}
|
||||
return;
|
||||
myInRelServFlg.set(flag);
|
||||
}
|
||||
|
||||
//
|
||||
@ -790,7 +784,7 @@ public class RelationSupport
|
||||
|
||||
int pbType = 0;
|
||||
|
||||
Role role = null;
|
||||
Role role;
|
||||
synchronized(myRoleName2ValueMap) {
|
||||
// No null Role is allowed, so direct use of get()
|
||||
role = (myRoleName2ValueMap.get(roleName));
|
||||
@ -801,7 +795,7 @@ public class RelationSupport
|
||||
|
||||
} else {
|
||||
// Checks if the role is readable
|
||||
Integer status = null;
|
||||
Integer status;
|
||||
|
||||
if (relationServCallFlg) {
|
||||
|
||||
@ -851,7 +845,7 @@ public class RelationSupport
|
||||
pbType = status.intValue();
|
||||
}
|
||||
|
||||
Object result = null;
|
||||
Object result;
|
||||
|
||||
if (pbType == 0) {
|
||||
// Role can be retrieved
|
||||
@ -937,7 +931,7 @@ public class RelationSupport
|
||||
for (int i = 0; i < roleNameArray.length; i++) {
|
||||
String currRoleName = roleNameArray[i];
|
||||
|
||||
Object currResult = null;
|
||||
Object currResult;
|
||||
|
||||
// Can throw RelationServiceNotRegisteredException
|
||||
//
|
||||
@ -1102,13 +1096,13 @@ public class RelationSupport
|
||||
// handle initialization of role when creating the relation
|
||||
// (roles provided in the RoleList parameter are directly set but
|
||||
// roles automatically initialized are set using setRole())
|
||||
Role role = null;
|
||||
Role role;
|
||||
synchronized(myRoleName2ValueMap) {
|
||||
role = (myRoleName2ValueMap.get(roleName));
|
||||
}
|
||||
|
||||
List<ObjectName> oldRoleValue;
|
||||
Boolean initFlg = null;
|
||||
Boolean initFlg;
|
||||
|
||||
if (role == null) {
|
||||
initFlg = true;
|
||||
@ -1122,7 +1116,7 @@ public class RelationSupport
|
||||
// Checks if the role can be set: is writable (except if
|
||||
// initialization) and correct value
|
||||
try {
|
||||
Integer status = null;
|
||||
Integer status;
|
||||
|
||||
if (relationServCallFlg) {
|
||||
|
||||
@ -1314,7 +1308,7 @@ public class RelationSupport
|
||||
Object[] params = new Object[3];
|
||||
params[0] = myRelId;
|
||||
params[1] = newRole;
|
||||
params[2] = ((ArrayList)oldRoleValue);
|
||||
params[2] = oldRoleValue;
|
||||
String[] signature = new String[3];
|
||||
signature[0] = "java.lang.String";
|
||||
signature[1] = "javax.management.relation.Role";
|
||||
@ -1598,7 +1592,6 @@ public class RelationSupport
|
||||
myRelTypeName = relationTypeName;
|
||||
// Can throw InvalidRoleValueException
|
||||
initRoleMap(list);
|
||||
myInRelServFlg = Boolean.FALSE;
|
||||
|
||||
RELATION_LOGGER.exiting(RelationSupport.class.getName(), "initMembers");
|
||||
return;
|
||||
@ -1710,7 +1703,7 @@ public class RelationSupport
|
||||
roleName, relationServCallFlg, relationServ});
|
||||
|
||||
// Retrieves current role value
|
||||
Role role = null;
|
||||
Role role;
|
||||
synchronized(myRoleName2ValueMap) {
|
||||
role = (myRoleName2ValueMap.get(roleName));
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ public class JMXConnectorFactory {
|
||||
|
||||
Iterator<JMXConnectorProvider> providers =
|
||||
getProviderIterator(JMXConnectorProvider.class, loader);
|
||||
JMXConnector connection = null;
|
||||
JMXConnector connection;
|
||||
IOException exception = null;
|
||||
while(providers.hasNext()) {
|
||||
try {
|
||||
@ -450,7 +450,7 @@ public class JMXConnectorFactory {
|
||||
"] Service provider exception: " + e);
|
||||
if (!(e instanceof MalformedURLException)) {
|
||||
if (exception == null) {
|
||||
if (exception instanceof IOException) {
|
||||
if (e instanceof IOException) {
|
||||
exception = (IOException) e;
|
||||
} else {
|
||||
exception = EnvHelp.initCause(
|
||||
|
@ -215,12 +215,10 @@ public class JMXConnectorServerFactory {
|
||||
JMXConnectorFactory.
|
||||
getProviderIterator(JMXConnectorServerProvider.class, loader);
|
||||
|
||||
JMXConnectorServer connection = null;
|
||||
IOException exception = null;
|
||||
while (providers.hasNext()) {
|
||||
try {
|
||||
connection = providers.next().newJMXConnectorServer(url, map, mbs);
|
||||
return connection;
|
||||
return providers.next().newJMXConnectorServer(url, map, mbs);
|
||||
} catch (JMXProviderException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
@ -230,7 +228,7 @@ public class JMXConnectorServerFactory {
|
||||
"] Service provider exception: " + e);
|
||||
if (!(e instanceof MalformedURLException)) {
|
||||
if (exception == null) {
|
||||
if (exception instanceof IOException) {
|
||||
if (e instanceof IOException) {
|
||||
exception = (IOException) e;
|
||||
} else {
|
||||
exception = EnvHelp.initCause(
|
||||
|
@ -162,8 +162,6 @@ public class JMXServiceURL implements Serializable {
|
||||
requiredPrefix);
|
||||
}
|
||||
|
||||
int[] ptr = new int[1];
|
||||
|
||||
// Parse the protocol name
|
||||
final int protoStart = requiredPrefixLength;
|
||||
final int protoEnd = indexOf(serviceURL, ':', protoStart);
|
||||
@ -664,11 +662,6 @@ public class JMXServiceURL implements Serializable {
|
||||
hostNameBitSet.set('.');
|
||||
}
|
||||
|
||||
private static void addCharsToBitSet(BitSet set, String chars) {
|
||||
for (int i = 0; i < chars.length(); i++)
|
||||
set.set(chars.charAt(i));
|
||||
}
|
||||
|
||||
/**
|
||||
* The value returned by {@link #getProtocol()}.
|
||||
*/
|
||||
|
@ -1376,12 +1376,12 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
||||
|
||||
protected Integer addListenerForMBeanRemovedNotif()
|
||||
throws IOException, InstanceNotFoundException {
|
||||
MarshalledObject<NotificationFilter> sFilter = null;
|
||||
NotificationFilterSupport clientFilter =
|
||||
new NotificationFilterSupport();
|
||||
clientFilter.enableType(
|
||||
MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
|
||||
sFilter = new MarshalledObject<NotificationFilter>(clientFilter);
|
||||
MarshalledObject<NotificationFilter> sFilter =
|
||||
new MarshalledObject<NotificationFilter>(clientFilter);
|
||||
|
||||
Integer[] listenerIDs;
|
||||
final ObjectName[] names =
|
||||
@ -1434,7 +1434,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
||||
connectionId,
|
||||
clientNotifCounter++,
|
||||
message,
|
||||
new Long(number));
|
||||
Long.valueOf(number));
|
||||
sendNotification(n);
|
||||
}
|
||||
}
|
||||
@ -1593,7 +1593,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
||||
|
||||
protected void doStart() throws IOException {
|
||||
// Get RMIServer stub from directory or URL encoding if needed.
|
||||
RMIServer stub = null;
|
||||
RMIServer stub;
|
||||
try {
|
||||
stub = (rmiServer!=null)?rmiServer:
|
||||
findRMIServer(jmxServiceURL, env);
|
||||
@ -2532,7 +2532,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
||||
* A static WeakReference to an {@link org.omg.CORBA.ORB ORB} to
|
||||
* connect unconnected stubs.
|
||||
**/
|
||||
private static WeakReference<ORB> orb = null;
|
||||
private static volatile WeakReference<ORB> orb = null;
|
||||
|
||||
// TRACES & DEBUG
|
||||
//---------------
|
||||
|
@ -365,7 +365,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
|
||||
// Access file property specified, create an instance
|
||||
// of the MBeanServerFileAccessController class
|
||||
//
|
||||
MBeanServerForwarder mbsf = null;
|
||||
MBeanServerForwarder mbsf;
|
||||
try {
|
||||
mbsf = new MBeanServerFileAccessController(accessFile);
|
||||
} catch (IOException e) {
|
||||
|
@ -344,13 +344,11 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
//
|
||||
if (isActive == true) {
|
||||
|
||||
TimerAlarmClock alarmClock;
|
||||
|
||||
for (Object[] obj : timerTable.values()) {
|
||||
|
||||
// Stop all the TimerAlarmClock.
|
||||
//
|
||||
alarmClock = (TimerAlarmClock)obj[ALARM_CLOCK_INDEX];
|
||||
TimerAlarmClock alarmClock = (TimerAlarmClock)obj[ALARM_CLOCK_INDEX];
|
||||
if (alarmClock != null) {
|
||||
// alarmClock.interrupt();
|
||||
// try {
|
||||
@ -364,7 +362,6 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
// //
|
||||
|
||||
alarmClock.cancel();
|
||||
alarmClock = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,8 +455,7 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
|
||||
// Create and add the timer notification into the timer table.
|
||||
//
|
||||
Integer notifID = null;
|
||||
notifID = new Integer(++counterID);
|
||||
Integer notifID = Integer.valueOf(++counterID);
|
||||
|
||||
// The sequenceNumber and the timeStamp attributes are updated
|
||||
// when the notification is emitted by the timer.
|
||||
@ -486,8 +482,8 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
|
||||
obj[TIMER_NOTIF_INDEX] = (Object)notif;
|
||||
obj[TIMER_DATE_INDEX] = (Object)d;
|
||||
obj[TIMER_PERIOD_INDEX] = (Object) new Long(period);
|
||||
obj[TIMER_NB_OCCUR_INDEX] = (Object) new Long(nbOccurences);
|
||||
obj[TIMER_PERIOD_INDEX] = (Object) period;
|
||||
obj[TIMER_NB_OCCUR_INDEX] = (Object) nbOccurences;
|
||||
obj[ALARM_CLOCK_INDEX] = (Object)alarmClock;
|
||||
obj[FIXED_RATE_INDEX] = Boolean.valueOf(fixedRate);
|
||||
|
||||
@ -678,7 +674,6 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
// // Remove the reference on the TimerAlarmClock.
|
||||
// //
|
||||
alarmClock.cancel();
|
||||
alarmClock = null;
|
||||
}
|
||||
|
||||
// Remove the timer notification from the timer table.
|
||||
@ -755,7 +750,6 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
//
|
||||
// }
|
||||
alarmClock.cancel();
|
||||
alarmClock = null;
|
||||
}
|
||||
|
||||
// Remove all the timer notifications from the timer table.
|
||||
@ -906,8 +900,7 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
|
||||
Object[] obj = timerTable.get(id);
|
||||
if (obj != null) {
|
||||
Long period = (Long)obj[TIMER_PERIOD_INDEX];
|
||||
return (new Long(period.longValue()));
|
||||
return (Long)obj[TIMER_PERIOD_INDEX];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -924,8 +917,7 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
|
||||
Object[] obj = timerTable.get(id);
|
||||
if (obj != null) {
|
||||
Long nbOccurences = (Long)obj[TIMER_NB_OCCUR_INDEX];
|
||||
return (new Long(nbOccurences.longValue()));
|
||||
return (Long)obj[TIMER_NB_OCCUR_INDEX];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1096,7 +1088,7 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
if ((nbOccurences.longValue() == 0) || (nbOccurences.longValue() > 1)) {
|
||||
|
||||
date.setTime(date.getTime() + period.longValue());
|
||||
obj[TIMER_NB_OCCUR_INDEX] = new Long(java.lang.Math.max(0L, (nbOccurences.longValue() - 1)));
|
||||
obj[TIMER_NB_OCCUR_INDEX] = Long.valueOf(java.lang.Math.max(0L, (nbOccurences.longValue() - 1)));
|
||||
nbOccurences = (Long)obj[TIMER_NB_OCCUR_INDEX];
|
||||
|
||||
if (isActive == true) {
|
||||
@ -1146,9 +1138,6 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
// // Ignore...
|
||||
// }
|
||||
alarmClock.cancel();
|
||||
// Remove the reference on the TimerAlarmClock.
|
||||
//
|
||||
alarmClock = null;
|
||||
}
|
||||
timerTable.remove(notifID);
|
||||
}
|
||||
@ -1165,10 +1154,6 @@ public class Timer extends NotificationBroadcasterSupport
|
||||
// }
|
||||
|
||||
alarmClock.cancel();
|
||||
|
||||
// Remove the reference on the TimerAlarmClock.
|
||||
//
|
||||
alarmClock = null;
|
||||
}
|
||||
timerTable.remove(notifID);
|
||||
}
|
||||
|
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6701459
|
||||
* @summary Test sequence numbers in RelationService notifications.
|
||||
* @author Eamonn McManus
|
||||
*/
|
||||
|
||||
/*
|
||||
* Bug 6701459 is for a synchronization problem that is very unlikely to occur
|
||||
* in practice and it would be very hard to test it. Instead we just check that
|
||||
* the fix has not introduced any obviously-wrong behavior in the sequence
|
||||
* numbers.
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import javax.management.JMX;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerFactory;
|
||||
import javax.management.Notification;
|
||||
import javax.management.NotificationListener;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.relation.RelationServiceMBean;
|
||||
import javax.management.relation.Role;
|
||||
import javax.management.relation.RoleInfo;
|
||||
import javax.management.relation.RoleList;
|
||||
|
||||
public class RelationNotificationSeqNoTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
|
||||
ObjectName relSvcName = new ObjectName("a:type=relationService");
|
||||
RelationServiceMBean relSvc =
|
||||
JMX.newMBeanProxy(mbs, relSvcName, RelationServiceMBean.class);
|
||||
mbs.createMBean("javax.management.relation.RelationService",
|
||||
relSvcName,
|
||||
new Object[] {Boolean.TRUE},
|
||||
new String[] {"boolean"});
|
||||
|
||||
final BlockingQueue<Notification> q =
|
||||
new ArrayBlockingQueue<Notification>(100);
|
||||
NotificationListener qListener = new NotificationListener() {
|
||||
public void handleNotification(Notification notification,
|
||||
Object handback) {
|
||||
q.add(notification);
|
||||
}
|
||||
};
|
||||
mbs.addNotificationListener(relSvcName, qListener, null, null);
|
||||
|
||||
RoleInfo leftInfo =
|
||||
new RoleInfo("left", "javax.management.timer.TimerMBean");
|
||||
RoleInfo rightInfo =
|
||||
new RoleInfo("right", "javax.management.timer.Timer");
|
||||
relSvc.createRelationType("typeName", new RoleInfo[] {leftInfo, rightInfo});
|
||||
ObjectName timer1 = new ObjectName("a:type=timer,number=1");
|
||||
ObjectName timer2 = new ObjectName("a:type=timer,number=2");
|
||||
mbs.createMBean("javax.management.timer.Timer", timer1);
|
||||
mbs.createMBean("javax.management.timer.Timer", timer2);
|
||||
|
||||
Role leftRole =
|
||||
new Role("left", Arrays.asList(new ObjectName[] {timer1}));
|
||||
Role rightRole =
|
||||
new Role("right", Arrays.asList(new ObjectName[] {timer2}));
|
||||
RoleList roles =
|
||||
new RoleList(Arrays.asList(new Role[] {leftRole, rightRole}));
|
||||
|
||||
final int NREPEAT = 10;
|
||||
|
||||
for (int i = 0; i < NREPEAT; i++) {
|
||||
relSvc.createRelation("relationName", "typeName", roles);
|
||||
relSvc.removeRelation("relationName");
|
||||
}
|
||||
|
||||
Notification firstNotif = q.remove();
|
||||
long seqNo = firstNotif.getSequenceNumber();
|
||||
for (int i = 0; i < NREPEAT * 2 - 1; i++) {
|
||||
Notification n = q.remove();
|
||||
long nSeqNo = n.getSequenceNumber();
|
||||
if (nSeqNo != seqNo + 1) {
|
||||
throw new Exception(
|
||||
"TEST FAILED: expected seqNo " + (seqNo + 1) + "; got " +
|
||||
nSeqNo);
|
||||
}
|
||||
seqNo++;
|
||||
}
|
||||
System.out.println("TEST PASSED: got " + (NREPEAT * 2) + " notifications " +
|
||||
"with contiguous sequence numbers");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user