当前位置: 首页>>代码示例>>Java>>正文


Java EnvHelp类代码示例

本文整理汇总了Java中com.sun.jmx.remote.util.EnvHelp的典型用法代码示例。如果您正苦于以下问题:Java EnvHelp类的具体用法?Java EnvHelp怎么用?Java EnvHelp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EnvHelp类属于com.sun.jmx.remote.util包,在下文中一共展示了EnvHelp类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: export

import com.sun.jmx.remote.util.EnvHelp; //导入依赖的package包/类
private void export(Remote obj) throws RemoteException {
    final RMIExporter exporter =
        (RMIExporter) env.get(RMIExporter.EXPORTER_ATTRIBUTE);
    final boolean daemon = EnvHelp.isServerDaemon(env);

    if (daemon && exporter != null) {
        throw new IllegalArgumentException("If "+EnvHelp.JMX_SERVER_DAEMON+
                " is specified as true, "+RMIExporter.EXPORTER_ATTRIBUTE+
                " cannot be used to specify an exporter!");
    }

    if (daemon) {
        if (csf == null && ssf == null) {
            new UnicastServerRef(port).exportObject(obj, null, true);
        } else {
            new UnicastServerRef2(port, csf, ssf).exportObject(obj, null, true);
        }
    } else if (exporter != null) {
        exporter.exportObject(obj, port, csf, ssf);
    } else {
        UnicastRemoteObject.exportObject(obj, port, csf, ssf);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:RMIJRMPServerImpl.java

示例2: createMBean

import com.sun.jmx.remote.util.EnvHelp; //导入依赖的package包/类
public ObjectInstance createMBean(String className, ObjectName name,
                                  Object[] params, String[] signature)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException  {

    try {
        return createMBean(className, name, null, true,
                           params, signature);
    } catch (InstanceNotFoundException e) {
        /* Can only happen if loaderName doesn't exist, but we just
           passed null, so we shouldn't get this exception.  */
        throw EnvHelp.initCause(
            new IllegalArgumentException("Unexpected exception: " + e), e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:DefaultMBeanServerInterceptor.java

示例3: getListener

import com.sun.jmx.remote.util.EnvHelp; //导入依赖的package包/类
private NotificationListener getListener(ObjectName listener)
    throws ListenerNotFoundException {
    // ----------------
    // Get listener object
    // ----------------
    DynamicMBean instance;
    try {
        instance = getMBean(listener);
    } catch (InstanceNotFoundException e) {
        throw EnvHelp.initCause(
                      new ListenerNotFoundException(e.getMessage()), e);
    }

    Object resource = getResource(instance);
    if (!(resource instanceof NotificationListener)) {
        final RuntimeException exc =
            new IllegalArgumentException(listener.getCanonicalName());
        final String msg =
            "MBean " + listener.getCanonicalName() + " does not " +
            "implement " + NotificationListener.class.getName();
        throw new RuntimeOperationsException(exc, msg);
    }
    return (NotificationListener) resource;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:DefaultMBeanServerInterceptor.java

示例4: authenticationFailure

import com.sun.jmx.remote.util.EnvHelp; //导入依赖的package包/类
private static void authenticationFailure(String method,
                                          Exception exception)
    throws SecurityException {
    String msg;
    SecurityException se;
    if (exception instanceof SecurityException) {
        msg = exception.getMessage();
        se = (SecurityException) exception;
    } else {
        msg = "Authentication failed! " + exception.getMessage();
        final SecurityException e = new SecurityException(msg);
        EnvHelp.initCause(e, exception);
        se = e;
    }
    logException(method, msg, se);
    throw se;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:JMXPluggableAuthenticator.java

示例5: ClientNotifForwarder

import com.sun.jmx.remote.util.EnvHelp; //导入依赖的package包/类
public ClientNotifForwarder(ClassLoader defaultClassLoader, Map<String, ?> env) {
    maxNotifications = EnvHelp.getMaxFetchNotifNumber(env);
    timeout = EnvHelp.getFetchTimeout(env);

    /* You can supply an Executor in which the remote call to
       fetchNotifications will be made.  The Executor's execute
       method reschedules another task, so you must not use
       an Executor that executes tasks in the caller's thread.  */
    Executor ex = (Executor)
        env.get("jmx.remote.x.fetch.notifications.executor");
    if (ex == null)
        ex = new LinearExecutor();
    else if (logger.traceOn())
        logger.trace("ClientNotifForwarder", "executor is " + ex);

    this.defaultClassLoader = defaultClassLoader;
    this.executor = ex;
    this.acc = AccessController.getContext();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:ClientNotifForwarder.java

示例6: beforeRemove

import com.sun.jmx.remote.util.EnvHelp; //导入依赖的package包/类
/**
 * Import: should not remove a listener during reconnection, the reconnection
 * needs to change the listener list and that will possibly make removal fail.
 */
private synchronized void beforeRemove() throws IOException {
    while (beingReconnected) {
        if (state == TERMINATED) {
            throw new IOException("Terminated.");
        }

        try {
            wait();
        } catch (InterruptedException ire) {
            IOException ioe = new IOException(ire.toString());
            EnvHelp.initCause(ioe, ire);

            throw ioe;
        }
    }

    if (state == TERMINATED) {
        throw new IOException("Terminated.");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:ClientNotifForwarder.java

示例7: findRMIServer

import com.sun.jmx.remote.util.EnvHelp; //导入依赖的package包/类
private RMIServer findRMIServer(JMXServiceURL directoryURL,
        Map<String, Object> environment)
        throws NamingException, IOException {
    final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true);
    if (isIiop) {
        // Make sure java.naming.corba.orb is in the Map.
        environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment));
    }

    String path = directoryURL.getURLPath();
    int end = path.indexOf(';');
    if (end < 0) end = path.length();
    if (path.startsWith("/jndi/"))
        return findRMIServerJNDI(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/stub/"))
        return findRMIServerJRMP(path.substring(6,end), environment, isIiop);
    else if (path.startsWith("/ior/")) {
        if (!IIOPHelper.isAvailable())
            throw new IOException("iiop protocol not available");
        return findRMIServerIIOP(path.substring(5,end), environment, isIiop);
    } else {
        final String msg = "URL path must begin with /jndi/ or /stub/ " +
                "or /ior/: " + path;
        throw new MalformedURLException(msg);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:RMIConnector.java


注:本文中的com.sun.jmx.remote.util.EnvHelp类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。