Examples of InvokerBeanMgr


Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

   * @param sequenceID
   * @throws SandeshaException
   */
  public static void cleanReceivingSideAfterInvocation (ConfigurationContext configContext, String sequenceID) throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    InvokerBeanMgr storageMapBeanMgr = storageManager.getStorageMapBeanMgr();
       
    //removing storageMap entries
    InvokerBean findStorageMapBean = new InvokerBean ();
    findStorageMapBean.setSequenceID(sequenceID);
    findStorageMapBean.setInvoked(true);
    Collection collection = storageMapBeanMgr.find(findStorageMapBean);
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
      InvokerBean storageMapBean = (InvokerBean) iterator.next();
      storageMapBeanMgr.delete(storageMapBean.getMessageContextRefKey());
    }
   
    String cleanStatus = (String) receivingSideCleanMap.get(sequenceID);
    if (cleanStatus!=null && CLEANED_ON_TERMINATE_MSG.equals(cleanStatus))
      completeTerminationOfReceivingSide(configContext,sequenceID);
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

   * This has to be called by the lastly invocated one of the above two methods.
   *
   */
  private static void completeTerminationOfReceivingSide (ConfigurationContext configContext, String sequenceID) throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    InvokerBeanMgr storageMapBeanMgr = storageManager.getStorageMapBeanMgr();
    NextMsgBeanMgr nextMsgBeanMgr = storageManager.getNextMsgBeanMgr();
   
    //removing nextMsgMgr entries
    NextMsgBean findNextMsgBean = new NextMsgBean ();
    findNextMsgBean.setSequenceID(sequenceID);
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

    NextMsgBean bean = mgr.retrieve(sequenceId);

    if (bean == null)
      throw new SandeshaException("Error- The sequence does not exist");

    InvokerBeanMgr storageMapMgr = storageManager.getStorageMapBeanMgr();
   
    //inorder invocation is still a global property
    boolean inOrderInvocation = SandeshaUtil.getPropertyBean(msgCtx.getConfigurationContext().getAxisConfiguration()).isInOrder();
   
    if (inOrderInvocation) {
     
      //pause the message
      rmMsgCtx.pause();
     
      SequencePropertyBean incomingSequenceListBean = (SequencePropertyBean) seqPropMgr
          .retrieve(
              Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
              Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);

      if (incomingSequenceListBean == null) {
        ArrayList incomingSequenceList = new ArrayList();
        incomingSequenceListBean = new SequencePropertyBean();
        incomingSequenceListBean
            .setSequenceID(Sandesha2Constants.SequenceProperties.ALL_SEQUENCES);
        incomingSequenceListBean
            .setName(Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
        incomingSequenceListBean.setValue(incomingSequenceList
            .toString());

        seqPropMgr.insert(incomingSequenceListBean);
      }

      ArrayList incomingSequenceList = SandeshaUtil
          .getArrayListFromString(incomingSequenceListBean.getValue());

      //Adding current sequence to the incoming sequence List.
      if (!incomingSequenceList.contains(sequenceId)) {
        incomingSequenceList.add(sequenceId);

        //saving the property.
        incomingSequenceListBean.setValue(incomingSequenceList
            .toString());
        seqPropMgr.insert(incomingSequenceListBean);
      }

      //saving the message.
      try {
        storageManager.storeMessageContext(key,rmMsgCtx
            .getMessageContext());
        storageMapMgr.insert(new InvokerBean(key, msgNo, sequenceId));

        //This will avoid performing application processing more
        // than
        // once.
        rmMsgCtx.setProperty(
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

        finder.setMsgNo(messageNumber + 1);

        StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());
        tran = storageManager.getTransaction();

        InvokerBeanMgr mgr = storageManager.getInvokerBeanMgr();
        InvokerBean nextBean = mgr.findUnique(finder);

        if(nextBean != null) {
          if(pooledThread) {
            if(log.isDebugEnabled()) log.debug("InvokerWorker:: pooledThread");
            initializeFromBean(nextBean);
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

    }
   
    try {
     
      StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration());
      InvokerBeanMgr invokerBeanMgr = storageManager.getInvokerBeanMgr();
     
      //starting a transaction
      if(tran == null) {
        transaction = storageManager.getTransaction();
      } else {
        transaction = tran;
      }
     
      InvokerBean invokerBean = invokerBeanMgr.retrieve(messageContextKey);

      msgToInvoke = storageManager.retrieveMessageContext(messageContextKey, configurationContext);
      if(msgToInvoke==null){
        //return since there is nothing to do
        if(log.isDebugEnabled()) log.debug("null msg");
        return false;
      }

      // ending the transaction before invocation.
      if(transaction != null) {
        transaction.commit();
        transaction = storageManager.getTransaction();
      }

      RMMsgContext rmMsg = MsgInitializer.initializeMessage(msgToInvoke);

      // Lock the RMD Bean just to avoid deadlocks
      RMDBean rMDBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, invokerBean.getSequenceID());

      boolean highestMessage = false;

      if(!ignoreNextMsg){
        // updating the next msg to invoke
        long nextMsgNo = rMDBean.getNextMsgNoToProcess();
       
        if (!(invokerBean.getMsgNo()==nextMsgNo)) {
          //someone else has invoked this before us - this run should now stop
          if(log.isDebugEnabled()) log.debug("Operated message number is different from the Next Message Number to invoke");
          return false;
        }
       
        nextMsgNo++;
        rMDBean.setNextMsgNoToProcess(nextMsgNo);
        storageManager.getRMDBeanMgr().update(rMDBean);
      }
     
      // Check if this is the last message
      if (rmMsg.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
        Sequence sequence = rmMsg.getSequence();
       
        if (sequence.getLastMessage()) {
          //this will work for RM 1.0 only
          highestMessage = true;
        } else {
          if (rMDBean!=null && rMDBean.isTerminated()) {
            long highestInMsgNo = rMDBean.getHighestInMessageNumber();
            if (invokerBean.getMsgNo()==highestInMsgNo)
              highestMessage = true;
          }
        }
      }

      // Depending on the transaction  support, the service will be invoked only once.
      // Therefore we delete the invoker bean and message now, ahead of time
      invokerBeanMgr.delete(messageContextKey);
      // removing the corresponding message context as well.
      storageManager.removeMessageContext(messageContextKey);

      try {
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

   */
  public static void cleanReceivingSideAfterInvocation(String sequenceId,
      StorageManager storageManager) throws SandeshaException {
    if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Enter: TerminateManager::cleanReceivingSideAfterInvocation " +sequenceId);
   
    InvokerBeanMgr invokerBeanMgr = storageManager.getInvokerBeanMgr();

    // removing InvokerBean entries
    InvokerBean invokerFindBean = new InvokerBean();
    invokerFindBean.setSequenceID(sequenceId);
    Collection<InvokerBean> collection = invokerBeanMgr.find(invokerFindBean);
    Iterator<InvokerBean> iterator = collection.iterator();
    while (iterator.hasNext()) {
      InvokerBean invokerBean = (InvokerBean) iterator.next();
      String messageStoreKey = invokerBean.getMessageContextRefKey();
      invokerBeanMgr.delete(messageStoreKey);

      // removing the respective message context from the message store.
      storageManager.removeMessageContext(messageStoreKey);
    }

View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

//    //first we block while we wait for the invoking thread to pause
//    blockForPause();
    try{
      StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(ctx, ctx.getAxisConfiguration());
      //get all invoker beans for the sequence
      InvokerBeanMgr storageMapMgr = storageManager
          .getInvokerBeanMgr();
      RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
      RMDBean rMDBean = rmdBeanMgr.retrieve(sequenceID);
     
      if (rMDBean != null) {
       
        //The outOfOrder window is the set of known sequence messages (including those
        //that are missing) at the time the button is pressed.
        long firstMessageInOutOfOrderWindow = rMDBean.getNextMsgNoToProcess();
     
        InvokerBean selector = new InvokerBean();
        selector.setSequenceID(sequenceID);
        Iterator<InvokerBean> stMapIt = storageMapMgr.find(selector).iterator();
       
        long highestMsgNumberInvoked = 0;
        Transaction transaction = null;
       
        //invoke each bean in turn.
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

    Transaction transaction = null;

    try {
      RMDBeanMgr nextMsgMgr = storageManager.getRMDBeanMgr();

      InvokerBeanMgr storageMapMgr = storageManager
          .getInvokerBeanMgr();

      transaction = storageManager.getTransaction();
     
      // Pick a sequence using a round-robin approach
      ArrayList<SequenceEntry> allSequencesList = getSequences();
      int size = allSequencesList.size();
      log.debug("Choosing one from " + size + " sequences");
      if(nextIndex >= size) {
        nextIndex = 0;

        // We just looped over the set of sequences. If we didn't process any
        // messages on this loop then we sleep before the next one
        if(size == 0 || !processedMessage) {
          sleep = true;
        }
        processedMessage = false;
       
        if (log.isDebugEnabled()) log.debug("Exit: Invoker::internalRun, looped over all sequences, sleep " + sleep);
       
        if(transaction != null && transaction.isActive()) transaction.commit();
        transaction = null;
       
        return sleep;
      }

      SequenceEntry entry = (SequenceEntry) allSequencesList.get(nextIndex++);
      String sequenceId = entry.getSequenceId();
      log.debug("Chose sequence " + sequenceId);

      RMDBean nextMsgBean = nextMsgMgr.retrieve(sequenceId);
      if (nextMsgBean == null) {
        log.debug("Next message not set correctly. Removing invalid entry.");

        stopThreadForSequence(sequenceId, entry.isRmSource());
        allSequencesList = getSequences();
        if (allSequencesList.size() == 0)
          sleep = true;

        if (log.isDebugEnabled()) log.debug("Exit: Invoker::internalRun, sleep " + sleep);
       
        if(transaction != null && transaction.isActive()) transaction.commit();
        transaction = null;

        return sleep;
      }

      long nextMsgno = nextMsgBean.getNextMsgNoToProcess();
      if (nextMsgno <= 0) {
        // Make sure we sleep on the next loop, so that we don't spin in a tight loop
        sleep = true;
        if (log.isDebugEnabled())
          log.debug("Invalid Next Message Number " + nextMsgno);
        String message = SandeshaMessageHelper.getMessage(
            SandeshaMessageKeys.invalidMsgNumber, Long
                .toString(nextMsgno));
        throw new SandeshaException(message);
      }

      InvokerBean selector = new InvokerBean();
      selector.setSequenceID(sequenceId);
      selector.setMsgNo(nextMsgno);
      List<InvokerBean> invokerBeans = storageMapMgr.find(selector);
     
      //add any msgs that belong to out of order windows
      addOutOfOrderInvokerBeansToList(sequenceId,
          storageManager, invokerBeans);
     
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

   * @throws SandeshaException
   */
  public static void terminateAfterInvocation (ConfigurationContext configContext, String sequenceID) throws SandeshaException {
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext);
    SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropretyBeanMgr();
    InvokerBeanMgr storageMapBeanMgr = storageManager.getStorageMapBeanMgr();

    //removing storageMap entries
    InvokerBean findStorageMapBean = new InvokerBean ();
    findStorageMapBean.setSequenceId(sequenceID);
    Collection collection = storageMapBeanMgr.find(findStorageMapBean);
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
      InvokerBean storageMapBean = (InvokerBean) iterator.next();
      storageMapBeanMgr.delete(storageMapBean.getKey());
    }
   
    SequencePropertyBean allSequenceBean = sequencePropertyBeanMgr.retrieve(Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
    ArrayList allSequenceList = (ArrayList) allSequenceBean.getValue();
   
View Full Code Here

Examples of org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr

    NextMsgBean bean = mgr.retrieve(sequenceId);

    if (bean == null)
      throw new SandeshaException("Error- The sequence does not exist");

    InvokerBeanMgr storageMapMgr = storageManager.getStorageMapBeanMgr();

    long nextMsgno = bean.getNextMsgNoToProcess();

    if (msgCtx.isServerSide()) {
      boolean inOrderInvocation = PropertyManager.getInstance().isInOrderInvocation();
      if (inOrderInvocation) {
        //pause the message
        msgCtx.setPausedTrue(new QName(Sandesha2Constants.IN_HANDLER_NAME));

        SequencePropertyBean incomingSequenceListBean = (SequencePropertyBean) seqPropMgr
            .retrieve(
                Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
                Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);

        if (incomingSequenceListBean == null) {
          ArrayList incomingSequenceList = new ArrayList();
          incomingSequenceListBean = new SequencePropertyBean();
          incomingSequenceListBean
              .setSequenceId(Sandesha2Constants.SequenceProperties.ALL_SEQUENCES);
          incomingSequenceListBean
              .setName(Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
          incomingSequenceListBean.setValue(incomingSequenceList);

          seqPropMgr.insert(incomingSequenceListBean);
        }

        ArrayList incomingSequenceList = (ArrayList) incomingSequenceListBean
            .getValue();

        //Adding current sequence to the incoming sequence List.
        if (!incomingSequenceList.contains(sequenceId)) {
          incomingSequenceList.add(sequenceId);
        }

        //saving the message.
        try {
          String key = SandeshaUtil.storeMessageContext(rmMsgCtx
              .getMessageContext());
          storageMapMgr.insert(new InvokerBean(key, msgNo,
              sequenceId));

          //This will avoid performing application processing more
          // than
          // once.
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.