Examples of InvocationRequest


Examples of org.jboss.remoting.InvocationRequest

         }
      }

      if (payload instanceof InvocationRequest)
      {
         InvocationRequest ir = (InvocationRequest) payload;
         Map metadata = ir.getRequestPayload();
         if (metadata == null)
         {
            metadata = new HashMap();
            ir.setRequestPayload(metadata);
         }
         try
         {
            String clientHost = RemoteServer.getClientHost();
            metadata.put(Remoting.CLIENT_ADDRESS, InetAddress.getByName(clientHost));
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

      Object obj = versionedRead(inputStream, invoker, getClass().getClassLoader(), version);

      // setting timestamp since about to start processing
      lastRequestHandledTimestamp = System.currentTimeMillis();

      InvocationRequest req = null;
      boolean createdInvocationRequest = false;
      boolean isError = false;

      if(obj instanceof InvocationRequest)
      {
         req = (InvocationRequest)obj;
      }
      else
      {
         req = createInvocationRequest(obj, socketWrapper);
         createdInvocationRequest = true;
         performVersioning = false;
      }

      boolean isServerSideOnewayRequest = isServerSideOneway(req);
      InetAddress clientAddress = socketWrapper.getSocket().getInetAddress();
      Object resp = null;

      try
      {
         // Make absolutely sure thread interrupted is cleared.
         Thread.interrupted();

         if(trace) { log.trace("about to call " + invoker + ".invoke()"); }

         if (req.getRequestPayload() == null)
            req.setRequestPayload(new HashMap());

         req.getRequestPayload().put(Remoting.CLIENT_ADDRESS, clientAddress);

         // call transport on the subclass, get the result to handback
         resp = invoker.invoke(req);

         if(trace) { log.trace(invoker + ".invoke() returned " + resp); }
      }
      catch (Throwable ex)
      {
         resp = ex;
         isError = true;
         if (trace) log.trace(invoker + ".invoke() call failed", ex);
      }

      Thread.interrupted(); // clear interrupted state so we don't fail on socket writes

      if(isServerSideOnewayRequest)
      {
         if(trace) { log.trace("oneway request, writing no reply on the wire"); }
      }
      else
      {
         if(!createdInvocationRequest)
         {
            // need to return invocation response
            if(trace) { log.trace("creating response instance"); }
            resp = new InvocationResponse(req.getSessionId(), resp, isError, req.getReturnPayload());
         }

         OutputStream outputStream = socketWrapper.getOutputStream();
         if (performVersioning)
         {
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

      else
      {
         // need to wrap request with invocation request
         SocketAddress remoteAddress = socketWrapper.getSocket().getRemoteSocketAddress();

         return new InvocationRequest(remoteAddress.toString(),
                                      invoker.getSupportedSubsystems()[0],
                                      obj, new HashMap(), null, null);
      }
   }
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

      return HTTPMarshaller.DATATYPE;
   }

   protected InvocationRequest getInvocationRequest(Map metadata, Object obj)
   {
      InvocationRequest request = null;

      if(obj instanceof InvocationRequest)
      {
         request = (InvocationRequest) obj;
         if(request.getRequestPayload() == null)
         {
            request.setRequestPayload(metadata);
         }
         else
         {
            request.getRequestPayload().putAll(metadata);
         }
      }
      else
      {
         request = createNewInvocationRequest(metadata, obj);
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

   {
      // will try to use the same session id if possible to track
      String sessionId = getSessionId(metadata);
      String subSystem = (String) metadata.get(HEADER_SUBSYSTEM);

      InvocationRequest request = null;
      Map responseMap = new HashMap();
      boolean isLeasQuery = checkForLeaseQuery(metadata);
      if(isLeasQuery)
      {
         addLeaseInfo(responseMap);
         request = new CreatedInvocationRequest(sessionId, subSystem, "$PING$", null, responseMap, null);
      }
      else
      {
         request = new CreatedInvocationRequest(sessionId, subSystem, payload, metadata, null, null);
      }
      request.setReturnPayload(responseMap);
      return request;
   }
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

      boolean shouldLease = false;
      long leasePeriod = -1;

      if(invocation != null && invocation instanceof InvocationRequest)
      {
         InvocationRequest request = (InvocationRequest)invocation;

         Object payload = request.getParameter();
         // although a bit of a hack, this will determin if first time ping called by client.
         if(payload != null && payload instanceof String && "$PING$".equalsIgnoreCase((String)payload) && request.getReturnPayload() != null)
         {
            try
            {
               // now know is a ping request, so convert to be a HEAD method call
               conn.setDoOutput(false);
               conn.setDoInput(true);
               conn.setRequestMethod("HEAD");
               // set the remoting version
               conn.setRequestProperty(HTTPMetadataConstants.REMOTING_VERSION_HEADER, new Integer(getVersion()).toString());
               // set the user agent
               conn.setRequestProperty(HTTPMetadataConstants.REMOTING_USER_AGENT, "JBossRemoting - " + Version.VERSION);
               conn.setRequestProperty(HTTPMetadataConstants.REMOTING_LEASE_QUERY, "true");
               conn.setRequestProperty("sessionId", request.getSessionId());
               conn.connect();

               //InputStream is = (conn.getResponseCode() < 400) ? conn.getInputStream() : conn.getErrorStream();
               Map headers = conn.getHeaderFields();
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

         Home home = null;
         try
         {
            home = (Home) it.next();
            locator = new InvokerLocator(protocol, home.host, home.port, path, params);
            invoke(new InvocationRequest(null, null, ServerInvoker.ECHO, null, null, null));
            if (log.isTraceEnabled()) log.trace(this + " able to contact server at: " + home);
            return home;
         }
         catch (Throwable e)
         {
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

   {
     if (oneway)
     {      
       OnewayInvocation oi = new OnewayInvocation(this);
 
       InvocationRequest request =
         new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,
             oi, ONE_WAY_METADATA, null, null);
 
       return request;    
     }
     else
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

      {
         PacketSupport packet = null;
        
         if (obj instanceof InvocationRequest)
         {                       
            InvocationRequest req = (InvocationRequest)obj;
           
            Object param = req.getParameter();
           
            if (param instanceof PacketSupport)
            {
               // A JBM invocation
               packet = (PacketSupport)param;   
View Full Code Here

Examples of org.jboss.remoting.InvocationRequest

  
   public Object getPayload()
   {
      //Wrap this in an InvocationRequest
        
      InvocationRequest req = new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,
                                                    this, null, null, null);
     
      return req;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.