/** * Send multiple dynamic requests asynchronously. * * @param req an array of request objects. */ public synchronized void send_multiple_requests_deferred(Request[] req) { checkShutdownState(); // add the new Requests to pending dynamic Requests for (int i = 0; i < req.length; i++) { dynamicRequests.addElement(req[i]); } // Invoke the send_deferred on each new Request for (int i = 0; i < req.length; i++) { AsynchInvoke invokeObject = new AsynchInvoke( this, (com.sun.corba.se.impl.corba.RequestImpl)req[i], true); new Thread(invokeObject).start(); } }
/** * Send multiple dynamic requests asynchronously. * * @param req an array of request objects. */ public synchronized void send_multiple_requests_deferred(Request[] req) { checkShutdownState(); // add the new Requests to pending dynamic Requests for (int i = 0; i < req.length; i++) { dynamicRequests.addElement(req[i]); } // Invoke the send_deferred on each new Request for (int i = 0; i < req.length; i++) { AsynchInvoke invokeObject = new AsynchInvoke( this, (com.sun.corba.se.impl.corba.RequestImpl)req[i], true); new Thread(null, invokeObject, "ORB-Request-Thread", 0, false).start(); } }
/** * Test catching the user exception, thrown on the remote side. */ public void testUserException() { System.out.println("**** Test user exception:"); ExceptionList exList = orb.create_exception_list(); exList.add(WeThrowThisExceptionHelper.type()); Request rq = object._create_request(null, "throwException", orb.create_list(1), null, exList, null ); rq.add_in_arg().insert_long(123); rq.invoke(); UnknownUserException uku = (UnknownUserException) rq.env().exception(); WeThrowThisException our_exception = WeThrowThisExceptionHelper.extract(uku.except); System.out.println(" Our user exception, field " + our_exception.ourField + ", has been thrown on remote side." ); }
/** * Passes wide (UTF-16) string and narrow (ISO8859_1) string. * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default * encodings. */ public void testWideNarrowStrings() throws BAD_OPERATION { System.out.println("**** Test 8 bit and 16 bit char strings"); Request rq = object._create_request(null, "passCharacters", orb.create_list(0), null); rq.add_in_arg().insert_wstring("wide string"); rq.add_in_arg().insert_string("narrow string"); rq.set_return_type(orb.get_primitive_tc(TCKind.tk_wstring)); rq.invoke(); System.out.println(" Returned ' " + rq.result().value().extract_wstring()); }
/** * Create the request for the local call */ public Request create_request(org.omg.CORBA.Object target, Context context, String operation, NVList parameters, NamedValue returns ) { if (orb instanceof OrbFunctional) { ((OrbFunctional) orb).ensureRunning(); } gnuRequest g = new gnuRequest(); g.setORB(orb); g.setOperation(operation); g.setIor(ior); g.m_target = target; g.ctx(context); g.set_args(parameters); if (returns != null) g.set_result(returns); return g; }
/** * Create the request for the local call. */ public Request create_request(org.omg.CORBA.Object target, Context context, String operation, NVList parameters, NamedValue returns, ExceptionList exceptions, ContextList ctx_list ) { if (orb instanceof OrbFunctional) { ((OrbFunctional) orb).ensureRunning(); } gnuRequest g = new gnuRequest(); g.setORB(orb); g.setOperation(operation); g.setIor(ior); g.m_target = target; g.ctx(context); g.set_args(parameters); g.set_exceptions(exceptions); g.set_context_list(ctx_list); if (returns != null) g.set_result(returns); return g; }
/** * Creates the request to invoke the method on this object. * * @param target the object, for that the operation must be invoked. * @param context context (null allowed) * @param operation the method name * @param parameters the method parameters * @param returns the return value holder * * @return the created request. */ public Request create_request(org.omg.CORBA.Object target, Context context, String operation, NVList parameters, NamedValue returns ) { gnuRequest request = getRequestInstance(target); request.setIor(getIor()); request.set_target(target); request.setOperation(operation); request.set_args(parameters); request.m_context = context; request.set_result(returns); request.setORB(orb); return request; }
/** * Creates the request to invoke the method on this object. * * @param target the object, for that the operation must be invoked. * @param context context (null allowed) * @param operation the method name * @param parameters the method parameters * @param returns the return value holder * * @return the created request. */ public Request create_request(org.omg.CORBA.Object target, Context context, String operation, NVList parameters, NamedValue returns, ExceptionList exceptions, ContextList ctx_list ) { gnuRequest request = getRequestInstance(target); request.setIor(ior); request.set_target(target); request.setOperation(operation); request.set_args(parameters); request.m_context = context; request.set_result(returns); request.set_exceptions(exceptions); request.set_context_list(ctx_list); request.setORB(orb); return request; }
public Request create_request(org.omg.CORBA.Object obj, Context ctx, String operation, NVList arg_list, NamedValue result) { return new RequestImpl(orb, obj, ctx, operation, arg_list, result, null, null); }
public Request create_request(org.omg.CORBA.Object obj, Context ctx, String operation, NVList arg_list, NamedValue result, ExceptionList exclist, ContextList ctxlist) { return new RequestImpl(orb, obj, ctx, operation, arg_list, result, exclist, ctxlist); }
public synchronized void send_multiple_requests_oneway(Request[] req) { checkShutdownState(); // Invoke the send_oneway on each new Request for (int i = 0; i < req.length; i++) { req[i].send_oneway(); } }
/** * Get the next request that has gotten a response. * * @result the next request ready with a response. */ public org.omg.CORBA.Request get_next_response() throws org.omg.CORBA.WrongTransaction { synchronized( this ) { checkShutdownState(); } while (true) { // check if there already is a response synchronized ( dynamicRequests ) { Enumeration elems = dynamicRequests.elements(); while ( elems.hasMoreElements() ) { Request currRequest = (Request)elems.nextElement(); if ( currRequest.poll_response() ) { // get the response for this successfully polled Request currRequest.get_response(); dynamicRequests.removeElement(currRequest); return currRequest; } } } // wait for a response synchronized(this.svResponseReceived) { while (!this.svResponseReceived.value()) { try { this.svResponseReceived.wait(); } catch(java.lang.InterruptedException ex) { // NO-OP } } // reinitialize the response flag this.svResponseReceived.reset(); } } }