Package org.apache.sandesha2.storage.beans

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


    }
    return true;
  }

  protected boolean delete(Object key) throws SandeshaStorageException {
    RMBean bean = null;
    synchronized (table) {
      bean = (RMBean) table.get(key);
    }
    if(bean != null) {
      mgr.enlistBean(bean);
View Full Code Here


    }
    return bean != null;
  }

  protected RMBean retrieve(Object key) throws SandeshaStorageException {
    RMBean bean = null;
    synchronized (table) {
      bean = (RMBean) table.get(key);
    }
    if(bean != null) {
      mgr.enlistBean(bean);
View Full Code Here

    return bean;
  }

  protected boolean update(Object key, RMBean bean) throws SandeshaStorageException {
    mgr.enlistBean(bean);
    RMBean oldBean = null;
    synchronized (table) {
      oldBean = (RMBean) table.get(key);
      table.put(key, bean);
    }
    if(oldBean == null) return false;
View Full Code Here

      if(matchInfo == null) {
        beans.addAll(table.values());
      } else {
        Iterator i = table.values().iterator();
        while(i.hasNext()) {
          RMBean candidate = (RMBean)i.next();
          if(candidate.match(matchInfo)) {
            beans.add(candidate);
          }
        }
      }
    }
   
    // Now we have a point-in-time view of the beans, lock them all
    Iterator i = beans.iterator();
    while(i.hasNext()) mgr.enlistBean((RMBean) i.next());
   
    // Finally remove any beans that are no longer in the table
    synchronized (table) {
      i = beans.iterator();
      while(i.hasNext()) {
        RMBean bean = (RMBean) i.next();
        if(!table.containsValue(bean)) {
          i.remove();
        }
      }
    }
View Full Code Here

    return beans;
  }

  protected RMBean findUnique (RMBean matchInfo) throws SandeshaException {
    RMBean result = null;
    synchronized (table) {
      Iterator i = table.values().iterator();
      while(i.hasNext()) {
        RMBean candidate = (RMBean)i.next();
        if(candidate.match(matchInfo)) {
          if(result == null) {
            result = candidate;
          } else {
            String message = SandeshaMessageHelper.getMessage(
                SandeshaMessageKeys.nonUniqueResult,
                result.toString(),
                candidate.toString());
            log.error(message);
            throw new SandeshaException (message);
          }
        }
      }
View Full Code Here

   * @throws SandeshaStorageException
   */
  protected void checkKeys (List findBeanList) throws SandeshaStorageException {
   
    for (Iterator iter = findBeanList.iterator(); iter.hasNext();) {
      RMBean rmBean = (RMBean) iter.next();
     
      List conflicts = find(rmBean);
      if (conflicts.size()>0) {
        //we only report the first conflict here.
        throw new SandeshaStorageException ("Key conflict occured with the bean " + conflicts.get(0));
View Full Code Here

    if(log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::releaseLocks, " + this);
    manager.removeTransaction(this);

    Iterator beans = enlistedBeans.iterator();
    while(beans.hasNext()) {
      RMBean bean = (RMBean) beans.next();
      synchronized (bean) {
        bean.setTransaction(null);
        bean.notifyAll();
      }
    }
    enlistedBeans.clear();
   
    if(log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::releaseLocks");
View Full Code Here

  }

  protected boolean update(String key, T bean) throws SandeshaStorageException {
    if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Entry: InMemoryBeanMgr " + this.getClass() + " update " + key + ", " + bean);
    mgr.enlistBean(bean);
    RMBean oldBean = (RMBean) table.put(key, bean);
    if(oldBean == null) return false;
    mgr.enlistBean(oldBean);
    if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Exit: InMemoryBeanMgr " + this.getClass() + " update " + true);
    return true;
  }
View Full Code Here

    if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::releaseLocks, " + this);
    manager.removeTransaction(this);

    Iterator beans = enlistedBeans.iterator();
    while(beans.hasNext()) {
      RMBean bean = (RMBean) beans.next();
      DummyTransaction tran = (DummyTransaction) bean.getTransaction();
      tran.unlock();
    }
    enlistedBeans=new ArrayList<RMBean>();
   
    if(LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::releaseLocks");
View Full Code Here

      StorageManager storageManager =
        SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
     
      Transaction tran = storageManager.getTransaction();
     
      RMDBean finderBean = new RMDBean();
      List rmdBeans = storageManager.getRMDBeanMgr().find(finderBean);
     
      tran.commit();
     
      lastError = null;
     
      if (rmdBeans.isEmpty())
        lastError = new Error("rmdBeans empty " + rmdBeans);
      else {
        RMDBean bean = (RMDBean)rmdBeans.get(0);
        if (bean.isTerminated())
          break;
       
        lastError = new Error("RMDBean not deleted " + bean);
      }
    }

    if(lastError != null) throw lastError;

    while(System.currentTimeMillis() < limit) {
      Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
     
      // Check that the sequence has been deleted.
      StorageManager storageManager =
        SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
     
      Transaction tran = storageManager.getTransaction();
     
      RMDBean finderBean = new RMDBean();
      List rmdBeans = storageManager.getRMDBeanMgr().find(finderBean);
     
      tran.commit();
     
      lastError = null;
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.storage.beans.RMBean

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.