au.gov.tas.dpiwe.mr.server
Class LightweightContainer

java.lang.Object
  extended by au.gov.tas.dpiwe.mr.util.Messenger
      extended by au.gov.tas.dpiwe.mr.BeanCache
          extended by au.gov.tas.dpiwe.mr.PresentationUtilities
              extended by au.gov.tas.dpiwe.mr.BeanBundler
                  extended by au.gov.tas.dpiwe.mr.server.database.QueryBuilder
                      extended by au.gov.tas.dpiwe.mr.Container
                          extended by au.gov.tas.dpiwe.mr.DaemonContainer
                              extended by au.gov.tas.dpiwe.mr.CommandInterpreter
                                  extended by au.gov.tas.dpiwe.mr.server.DatabaseBackedContainer
                                      extended by au.gov.tas.dpiwe.mr.server.servlet.ServerContainer
                                          extended by au.gov.tas.dpiwe.mr.server.ServerContainer
                                              extended by au.gov.tas.dpiwe.mr.server.LightweightContainer
All Implemented Interfaces:
ServerDaemonContainer, Principal, UserTransaction

public class LightweightContainer
extends ServerContainer

This lightweight container a specialization of the ServerContainer class which reuses less of the Container code so that it has no increasing memory demand as transaction size becomes large.

Since:
Mr Architecture 3.0
Version:
1.0.0.4
Author:
Kade Hansson
See Also:
Container, ServerContainer

Nested Class Summary
 
Nested classes/interfaces inherited from class au.gov.tas.dpiwe.mr.server.ServerContainer
ServerContainer.ReferenceReaper
 
Nested classes/interfaces inherited from class au.gov.tas.dpiwe.mr.BeanCache
BeanCache.TypeRecord
 
Field Summary
 
Fields inherited from class au.gov.tas.dpiwe.mr.server.ServerContainer
changedClassesSoFar, currentCommandIndex, currentDetail, currentStartTimestamp, daemonLog, databaseConnection, defaultLog, headModifiedSequenceNo, log, logContent, maximumModifiedQueueLength, modifiedQueue, modifiedQueueLength, reaper2, removedResponses, responseCache, responseCacheBeanClassList, responseHistogram, responsesSoFar, sessionLastRequestSerialTable, sessionLastResponseTable, sessionTable, totalResponses
 
Fields inherited from class au.gov.tas.dpiwe.mr.server.servlet.ServerContainer
securityLayer
 
Fields inherited from class au.gov.tas.dpiwe.mr.server.DatabaseBackedContainer
blobToByteArrayBufferSize, clobToStringBufferSize, deleteQuery, insertQuery, Level_DriverDebug, Level_PopulationDebug, Level_QueryDebug, lockQuery, newTableQuery, selectQuery, sequenceQuery, updateQuery, wipeQuery
 
Fields inherited from class au.gov.tas.dpiwe.mr.DaemonContainer
autoStartDaemonList, daemonSupport, daemonTable, killedDaemonList, runningDaemonList
 
Fields inherited from class au.gov.tas.dpiwe.mr.Container
appName, batchFindTimeout, batchThreadGroupBadCommandExceptionTable, batchThreadGroupBadCommandIndexWaveCountTable, batchThreadGroupCommandTable, batchThreadGroupResponseTable, batchThreadGroupWaveCountTable, batchThreadGroupWaveResponseTable, dateSignature, executeBatchFind, handleCommandTable, initiateBatchFind, integerSignature, localContainer, localContainers, setClass, setWasNull, stringSignature, threadBadCommandIndex, threadBatchFind, threadCommands, threadGroupBatchFindTable, transactionThreadNameCommandTable, transactionThreadRollbackOnlyList, transactionTimeout, userEntityBeanClass
 
Fields inherited from class au.gov.tas.dpiwe.mr.server.database.QueryBuilder
database
 
Fields inherited from class au.gov.tas.dpiwe.mr.PresentationUtilities
annotationSignature, beanFieldNameCollectionGetterMethodTable, beanFieldNameConstructorMethodTable, beanFieldNameDestructorMethodTable, beanFieldNameGetterMethodTable, beanFieldNamePostRelatorMethodTable, beanFieldNameRelatorMethodTable, beanFieldNameSetterMethodTable, beanFieldNameTable, beanPrefixTable, CSVDateTime_MillisecondAsFractionOfDay, Format_None, Format_UnicodeTF16CSV, Format_UnicodeTF16Quoted, Format_UnicodeTF16WithUnits, Format_UnicodeTF16XML, Format_UnicodeTF8CSV, Format_UnicodeTF8Quoted, Format_UnicodeTF8URLEncoded, Format_UnicodeTF8WithUnits, Format_UnicodeTF8XML, XMLDateTime_DateFormatter, XMLDateTime_DateLength, XMLDateTime_DateTimeFormatter, XMLDateTime_DateTimeLength, XMLDateTime_RFC822ZoneFormatter, XMLDateTime_TimeFormatter, XMLDateTime_TimeLength, XMLDateTime_TimezoneLength
 
Fields inherited from class au.gov.tas.dpiwe.mr.BeanCache
addingLegacy, beanCache, beanClassMethodTable, beanClassTable, beanHistogram, clientCachedBeanLifetime, componentClassMethodTable, deferredCacheableList, deferredHistoricCommandList, deferredKeyGetterMethodNameTable, deferredKeySetterMethodNameTable, deferredKeyTypeNameTable, deferredTrailList, deferredUnderscoreList, historicCommandPoolTable, homeInterfaceMethodTable, homeInterfaceTable, initialPerBeanClassCacheSize, keyClassTable, keyGetterTable, keySetterTable, lastPurgeEndSequenceNo, objectCache, objectClassMethodTable, objectClassTable, objectHistogram, objectInterfaceList, reaper, removedBeans, removedObjects, tableNameLCToTableNameMapping, tableNameToBeanClassMapping, totalBeans, totalObjects, trailList, underscoreList
 
Fields inherited from class au.gov.tas.dpiwe.mr.util.Messenger
console, error, exceptionMessageTable, exceptionsToConsole, exceptionsToError, Level_Debug, Level_Exception, Level_None, Level_Normal, messageLevel
 
Constructor Summary
LightweightContainer(MrDatabase database)
          Instantiates the lightweight container without logging.
LightweightContainer(MrDatabase database, int beanClassCount, int initialPerBeanClassCacheSize, String appName)
          Instantiates the lightweight container without logging.
LightweightContainer(MrDatabase database, String logFileName)
          Instantiates the lightweight container with logging.
LightweightContainer(MrDatabase database, String logFileName, int beanClassCount, int initialPerBeanClassCacheSize, String appName)
          Instantiates the lightweight container with logging.
LightweightContainer(MrDatabase database, String logFileName, String appName)
          Instantiates the lightweight container with logging.
 
Method Summary
protected  Collection begin(Object handle, int size)
          Creates a new transaction and associates it with the given object.
protected  void commit(Object handle)
          Complete the given transaction.
protected  Response doCommandInTransactionContext(Command command)
          Internal method which executes a command immediately.
protected  void rollback(Object handle)
          Roll back the given transaction.
 
Methods inherited from class au.gov.tas.dpiwe.mr.server.ServerContainer
activateEntityBean, beginAtom, beginRequest, beginSession, cacheEntityBean, cacheResponse, closeLog, debugStackTrace, debugStackTrace2, discharge, doCommand, doCommandNoDatabase, doCommands, doCommandsWithDatabase, doStatusCommand, emptyMessage, emptyMessage, endAtom, endRequest, establishSession, executeRetrieveMethodCallsForBeanObject, executeRetrieveMethodCallsForBeanObjects, flushResponsesForEntityBeanClass, foreshadow, getCachedEntityBean, getLogFileName, getMrDatabase, getSecurityLayer, getSessionUserTable, getThreadNameLogTable, getThreadNameRequestDateTable, getThreadNameRequestDetailTable, leaveTrail, logCacheHistogram, logCacheStats, login, loginFailure, message, message, message, messageFirstPart, messageFirstPart, messageLastPart, messageLastPart, messagePart, messagePart, openLog, openLog, passivateEntityBean, prodServer, purgeModifiedQueue, queryReport, reapReferences2, recordModified, requiresDatabaseConnection, resetClock, setLastUpdateDateInEntityBean, setSecurityLayer, setWriteableFieldsGivenHTTPRequestParameters, shutdown, stackTrace, stackTrace2, success, undoCommands
 
Methods inherited from class au.gov.tas.dpiwe.mr.server.servlet.ServerContainer
activateBeansAuthenticateUserAndRemoveUnauthorizedCommands, getDetail, passivateBeansAndObscureSensitiveInformation
 
Methods inherited from class au.gov.tas.dpiwe.mr.server.DatabaseBackedContainer
doCreateCommand, doDateCommand, doFindCommand, doFlushCommand, doInvokeCommand, doJoinCommand, doLoadCommand, doLockCommand, doRemoveCommand, doSelectCommand, doStoreCommand, doWipeCommand, generateJoinedBeansFromCombinedRecords, getLastUpdateDateFromRecord, getLastUpdateUserFromRecord, populateEntityBeanWithRecord, recoverFromDatabaseFailure, recoverFromDatabaseFailure
 
Methods inherited from class au.gov.tas.dpiwe.mr.CommandInterpreter
doLogCommand
 
Methods inherited from class au.gov.tas.dpiwe.mr.DaemonContainer
addDaemon, addDaemon, autoStartDaemons, doStartCommand, doStopCommand, getKilledDaemonNames, getRunningDaemonNames, killDaemonsImmediate, loadTypes, startDaemon, stopDaemon
 
Methods inherited from class au.gov.tas.dpiwe.mr.Container
activateEntityBean, activateEntityBean, activateEntityBeanRelatives, addType, addTypeLater, alertServer, areBeanObjectRelativesPersistent, batchRetrieveMethodCallsForBeanObject, batchRetrieveMethodCallsForBeanObjects, begin, begin, bind, commit, convertPrototypeFromDefaultDatabaseWildcards, convertPrototypeToDefaultDatabaseWildcards, copyUpdateStampFromEntityBeanToBean, createEntityBean, createEntityBeanImmediately, debugTransaction, doCommand, equals, executeBatchFind, executeRetrieveMethodCallsForBeanObjects, findAllOfEntityBean, findEntityBean, findLocalContainer, flushBeans, getAppName, getBadCommandIndex, getIDForEntityBean, getLastUpdateDateFromEntityBean, getName, getObjectIDForEntityBean, getPooledUserEntityBean, getRollbackOnly, getRollbackOnly, getServerDate, getServerDate, getStatus, getStatus, getUserEntityBeanClass, getUserTransaction, hashCode, heimlichServer, initiateBatchFind, invokeMethodOfBeanObject, invokeMethodOfHome, isCommandWhichExpectsNonPooledBean, loadEntityBean, lockHome, logOnServer, nullifyRelationships, passivateEntityBean, passivateEntityBeanRelatives, purgeTimedOutTransactions, removeEntityBean, removeNonRelatives, removeNonRelativesFromBeanObjectNonRelatives, removeNonRelativesFromBeanObjectRelatives, reportServerStatus, restoreNonRelativesToBeanObjectRelatives, rollback, selectAllOfEntityBeans, selectAllOfEntityBeansInOrder, selectEntityBeans, selectEntityBeansInOrder, selectSiameseBeanObjects, setRollbackOnly, setRollbackOnly, setTransactionTimeout, setUserEntityBeanClass, storeBeanObjectRelatives, storeEntityBean, toString, unbind, unrelateGivenRelativesFromBeanObjectRelatives, wipeEntityBeans
 
Methods inherited from class au.gov.tas.dpiwe.mr.server.database.QueryBuilder
buildFieldAndValueListForEntityBean, buildQualifiedFieldAndValueListForEntityBean, getCompoundConstraint, getFieldListForCompositeField, getOrderFieldsList, getPrimaryKeyConstraint, getPrimaryKeyConstraint, getPrimaryKeyFieldNames, getTableNameForEntityBean, getTableNameForEntityBeanClass, isDatabaseSpecificFieldType, listFieldTypeConstraintsForTable, listFieldValuesForEntityBean, listOrphanedFields, listQualifiedFieldsForEntityBeans, listUpdateFieldsAndValuesForEntityBean, processJoinedQuery, translateName, translateNames
 
Methods inherited from class au.gov.tas.dpiwe.mr.BeanBundler
bundleBeanObjectCollectionIntoBeanObjectMap, bundleEntityBeanCollectionIntoEntityBeanList, bundleEntityBeanCollectionIntoEntityBeanMap, bundleEntityBeanCollectionIntoEntityBeanSet, bundleEntityBeanCollectionIntoEntityBeanSortedSet, bundleEntityBeanCollectionIntoPrimaryKeySet, bundleEntityBeanIntoBeanObjectCollection, bundleEntityBeanIntoBeanObjectCollection, bundleEntityBeanIntoBeanObjectList, bundleEntityBeanIntoBeanObjectList, bundleEntityBeanIntoBeanObjectMap, bundleEntityBeanIntoBeanObjectMap, bundleEntityBeanIntoBeanObjectSet, bundleEntityBeanIntoBeanObjectSet, bundleEntityBeanIntoBeanObjectSortedSet, bundleEntityBeanIntoBeanObjectSortedSet, bundleEntityBeanListIntoPrimaryKeySet, bundleEntityBeanMapIntoPrimaryKeySet, bundleEntityBeanSetIntoPrimaryKeySet, bundleEntityBeanSortedSetIntoPrimaryKeySet, bundleThinSiameseBeanIntoSiameseBeanObjectCollection, filterBeanObjectCollection, filterBeanObjectList, filterBeanObjectMap, filterBeanObjectSet, filterBeanObjectSet, unbundleBeanObjectIntoEntityBeanCollection, unbundleBeanObjectIntoEntityBeanList, unbundleBeanObjectIntoEntityBeanMap, unbundleBeanObjectIntoEntityBeanSet, unbundleBeanObjectIntoEntityBeanSet
 
