本文整理汇总了Java中com.sun.jmx.mbeanserver.Util.cast方法的典型用法代码示例。如果您正苦于以下问题:Java Util.cast方法的具体用法?Java Util.cast怎么用?Java Util.cast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.mbeanserver.Util
的用法示例。
在下文中一共展示了Util.cast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInputArguments
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
static String[] getInputArguments(Object userData) {
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getInputArguments";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final List<String> l = getRuntimeMXBean().getInputArguments();
final String[] args = l.toArray(new String[0]);
if (m != null) m.put(tag,args);
return args;
}
示例2: getLibraryPath
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
static String[] getLibraryPath(Object userData) {
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getLibraryPath";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final String[] args = splitPath(getRuntimeMXBean().getLibraryPath());
if (m != null) m.put(tag,args);
return args;
}
示例3: addListenerWithSubject
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
private Integer addListenerWithSubject(ObjectName name,
MarshalledObject<NotificationFilter> filter,
Subject delegationSubject,
boolean reconnect)
throws InstanceNotFoundException, IOException {
final boolean debug = logger.debugOn();
if (debug)
logger.debug("addListenerWithSubject",
"(ObjectName,MarshalledObject,Subject)");
final ObjectName[] names = new ObjectName[] {name};
final MarshalledObject<NotificationFilter>[] filters =
Util.cast(new MarshalledObject<?>[] {filter});
final Subject[] delegationSubjects = new Subject[] {
delegationSubject
};
final Integer[] listenerIDs =
addListenersWithSubjects(names,filters,delegationSubjects,
reconnect);
if (debug) logger.debug("addListenerWithSubject","listenerID="
+ listenerIDs[0]);
return listenerIDs[0];
}
示例4: getClassPath
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
static String[] getClassPath(Object userData) {
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getClassPath";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final String[] args = splitPath(getRuntimeMXBean().getClassPath());
if (m != null) m.put(tag,args);
return args;
}
示例5: getMemoryPools
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* Get the list of memory pool associated with the
* given MemoryManagerMXBean.
**/
protected String[] getMemoryPools(Object userData,
MemoryManagerMXBean mmm, long mmarc) {
final String listTag =
"JvmMemManager." + mmarc + ".getMemoryPools";
String[] result=null;
if (userData instanceof Map) {
result = (String[])((Map)userData).get(listTag);
if (result != null) return result;
}
if (mmm!=null) {
result = mmm.getMemoryPoolNames();
}
if ((result!=null)&&(userData instanceof Map)) {
Map<Object, Object> map = Util.cast(userData);
map.put(listTag,result);
}
return result;
}
示例6: getBootClassPath
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
static String[] getBootClassPath(Object userData) {
if (!getRuntimeMXBean().isBootClassPathSupported())
return new String[0];
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getBootClassPath";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final String[] args = splitPath(getRuntimeMXBean().getBootClassPath());
if (m != null) m.put(tag,args);
return args;
}
示例7: updateCachedDatas
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* Update cahed datas.
* Obtains a {@link List} of raw datas by calling
* {@link #getRawDatas(Map,String) getRawDatas((Map)context,getRawDatasKey())}.<br>
* Then allocate a new {@link TreeMap} to serve as temporary map between
* names and indexes, and call {@link #updateCachedDatas(Object,List)}
* with that temporary map as context.<br>
* Finally replaces the {@link #names} TreeMap by the temporary
* TreeMap.
* @param context The request contextual cache allocated by the
* {@link JvmContextFactory}.
**/
protected SnmpCachedData updateCachedDatas(Object context) {
final Map<Object, Object> userData =
(context instanceof Map)?Util.<Map<Object, Object>>cast(context):null;
// Look for memory manager list in request contextual cache.
final List<?> rawDatas = getRawDatas(userData,getRawDatasKey());
log.debug("updateCachedDatas","rawDatas.size()=" +
((rawDatas==null)?"<no data>":""+rawDatas.size()));
TreeMap<String,SnmpOid> ctxt = new TreeMap<>();
final SnmpCachedData result =
super.updateCachedDatas(ctxt,rawDatas);
names = ctxt;
return result;
}
示例8: updateCachedDatas
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* Update cahed datas.
* Obtains a {@link List} of raw datas by calling
* {@link #getRawDatas(Map,String) getRawDatas((Map)context,getRawDatasKey())}.<br>
* Then allocate a new {@link TreeMap} to serve as temporary map between
* names and indexes, and call {@link #updateCachedDatas(Object,List)}
* with that temporary map as context.<br>
* Finally replaces the {@link #names} TreeMap by the temporary
* TreeMap.
* @param context The request contextual cache allocated by the
* {@link JvmContextFactory}.
**/
protected SnmpCachedData updateCachedDatas(Object context) {
final Map<Object, Object> userData =
(context instanceof Map)?Util.<Map<Object, Object>>cast(context):null;
// Look for memory manager list in request contextual cache.
final List rawDatas = getRawDatas(userData,getRawDatasKey());
log.debug("updateCachedDatas","rawDatas.size()=" +
((rawDatas==null)?"<no data>":""+rawDatas.size()));
TreeMap ctxt = new TreeMap();
final SnmpCachedData result =
super.updateCachedDatas(ctxt,rawDatas);
names = ctxt;
return result;
}
示例9: getUserData
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
public static Map<Object, Object> getUserData() {
final Object userData =
com.sun.jmx.snmp.ThreadContext.get("SnmpUserData");
if (userData instanceof Map<?, ?>) return Util.cast(userData);
else return null;
}
示例10: construct
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* Make a DynamicMBean out of <var>implementation</var>, using the
* specified <var>mbeanInterface</var> class.
* @param implementation The implementation of this MBean.
* If <code>null</code>, and null implementation is allowed,
* then the implementation is assumed to be <var>this</var>.
* @param mbeanInterface The Management Interface exported by this
* MBean's implementation. If <code>null</code>, then this
* object will use standard JMX design pattern to determine
* the management interface associated with the given
* implementation.
* @param nullImplementationAllowed <code>true</code> if a null
* implementation is allowed. If null implementation is allowed,
* and a null implementation is passed, then the implementation
* is assumed to be <var>this</var>.
* @exception IllegalArgumentException if the given
* <var>implementation</var> is null, and null is not allowed.
**/
private <T> void construct(T implementation, Class<T> mbeanInterface,
boolean nullImplementationAllowed,
boolean isMXBean)
throws NotCompliantMBeanException {
if (implementation == null) {
// Have to use (T)this rather than mbeanInterface.cast(this)
// because mbeanInterface might be null.
if (nullImplementationAllowed)
implementation = Util.<T>cast(this);
else throw new IllegalArgumentException("implementation is null");
}
if (isMXBean) {
if (mbeanInterface == null) {
mbeanInterface = Util.cast(Introspector.getMXBeanInterface(
implementation.getClass()));
}
this.mbean = new MXBeanSupport(implementation, mbeanInterface);
} else {
if (mbeanInterface == null) {
mbeanInterface = Util.cast(Introspector.getStandardMBeanInterface(
implementation.getClass()));
}
this.mbean =
new StandardMBeanSupport(implementation, mbeanInterface);
}
}
示例11: initialize
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* Initialize this <code>LoginModule</code>.
*
* @param subject the <code>Subject</code> to be authenticated.
* @param callbackHandler a <code>CallbackHandler</code> to acquire the
* user's name and password.
* @param sharedState shared <code>LoginModule</code> state.
* @param options options specified in the login
* <code>Configuration</code> for this particular
* <code>LoginModule</code>.
*/
public void initialize(Subject subject, CallbackHandler callbackHandler,
Map<String,?> sharedState,
Map<String,?> options)
{
this.subject = subject;
this.callbackHandler = callbackHandler;
this.sharedState = Util.cast(sharedState);
this.options = options;
// initialize any configured options
tryFirstPass =
"true".equalsIgnoreCase((String)options.get("tryFirstPass"));
useFirstPass =
"true".equalsIgnoreCase((String)options.get("useFirstPass"));
storePass =
"true".equalsIgnoreCase((String)options.get("storePass"));
clearPass =
"true".equalsIgnoreCase((String)options.get("clearPass"));
passwordFile = (String)options.get("passwordFile");
passwordFileDisplayName = passwordFile;
userSuppliedPasswordFile = true;
// set the location of the password file
if (passwordFile == null) {
passwordFile = DEFAULT_PASSWORD_FILE_NAME;
userSuppliedPasswordFile = false;
try {
System.getProperty("java.home");
hasJavaHomePermission = true;
passwordFileDisplayName = passwordFile;
} catch (SecurityException e) {
hasJavaHomePermission = false;
passwordFileDisplayName =
ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
}
}
}
示例12: addListenerForMBeanRemovedNotif
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
protected Integer addListenerForMBeanRemovedNotif()
throws IOException, InstanceNotFoundException {
NotificationFilterSupport clientFilter =
new NotificationFilterSupport();
clientFilter.enableType(
MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
MarshalledObject<NotificationFilter> sFilter =
new MarshalledObject<NotificationFilter>(clientFilter);
Integer[] listenerIDs;
final ObjectName[] names =
new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
final MarshalledObject<NotificationFilter>[] filters =
Util.cast(new MarshalledObject<?>[] {sFilter});
final Subject[] subjects = new Subject[] {null};
try {
listenerIDs =
connection.addNotificationListeners(names,
filters,
subjects);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
listenerIDs =
connection.addNotificationListeners(names,
filters,
subjects);
}
return listenerIDs[0];
}
示例13: getJvmThreadInstance
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
private JvmThreadInstanceEntryImpl getJvmThreadInstance(Object userData,
SnmpOid oid) {
JvmThreadInstanceEntryImpl cached = null;
String entryTag = null;
Map<Object, Object> map = null;
final boolean dbg = log.isDebugOn();
if (userData instanceof Map) {
map = Util.cast(userData);
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
entryTag = "JvmThreadInstanceTable.entry." + oid.toString();
cached = (JvmThreadInstanceEntryImpl) map.get(entryTag);
}
// If the entry is in the cache, simply return it.
//
if (cached != null) {
if (dbg) log.debug("*** getJvmThreadInstance",
"Entry found in cache: " + entryTag);
return cached;
}
if (dbg) log.debug("*** getJvmThreadInstance", "Entry [" +
oid + "] is not in cache");
// Entry not in cache. We will create one if needed.
//
ThreadInfo info = null;
try {
info = getThreadInfo(oid);
} catch (RuntimeException r) {
log.trace("*** getJvmThreadInstance",
"Failed to get thread info for rowOid: " + oid);
log.debug("*** getJvmThreadInstance",r);
}
// No thread by that id => no entry.
//
if(info == null) {
if (dbg) log.debug("*** getJvmThreadInstance",
"No entry by that oid [" + oid + "]");
return null;
}
cached = new JvmThreadInstanceEntryImpl(info, oid.toByte());
if (map != null) map.put(entryTag, cached);
if (dbg) log.debug("*** getJvmThreadInstance",
"Entry created for Thread OID [" + oid + "]");
return cached;
}
示例14: getIndex
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* Call {@link #getKey(Object,List,int,Object)} in order to get
* the item name. Then check whether an index was already allocated
* for the entry by that name. If yes return it. Otherwise, call
* {@link #makeIndex(Object,List,int,Object)} to compute a new
* index for that entry.
* Finally store the association between
* the name and index in the context TreeMap.
* @param context The context passed to
* {@link #updateCachedDatas(Object,List)}.
* It is expected to
* be an instance of {@link TreeMap}.
* @param rawDatas Raw table datas passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rank Rank of the given <var>item</var> in the
* <var>rawDatas</var> list iterator.
* @param item The raw data object for which an index must be determined.
**/
protected SnmpOid getIndex(Object context, List<?> rawDatas,
int rank, Object item) {
final String key = getKey(context,rawDatas,rank,item);
final Object index = (names==null||key==null)?null:names.get(key);
final SnmpOid result =
((index != null)?((SnmpOid)index):makeIndex(context,rawDatas,
rank,item));
if ((context != null) && (key != null) && (result != null)) {
Map<Object, Object> map = Util.cast(context);
map.put(key,result);
}
log.debug("getIndex","key="+key+", index="+result);
return result;
}
示例15: asList
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* Return a view of this list as a {@code List<Role>}.
* Changes to the returned value are reflected by changes
* to the original {@code RoleList} and vice versa.
*
* @return a {@code List<Role>} whose contents
* reflect the contents of this {@code RoleList}.
*
* <p>If this method has ever been called on a given
* {@code RoleList} instance, a subsequent attempt to add
* an object to that instance which is not a {@code Role}
* will fail with an {@code IllegalArgumentException}. For compatibility
* reasons, a {@code RoleList} on which this method has never
* been called does allow objects other than {@code Role}s to
* be added.</p>
*
* @throws IllegalArgumentException if this {@code RoleList} contains
* an element that is not a {@code Role}.
*
* @since 1.6
*/
@SuppressWarnings("unchecked")
public List<Role> asList() {
if (!typeSafe) {
if (tainted)
checkTypeSafe(this);
typeSafe = true;
}
return Util.cast(this);
}