java.rmi.StubNotFoundException Java Examples
The following examples show how to use
java.rmi.StubNotFoundException.
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 File: Util.java From jdk8u-dev-jdk with 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 File: Util.java From jdk8u-jdk with 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 File: Util.java From openjdk-jdk9 with 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 File: Util.java From openjdk-jdk8u-backup with 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 File: Util.java From hottub with 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 File: Util.java From openjdk-jdk8u with 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 File: Util.java From jdk8u60 with 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 File: Util.java From openjdk-8-source with 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 File: Util.java From TencentKona-8 with 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 File: Util.java From dragonwell8_jdk with 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 File: Util.java From openjdk-8 with 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 File: Util.java From jdk8u_jdk with 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 File: Util.java From jdk8u-jdk with 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 File: RmiSupportTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example #15
Source File: RmiSupportTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); }
Example #16
Source File: RmiSupportTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithException(StubNotFoundException.class); }
Example #17
Source File: RmiSupportTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example #18
Source File: RmiSupportTests.java From spring-analysis-note with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithException(StubNotFoundException.class); }
Example #19
Source File: RmiSupportTests.java From java-technology-stack with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example #20
Source File: RmiSupportTests.java From java-technology-stack with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example #21
Source File: RmiSupportTests.java From java-technology-stack with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); }
Example #22
Source File: RmiSupportTests.java From java-technology-stack with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithException(StubNotFoundException.class); }
Example #23
Source File: RmiSupportTests.java From spring-analysis-note with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example #24
Source File: RmiSupportTests.java From spring-analysis-note with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithBusinessInterfaceAndStubNotFoundException() throws Exception { doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( StubNotFoundException.class, RemoteConnectFailureException.class); }
Example #25
Source File: RmiSupportTests.java From spring-analysis-note with MIT License | 4 votes |
@Test public void rmiProxyFactoryBeanWithStubNotFoundExceptionAndRefresh() throws Exception { doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); }
Example #26
Source File: RmiClientInterceptorUtils.java From lams with 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 File: RmiClientInterceptorUtils.java From spring4-understanding with 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 File: RmiClientInterceptorUtils.java From java-technology-stack with 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 File: RmiClientInterceptorUtils.java From spring-analysis-note with 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); }