|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.domian.repository.AbstractRepository<T> net.sourceforge.domian.repository.AbstractDomianCoreRepository<T> net.sourceforge.domian.repository.AbstractXStreamXmlFileRepository<T>
abstract class AbstractXStreamXmlFileRepository<T extends Entity>
Common functionality for all Domian XStream-based repositories,
e.g. an extensive set of Synchronizer
convenience methods.
Field Summary | |
---|---|
private static int |
ALL_STACKTRACE_LINES
|
private java.lang.Integer |
maxNumberOfRetries
When using the *WithRetry methods,
this value defines the maximum number of times an operation will be retried. |
protected java.lang.String |
repositoryId
The repository-ID the name of the repository. |
protected java.lang.String |
repositoryRootPath
For file-based repositories the repositoryRootPath is the absolute path for all repositories of the same type. |
private java.lang.Integer |
retryTimeoutInMilliseconds
When using the *WithRetry methods,
this value defines the timeout for all retried operations. |
protected static java.lang.String |
XSTREAM_XML_FILE_SUFFIX
|
Fields inherited from class net.sourceforge.domian.repository.AbstractDomianCoreRepository |
---|
DEFAULT_DOMIAN_ROOT_DIR_NAME, DEFAULT_DOMIAN_ROOT_PATH, log, synchronizer |
Fields inherited from class net.sourceforge.domian.repository.AbstractRepository |
---|
supportsRecursiveIndexing, usesNativePartitioningSupport |
Constructor Summary | |
---|---|
AbstractXStreamXmlFileRepository()
|
Method Summary | ||
---|---|---|
protected void |
call(java.util.concurrent.Callable<T> callable)
Added for completeness. |
|
protected
|
callConcurrently(java.util.concurrent.Callable<T> callable)
Convenience method for running a Callable in a concurrent manner. |
|
protected
|
callConcurrentlyInNewThread(java.util.concurrent.Callable<T> callable)
|
|
protected
|
callConcurrentlyWithRetry(java.util.concurrent.Callable<T> callable)
Convenience method for running a Callable in a concurrent manner. |
|
protected
|
callExclusively(java.util.concurrent.Callable<T> callable)
Convenience method for running a Callable in an exclusively manner. |
|
protected
|
callExclusivelyInNewThread(java.util.concurrent.Callable<T> callable)
|
|
protected
|
callExclusivelyWithRetry(java.util.concurrent.Callable<T> callable)
Convenience method for running a Callable in an exclusively manner. |
|
java.lang.String |
getEncoding()
|
|
java.lang.Integer |
getMaxNumberOfRetries()
|
|
java.io.File |
getRepositoryDirectory()
|
|
java.lang.String |
getRepositoryId()
|
|
protected java.lang.String |
getRepositoryPath(java.lang.String repositoryRootPath,
PersistentRepository<T> repository)
|
|
java.lang.String |
getRepositoryPathString()
|
|
java.lang.String |
getRepositoryRootPath()
|
|
java.lang.Integer |
getRetryTimeoutInMilliseconds()
|
|
private
|
retry(java.util.concurrent.Callable<T> callable,
java.lang.Exception retryReason,
Synchronizer.MODE synchronizedMode)
Executes the given Callable in a fresh thread, with time-out set to retryTimeoutInMilliseconds . |
|
private
|
retry(java.lang.String methodName,
java.util.concurrent.Callable<T> callable,
java.lang.Exception reasonForRetry,
Synchronizer.MODE synchronizedMode)
Executes the given Callable in a fresh thread, with time-out set to retryTimeoutInMilliseconds . |
|
protected void |
run(java.lang.Runnable runnable)
Added for completeness. |
|
protected void |
runAsynchronously(java.lang.Runnable runnable)
Executes the given Runnable in a fresh and independent thread. |
|
protected void |
runConcurrently(java.lang.Runnable runnable)
Convenience method for running a Runnable in a concurrent manner. |
|
void |
setMaxNumberOfRetries(java.lang.Integer maxNumberOfRetries)
|
|
void |
setRetryTimeoutInMilliseconds(java.lang.Integer retryTimeoutInMilliseconds)
|
Methods inherited from class net.sourceforge.domian.repository.AbstractDomianCoreRepository |
---|
|
Methods inherited from class net.sourceforge.domian.repository.AbstractRepository |
---|
contains, count, countAll, countAllEntitiesSpecifiedBy, find, findAll, findSingle, findSingleEntitySpecifiedBy, isIndexingEntitiesRecursively, isPartitioningNatively, iterate, iterateAll, putAll, remove, removeAll, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.domian.repository.PersistentRepository |
---|
close, getFormat, getMetaDataFor, getPersistenceDefinition, load, persist |
Methods inherited from interface net.sourceforge.domian.repository.Repository |
---|
count, countAll, countAllEntitiesSpecifiedBy, find, findAll, findAllEntitiesSpecifiedBy, findSingle, findSingleEntitySpecifiedBy, isIndexingEntitiesRecursively, isPartitioningNatively, iterate, iterateAll, iterateAllEntitiesSpecifiedBy, makePartition, put, putAll, remove, remove, removeAll, removeAllEntitiesSpecifiedBy, update, update |
Field Detail |
---|
protected static final java.lang.String XSTREAM_XML_FILE_SUFFIX
private static final int ALL_STACKTRACE_LINES
protected java.lang.String repositoryRootPath
repositoryRootPath
is the absolute path for all repositories of the same type.
protected java.lang.String repositoryId
${repositoryRootPath}/${repositoryId}
forms the absolute folder path in which the repository data resides.
private java.lang.Integer maxNumberOfRetries
*WithRetry
methods,
this value defines the maximum number of times an operation will be retried.
The default value is 2.
private java.lang.Integer retryTimeoutInMilliseconds
*WithRetry
methods,
this value defines the timeout for all retried operations.
The default value is 500.
Constructor Detail |
---|
AbstractXStreamXmlFileRepository()
Method Detail |
---|
public java.lang.String getRepositoryRootPath()
public java.lang.String getRepositoryId()
getRepositoryId
in interface PersistentRepository<T extends Entity>
public java.lang.String getRepositoryPathString()
public java.io.File getRepositoryDirectory()
getRepositoryDirectory
in interface PersistentRepository<T extends Entity>
public java.lang.Integer getMaxNumberOfRetries()
public void setMaxNumberOfRetries(java.lang.Integer maxNumberOfRetries)
public java.lang.Integer getRetryTimeoutInMilliseconds()
public void setRetryTimeoutInMilliseconds(java.lang.Integer retryTimeoutInMilliseconds)
public java.lang.String getEncoding()
getEncoding
in interface TextualFormatRepository<T extends Entity>
protected java.lang.String getRepositoryPath(java.lang.String repositoryRootPath, PersistentRepository<T> repository)
protected void run(java.lang.Runnable runnable)
protected void call(java.util.concurrent.Callable<T> callable) throws java.lang.Exception
java.lang.Exception
protected void runConcurrently(java.lang.Runnable runnable)
Runnable
in a concurrent manner.
Synchronizer
protected <T> T callConcurrently(java.util.concurrent.Callable<T> callable)
Callable
in a concurrent manner.
Synchronizer
protected <T> T callExclusively(java.util.concurrent.Callable<T> callable)
Callable
in an exclusively manner.
Synchronizer
protected <T> T callConcurrentlyWithRetry(java.util.concurrent.Callable<T> callable)
Callable
in a concurrent manner.
If an exception is thrown, the Callable
will be immediately retried.
The nature of the retries are further defined by the maxNumberOfRetries
and
retryTimeoutInMilliseconds
member values.
protected <T> T callExclusivelyWithRetry(java.util.concurrent.Callable<T> callable)
Callable
in an exclusively manner.
If an exception is thrown, the Callable
will be immediately queued for retrial.
The nature of the retries are further defined by the maxNumberOfRetries
and
retryTimeoutInMilliseconds
member values.
protected <T> T callConcurrentlyInNewThread(java.util.concurrent.Callable<T> callable) throws java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException, java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
java.lang.InterruptedException
protected <T> T callExclusivelyInNewThread(java.util.concurrent.Callable<T> callable) throws java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException, java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
java.lang.InterruptedException
protected void runAsynchronously(java.lang.Runnable runnable)
Runnable
in a fresh and independent thread.
This method does not block the original thread.
The Synchronizer
mode is concurrent.
(An asynchronous version of Synchronizer
in exclusive mode has no meaning,
as it is a "stop-the-world" kind of mode.)
private <T> T retry(java.util.concurrent.Callable<T> callable, java.lang.Exception retryReason, Synchronizer.MODE synchronizedMode)
Callable
in a fresh thread, with time-out set to retryTimeoutInMilliseconds
.
The Callable
will be retried maxNumberOfRetries
times.
This method will use an uncapitalized version of the given callable's simple class name as method name.
private <T> T retry(java.lang.String methodName, java.util.concurrent.Callable<T> callable, java.lang.Exception reasonForRetry, Synchronizer.MODE synchronizedMode)
Callable
in a fresh thread, with time-out set to retryTimeoutInMilliseconds
.
The Callable
will be retried maxNumberOfRetries
times.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |