java.rmi.AccessException Java Examples

The following examples show how to use java.rmi.AccessException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: dragonwell8_jdk   Author: alibaba   File: Activation.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #2
Source Project: dragonwell8_jdk   Author: alibaba   File: NonLocalActivationTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #3
Source Project: dragonwell8_jdk   Author: alibaba   File: NonLocalRegistryTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int rrIndex = msg.indexOf("Registry.Registry");     // Obsolete error text
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                rrIndex != -1 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #4
Source Project: dragonwell8_jdk   Author: alibaba   File: NonLocalJMXRemoteTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            System.out.println("Exception message is " + msg);
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #5
Source Project: TencentKona-8   Author: Tencent   File: Activation.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #6
Source Project: TencentKona-8   Author: Tencent   File: NonLocalActivationTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #7
Source Project: TencentKona-8   Author: Tencent   File: NonLocalRegistryTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int rrIndex = msg.indexOf("Registry.Registry");     // Obsolete error text
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                rrIndex != -1 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #8
Source Project: TencentKona-8   Author: Tencent   File: NonLocalJMXRemoteTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            System.out.println("Exception message is " + msg);
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #9
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #10
Source Project: jdk8u60   Author: chenghanpeng   File: Activation.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    RegistryImpl.checkAccess("ActivationSystem.shutdown");

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #11
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: NonLocalActivationTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #12
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: NonLocalJMXRemoteTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #13
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: NonLocalRegistryTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int rrIndex = msg.indexOf("Registry.Registry");     // Obsolete error text
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                rrIndex != -1 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #14
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #15
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: NonLocalActivationTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Exception ex, String msg1) {
    Throwable t = ex;
    System.out.println();
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf(msg1);
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur", ex);
    }
}
 
Example #16
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: NonLocalJMXRemoteTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the exception chain for the expected AccessException and message.
 * @param ex the exception from the remote invocation.
 */
private static void assertIsAccessException(Throwable ex) {
    Throwable t = ex;
    while (!(t instanceof AccessException) && t.getCause() != null) {
        t = t.getCause();
    }
    if (t instanceof AccessException) {
        String msg = t.getMessage();
        int asIndex = msg.indexOf("Registry");
        int disallowIndex = msg.indexOf("disallowed");
        int nonLocalHostIndex = msg.indexOf("non-local host");
        if (asIndex < 0 ||
                disallowIndex < 0 ||
                nonLocalHostIndex < 0 ) {
            System.out.println("Exception message is " + msg);
            throw new RuntimeException("exception message is malformed", t);
        }
        System.out.printf("Found expected AccessException: %s%n%n", t);
    } else {
        throw new RuntimeException("AccessException did not occur when expected", ex);
    }
}
 
Example #17
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shutdown the activation system. Destroys all groups spawned by
 * the activation daemon and exits the activation daemon.
 */
public void shutdown() throws AccessException {
    // RegistryImpl.checkAccess() is done in the SameHostOnlyServerRef
    // during unmarshallCustomData and is not applicable to local access.

    Object lock = startupLock;
    if (lock != null) {
        synchronized (lock) {
            // nothing
        }
    }

    synchronized (Activation.this) {
        if (!shuttingDown) {
            shuttingDown = true;
            (new Shutdown()).start();
        }
    }
}
 
Example #18
Source Project: dragonwell8_jdk   Author: alibaba   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example #19
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        super.rebind(name, obj);
    }
}
 
Example #20
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.rebind");
        super.rebind(name, obj);
    }
}
 
Example #21
Source Project: TencentKona-8   Author: Tencent   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.bind");
        super.bind(name, obj);
    }
}
 
Example #22
Source Project: TencentKona-8   Author: Tencent   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example #23
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.bind");
        super.bind(name, obj);
    }
}
 
Example #24
Source Project: jdk8u60   Author: chenghanpeng   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        super.bind(name, obj);
    }
}
 
Example #25
Source Project: jdk8u60   Author: chenghanpeng   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        super.unbind(name);
    }
}
 
Example #26
Source Project: jdk8u60   Author: chenghanpeng   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        super.rebind(name, obj);
    }
}
 
Example #27
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.bind");
        super.bind(name, obj);
    }
}
 
Example #28
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Remote obj)
    throws RemoteException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.rebind");
        super.rebind(name, obj);
    }
}
 
Example #29
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example #30
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: Activation.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void bind(String name, Remote obj)
    throws RemoteException, AlreadyBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "binding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.bind");
        super.bind(name, obj);
    }
}