Search in sources :

Example 1 with RemarshalException

use of org.omg.CORBA.portable.RemarshalException in project jdk8u_jdk by JetBrains.

the class _HelloInterface_Stub method sayHelloWithInetAddress.

public String sayHelloWithInetAddress(InetAddress arg0) throws java.rmi.RemoteException {
    if (!Util.isLocal(this)) {
        try {
            org.omg.CORBA_2_3.portable.InputStream in = null;
            try {
                org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _request("sayHelloWithInetAddress", true);
                out.write_value(arg0, InetAddress.class);
                in = (org.omg.CORBA_2_3.portable.InputStream) _invoke(out);
                return (String) in.read_value(String.class);
            } catch (ApplicationException ex) {
                in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
                String $_id = in.read_string();
                throw new UnexpectedException($_id);
            } catch (RemarshalException ex) {
                return sayHelloWithInetAddress(arg0);
            } finally {
                _releaseReply(in);
            }
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex);
        }
    } else {
        ServantObject so = _servant_preinvoke("sayHelloWithInetAddress", HelloInterface.class);
        if (so == null) {
            return sayHelloWithInetAddress(arg0);
        }
        try {
            InetAddress arg0Copy = (InetAddress) Util.copyObject(arg0, _orb());
            return ((HelloInterface) so.servant).sayHelloWithInetAddress(arg0Copy);
        } catch (Throwable ex) {
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
            throw Util.wrapException(exCopy);
        } finally {
            _servant_postinvoke(so);
        }
    }
}
Also used : UnexpectedException(java.rmi.UnexpectedException) InputStream(org.omg.CORBA.portable.InputStream) OutputStream(org.omg.CORBA.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) ServantObject(org.omg.CORBA.portable.ServantObject) InetAddress(java.net.InetAddress)

Example 2 with RemarshalException

use of org.omg.CORBA.portable.RemarshalException in project jdk8u_jdk by JetBrains.

the class _HelloInterface_Stub method sayHelloWithHashMap.

public String sayHelloWithHashMap(ConcurrentHashMap arg0) throws java.rmi.RemoteException {
    if (!Util.isLocal(this)) {
        try {
            org.omg.CORBA_2_3.portable.InputStream in = null;
            try {
                org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _request("sayHelloWithHashMap", true);
                out.write_value(arg0, ConcurrentHashMap.class);
                in = (org.omg.CORBA_2_3.portable.InputStream) _invoke(out);
                return (String) in.read_value(String.class);
            } catch (ApplicationException ex) {
                in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
                String $_id = in.read_string();
                throw new UnexpectedException($_id);
            } catch (RemarshalException ex) {
                return sayHelloWithHashMap(arg0);
            } finally {
                _releaseReply(in);
            }
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex);
        }
    } else {
        ServantObject so = _servant_preinvoke("sayHelloWithHashMap", HelloInterface.class);
        if (so == null) {
            return sayHelloWithHashMap(arg0);
        }
        try {
            ConcurrentHashMap arg0Copy = (ConcurrentHashMap) Util.copyObject(arg0, _orb());
            return ((HelloInterface) so.servant).sayHelloWithHashMap(arg0Copy);
        } catch (Throwable ex) {
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
            throw Util.wrapException(exCopy);
        } finally {
            _servant_postinvoke(so);
        }
    }
}
Also used : UnexpectedException(java.rmi.UnexpectedException) InputStream(org.omg.CORBA.portable.InputStream) OutputStream(org.omg.CORBA.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) ServantObject(org.omg.CORBA.portable.ServantObject) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 3 with RemarshalException

use of org.omg.CORBA.portable.RemarshalException in project jdk8u_jdk by JetBrains.

the class _HelloInterface_Stub method sayHelloWithReentrantLock.

public String sayHelloWithReentrantLock(ReentrantLock arg0) throws java.rmi.RemoteException {
    if (!Util.isLocal(this)) {
        try {
            org.omg.CORBA_2_3.portable.InputStream in = null;
            try {
                org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _request("sayHelloWithReentrantLock", true);
                out.write_value(arg0, ReentrantLock.class);
                in = (org.omg.CORBA_2_3.portable.InputStream) _invoke(out);
                return (String) in.read_value(String.class);
            } catch (ApplicationException ex) {
                in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
                String $_id = in.read_string();
                throw new UnexpectedException($_id);
            } catch (RemarshalException ex) {
                return sayHelloWithReentrantLock(arg0);
            } finally {
                _releaseReply(in);
            }
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex);
        }
    } else {
        ServantObject so = _servant_preinvoke("sayHelloWithReentrantLock", HelloInterface.class);
        if (so == null) {
            return sayHelloWithReentrantLock(arg0);
        }
        try {
            ReentrantLock arg0Copy = (ReentrantLock) Util.copyObject(arg0, _orb());
            return ((HelloInterface) so.servant).sayHelloWithReentrantLock(arg0Copy);
        } catch (Throwable ex) {
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
            throw Util.wrapException(exCopy);
        } finally {
            _servant_postinvoke(so);
        }
    }
}
Also used : ReentrantLock(java.util.concurrent.locks.ReentrantLock) UnexpectedException(java.rmi.UnexpectedException) InputStream(org.omg.CORBA.portable.InputStream) OutputStream(org.omg.CORBA.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) ServantObject(org.omg.CORBA.portable.ServantObject)

Example 4 with RemarshalException

use of org.omg.CORBA.portable.RemarshalException in project jdk8u_jdk by JetBrains.

the class _HelloInterface_Stub method sayHelloToTest.

