Package org.apache.sandesha2.workers

Examples of org.apache.sandesha2.workers.SequenceEntry


     
      //setting a dummy property been to stop Sandesha2 from throwing exceptions.
      SandeshaPolicyBean policyBean = new SandeshaPolicyBean ();
      axisConfiguration.addParameter(new Parameter (Sandesha2Constants.SANDESHA_PROPERTY_BEAN,policyBean));
     
      InMemoryStorageManager storageManager = new InMemoryStorageManager (configurationContext);
     
      Transaction transaction = storageManager.getTransaction();
     
      RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
     
      RMSBean rmsBean = new RMSBean ();
      RMSBean duplicateRMSBean = new RMSBean ();
     
      rmsBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
View Full Code Here


    rmdBean.setSequenceID(seqID);
    rmdBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmdBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmdBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmdBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmdBean.setServerCompletedMessages(new RangeString());
    // Flag that the sequence is closed.
    rmdBean.setClosed(true);
   
    // Create a transaction and insert the RMSBean
    Transaction tran = storageManager.getTransaction();
View Full Code Here

    rmsBean.setInternalSequenceID(SandeshaUtil.getInternalSequenceID(seqID, null));
    rmsBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmsBean.setClientCompletedMessages(new RangeString());
    rmsBean.setNextMessageNumber(1);
   
    // Create a transaction and insert the RMSBean
    Transaction tran = storageManager.getTransaction();
   
View Full Code Here

    rmsBean.setInternalSequenceID(SandeshaUtil.getInternalSequenceID(seqID, null));
    rmsBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmsBean.setClientCompletedMessages(new RangeString());
    rmsBean.setNextMessageNumber(4);
    rmsBean.setHighestOutMessageNumber(3);
   
    SenderBean bean1 = getSenderBean(seqID, 1, 1);
    SenderBean bean2 = getSenderBean(seqID, 0, 2);
View Full Code Here

    MessagePending messagePending = (MessagePending) message.getMessagePart(Sandesha2Constants.MessageParts.MESSAGE_PENDING);
    if (messagePending!=null) {
      boolean pending = messagePending.isPending();
      if (pending) {
        SequenceEntry entry = (SequenceEntry) message.getProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY);
        if(entry != null) {
          ConfigurationContext context = message.getConfigurationContext();
          StorageManager storage = SandeshaUtil.getSandeshaStorageManager(context, context.getAxisConfiguration());
          PollingManager pollingManager = storage.getPollingManager();
          if(pollingManager != null) pollingManager.schedulePollingRequest(entry.getSequenceId(), entry.isRmSource());
        }
      }
    }
     
   
View Full Code Here

    try {
      // If we have request scheduled, handle them first, and then pick
      // pick a sequence using a round-robin approach. Scheduled polls
      // bypass the normal polling checks, to make sure that they happen
      boolean forcePoll = false;
      SequenceEntry entry = null;
      synchronized (this) {
        if(!scheduledPollingRequests.isEmpty()) {
          entry = (SequenceEntry) scheduledPollingRequests.removeFirst();
          forcePoll = true;
        }
      }
      if(entry == null) {
        ArrayList allSequencesList = getSequences();
        int size = allSequencesList.size();
        if(log.isDebugEnabled()) log.debug("Choosing one from " + size + " sequences");
        if(nextIndex >= size) {
          nextIndex = 0;
          // We just looped over the set of sequences, so sleep before we try
          // polling them again.
          if (log.isDebugEnabled()) log.debug("Exit: PollingManager::internalRun, looped over all sequences, sleeping");
          return true;
        }
 
        entry = (SequenceEntry) allSequencesList.get(nextIndex++);
      }
      if(log.isDebugEnabled()) log.debug("Chose sequence " + entry.getSequenceId());

      t = storageManager.getTransaction();
      if(entry.isRmSource()) {
        pollRMSSide(entry, forcePoll);
      } else {
        pollRMDSide(entry, forcePoll);
      }
      if(t != null) t.commit();
View Full Code Here

   * @param sequenceId
   */
  public synchronized void schedulePollingRequest(String sequenceId, boolean rmSource) {
    if(log.isDebugEnabled()) log.debug("Enter: PollingManager::shedulePollingRequest, " + sequenceId);
   
    SequenceEntry entry = new SequenceEntry(sequenceId, rmSource);
    scheduledPollingRequests.add(entry);
    this.wakeThread();
   
    if(log.isDebugEnabled()) log.debug("Exit: PollingManager::shedulePollingRequest");
  }
View Full Code Here

    MessageContext createSeqContext = createSequenceMsg.getMessageContext();
   
    // If this create is the result of a MakeConnection, then we must have a related
    // outbound sequence.
    SequenceEntry entry = (SequenceEntry) createSeqContext.getProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY);
    if(log.isDebugEnabled()) log.debug("This message is associated with sequence entry: " + entry);
    if(entry != null && entry.isRmSource()) {
      rmdBean.setOutboundInternalSequence(entry.getSequenceId());
    }

    rmdBean.setServerCompletedMessages(new RangeString());
   
    rmdBean.setReplyToEPR(to.getAddress());
View Full Code Here

    try {
      // If we have request scheduled, handle them first, and then pick
      // pick a sequence using a round-robin approach. Scheduled polls
      // bypass the normal polling checks, to make sure that they happen
      boolean forcePoll = false;
      SequenceEntry entry = null;
      synchronized (this) {
        if(!scheduledPollingRequests.isEmpty()) {
          entry = (SequenceEntry) scheduledPollingRequests.removeFirst();
          forcePoll = true;
        }
      }
      if(entry == null) {
        ArrayList allSequencesList = getSequences();
        int size = allSequencesList.size();
        if(log.isDebugEnabled()) log.debug("Choosing one from " + size + " sequences");
        if(nextIndex >= size) {
          nextIndex = 0;
          // We just looped over the set of sequences, so sleep before we try
          // polling them again.
          if (log.isDebugEnabled()) log.debug("Exit: PollingManager::internalRun, looped over all sequences, sleeping");
          return true;
        }
 
        entry = (SequenceEntry) allSequencesList.get(nextIndex++);
       
        long now = System.currentTimeMillis();
        Long time = (Long) pollTimes.get(entry.getSequenceId());
        if(time != null && (now - time.longValue()) < POLLING_MANAGER_WAIT_TIME) {
          // We have polled for this sequence too recently, so skip over this one
          if (log.isDebugEnabled()) log.debug("Exit: PollingManager::internalRun, skipping sequence, not sleeping");
          return false;
        }
        pollTimes.put(entry.getSequenceId(), new Long(now));
       
      }
      if(log.isDebugEnabled()) log.debug("Chose sequence " + entry.getSequenceId());

      t = storageManager.getTransaction();
      if(entry.isRmSource()) {
        pollRMSSide(entry, forcePoll);
      } else {
        pollRMDSide(entry, forcePoll);
      }
      if(t != null) t.commit();
View Full Code Here

   * @param sequenceId
   */
  public synchronized void schedulePollingRequest(String sequenceId, boolean rmSource) {
    if(log.isDebugEnabled()) log.debug("Enter: PollingManager::shedulePollingRequest, " + sequenceId);
   
    SequenceEntry entry = new SequenceEntry(sequenceId, rmSource);
    scheduledPollingRequests.add(entry);
    this.wakeThread();
   
    if(log.isDebugEnabled()) log.debug("Exit: PollingManager::shedulePollingRequest");
  }
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.workers.SequenceEntry

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.