Search in sources :

Example 1 with LocalFileLock

use of org.apache.carbondata.core.locks.LocalFileLock in project carbondata by apache.

the class LocalFileLockTest method testingLocalFileLockingByAcquiring2Locks.

@Test
public void testingLocalFileLockingByAcquiring2Locks() {
    CarbonTableIdentifier carbonTableIdentifier = new CarbonTableIdentifier("databaseName", "tableName", "tableId");
    LocalFileLock localLock1 = new LocalFileLock(carbonTableIdentifier, LockUsage.METADATA_LOCK);
    Assert.assertTrue(localLock1.lock());
    LocalFileLock localLock2 = new LocalFileLock(carbonTableIdentifier, LockUsage.METADATA_LOCK);
    Assert.assertTrue(!localLock2.lock());
    Assert.assertTrue(localLock1.unlock());
    Assert.assertTrue(localLock2.lock());
}
Also used : CarbonTableIdentifier(org.apache.carbondata.core.metadata.CarbonTableIdentifier) LocalFileLock(org.apache.carbondata.core.locks.LocalFileLock) Test(org.junit.Test)

Aggregations

LocalFileLock (org.apache.carbondata.core.locks.LocalFileLock)1 CarbonTableIdentifier (org.apache.carbondata.core.metadata.CarbonTableIdentifier)1 Test (org.junit.Test)1