Package net.sf.hajdbc.state

Examples of net.sf.hajdbc.state.StateManager


   * @see net.sf.hajdbc.durability.none.NoDurability#recover(java.util.Map)
   */
  @Override
  public void recover(Map<InvocationEvent, Map<String, InvokerEvent>> invokers)
  {
    StateManager stateManager = this.cluster.getStateManager();

    for (D database: this.cluster.getBalancer().backups())
    {
      this.cluster.deactivate(database, stateManager);
    }

    for (InvocationEvent event: invokers.keySet())
    {
      stateManager.afterInvocation(event);
    }
  }
View Full Code Here


  {
    DatabaseCluster<Z, D> cluster = factory.getDatabaseCluster();
    ExceptionFactory<E> exceptionFactory = factory.getExceptionFactory();
    Balancer<Z, D> balancer = cluster.getBalancer();
    Dialect dialect = cluster.getDialect();
    StateManager stateManager = cluster.getStateManager();
   
    while (true)
    {
      D database = this.selector.selectDatabase(balancer);
     
View Full Code Here

  public <Z, D extends Database<Z>, T, R, E extends Exception> SortedMap<D, R> invoke(ProxyFactory<Z, D, T, E> factory, Invoker<Z, D, T, R, E> invoker) throws E
  {
    DatabaseCluster<Z, D> cluster = factory.getDatabaseCluster();
    Balancer<Z, D> balancer = cluster.getBalancer();
    Dialect dialect = cluster.getDialect();
    StateManager stateManager = cluster.getStateManager();

    for (Map.Entry<D, T> entry: factory.entries())
    {
      D database = entry.getKey();
     
View Full Code Here

        {
          failedDatabases.add(entry.getKey());
        }
      }

      StateManager stateManager = cluster.getStateManager();
     
      // Deactivate failed databases, unless all failed
      if (!resultMap.isEmpty() || (failedDatabases.size() < exceptionMap.size()))
      {
        for (D failedDatabase: failedDatabases)
View Full Code Here

   * @see net.sf.hajdbc.durability.coarse.CoarseDurability#recover(java.util.Map)
   */
  @Override
  public void recover(Map<InvocationEvent, Map<String, InvokerEvent>> map)
  {
    StateManager stateManager = this.cluster.getStateManager();
    Balancer<Z, D> balancer = this.cluster.getBalancer();
    D primary = balancer.primary();

    for (Map.Entry<InvocationEvent, Map<String, InvokerEvent>> entry: map.entrySet())
    {
      InvocationEvent invocation = entry.getKey();
      Map<String, InvokerEvent> invokers = entry.getValue();

      if (!invokers.isEmpty())
      {
        for (D backup: balancer.backups())
        {
          if (this.deactivateSlave(primary, backup, invocation, invokers))
          {
            this.cluster.deactivate(backup, stateManager);
          }
        }
      }
     
      stateManager.afterInvocation(invocation);
    }
  }
View Full Code Here

        {
          failedDatabases.add(entry.getKey());
        }
      }

      StateManager stateManager = cluster.getStateManager();
     
      // Deactivate failed databases, unless all failed
      if (!resultMap.isEmpty() || (failedDatabases.size() < exceptionMap.size()))
      {
        for (D failedDatabase: failedDatabases)
View Full Code Here

  {
    DatabaseCluster<Z, D> cluster = map.getRoot().getDatabaseCluster();
    ExceptionFactory<E> exceptionFactory = map.getExceptionFactory();
    Balancer<Z, D> balancer = cluster.getBalancer();
    Dialect dialect = cluster.getDialect();
    StateManager stateManager = cluster.getStateManager();
   
    while (true)
    {
      D database = this.selector.selectDatabase(balancer);
     
View Full Code Here

  @Override
  public <Z, D extends Database<Z>, T, R, E extends Exception> SortedMap<D, R> invoke(ProxyFactory<Z, D, T, E> map, Invoker<Z, D, T, R, E> invoker) throws E
  {
    DatabaseCluster<Z, D> cluster = map.getDatabaseCluster();
    Dialect dialect = cluster.getDialect();
    StateManager stateManager = cluster.getStateManager();

    for (Map.Entry<D, T> entry: map.entries())
    {
      D database = entry.getKey();
     
View Full Code Here

  @Override
  public <Z, D extends Database<Z>, T, R, E extends Exception> SortedMap<D, R> invoke(ProxyFactory<Z, D, T, E> map, Invoker<Z, D, T, R, E> invoker) throws E
  {
    DatabaseCluster<Z, D> cluster = map.getDatabaseCluster();
    Dialect dialect = cluster.getDialect();
    StateManager stateManager = cluster.getStateManager();

    for (Map.Entry<D, T> entry: map.entries())
    {
      D database = entry.getKey();
     
View Full Code Here

        {
          failedDatabases.add(entry.getKey());
        }
      }

      StateManager stateManager = cluster.getStateManager();
     
      // Deactivate failed databases, unless all failed
      if (!resultMap.isEmpty() || (failedDatabases.size() < exceptionMap.size()))
      {
        for (D failedDatabase: failedDatabases)
View Full Code Here

TOP

Related Classes of net.sf.hajdbc.state.StateManager

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.