Java Code Examples for java.rmi.StubNotFoundException
The following examples show how to use
java.rmi.StubNotFoundException. These examples are extracted from open source projects.
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 Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 2
Source Project: TencentKona-8 Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 3
Source Project: jdk8u60 Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 4
Source Project: openjdk-jdk8u Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 5
Source Project: openjdk-jdk8u-backup Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 6
Source Project: openjdk-jdk9 Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 7
Source Project: jdk8u-jdk Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 8
Source Project: hottub Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 9
Source Project: openjdk-8-source Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 10
Source Project: openjdk-8 Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 11
Source Project: jdk8u_jdk Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 12
Source Project: jdk8u-jdk Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 13
Source Project: jdk8u-dev-jdk Source File: Util.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a proxy for the specified implClass. * * If both of the following criteria is satisfied, a dynamic proxy for * the specified implClass is returned (otherwise a RemoteStub instance * for the specified implClass is returned): * * a) either the property java.rmi.server.ignoreStubClasses is true or * a pregenerated stub class does not exist for the impl class, and * b) forceStubUse is false. * * If the above criteria are satisfied, this method constructs a * dynamic proxy instance (that implements the remote interfaces of * implClass) constructed with a RemoteObjectInvocationHandler instance * constructed with the clientRef. * * Otherwise, this method loads the pregenerated stub class (which * extends RemoteStub and implements the remote interfaces of * implClass) and constructs an instance of the pregenerated stub * class with the clientRef. * * @param implClass the class to obtain remote interfaces from * @param clientRef the remote ref to use in the invocation handler * @param forceStubUse if true, forces creation of a RemoteStub * @throws IllegalArgumentException if implClass implements illegal * remote interfaces * @throws StubNotFoundException if problem locating/creating stub or * creating the dynamic proxy instance **/ public static Remote createProxy(Class<?> implClass, RemoteRef clientRef, boolean forceStubUse) throws StubNotFoundException { Class<?> remoteClass; try { remoteClass = getRemoteClass(implClass); } catch (ClassNotFoundException ex ) { throw new StubNotFoundException( "object does not implement a remote interface: " + implClass.getName()); } if (forceStubUse || !(ignoreStubClasses || !stubClassExists(remoteClass))) { return createStub(remoteClass, clientRef); } final ClassLoader loader = implClass.getClassLoader(); final Class<?>[] interfaces = getRemoteInterfaces(implClass); final InvocationHandler handler = new RemoteObjectInvocationHandler(clientRef); /* REMIND: private remote interfaces? */ try { return AccessController.doPrivileged(new PrivilegedAction<Remote>() { public Remote run() { return (Remote) Proxy.newProxyInstance(loader, interfaces, handler); }}); } catch (IllegalArgumentException e) { throw new StubNotFoundException("unable to create proxy", e); } }
Example 14
Source Project: spring-analysis-note Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithException(StubNotFoundException.class); }
Example 15
Source Project: spring-analysis-note Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); }
Example 16
Source Project: spring-analysis-note Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example 17
Source Project: spring-analysis-note Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example 18
Source Project: java-technology-stack Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithException(StubNotFoundException.class); }
Example 19
Source Project: java-technology-stack Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); }
Example 20
Source Project: java-technology-stack Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example 21
Source Project: java-technology-stack Source File: RmiSupportTests.java License: MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example 22
Source Project: spring4-understanding Source File: RmiSupportTests.java License: Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithException(StubNotFoundException.class); }
Example 23
Source Project: spring4-understanding Source File: RmiSupportTests.java License: Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); }
Example 24
Source Project: spring4-understanding Source File: RmiSupportTests.java License: Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example 25
Source Project: spring4-understanding Source File: RmiSupportTests.java License: Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example 26
Source Project: lams Source File: RmiClientInterceptorUtils.java License: GNU General Public License v2.0 | 3 votes |
/** * Determine whether the given RMI exception indicates a connect failure. * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException, * NoSuchObjectException and StubNotFoundException as connect failure. * @param ex the RMI exception to check * @return whether the exception should be treated as connect failure * @see java.rmi.ConnectException * @see java.rmi.ConnectIOException * @see java.rmi.UnknownHostException * @see java.rmi.NoSuchObjectException * @see java.rmi.StubNotFoundException */ public static boolean isConnectFailure(RemoteException ex) { return (ex instanceof ConnectException || ex instanceof ConnectIOException || ex instanceof UnknownHostException || ex instanceof NoSuchObjectException || ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException || isCorbaConnectFailure(ex.getCause())); }
Example 27
Source Project: spring4-understanding Source File: RmiClientInterceptorUtils.java License: Apache License 2.0 | 3 votes |
/** * Determine whether the given RMI exception indicates a connect failure. * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException, * NoSuchObjectException and StubNotFoundException as connect failure. * @param ex the RMI exception to check * @return whether the exception should be treated as connect failure * @see java.rmi.ConnectException * @see java.rmi.ConnectIOException * @see java.rmi.UnknownHostException * @see java.rmi.NoSuchObjectException * @see java.rmi.StubNotFoundException */ public static boolean isConnectFailure(RemoteException ex) { return (ex instanceof ConnectException || ex instanceof ConnectIOException || ex instanceof UnknownHostException || ex instanceof NoSuchObjectException || ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException || isCorbaConnectFailure(ex.getCause())); }
Example 28
Source Project: spring-analysis-note Source File: RmiClientInterceptorUtils.java License: MIT License | 2 votes |
/** * Determine whether the given RMI exception indicates a connect failure. * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException, * NoSuchObjectException and StubNotFoundException as connect failure. * @param ex the RMI exception to check * @return whether the exception should be treated as connect failure * @see java.rmi.ConnectException * @see java.rmi.ConnectIOException * @see java.rmi.UnknownHostException * @see java.rmi.NoSuchObjectException * @see java.rmi.StubNotFoundException */ public static boolean isConnectFailure(RemoteException ex) { return (ex instanceof ConnectException || ex instanceof ConnectIOException || ex instanceof UnknownHostException || ex instanceof NoSuchObjectException || ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException); }
Example 29
Source Project: java-technology-stack Source File: RmiClientInterceptorUtils.java License: MIT License | 2 votes |
/** * Determine whether the given RMI exception indicates a connect failure. * <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException, * NoSuchObjectException and StubNotFoundException as connect failure. * @param ex the RMI exception to check * @return whether the exception should be treated as connect failure * @see java.rmi.ConnectException * @see java.rmi.ConnectIOException * @see java.rmi.UnknownHostException * @see java.rmi.NoSuchObjectException * @see java.rmi.StubNotFoundException */ public static boolean isConnectFailure(RemoteException ex) { return (ex instanceof ConnectException || ex instanceof ConnectIOException || ex instanceof UnknownHostException || ex instanceof NoSuchObjectException || ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException); }