Examples of InvokerBean


Examples of org.apache.sandesha2.storage.beans.InvokerBean

    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.beans.InvokerBean

    super(mgr, context, Sandesha2Constants.BeanMAPs.STORAGE_MAP);
  }

  public boolean insert(InvokerBean bean) throws SandeshaStorageException {
    //first check that an invoker bean does not already exist with the same msg and seq numbers
    InvokerBean finder = new InvokerBean();
    finder.setMsgNo(bean.getMsgNo());
    finder.setSequenceID(bean.getSequenceID());
    lock.lock();
    boolean result = false;
    if(super.findUnique(finder)!=null){
      if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("InMemoryInvokerBeanMgr insert failed due to existing invoker bean");
      result = false;
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

    return sql.toString();
  }

  private InvokerBean getInvokerBean(ResultSet rs)
      throws Exception {
    InvokerBean invokerBean = new InvokerBean();
    invokerBean.setMessageContextRefKey(rs.getString("message_context_ref_key"));
    invokerBean.setSequenceID(rs.getString("sequence_id"));
    invokerBean.setMsgNo(rs.getLong("msg_no"));
    invokerBean.setFlags(rs.getInt("flags"));
    invokerBean.setContext((Serializable) getObject(rs, "context"));
    return invokerBean;
  }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

    return true;
  }

  public InvokerBean retrieve(String key)
      throws SandeshaStorageException {
    InvokerBean invokerBean = null;
    try {
      Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
      ResultSet rs = stmt.executeQuery("select * from wsrm_invoker where message_context_ref_key='" + key + "'");
      if (! rs.next()) return invokerBean;
      invokerBean = getInvokerBean(rs);
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

  }

  public InvokerBean findUnique(InvokerBean bean)
      throws SandeshaException {
    String sql = requestForModel(bean);
    InvokerBean result = null;
    try {
      Statement stmt = getDbConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
      ResultSet rs = stmt.executeQuery(sql);
      while (rs.next()) {
        if (result == null) {
          result = getInvokerBean(rs);
        } else {
          String message = SandeshaMessageHelper.getMessage(
              SandeshaMessageKeys.nonUniqueResult,
              result.toString(),
              getInvokerBean(rs).toString());
          log.error(message);
          throw new SandeshaException(message);
        }
      }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

           
          boolean isDuplicate = true;
          //still allow this msg if we have no corresponding invoker bean for it and we are inOrder
          if(SandeshaUtil.isInOrder(rmMsgCtx.getMessageContext()))
          {
              InvokerBean finderBean = new InvokerBean();
              finderBean.setMsgNo(msgNo);
              finderBean.setSequenceID(sequenceId);
              List<InvokerBean> invokerBeanList = storageManager.getInvokerBeanMgr().find(finderBean);
              if((invokerBeanList==null || invokerBeanList.size()==0)
                  && bean.getNextMsgNoToProcess()<=msgNo){
                isDuplicate = false;
                if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled())
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

       
        //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.
        //NOTE: here we are breaking ordering
        while(stMapIt.hasNext()){
          //invoke the app
          try{
            transaction = storageManager.getTransaction();
            InvokerBean invoker = (InvokerBean)stMapIt.next();
           
            // start a new worker thread and let it do the invocation.
            String workId = sequenceID;
           
            InvokerWorker worker = new InvokerWorker(ctx, invoker);
            worker.forceOutOfOrder();
            worker.setPooled();
            worker.setWorkId(workId);
           
            // Wrap the invoker worker with the correct context, if needed.
            Runnable work = worker;
            ContextManager contextMgr = SandeshaUtil.getContextManager(ctx);
            if(contextMgr != null) {
              work = contextMgr.wrapWithContext(work, invoker.getContext());
            }
           
            // Setup the lock for the new worker
            worker.getLock().addWork(workId, worker);
            ctx.getThreadPool().execute(work);

            long msgNumber = invoker.getMsgNo();
            //if necessary, update the "next message number" bean under this transaction
            if(msgNumber>highestMsgNumberInvoked){
              highestMsgNumberInvoked = invoker.getMsgNo();
              rMDBean.setNextMsgNoToProcess(highestMsgNumberInvoked+1);
             
              if(allowLaterDeliveryOfMissingMessages){
                //we also need to update the sequence OUT_OF_ORDER_RANGES property
                //so as to include our latest view of this outOfOrder range.
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

   
    if(rmdBean != null && rmdBean.getOutOfOrderRanges() != null){
      RangeString rangeString = rmdBean.getOutOfOrderRanges();
      //we now have the set of ranges that can be delivered out of order.
      //Look for any invokable message that lies in one of those ranges
      InvokerBean selector = new InvokerBean();
      selector.setSequenceID(sequenceID);
      Iterator<InvokerBean> invokerBeansIterator =
        storageManager.getInvokerBeanMgr().find(selector).iterator();
     
      while(invokerBeansIterator.hasNext()){
        InvokerBean invokerBean = (InvokerBean)invokerBeansIterator.next();
       
        if(rangeString.isMessageNumberInRanges(invokerBean.getMsgNo())){
          //an invoker bean that has not been deleted and lies in an out
          //or order range - we can add this to the list
          list.add(invokerBean);
        }
      }
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

            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);
     
      // If there aren't any beans to process then move on to the next sequence
      if (invokerBeans.size() == 0) {
        if (log.isDebugEnabled()) log.debug("Exit: Invoker::internalRun, no beans to invoke on sequence " + sequenceId + ", sleep " + sleep);
       
        if(transaction != null && transaction.isActive()) transaction.commit();
        transaction = null;

        return sleep;
      }
     
      Iterator<InvokerBean> stMapIt = invokerBeans.iterator();

      //TODO correct the locking mechanism to have one lock per sequence.
      //TODO should this be a while, not an if?
      if (stMapIt.hasNext()) { //some invokation work is present
       
        InvokerBean bean = (InvokerBean) stMapIt.next();
        //see if this is an out of order msg
        boolean beanIsOutOfOrderMsg = bean.getMsgNo()!=nextMsgno;
       
        String workId = sequenceId;
                 
        //check whether the bean is already assigned to a worker.
        if (getWorkerLock().isWorkPresent(workId)) {
          // As there is already a worker assigned we are probably dispatching
          // messages too quickly, so we sleep before trying the next sequence.
          sleep = true;
          String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.workAlreadyAssigned, workId);
          if (log.isDebugEnabled()) log.debug("Exit: Invoker::internalRun, " + message + ", sleep " + sleep);
         
          if(transaction != null) {
            transaction.commit();
            transaction = null;
          }
         
          return sleep;
        }

        if(transaction != null) {
          transaction.commit();
          transaction = null;
        }

        // start a new worker thread and let it do the invocation.
        InvokerWorker worker = new InvokerWorker(context, bean);
        if(beanIsOutOfOrderMsg) worker.forceOutOfOrder();
        worker.setPooled();
        worker.setWorkId(workId);
       
        // Wrap the invoker worker with the correct context, if needed.
        Runnable work = worker;
        ContextManager contextMgr = SandeshaUtil.getContextManager(context);
        if(contextMgr != null) {
          work = contextMgr.wrapWithContext(work, bean.getContext());
        }
        try {
          // Set the lock up before we start the thread, but roll it back
          // if we hit any problems
          if(worker.getLock().addWork(workId, worker))
View Full Code Here

Examples of org.apache.sandesha2.storage.beans.InvokerBean

    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
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.