|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tmatesoft.svn.core.wc.DefaultSVNRepositoryPool
public class DefaultSVNRepositoryPool
The DefaultSVNRepositoryPool class is a default implementation of the ISVNRepositoryPool interface.
It creates SVNRepository objects that may be stored in a common pool and reused later. The objects common pool may be shared by different threads, but each thread can retrieve only those objects, that have been created within that thread. So, DefaultSVNRepositoryPool is thread-safe. An objects pool may be global during runtime, or it may be private - one separate pool per one DefaultSVNRepositoryPool object. Also there's a possibility to have a DefaultSVNRepositoryPool object with the pool feature disabled (SVNRepository objects instantiated by such a creator are never cached).
DefaultSVNRepositoryPool caches one SVNRepository object per one url protocol (per one thread), that is the number of protocols used equals to the number of objects cached per one thread (if all objects are created as reusable).
Also DefaultSVNRepositoryPool is able to create SVNRepository objects that use a single socket connection (i.e. don't close a connection after every repository access operation but reuse a single one).
Field Summary | |
---|---|
static int |
INSTANCE_POOL
Deprecated. |
static int |
NO_POOL
Deprecated. |
static int |
RUNTIME_POOL
Deprecated. |
Fields inherited from interface org.tmatesoft.svn.core.io.ISVNSession |
---|
DEFAULT, KEEP_ALIVE |
Constructor Summary | |
---|---|
DefaultSVNRepositoryPool(ISVNAuthenticationManager authManager,
ISVNTunnelProvider tunnelProvider)
Constructs a DefaultSVNRepositoryPool instance that represents RUNTIME_POOL objects pool. |
|
DefaultSVNRepositoryPool(ISVNAuthenticationManager authManager,
ISVNTunnelProvider tunnelProvider,
boolean keepConnections,
int poolMode)
Deprecated. |
|
DefaultSVNRepositoryPool(ISVNAuthenticationManager authManager,
ISVNTunnelProvider tunnelProvider,
long timeout,
boolean keepConnection)
Constructs a DefaultSVNRepositoryPool instance that represents RUNTIME_POOL objects pool. |
Method Summary | |
---|---|
void |
connectionClosed(SVNRepository repository)
Places the specified repository into the pool of inactive SVNRepository
objects. |
void |
connectionOpened(SVNRepository repository)
Removes the specified repository object from the pool of inactive SVNRepository
objects held by this object. |
SVNRepository |
createRepository(SVNURL url,
boolean mayReuse)
Creates a new SVNRepository driver object. |
void |
dispose()
Disposes this pool. |
java.lang.String |
getCommitMessage(SVNRepository repository,
long revision)
Returns null. |
boolean |
hasCommitMessage(SVNRepository repository,
long revision)
Returns false. |
boolean |
keepConnection(SVNRepository repository)
Says if the given SVNRepository driver object should keep a connection opened. |
void |
saveCommitMessage(SVNRepository repository,
long revision,
java.lang.String message)
Does nothing. |
void |
setAuthenticationManager(ISVNAuthenticationManager authManager)
Sets the given authentication instance to this pool and to all SVNRepository objects
stored in this pool. |
void |
setCanceller(ISVNCanceller canceller)
Sets a canceller to be used in all SVNRepository objects produced by this
pool. |
void |
setDebugLog(ISVNDebugLog log)
Sets a debug logger to be used in all SVNRepository objects produced by this
pool. |
void |
shutdownConnections(boolean shutdownAll)
Closes connections of cached SVNRepository objects. |
static void |
shutdownTimer()
Stops the daemon thread that checks whether there are any SVNRepository objects
expired. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int RUNTIME_POOL
public static final int INSTANCE_POOL
public static final int NO_POOL
Constructor Detail |
---|
public DefaultSVNRepositoryPool(ISVNAuthenticationManager authManager, ISVNTunnelProvider tunnelProvider)
RUNTIME_POOL
objects pool.
SVNRepository objects created by this instance will
use a single socket connection.
This constructor is identical to
DefaultSVNRepositoryPool(authManager, tunnelProvider, DEFAULT_IDLE_TIMEOUT, true)
.
authManager
- an authentication drivertunnelProvider
- a tunnel providerpublic DefaultSVNRepositoryPool(ISVNAuthenticationManager authManager, ISVNTunnelProvider tunnelProvider, long timeout, boolean keepConnection)
RUNTIME_POOL
objects pool.
SVNRepository objects created by this instance will
use a single socket connection.
authManager
- an authentication drivertunnelProvider
- a tunnel providertimeout
- inactivity timeout after which open connections should be closedkeepConnection
- whether to keep connection openpublic DefaultSVNRepositoryPool(ISVNAuthenticationManager authManager, ISVNTunnelProvider tunnelProvider, boolean keepConnections, int poolMode)
authManager
- an authentication drivertunnelProvider
- a tunnel providerkeepConnections
- if true
then SVNRepository objects will keep
a single connection for accessing a repository,
if false - open
a new connection per each repository access operationpoolMode
- a mode of this object represented by
one of the constant fields of DefaultSVNRepositoryPoolMethod Detail |
---|
public SVNRepository createRepository(SVNURL url, boolean mayReuse) throws SVNException
mayReuse
is true
and the mode of this DefaultSVNRepositoryPool object is not
NO_POOL
then first tries to find the SVNRepository
object in the pool for the given protocol. If the object is not found,
creates a new one for that protocol, caches it in the pool and returns
back.
NOTE: be careful when simultaneously using several SVNRepository
drivers for the same protocol - since there can be only one driver object in
the pool per a protocol, creating two objects for the same protocol
with mayReuse
set to true,
actually returns the same single object stored in the thread pool.
createRepository
in interface ISVNRepositoryPool
url
- a repository location for which a driver
is to be createdmayReuse
- if true then
SVNRepository object is reusable
SVNException
SVNRepository
public void setAuthenticationManager(ISVNAuthenticationManager authManager)
SVNRepository
objects
stored in this pool.
setAuthenticationManager
in interface ISVNRepositoryPool
authManager
- authentication manager instancepublic boolean keepConnection(SVNRepository repository)
keepConnections
set to true
and if repository
is not created for the
"svn+ssh" protocol (since for this protocol there's
no extra need to keep a connection opened - it remains opened), this
method returns true.
keepConnection
in interface ISVNSession
repository
- an SVNRepository driver
public void shutdownConnections(boolean shutdownAll)
Actually, calls the dispose()
routine.
shutdownConnections
in interface ISVNRepositoryPool
shutdownAll
- if true - closes
connections of all the cached objects, otherwise only
connections of those cached objects which owner threads
have already disposedSVNRepository
public void dispose()
SVNRepository
objects from this pool.
dispose
in interface ISVNRepositoryPool
public static void shutdownTimer()
SVNRepository
objects
expired.
connectionClosed(SVNRepository)
public void saveCommitMessage(SVNRepository repository, long revision, java.lang.String message)
saveCommitMessage
in interface ISVNSession
repository
- an SVNRepository driver (to distinguish
that repository for which this message is actual)revision
- a revision numbermessage
- the commit message for revision
ISVNSession.getCommitMessage(SVNRepository, long)
public java.lang.String getCommitMessage(SVNRepository repository, long revision)
getCommitMessage
in interface ISVNSession
repository
- an SVNRepository driver (to distinguish
that repository for which a commit message is requested)revision
- a revision number
revision
ISVNSession.saveCommitMessage(SVNRepository, long, String)
public boolean hasCommitMessage(SVNRepository repository, long revision)
hasCommitMessage
in interface ISVNSession
repository
- an SVNRepository driver (to distinguish
that repository for which a commit message is requested)revision
- a revision number
public void connectionClosed(SVNRepository repository)
repository
into the pool of inactive SVNRepository
objects.
If this pool keeps connections open (refer to the keepConnection
parameter of the
constructor
),
then each SVNRepository
object which is passed to this method (what means it finished
the operation), must be reused in a period of time not greater than the timeout value. The timeout value
is either equal to the value passed to the constructor
,
or it defaults to 60 seconds if no valid timeout value was provided. Otherwise the repository object will
be closed
. Timeout checking occurs one time in 10 seconds. This
behavior - closing repository objects after timeout - can be changed by switching off the timer thread
via shutdownTimer()
.
connectionClosed
in interface ISVNConnectionListener
repository
- repository access objectpublic void connectionOpened(SVNRepository repository)
repository
object from the pool of inactive SVNRepository
objects held by this object. This method is synchronized.
connectionOpened
in interface ISVNConnectionListener
repository
- repository access object to remove from the poolpublic void setCanceller(ISVNCanceller canceller)
SVNRepository
objects produced by this
pool.
setCanceller
in interface ISVNRepositoryPool
canceller
- caller's cancellerpublic void setDebugLog(ISVNDebugLog log)
SVNRepository
objects produced by this
pool.
setDebugLog
in interface ISVNRepositoryPool
log
- debug logger
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |