public class MpxConnectionManager extends DefaultConnectionManager
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
protected int |
incSize
increment size.
|
protected boolean |
initialized
true if initialized.
|
protected int |
maxMinutes
max hours to close connections.
|
protected int |
minMinutes
min hours to close connections.
|
protected int |
minSize
minimum size.
|
protected Random |
random
randomizer.
|
protected Db |
serverDb
server Db to clone.
|
protected int |
unConCount
number of entries in unConList.
|
protected int[] |
unConList
free list for unattached connections.
|
conList, dbSize, freeConCount, freeConList, freeDbCount, freeDbList, idOffset, iniSize, maxConSize, maxDbSize, nameMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
MpxConnectionManager(Db serverDb)
Creates a connection manager with reasonable values for most servers.
|
MpxConnectionManager(String name,
Db serverDb,
int maxDb,
int idOffset,
int iniSize,
int incSize,
int minSize,
int maxSize,
int minMinutes,
int maxMinutes)
Creates a new connection manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attach(Session session)
Attaches a
Db to a connection.A Db must be attached before it can use any statements. |
protected int |
createConnections(int count)
Create spare connections.
|
void |
detach(Session session)
Detaches a connection from a
Db.A Db must be detached to release the connection for use of other Db instances. |
void |
forceDetach(Session session)
Detaches but also scans for pending statements to cleanup.
|
int |
getInfoLogSize()
Gets the number of connections when to start info logging.
|
int |
getWarnLogSize()
Gets the number of connections when to start warning logging.
|
int |
login(Session session) |
void |
logout(Session session) |
protected int |
popUnattached()
Gets a connection from the unattached freelist.
|
protected void |
pushUnattached(int index)
Adds the index of an unused connection to the freelist.
|
void |
setInfoLogSize(int infoLogSize)
Sets the number of connections when to start info logging.
|
void |
setWarnLogSize(int warnLogSize)
Sets the number of connections when to start warning logging.
|
void |
shutdown()
Shuts down this connection manager.
All connections are closed and the threads stopped. |
addConnection, addDb, assertSessionBelongsToMe, convertConnectionIdToIndex, getAttachTimeout, getConnectionCount, getConnections, getMaxConnections, getMaxCountForClearWarnings, getMaxSessions, getNumConnections, getNumSessions, removeConnection, removeDb, run, setAttachTimeout, setMaxCountForClearWarnings, toStringactiveCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetNameprotected final Db serverDb
protected final int incSize
protected final int minSize
protected final int minMinutes
protected final int maxMinutes
protected int[] unConList
protected int unConCount
protected Random random
protected boolean initialized
public MpxConnectionManager(String name, Db serverDb, int maxDb, int idOffset, int iniSize, int incSize, int minSize, int maxSize, int minMinutes, int maxMinutes)
name - the name of the connection managerserverDb - the root db to use for creating connections (may be open or closed)maxDb - the maximum number of Db instances, 0 = no limitidOffset - the offset for connection ids (> 0)iniSize - the initial size of the connection poolincSize - the number of connections to add if all in useminSize - the minimum number of connectionsmaxSize - the maximum number of connectionsminMinutes - minimum minutes a connection should be usedmaxMinutes - maximum minutes a connection should be usedpublic MpxConnectionManager(Db serverDb)
serverDb - the root db to use for creating connections (may be open or closed).public void shutdown()
shutdown in interface SessionManagershutdown in class DefaultConnectionManagerpublic int getInfoLogSize()
The default is 1/4th of the maximum number of connections.
public void setInfoLogSize(int infoLogSize)
infoLogSize - the info levelpublic int getWarnLogSize()
The default is half of the maximum number of connections.
public void setWarnLogSize(int warnLogSize)
warnLogSize - the warning levelprotected void pushUnattached(int index)
index - the index of the connection in the connections listprotected int popUnattached()
protected int createConnections(int count)
count - the number of connections to createpublic int login(Session session)
login in interface SessionManagerlogin in class DefaultConnectionManagerpublic void logout(Session session)
logout in interface SessionManagerlogout in class DefaultConnectionManagerpublic void attach(Session session)
ConnectionManagerDb to a connection.Upon return the the session will reference the connection.
attach in interface ConnectionManagerattach in class DefaultConnectionManagersession - the sessionpublic void detach(Session session)
ConnectionManagerDb.detach in interface ConnectionManagerdetach in class DefaultConnectionManagersession - the sessionpublic void forceDetach(Session session)
ConnectionManagerThis will detach at any nesting level!
forceDetach in interface ConnectionManagerforceDetach in class DefaultConnectionManagersession - the sessionCopyright © 2016 Krake Softwaretechnik. All rights reserved.