⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rmiconnectionimpl.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            if (e instanceof AttributeNotFoundException)                throw (AttributeNotFoundException) e;            if (e instanceof InvalidAttributeValueException)                throw (InvalidAttributeValueException) e;            if (e instanceof MBeanException)                throw (MBeanException) e;            if (e instanceof ReflectionException)                throw (ReflectionException) e;            if (e instanceof IOException)                throw (IOException) e;            throw newIOException("Got unexpected server exception: " + e, e);        }    }    public AttributeList setAttributes(ObjectName name,                         MarshalledObject attributes,                         Subject delegationSubject)        throws        InstanceNotFoundException,        ReflectionException,        IOException {        final AttributeList attrlist;        final boolean debug=logger.debugOn();	if (debug) logger.debug("setAttributes",                 "connectionId=" + connectionId                 +" unwrapping attributes with MBean extended ClassLoader.");	attrlist =	    unwrap(attributes,		   getClassLoaderFor(name),		   defaultClassLoader,                   AttributeList.class);        try {            final Object params[] = new Object[] { name, attrlist };            if (debug) logger.debug("setAttributes",                             "connectionId=" + connectionId                             +", name="+name                             +", attributes="+attrlist);            return (AttributeList)                doPrivilegedOperation(                  SET_ATTRIBUTES,                  params,                  delegationSubject);        } catch (PrivilegedActionException pe) {            Exception e = extractException(pe);            if (e instanceof InstanceNotFoundException)                throw (InstanceNotFoundException) e;            if (e instanceof ReflectionException)                throw (ReflectionException) e;            if (e instanceof IOException)                throw (IOException) e;            throw newIOException("Got unexpected server exception: " + e, e);        }    }    public Object invoke(ObjectName name,                         String operationName,                         MarshalledObject params,                         String signature[],                         Subject delegationSubject)        throws        InstanceNotFoundException,        MBeanException,        ReflectionException,        IOException {	checkNonNull("ObjectName", name);	checkNonNull("Operation name", operationName);        final Object[] values;        final boolean debug=logger.debugOn();	if (debug) logger.debug("invoke",                 "connectionId=" + connectionId                 +" unwrapping params with MBean extended ClassLoader.");	values = nullIsEmpty(unwrap(params,                                    getClassLoaderFor(name),                                     defaultClassLoader,                                    Object[].class));        try {            final Object params2[] =                new Object[] { name, operationName, values,			       nullIsEmpty(signature) };            if (debug) logger.debug("invoke",                             "connectionId=" + connectionId                             +", name="+name                             +", operationName="+operationName                             +", params="+objects(values)                             +", signature="+strings(signature));            return (Object)                doPrivilegedOperation(                  INVOKE,                  params2,                  delegationSubject);        } catch (PrivilegedActionException pe) {            Exception e = extractException(pe);            if (e instanceof InstanceNotFoundException)                throw (InstanceNotFoundException) e;            if (e instanceof MBeanException)                throw (MBeanException) e;            if (e instanceof ReflectionException)                throw (ReflectionException) e;            if (e instanceof IOException)                throw (IOException) e;            throw newIOException("Got unexpected server exception: " + e, e);        }    }    public String getDefaultDomain(Subject delegationSubject)        throws IOException {        try {            final Object params[] = new Object[] { };            if (logger.debugOn())  logger.debug("getDefaultDomain",                                    "connectionId=" + connectionId);            return (String)                doPrivilegedOperation(                  GET_DEFAULT_DOMAIN,                  params,                  delegationSubject);        } catch (PrivilegedActionException pe) {            Exception e = extractException(pe);            if (e instanceof IOException)                throw (IOException) e;            throw newIOException("Got unexpected server exception: " + e, e);        }    }    public String[] getDomains(Subject delegationSubject) throws IOException {        try {            final Object params[] = new Object[] { };            if (logger.debugOn())  logger.debug("getDomains",                                    "connectionId=" + connectionId);            return (String[])                doPrivilegedOperation(                  GET_DOMAINS,                  params,                  delegationSubject);        } catch (PrivilegedActionException pe) {            Exception e = extractException(pe);            if (e instanceof IOException)                throw (IOException) e;            throw newIOException("Got unexpected server exception: " + e, e);        }    }    public MBeanInfo getMBeanInfo(ObjectName name, Subject delegationSubject)        throws        InstanceNotFoundException,        IntrospectionException,        ReflectionException,        IOException {	checkNonNull("ObjectName", name);        try {            final Object params[] = new Object[] { name };            if (logger.debugOn())  logger.debug("getMBeanInfo",                                    "connectionId=" + connectionId                                    +", name="+name);            return (MBeanInfo)                doPrivilegedOperation(                  GET_MBEAN_INFO,                  params,                  delegationSubject);        } catch (PrivilegedActionException pe) {            Exception e = extractException(pe);            if (e instanceof InstanceNotFoundException)                throw (InstanceNotFoundException) e;            if (e instanceof IntrospectionException)                throw (IntrospectionException) e;            if (e instanceof ReflectionException)                throw (ReflectionException) e;            if (e instanceof IOException)                throw (IOException) e;            throw newIOException("Got unexpected server exception: " + e, e);        }    }    public boolean isInstanceOf(ObjectName name,                                String className,                                Subject delegationSubject)        throws InstanceNotFoundException, IOException {	checkNonNull("ObjectName", name);        try {            final Object params[] = new Object[] { name, className };            if (logger.debugOn())  logger.debug("isInstanceOf",                                    "connectionId=" + connectionId                                    +", name="+name                                    +", className="+className);            return ((Boolean)                doPrivilegedOperation(                  IS_INSTANCE_OF,                  params,                  delegationSubject)).booleanValue();        } catch (PrivilegedActionException pe) {            Exception e = extractException(pe);            if (e instanceof InstanceNotFoundException)                throw (InstanceNotFoundException) e;            if (e instanceof IOException)                throw (IOException) e;            throw newIOException("Got unexpected server exception: " + e, e);        }    }        public Integer[] addNotificationListeners(ObjectName[] names,                      MarshalledObject[] filters,                      Subject[] delegationSubjects)	    throws InstanceNotFoundException, IOException {	if (names == null || filters == null) {	    throw new IllegalArgumentException("Got null arguments.");	}	Subject[] sbjs = (delegationSubjects != null) ? delegationSubjects : 	new Subject[names.length];	if (names.length != filters.length || filters.length != sbjs.length) {	    final String msg = 		"The value lengths of 3 parameters are not same.";	    throw new IllegalArgumentException(msg);	}	for (int i=0; i<names.length; i++) {	    if (names[i] == null) {		throw new IllegalArgumentException("Null Object name.");	    }	}	int i=0;	ClassLoader targetCl;	NotificationFilter[] filterValues = 	new NotificationFilter[names.length];	Object params[];	Integer[] ids = new Integer[names.length];	final boolean debug=logger.debugOn(); 	try {	    for (; i<names.length; i++) {		targetCl = getClassLoaderFor(names[i]);		if (debug) logger.debug("addNotificationListener"+					"(ObjectName,NotificationFilter)",					"connectionId=" + connectionId +		      " unwrapping filter with target extended ClassLoader.");		filterValues[i] =                    unwrap(filters[i], targetCl, defaultClassLoader,                           NotificationFilter.class);		if (debug) logger.debug("addNotificationListener"+					"(ObjectName,NotificationFilter)",					"connectionId=" + connectionId					+", name=" + names[i]					+", filter=" + filterValues[i]);		ids[i] = (Integer)		    doPrivilegedOperation(ADD_NOTIFICATION_LISTENERS,					  new Object[] { names[i], 							 filterValues[i] },					  sbjs[i]);	    }	    return ids;	} catch (Exception e) {	    // remove all registered listeners	    for (int j=0; j<i; j++) {		try {		    getServerNotifFwd().removeNotificationListener(names[j], 								   ids[j]);		} catch (Exception eee) {		    // strange		}	    }			    if (e instanceof PrivilegedActionException) {		e = extractException(e);	    }	    if (e instanceof ClassCastException) {		throw (ClassCastException) e;	    } else if (e instanceof IOException) {		throw (IOException)e;	    } else if (e instanceof InstanceNotFoundException) {		throw (InstanceNotFoundException) e;	    } else if (e instanceof RuntimeException) {		throw (RuntimeException) e;	    } else {		throw newIOException("Got unexpected server exception: "+e,e);	    }	}    }    public void addNotificationListener(ObjectName name,                       ObjectName listener,                       MarshalledObject filter,                       MarshalledObject handback,                       Subject delegationSubject)        throws InstanceNotFoundException, IOException {	checkNonNull("Target MBean name", name);	checkNonNull("Listener MBean name", listener);        final NotificationFilter filterValue;        final Object handbackValue;        final boolean debug=logger.debugOn();	final ClassLoader targetCl = getClassLoaderFor(name);	if (debug) logger.debug("addNotificationListener"+                 "(ObjectName,ObjectName,NotificationFilter,Object)",                 "connectionId=" + connectionId                 +" unwrapping filter with target extended ClassLoader.");	filterValue =            unwrap(filter, targetCl, defaultClassLoader, NotificationFilter.class);	if (debug) logger.debug("addNotificationListener"+                 "(ObjectName,ObjectName,NotificationFilter,Object)",                 "connectionId=" + connectionId                 +" unwrapping handback with target extended ClassLoader.");	handbackValue =            unwrap(handback, targetCl, defaultClassLoader, Object.class);        try {            final Object params[] =                new Object[] { name, listener, filterValue, handbackValue };

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -