Package org.jboss.ws.extensions.wsrm.api

Examples of org.jboss.ws.extensions.wsrm.api.RMException


      else
      {
         if (false == sequence.getInboundId().equals(inboundSeqId))
         {
            logger.warn("Expected inbound sequenceId:" + sequence.getInboundId() + " , but was: " + inboundSeqId);
            throw new RMException("Expected inbound sequenceId:" + sequence.getInboundId() + " , but was: " + inboundSeqId);
         }
      }
      sequence.addReceivedInboundMessage(seqHeader.getMessageNumber());
   }
View Full Code Here


   public final RMMessage send(RMMessage request) throws Throwable
   {
      RMMessageRetransmissionConfig qos = RMTransportHelper.getSequence(request).getRMConfig().getMessageRetransmission();
      if (qos == null)
         throw new RMException("User must specify message retransmission configuration in JAX-WS WS-RM config");
     
      int countOfAttempts = qos.getCountOfAttempts();
      int inactivityTimeout = qos.getMessageTimeout();
      int retransmissionInterval = qos.getRetransmissionInterval();
      RMChannelResponse result = null;
      long startTime = 0L;
      long endTime = 0L;
      int attemptNumber = 1;
     
      for (int i = 0; i < countOfAttempts; i++)
      {
         logger.debug("Sending RM request - attempt no. " + attemptNumber++);
         Future<RMChannelResponse> futureResult = rmTasksQueue.submit(new RMChannelTask(request));
         try
         {
            startTime = System.currentTimeMillis();
            result = futureResult.get(inactivityTimeout, TimeUnit.SECONDS);
            if (result != null)
            {
               Throwable t = result.getFault();
               if (t != null)
               {
                  logger.warn(result.getFault().getClass().getName(), result.getFault());
               }
               else
               {
                  endTime = System.currentTimeMillis();
                  if (result.getResponse() != null)
                  {
                     Map<String, Object> remotingCtx = result.getResponse().getMetadata().getContext(RMChannelConstants.REMOTING_INVOCATION_CONTEXT);
                     if (remotingCtx != null)
                     {
                        if (Integer.valueOf(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).equals(remotingCtx.get(HTTPMetadataConstants.RESPONSE_CODE)))
                        {
                           logger.debug("Response message received in " + (endTime - startTime) + " miliseconds, but contains internal server code, going to resend the request message");
                           continue;
                        }
                     }
                  }
                  logger.debug("Response message received in " + (endTime - startTime) + " miliseconds");
                  break;
               }
               try
               {
                  Thread.sleep(retransmissionInterval * 1000);
               }
               catch (InterruptedException ie)
               {
                  logger.warn(ie.getMessage(), ie);
               }
            }
         }
         catch (TimeoutException te)
         {
            endTime = System.currentTimeMillis();
            logger.warn("Timeout - response message not received in " + (endTime - startTime) + " miliseconds");
            try
            {
               Thread.sleep(retransmissionInterval * 1000);
            }
            catch (InterruptedException ie)
            {
               logger.warn(ie.getMessage(), ie);
            }
         }
      }

      if (result == null)
         throw new RMException("Unable to deliver message with addressing id: " + RMTransportHelper.getAddressingMessageId(request) + ". Count of attempts to deliver the message was: " + countOfAttempts);
     
      Throwable fault = result.getFault();
      if (fault != null)
      {
         throw new RMException("Unable to deliver message with addressing id: " + RMTransportHelper.getAddressingMessageId(request) + ". Count of attempts to deliver the message was: " + countOfAttempts, fault);
      }
      else
      {
         return result.getResponse();
      }
View Full Code Here

   }
  
   public void validate()
   {
      if (this.identifier == null)
         throw new RMException("Identifier not set");
   }
View Full Code Here

   }

   public void validate()
   {
      if (this.identifier == null)
         throw new RMException("Identifier not set");
      if ((this.acknowledgementRanges.size() == 0) && (this.nacks.size() == 0) && (!this.isNone))
         throw new RMException("AcknowledgementRange or Nack or None must be set");
   }
View Full Code Here

         candidateSequence.setDuration(RMHelper.durationToLong(createSequenceResponse.getExpires()));
         this.wsrmSequence = candidateSequence;
      }
      catch (Exception e)
      {
         throw new RMException("Unable to create WSRM sequence", e);
      }
   }
View Full Code Here

   }

   public void validate()
   {
      if (this.identifier == null)
         throw new RMException("Identifier not set");
   }
View Full Code Here

   }

   public void validate()
   {
      if (this.identifier == null)
         throw new RMException("Identifier not set");
   }
View Full Code Here

   }

   public void validate()
   {
      if (this.faultCode == null)
         throw new RMException("FaultCode must be set");
   }
View Full Code Here

     
      // try to serialize SequenceAcknowledgement to message
      serialize(rmConstants.getSequenceAcknowledgementQName(), outMsgs, data, soapMessage, sequenceImpl);
     
      if ((outMsgs.size() != 0) && (data.size() == 0))
         throw new RMException("RM handler did not serialize WS-RM message to the payload");

      return true;
   }
View Full Code Here

      deserialize(rmConstants.getTerminateSequenceResponseQName(), soapMessage, messages, data);
     
      // TODO: implement SequenceFault deserialization
     
      if (data.size() == 0)
         throw new RMException("RM handler was not able to find WS-RM message in the payload");
     
      // propagate RM response context to higher layers
      msgContext.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext);
      msgContext.setScope(RMConstant.RESPONSE_CONTEXT, Scope.APPLICATION);
     
View Full Code Here

TOP

Related Classes of org.jboss.ws.extensions.wsrm.api.RMException

Copyright © 2018 www.massapicom. 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.