Methods inherited from class au.gov.tas.dpiwe.mr.PresentationUtilities
buildFieldList, buildFieldListForEntityBean, buildFieldNameGetterMethodTable, buildFieldNameGetterMethodTable, buildFieldNameSetterMethodTable, buildFieldNameSetterMethodTable, buildFieldNameValueTable, buildFieldNameValueTable, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeAlgebraic, decodeBasicValue, decodeBasicValues, decodeSpecialValue, expressBasicValue, expressBasicValues, expressSpecialValue, expressVCD, getDestructorsForField, getFieldTypeByName, getFieldValueByName, getParentObjectForField, getPrototypeBeanObjectForBeanType, getPrototypeBeanObjectForTableName, getPrototypeFieldValueByName, getReadableFieldNamesInCSVFormat, getReadableFieldNamesInQueryOrder, getReadableFieldsAsMap, getReadableFieldsInURLEncodedFormat, getReadableFieldsInXMLFormat, getReadableFieldValuesInCSVFormat, getReadableFieldValuesInQueryOrder, isBasicFieldType, isCollectionType, isFieldPartOfCompositePrimaryKey, isRangeType, isRelationshipField, isRelationshipField, isRelationshipField, isSpecialCollectionType, isSpecialFieldType, isYesOrNoField, isYesOrNoField, leapYearsSince1900, listFieldsForEntityBean, main, newVCD, nonLeapYearsSince1900, replaceCompositePrimaryKeyWithClone, setFieldValueByName, setWriteableFieldsGivenCSVLine, setWriteableFieldsGivenMap, setWriteableFieldsGivenXMLFragment, stripPrefixFromFieldName, validateEntityBean
 
Methods inherited from class au.gov.tas.dpiwe.mr.BeanCache
addHistoricCommandType, addType, addType, addTypeLater, addTypeLater, beginLegacyTypes, buildFullMethodList, buildMethodList, buildMethodList, buildSinglyInheritedMethodList, cacheBeanObject, cacheEntityBean, classForName, compareEntityBeans, compareEntityBeanTypes, endLegacyTypes, ensureType, ensureTypeIgnoreCase, getAbstractNameForEntityBean, getAbstractNameForEntityBeanClass, getAbstractNameForUIBean, getAbstractNameForUIBeanClass, getAllTypes, getBeanObjectForEntityBean, getBeanObjectForEntityBean, getHomeForBeanObject, getHomeForEntityBean, getKeyGetterForEntityBean, getKeySetterForEntityBean, getPackageNameForEntityBeanClass, getPooledBeanObjectForEntityBean, getPooledBeanObjectForEntityBean, getPooledEntityBean, getPooledEntityBean, getPooledEntityBean, getPrimaryKeyFieldNameForEntityBean, getPrimaryKeyFieldNameForEntityBeanClass, getPrimaryKeyFieldTypeNameForEntityBeanClass, getType, getTypeIgnoreCase, hashEntityBean, hashEntityBeanType, isCachedEntityBean, loadTypeForName, loadTypeOnNull, loadTypes, reapReferences, throwOnNull, throwOnNull, uncacheBeanObjectForEntityBean, uncacheBeans, uncacheEntityBean
 
Methods inherited from class au.gov.tas.dpiwe.mr.util.Messenger
debugEmptyMessage, debugEmptyMessage, debugMessage, debugMessage, debugMessage, debugMessageFirstPart, debugMessageFirstPart, debugMessageLastPart, debugMessageLastPart, debugMessagePart, debugMessagePart, emptyMessage, emptyMessage, getMessageLevel, isTweenMessage, message, message, message, messageFirstPart, messageFirstPart, messageLastPart, messageLastPart, messagePart, messagePart, messagePart, messagePart, prettyException, setConsoleOutput, setConsoleOutput, setErrorOutput, setErrorOutput, setMessageLevel, setOutput, success
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LightweightContainer