public String sayHelloToTest(Test arg0) throws java.rmi.RemoteException {
    if (!Util.isLocal(this)) {
        try {
            org.omg.CORBA_2_3.portable.InputStream in = null;
            try {
                org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _request("sayHelloToTest", true);
                out.write_value(arg0, Test.class);
                in = (org.omg.CORBA_2_3.portable.InputStream) _invoke(out);
                return (String) in.read_value(String.class);
            } catch (ApplicationException ex) {
                in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
                String $_id = in.read_string();
                throw new UnexpectedException($_id);
            } catch (RemarshalException ex) {
                return sayHelloToTest(arg0);
            } finally {
                _releaseReply(in);
            }
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex);
        }
    } else {
        ServantObject so = _servant_preinvoke("sayHelloToTest", HelloInterface.class);
        if (so == null) {
            return sayHelloToTest(arg0);
        }
        try {
            Test arg0Copy = (Test) Util.copyObject(arg0, _orb());
            return ((HelloInterface) so.servant).sayHelloToTest(arg0Copy);
        } catch (Throwable ex) {
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
            throw Util.wrapException(exCopy);
        } finally {
            _servant_postinvoke(so);
        }
    }
}
Also used : UnexpectedException(java.rmi.UnexpectedException) InputStream(org.omg.CORBA.portable.InputStream) OutputStream(org.omg.CORBA.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) ServantObject(org.omg.CORBA.portable.ServantObject)

Example 5 with RemarshalException

use of org.omg.CORBA.portable.RemarshalException in project wildfly by wildfly.

the class DynamicIIOPStub method invoke.

/**
     * Sends a request message to the server, receives the reply from the
     * server, and returns an <code>Object</code> result to the caller.
     */
public Object invoke(String operationName, final StubStrategy stubStrategy, Object[] params) throws Throwable {
    if (operationName.equals("_get_handle") && this instanceof javax.ejb.EJBObject) {
        if (handle == null) {
            handle = new HandleImplIIOP(this);
        }
        return handle;
    } else if (operationName.equals("_get_homeHandle") && this instanceof javax.ejb.EJBHome) {
        if (handle == null) {
            handle = new HomeHandleImplIIOP(this);
        }
        return handle;
    } else {
        //FIXME
        // all invocations are now made using remote invocation
        // local invocations between two different applications cause
        // ClassCastException between Stub and Interface
        // (two different modules are loading the classes)
        // problem was unnoticeable with JacORB because it uses
        // remote invocations to all stubs to which interceptors are
        // registered and a result all that JacORB always used
        // remote invocations
        // remote call path
        // To check whether this is a local stub or not we must call
        // org.omg.CORBA.portable.ObjectImpl._is_local(), and _not_
        // javax.rmi.CORBA.Util.isLocal(Stub s), which in Sun's JDK
        // always return false.
        InputStream in = null;
        try {
            try {
                OutputStream out = (OutputStream) _request(operationName, true);
                stubStrategy.writeParams(out, params);
                tracef("sent request: %s", operationName);
                in = (InputStream) _invoke(out);
                if (stubStrategy.isNonVoid()) {
                    trace("received reply");
                    final InputStream finalIn = in;
                    return doPrivileged(new PrivilegedAction<Object>() {

                        public Object run() {
                            return stubStrategy.readRetval(finalIn);
                        }
                    });
                } else {
                    return null;
                }
            } catch (final ApplicationException ex) {
                trace("got application exception");
                in = (InputStream) ex.getInputStream();
                final InputStream finalIn1 = in;
                throw doPrivileged(new PrivilegedAction<Exception>() {

                    public Exception run() {
                        return stubStrategy.readException(ex.getId(), finalIn1);
                    }
                });
            } catch (RemarshalException ex) {
                trace("got remarshal exception");
                return invoke(operationName, stubStrategy, params);
            }
        } catch (SystemException ex) {
            if (EjbLogger.EJB3_INVOCATION_LOGGER.isTraceEnabled()) {
                EjbLogger.EJB3_INVOCATION_LOGGER.trace("CORBA system exception in IIOP stub", ex);
            }
            throw Util.mapSystemException(ex);
        } finally {
            _releaseReply(in);
        }
    }
}
Also used : InputStream(org.omg.CORBA_2_3.portable.InputStream) OutputStream(org.omg.CORBA_2_3.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) HandleImplIIOP(org.jboss.ejb.iiop.HandleImplIIOP) HomeHandleImplIIOP(org.jboss.ejb.iiop.HomeHandleImplIIOP) PrivilegedAction(java.security.PrivilegedAction) HomeHandleImplIIOP(org.jboss.ejb.iiop.HomeHandleImplIIOP)

Aggregations

SystemException (org.omg.CORBA.SystemException)8 ApplicationException (org.omg.CORBA.portable.ApplicationException)8 RemarshalException (org.omg.CORBA.portable.RemarshalException)8 UnexpectedException (java.rmi.UnexpectedException)7 InputStream (org.omg.CORBA.portable.InputStream)7 OutputStream (org.omg.CORBA.portable.OutputStream)7 ServantObject (org.omg.CORBA.portable.ServantObject)7 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 InetAddress (java.net.InetAddress)1 PrivilegedAction (java.security.PrivilegedAction)1 HashMap (java.util.HashMap)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 HandleImplIIOP (org.jboss.ejb.iiop.HandleImplIIOP)1 HomeHandleImplIIOP (org.jboss.ejb.iiop.HomeHandleImplIIOP)1 InputStream (org.omg.CORBA_2_3.portable.InputStream)1 OutputStream (org.omg.CORBA_2_3.portable.OutputStream)1