Refine search
/** * Marshals the sequence of method parameters into an output stream. * * @param out a CDR output stream * @param params an object array with the parameters. */ public void writeParams(OutputStream out, Object[] params) { int len = params.length; if (len != paramWriters.length) { throw IIOPLogger.ROOT_LOGGER.errorMashalingParams(); } for (int i = 0; i < len; i++) { Object param = params[i]; if (param instanceof PortableRemoteObject) { try { param = PortableRemoteObject.toStub((Remote) param); } catch (NoSuchObjectException e) { throw new RuntimeException(e); } } paramWriters[i].write(out, RemoteObjectSubstitutionManager.writeReplaceRemote(param)); } }
/** * This is a convenience method to lookup a remote object by name within * the naming context. * @exception javax.naming.NamingException if the object with that * name could not be found. */ public static java.rmi.Remote lookupObject(String publishedName, java.lang.Class anInterface) throws javax.naming.NamingException { Context ic = new InitialContext(); java.lang.Object objRef = ic.lookup(publishedName); return (java.rmi.Remote) PortableRemoteObject.narrow(objRef, anInterface); }
if (!extraJndiProperties.isEmpty()) env.putAll(extraJndiProperties); ctx = new InitialContext(env); ctx = new InitialContext(); Object lookedUpObject = ctx.lookup(name); if (narrowJndiObject) { wrappedFactory = (XAConnectionFactory) PortableRemoteObject.narrow(lookedUpObject, XAConnectionFactory.class); ctx.close();
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { InitialContext ctx = new InitialContext(); Context enc = (Context) ctx.lookup("java:comp/env"); StatelessSessionHome home = (StatelessSessionHome) enc.lookup("ejb/OptimizedEJB"); StatelessSession bean = home.create(); bean.noop(); Object homeRef = enc.lookup("ejb/OptimizedEJB"); home = (StatelessSessionHome) PortableRemoteObject.narrow(homeRef, StatelessSessionHome.class); bean = home.create(); bean.noop(); bean.getData(); StatelessSessionLocalHome localHome = (StatelessSessionLocalHome) enc.lookup("ejb/local/OptimizedEJB"); StatelessSessionLocal localBean = localHome.create(); localBean.noop(); } catch (Exception e) { throw new ServletException("Failed to call OptimizedEJB through remote and local interfaces", e); } response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head><title>EJBServlet</title></head>"); out.println("<body>Tests passed<br>Time:" + new Date().toString() + "</body>"); out.println("</html>"); out.close(); }
if (bound && !boundFailed) { try { InitialContext ictx = new InitialContext(); ictx.unbind(TMFACTORY_NAME); PortableRemoteObject.unexportObject(tf);
/** * Performs shutdown of the server. Should be called last. */ public void shutdown () throws SysException { if ( exported_ ) { String exportClass = properties_ .getProperty ( "com.atomikos.icatch.rmi_export_class" ); try { if ( "PortableRemoteObject".equals ( exportClass ) ) PortableRemoteObject.unexportObject ( this ); else if ( "UnicastRemoteObject".equals ( exportClass ) ) UnicastRemoteObject.unexportObject ( this, true ); Context ctx = getInitialContext (); ctx.unbind ( name_ ); } catch ( Exception e ) { throw new SysException ( e.getMessage (), e ); } // set exported to false, to make sure this method is // idempotent exported_ = false; } }
PortableRemoteObject.exportObject ( this ); exported_ = true; } else if ( "UnicastRemoteObject".equals ( exportClass ) ) { ctx.rebind ( name_, this ); } catch ( Exception e ) {
/** * Converts the return value of a local invocation into the expected type. * A conversion is needed if the return value is a remote interface * (in this case <code>PortableRemoteObject.narrow()</code> must be called). * * @param obj the return value to be converted * @return the converted value. */ public Object convertLocalRetval(Object obj) { if (retvalRemoteInterface == null) return obj; else return PortableRemoteObject.narrow(obj, retvalRemoteInterface); }
/** * unregister this bean in JNDI (unbind) * @throws NamingException exception */ protected void unregister() throws NamingException { if (TraceEjb.isDebugIc()) { TraceEjb.interp.log(BasicLevel.DEBUG, ""); } String name = dd.getJndiName(); // unregister in default InitialContext bf.getInitialContext().unbind(name); try { PortableRemoteObject.unexportObject(this); } catch (NoSuchObjectException e) { TraceEjb.interp.log(BasicLevel.ERROR, "unexportObject(JHome) failed", e); } unregistered = true; }
public void begin() throws NotSupportedException, SystemException { current.begin(); // Creation of the global transaction coordinator TransactionContext localTC = current.getPropagationContext(false); Coordinator c; if (localTC.getCoordinator() == null) { try { c = (Coordinator) PortableRemoteObject.narrow(PortableRemoteObject.toStub(Current .getJTM().recreate(localTC)), Coordinator.class); } catch (RemoteException e) { throw new SystemException(e.getMessage()); } localTC.setCoordinator(c); localTC.setTerminator((Terminator) c); } }
public void writeAbstractObject(org.omg.CORBA.portable.OutputStream out, Object obj) { logger.finer("writeAbstractObject.1 " + " out=" + out); if (obj instanceof org.omg.CORBA.Object || obj instanceof Serializable) { // skip // } else if (obj instanceof Remote) { org.omg.CORBA.Object objref = null; try { objref = (org.omg.CORBA.Object) PortableRemoteObject .toStub((Remote) obj); } catch (java.rmi.NoSuchObjectException ex) { } if (objref == null) { try { PortableRemoteObject.exportObject((Remote) obj); objref = (org.omg.CORBA.Object) PortableRemoteObject .toStub((Remote) obj); } catch (RemoteException ex) { throw (MARSHAL) new MARSHAL("unable to export object").initCause(ex); } } obj = objref; } org.omg.CORBA_2_3.portable.OutputStream out_ = (org.omg.CORBA_2_3.portable.OutputStream) out; logger.finer("writeAbstractObject.2 " + " out=" + out); out_.write_abstract_interface(obj); }
/** * Initializes the object by calling <code>exportObject(this)</code>. * @exception RemoteException if export fails. */ protected PortableRemoteObject() throws RemoteException { if (proDelegate != null) { PortableRemoteObject.exportObject((Remote)this); } }
public void unexportObject(Remote remote) throws RemoteException { //PortableRemoteObjectExt.pushState(this); try { javax.rmi.PortableRemoteObject.unexportObject(remote); } finally { //PortableRemoteObjectExt.popState(); } }
/** * This is a convenience method to lookup a remote object by name within * the naming context. * @exception javax.naming.NamingException if the object with that * name could not be found. */ public static java.rmi.Remote lookupObject(String publishedName, java.lang.Class anInterface) throws javax.naming.NamingException { Context ic = new InitialContext(); java.lang.Object objRef = ic.lookup(publishedName); return (java.rmi.Remote) PortableRemoteObject.narrow(objRef, anInterface); }
if (!extraJndiProperties.isEmpty()) env.putAll(extraJndiProperties); ctx = new InitialContext(env); ctx = new InitialContext(); Object lookedUpObject = ctx.lookup(name); if (narrowJndiObject) { wrappedFactory = (XAConnectionFactory) PortableRemoteObject.narrow(lookedUpObject, XAConnectionFactory.class); ctx.close();
if (bound && !boundFailed) { try { InitialContext ictx = new InitialContext(); ictx.unbind(TMFACTORY_NAME); PortableRemoteObject.unexportObject(tf);