public class TestConcurrentJournal extends ProxyTestCase<Journal>
IConcurrencyManager
interface on the
Journal
.TestCase2.MyProperties, TestCase2.RandomType
_randomType, log
Constructor and Description |
---|
TestConcurrentJournal() |
TestConcurrentJournal(String name) |
Modifier and Type | Method and Description |
---|---|
void |
test_concurrentReadersAreOk()
A stress test that runs concurrent
ITx.READ_COMMITTED readers and
ITx.UNISOLATED writers and verifies that readers are able to
transparently continue to read against the named indices if the backing
FileChannel is closed by an interrupt noticed during an IO on
that FileChannel . |
void |
test_shutdown()
Test ability to create a
Journal and then shut it down (in
particular this is testing shutdown of the thread pool on the
ConcurrencyManager ). |
void |
test_shutdownNow() |
void |
test_submit_interrupt01()
Submits an unisolated task to the write service.
|
void |
test_submit_interrupt02()
Submits an unisolated task to the write service.
|
void |
test_submit_readService_01()
Submits an unisolated task to the read service and verifies that it executes.
|
void |
test_submit_txService_readCommitted_01()
Submits a read-committed task to the transaction service and verifies
that it executes.
|
void |
test_submit_txService_readOnly_01()
Submits an read-only task to the transaction service and verifies that it
executes.
|
void |
test_submit_txService_readWrite_01()
Submits a read-write task with an empty write set to the transaction
service and verifies that it executes.
|
void |
test_submit_writeService_01()
Submits an unisolated task to the write service and verifies that it
executes.
|
void |
test_tasksAreNotThreadSafe()
Verify that an
AbstractTask correctly rejects an attempt to
submit the same instance twice. |
void |
test_writeServiceCheckpointDirtyIndex()
Test verifies that a write on an index will cause the index to be
checkpointed when the task completes.
|
getDelegate, getOurDelegate, getProperties, getStore, getStore, reopenStore, setDelegate, setUp, tearDown
checkIfProxy, fail, getRandomData, setUp, tearDown
assertCondition, assertCondition, assertEquals, assertEquals, getBytes, getPort, getRandomData, getRandomData
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsWithinUlps, assertSameArray, assertSameArray, assertSameBigDecimal, assertSameBigDecimal, assertSameBigInteger, assertSameBigInteger, assertSameIterator, assertSameIterator, assertSameIteratorAnyOrder, assertSameIteratorAnyOrder, assertSameValue, assertSameValue, assertZeroUlps, assertZeroUlps, fail, getInnerCause, getNormalInt, getProjectBuildPath, getRandomObject, getRandomObject, getRandomOrder, getRandomString, getTestInputStream, getTestResource, getTestResource, getUlps, getUlps, isDEBUG, isDEBUG, isINFO, isINFO, isInnerCause, logProperties
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
public TestConcurrentJournal()
public TestConcurrentJournal(String name)
public void test_shutdown()
Journal
and then shut it down (in
particular this is testing shutdown of the thread pool on the
ConcurrencyManager
).public void test_shutdownNow()
public void test_submit_readService_01() throws InterruptedException, ExecutionException
public void test_submit_writeService_01() throws InterruptedException, ExecutionException
public void test_submit_txService_readOnly_01() throws InterruptedException, ExecutionException
public void test_submit_txService_readCommitted_01() throws InterruptedException, ExecutionException
public void test_submit_txService_readWrite_01() throws InterruptedException, ExecutionException
public void test_submit_interrupt01() throws InterruptedException, ExecutionException
Future.cancel(boolean)
with
mayInterruptWhileRunning := true
and that an appropriate
exception is thrown in the main thread.public void test_submit_interrupt02() throws InterruptedException, ExecutionException
Future.cancel(boolean)
with
mayInterruptWhileRunning := false
and that an appropriate
exception is thrown in the main thread when we Future.get()
the
result of the task.
Note: FutureTask.cancel(boolean)
is able to return control to the
caller without being allowed to interrupt the task. However, it does NOT
terminate the task - the worker thread is still running. Once the main
thread reaches Journal.shutdown()
it awaits the termination of
the WriteExecutorService
. However that service does NOT
terminate because that worker thread is still running an infinite loop.
Eventually, we interrupt the thread directly using a reference to it we obtained when setting up the task. This allows the journal to terminate and the test to complete.
public void test_tasksAreNotThreadSafe() throws InterruptedException, ExecutionException
AbstractTask
correctly rejects an attempt to
submit the same instance twice. This is important since the base class
has various items of state that are not thread-safe and are not designed
to be reusable.public void test_writeServiceCheckpointDirtyIndex() throws Exception
Exception
public void test_concurrentReadersAreOk() throws Throwable
ITx.READ_COMMITTED
readers and
ITx.UNISOLATED
writers and verifies that readers are able to
transparently continue to read against the named indices if the backing
FileChannel
is closed by an interrupt noticed during an IO on
that FileChannel
. In order for this test to succeed the backing
FileChannel
must be transparently re-opened in a thread-safe
manner if it is closed asynchronously (i.e., closed while the buffer
strategy is still open).Throwable
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.