4 Replies Latest reply on Aug 31, 2010 11:37 PM by silverjava

    Result Handler in Synchronus Mode?

    SrinivasanJR Level 1

      Hi,

       

            When i call the remote method from Flex to Java, a callback thread will be started which handles both the result and fault in 2 different methods.

       

      But i have a scenario like this.

       

      1) Call the remote Method from Flex to Java through BlazeDS.

      2) The Java Method returns a integer Value.

      3) Instead of handling this return in resultHandler, I would like to get the return value there itself.

       

      Is it possible?

       

       

      Please find my sample code.

       

          public static var server_:RemoteObject=new RemoteObject("sessionManager");            // Remote Object

       

         public static function faultEventHandler(event:FaultEvent):void            // FaultHandler
          {
              Alert.show(event.toString(),"Error Message");
          }
         
             
          public static function resultEventHandler(event:ResultEvent):void    // ResultHandler
          {

             //  Process the infoMessageHolder

       

           }

       

           public static function getSession(userId:UserLoginIdentifier , sessionIdHolder:Object,
                  message:InfoMessageHolder):InfoMessageHolder {
              try {
                  return server_.getSession(userId, true, message);              // Remote Call to Java Method
              } catch (e:Error) {
      //            TraceManager.TrException(e);
                  throw e;
              }
              return null;
          }

       

       

      But I want to be like this

       

      public static function getSession(userId:UserLoginIdentifier ,  sessionIdHolder:Object,
                   message:InfoMessageHolder):InfoMessageHolder {
               try {
                  InfoMessageHolder retValue = server_.getSession(userId, true, message);     // Remote call to the Java method
               } catch (e:Error) {
      //            TraceManager.TrException(e);
                   throw e;
               }
               return null;
           }

       

       

       

      Regards

      srini