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


Java EnvHelp.initCause方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:JMXPluggableAuthenticator.java

示例5: createListeners

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
private void createListeners() {
    logger.debug("createListeners", "starts");

    synchronized (this) {
        createdDuringQuery = new HashSet<ObjectName>();
    }

    try {
        addNotificationListener(MBeanServerDelegate.DELEGATE_NAME,
                                creationListener, creationFilter, null);
        logger.debug("createListeners", "added creationListener");
    } catch (Exception e) {
        final String msg = "Can't add listener to MBean server delegate: ";
        RuntimeException re = new IllegalArgumentException(msg + e);
        EnvHelp.initCause(re, e);
        logger.fine("createListeners", msg + e);
        logger.debug("createListeners", e);
        throw re;
    }

    /* Spec doesn't say whether Set returned by QueryNames can be modified
       so we clone it. */
    Set<ObjectName> names = queryNames(null, broadcasterQuery);
    names = new HashSet<ObjectName>(names);

    synchronized (this) {
        names.addAll(createdDuringQuery);
        createdDuringQuery = null;
    }

    for (ObjectName name : names)
        addBufferListener(name);
    logger.debug("createListeners", "ends");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:ArrayNotificationBuffer.java

示例6: valueFrom

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
static <T> T valueFrom(Descriptor d, String name, OpenType<T> openType) {
    Object x = d.getFieldValue(name);
    if (x == null)
        return null;
    try {
        return convertFrom(x, openType);
    } catch (Exception e) {
        final String msg =
            "Cannot convert descriptor field " + name + "  to " +
            openType.getTypeName();
        throw EnvHelp.initCause(new IllegalArgumentException(msg), e);
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:14,代码来源:OpenMBeanAttributeInfoSupport.java

示例7: openDataException

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
static OpenDataException openDataException(String msg, Throwable cause) {
    return EnvHelp.initCause(new OpenDataException(msg), cause);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:DefaultMXBeanMappingFactory.java

示例8: newIOException

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
/**
 * Construct a new IOException with a nested exception.
 * The nested exception is set only if JDK {@literal >= 1.4}
 */
private static IOException newIOException(String message,
                                          Throwable cause) {
    final IOException x = new IOException(message);
    return EnvHelp.initCause(x,cause);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:RMIConnectorServer.java

示例9: restart

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
private void restart(IOException ioe) throws IOException {
    // check state
    synchronized(lock) {
        if (state == TERMINATED) {
            throw new IOException("The client has been closed.");
        } else if (state == FAILED) { // already failed to re-start by another thread
            throw ioe;
        } else if (state == RE_CONNECTING) {
            // restart process has been called by another thread
            // we need to wait
            while(state == RE_CONNECTING) {
                try {
                    lock.wait();
                } catch (InterruptedException ire) {
                    // be asked to give up
                    InterruptedIOException iioe = new InterruptedIOException(ire.toString());
                    EnvHelp.initCause(iioe, ire);

                    throw iioe;
                }
            }

            if (state == TERMINATED) {
                throw new IOException("The client has been closed.");
            } else if (state != CONNECTED) {
                // restarted is failed by another thread
                throw ioe;
            }
            return;
        } else {
            state = RE_CONNECTING;
            lock.notifyAll();
        }
    }

    // re-starting
    try {
        doStart();
        synchronized(lock) {
            if (state == TERMINATED) {
                throw new IOException("The client has been closed.");
            }

            state = CONNECTED;

            lock.notifyAll();
        }

        return;
    } catch (Exception e) {
        logger.warning("restart", "Failed to restart: " + e);
        logger.debug("restart",e);

        synchronized(lock) {
            if (state == TERMINATED) {
                throw new IOException("The client has been closed.");
            }

            state = FAILED;

            lock.notifyAll();
        }

        try {
            doStop();
        } catch (Exception eee) {
            // OK.
            // We know there is a problem.
        }

        terminate();

        throw ioe;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:76,代码来源:ClientCommunicatorAdmin.java

示例10: invalidObjectException

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
static InvalidObjectException invalidObjectException(String msg,
                                                     Throwable cause) {
    return EnvHelp.initCause(new InvalidObjectException(msg), cause);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:DefaultMXBeanMappingFactory.java

示例11: newIOException

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
/**
 * Construct a new IOException with a nested exception.
 * The nested exception is set only if JDK >= 1.4
 */
private static IOException newIOException(String message,
                                          Throwable cause) {
    final IOException x = new IOException(message);
    return EnvHelp.initCause(x,cause);
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:10,代码来源:RMIConnectionImpl.java

示例12: restart

import com.sun.jmx.remote.util.EnvHelp; //导入方法依赖的package包/类
private void restart(IOException ioe) throws IOException {
    // check state
    synchronized(lock) {
        if (state == TERMINATED) {
            throw new IOException("The client has been closed.");
        } else if (state == FAILED) { // already failed to re-start by another thread
            throw ioe;
        } else if (state == RE_CONNECTING) {
            // restart process has been called by another thread
            // we need to wait
            while(state == RE_CONNECTING) {
                try {
                    lock.wait();
                } catch (InterruptedException ire) {
                    // be asked to give up
                    InterruptedIOException iioe = new InterruptedIOException(ire.toString());
                    EnvHelp.initCause(iioe, ire);

                    throw iioe;
                }
            }

            if (state == TERMINATED) {
                throw new IOException("The client has been closed.");
            } else if (state != CONNECTED) {
                // restarted is failed by another thread
                throw ioe;
            }
        } else {
            state = RE_CONNECTING;
            lock.notifyAll();
        }
    }

    // re-starting
    try {
        doStart();
        synchronized(lock) {
            if (state == TERMINATED) {
                throw new IOException("The client has been closed.");
            }

            state = CONNECTED;

            lock.notifyAll();
        }

        return;
    } catch (Exception e) {
        logger.warning("restart", "Failed to restart: " + e);
        logger.debug("restart",e);

        synchronized(lock) {
            if (state == TERMINATED) {
                throw new IOException("The client has been closed.");
            }

            state = FAILED;

            lock.notifyAll();
        }

        try {
            doStop();
        } catch (Exception eee) {
            // OK.
            // We know there is a problem.
        }

        terminate();

        throw ioe;
    }
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:75,代码来源:ClientCommunicatorAdmin.java


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