Package net.sf.hajdbc.lock

Examples of net.sf.hajdbc.lock.LockManager


   
    List<Lock> lockList = new ArrayList<Lock>(identifierSet.size());
   
    if (!identifierSet.isEmpty())
    {
      LockManager lockManager = cluster.getLockManager();
     
      for (String identifier: identifierSet)
      {
        lockList.add(lockManager.writeLock(identifier));
      }
    }
   
    return lockList;
  }
View Full Code Here


 
  private void connect(String url, String id) throws Exception
  {
    DatabaseCluster<java.sql.Driver, DriverDatabase> cluster = mock(DatabaseCluster.class);
    Balancer<java.sql.Driver, DriverDatabase> balancer = mock(Balancer.class);
    LockManager lockManager = mock(LockManager.class);
   
    DriverDatabase database = new DriverDatabase();
    database.setId("db1");
    database.setLocation("jdbc:mock:test");
   
    Driver driver = new Driver();
    Driver.setConfigurationFactory(id, this.configurationFactory);

    when(this.factory.createDatabaseCluster(eq(id), same(this.configurationFactory))).thenReturn(cluster);
   
    when(cluster.isActive()).thenReturn(true);
    when(cluster.getBalancer()).thenReturn(balancer);
    when(balancer.iterator()).thenReturn(Collections.singleton(database).iterator());
    when(cluster.getBalancer()).thenReturn(balancer);
    when(balancer.contains(database)).thenReturn(true);
    when(balancer.isEmpty()).thenReturn(false);
    when(balancer.size()).thenReturn(1);
    when(balancer.iterator()).thenReturn(Collections.singleton(database).iterator());
    when(balancer.next()).thenReturn(database);
    when(cluster.getExecutor()).thenReturn(Executors.newCachedThreadPool());
    when(cluster.getLockManager()).thenReturn(lockManager);
    when(lockManager.readLock(null)).thenReturn(mock(Lock.class));
    when(cluster.getDurability()).thenReturn(mock(Durability.class));
    when(cluster.getTransactionIdentifierFactory()).thenReturn(mock(TransactionIdentifierFactory.class));
   
    try
    {
View Full Code Here

  @SuppressWarnings("unchecked")
  private void connect(String url, String id) throws Exception
  {
    DatabaseCluster<java.sql.Driver, DriverDatabase> cluster = mock(DatabaseCluster.class);
    Balancer<java.sql.Driver, DriverDatabase> balancer = mock(Balancer.class);
    LockManager lockManager = mock(LockManager.class);
   
    DriverDatabase database = new DriverDatabase();
    database.setId("db1");
    database.setLocation("jdbc:mock:test");
   
    Driver driver = new Driver();
    Driver.setConfigurationFactory(id, this.configurationFactory);

    when(this.factory.createDatabaseCluster(eq(id), same(this.configurationFactory))).thenReturn(cluster);
   
    when(cluster.isActive()).thenReturn(true);
    when(cluster.getBalancer()).thenReturn(balancer);
    when(balancer.iterator()).thenReturn(Collections.singleton(database).iterator());
    when(cluster.getBalancer()).thenReturn(balancer);
    when(balancer.contains(database)).thenReturn(true);
    when(balancer.isEmpty()).thenReturn(false);
    when(balancer.size()).thenReturn(1);
    when(balancer.iterator()).thenReturn(Collections.singleton(database).iterator());
    when(balancer.next()).thenReturn(database);
    when(cluster.getExecutor()).thenReturn(Executors.newCachedThreadPool());
    when(cluster.getLockManager()).thenReturn(lockManager);
    when(lockManager.readLock(null)).thenReturn(mock(Lock.class));
    when(cluster.getDurability()).thenReturn(mock(Durability.class));
    when(cluster.getTransactionIdentifierFactory()).thenReturn(mock(TransactionIdentifierFactory.class));
   
    try
    {
View Full Code Here

TOP

Related Classes of net.sf.hajdbc.lock.LockManager

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.