public LightweightContainer(MrDatabase database)
Instantiates the lightweight container without logging.

This constructor chooses default hashtable sizes based on a medium-sized business application with a couple of hundred bean types.

If the lightweight container is one of many which may be running in a single VM, please call LightweightContainer(MrDatabase,String) instead in order to specify an appropriate application name.

Parameters:
database - the database schema to which objects in this container can be mapped.

LightweightContainer

public LightweightContainer(MrDatabase database,
                            int beanClassCount,
                            int initialPerBeanClassCacheSize,
                            String appName)
Instantiates the lightweight container without logging.

Parameters:
database - the database schema to which objects in this container can be mapped.
beanClassCount - an estimate of the number of bean types this container will contain.
initialPerBeanClassCacheSize - an estimate of the number of beans that will exist in the cache for a particular bean type.
appName - the name of the application which requires this container, usually the qualified name of the main application package, with an additional suffix if there are multiple containers per application.

LightweightContainer

public LightweightContainer(MrDatabase database,
                            String logFileName)
Instantiates the lightweight container with logging.

This constructor chooses default hashtable sizes based on a medium-sized business application with a couple of hundred bean types.

If the lightweight container is one of many which may be running in a single VM, please call LightweightContainer(MrDatabase,String,String) instead in order to specify an appropriate application name.

Parameters:
database - the database schema to which objects in this container can be mapped.
logFileName - the name of the log file to open (must already exist, as the new log entries are appended to the end of any existing file.)

LightweightContainer

public LightweightContainer(MrDatabase database,
                            String logFileName,
                            String appName)
Instantiates the lightweight container with logging.

This constructor chooses default hashtable sizes based on a medium-sized business application with a couple of hundred bean types.

Parameters:
database - the database schema to which objects in this container can be mapped.
logFileName - the name of the log file to open (must already exist, as the new log entries are appended to the end of any existing file.)
appName - the name of the application which requires this container, usually the qualified name of the main application package, with an additional suffix if there are multiple containers per application.

LightweightContainer

public LightweightContainer(MrDatabase database,
                            String logFileName,
                            int beanClassCount,
                            int initialPerBeanClassCacheSize,
                            String appName)
Instantiates the lightweight container with logging.

Parameters:
database - the database schema to which objects in this container can be mapped.
logFileName - the name of the log file to open (must already exist, as the new log entries are appended to the end of any existing file.)
beanClassCount - an estimate of the number of bean types this container will contain.
initialPerBeanClassCacheSize - an estimate of the number of beans that will exist in the cache for a particular bean type.
appName - the name of the application which requires this container, usually the qualified name of the main application package, with an additional suffix if there are multiple containers per application.
Method Detail

begin

protected Collection begin(Object handle,
                           int size)
                    throws NotSupportedException
Creates a new transaction and associates it with the given object.

Overrides:
begin in class Container
Parameters:
handle - the object to manage a thread on behalf of.
size - the expected number of commands in this transaction.
Returns:
the collection of commands for this transaction.
Throws:
NotSupportedException - if an attempt is made to nest transactions.

commit

protected void commit(Object handle)
               throws RollbackException,
                      HeuristicMixedException
Complete the given transaction.

When this method completes, the thread becomes associated with no transaction.

Overrides:
commit in class Container
Parameters:
handle - the object which owns the transaction.
Throws:
RollbackException - the transaction has been rolled back rather than committed, probably because one of the commands in the transaction failed.
HeuristicMixedException - unauthorized commands in the transaction have been rolled back, but those that were authorized have been committed.
IllegalStateException - if a transaction is not being managed for the calling thread.

rollback

protected void rollback(Object handle)
Roll back the given transaction. When this method completes, the thread becomes associated with no transaction.

Overrides:
rollback in class Container
Parameters:
handle - the object which owns the transaction.
Throws:
IllegalStateException - if a transaction is not being managed for the calling thread.

doCommandInTransactionContext

protected Response doCommandInTransactionContext(Command command)
                                          throws EJBException
Internal method which executes a command immediately. The effect of a subsequent rollback is to cause this and all subsequent commands executed within the transaction context rolled back to not be executed.

Overrides:
doCommandInTransactionContext in class Container
Parameters:
command - the command to execute.
Returns:
a response to the command, if it was executed immediately; otherwise null is returned.
Throws:
EJBException - if the command failed.
RollbackException - if the command failed and the transaction was rolled back as a result.