设置持久化实例实现
这个API的实现被用来将shark流程、 活动……的信息存储到数据库中。Shark使用DODS的实例持久化实现。你也可以通过这个接口实现你自己的持久化实现(例如使用hibernate或者EJB),然后配置shark使用这个实现。你可以编辑下面的配置文件片断来配置他:
#
# DODS instance persistent manager defaults
#
InstancePersistenceManagerClassName=org.enhydra.shark.instancepersistence.DODSPersistentManager
如果实例持久化实现没有定义的话,shark是不能工作的。
注意:如果你想要使用其他的实例持久化实现,你应该给出你自己的SharkTransaction API实现。
配置DODS实例持久化实现,当流程结束时删除流程
在默认条件下,DODS实现的实例持久化接口不能删除已完成的流程,他们会被留在数据库中。这个行为将在设置完以下参数后改变:
# Determines if finished processes should be deleted from DB (DODS persistence
# manager default is false)
#DODSPersistentManager.deleteFinishedProcesses=false
设置限制代理实现
在这个API上,shark有两种不同的实现。当一个活动或者流程被XPDL设置成超越了他的限制时,这些实现在默认情况下只是记录控制台日志。在标准实现中,对限制的检查,必须通过API在客户端上启动,而在基于定时器的实现中,这不能被完成。
如果你想使用你自己的实现,你可以编辑下列代码:
LimitAgentManagerClassName=org.enhydra.shark.limitagent.StandardLimitAgentManager
设置锁管理者(lock master)实现
锁管理者被用在流程的同步上。当用户使用锁管理者(lock master)时,将不能有超过一个的线程在同一时间访问一个流程。
在锁管理者(lock master)接口上,shark有两个实现。简单实现,当你使用的单一虚拟机时可以使用它。并且当你在多个虚拟机上一个数据库上使用shark时可以使用DODS作为持久化层。
默认条件下,锁管理器(lock master)是采用DODS方式的,并且他可以通过修改配置文件的方式修改锁管理器方式。
#==============================================================
# Default LockMaster is DODS#
#-------------------------------------------------------------
# SimpleLockMaster defaults#
#LockMasterClassName=org.enhydra.shark.processlocking.SimpleLockMaster
# The number of milliseconds to wait for a locked process, -1 is default
# for the simple lock master implementation, and it means wait forever
#SimpleLockMaster.Timeout=-1
# The number of milliseconds to try to acquire lock for the process if we
# must wait for it to be unlocked. Lock master will try to acquire process lock
# every SimpleLockMaster.LockWaitTime milliseconds until it succeeds, or
# until SimpleLockMaster.Timeout milliseconds has passed (int that case, an
# exception will be thrown).
# The simple lock master implementation default is 100 milliseconds
#SimpleLockMaster.LockWaitTime=100
#--------------------------------------------------------------
# DODSLockMaster defaults
#
LockMasterClassName=org.enhydra.shark.processlocking.DODSLockMaster
# The number of milliseconds to wait for a locked process, -1 is default
# for the DODS lock master implementation, and it means wait forever
DODSLockMaster.Timeout=1200
# The number of milliseconds to try to acquire lock for the process if we
# must wait for it to be unlocked. Lock master will try to acquire process lock
# every DODSLockMaster.LockWaitTime milliseconds until it succeeds, or
# until DODSLockMaster.Timeout milliseconds has passed (int that case, an
# exception will be thrown).
# The DODS lock master implementation default is 100 milliseconds
DODSLockMaster.LockWaitTime=400
# The database holding information on locked processes
#DODSLockMaster.DatabaseName=sharkdb
# The cache sizes must be set to zero
DatabaseManager.DB.sharkdb.LockTable.cache.maxCacheSize=0
DatabaseManager.DB.sharkdb.LockTable.cache.maxSimpleCacheSize=0
DatabaseManager.DB.sharkdb.LockTable.cache.maxComplexCacheSize=0
就像你所看到的,这里有很多额外的参数供lock master配置(包括超时,和锁等待时间),这些在配置文件里都有很好的描述。
当时用lock master 的DODS实现时,将DODS的LockTable cache size设置为0也是很重要的。
注意:你可以在shark中不使用lock master实现,但是以必须确定此时你的shark是在单个虚拟机上运行的,并且同时只能有一个客户端连接运行。
设置logging API实现
shark默认使用log4j作为logger实现,你可以在你得配置文件中配置你的logging API替换默认实现。下面时标准的logger配置:
#
# Standard logging manager defaults
#
LoggingManagerClassName=org.enhydra.shark.logging.StandardLoggingManager
# Standard Logging manager is using log4j, and here is log4j configuration
#
# log4j.rootLogger=info, SharkExecution, Console
log4j.appender.Database=org.apache.log4j.RollingFileAppender
log4j.appender.Database.File=C:/users/sasaboy/Shark/output/Shark/logs/SharkPersistence.log
log4j.appender.Database.MaxFileSize=10MB
log4j.appender.Database.MaxBackupIndex=2
log4j.appender.Database.layout=org.apache.log4j.PatternLayout
log4j.appender.Database.layout.ConversionPattern=%d{ISO8601}: %m%n
log4j.appender.XMLOutFormatForPersistence=org.apache.log4j.FileAppender
log4j.appender.XMLOutFormatForPersistence.File=C:/users/sasaboy/Shark/output/Shark/logs/chainsaw-persistence.log
log4j.appender.XMLOutFormatForPersistence.append=false
log4j.appender.XMLOutFormatForPersistence.layout=org.apache.log4j.xml.XMLLayout
log4j.appender.PackageEvents=org.apache.log4j.RollingFileAppender
log4j.appender.PackageEvents.File=C:/users/sasaboy/Shark/output/Shark/logs/SharkPackageHandlingEvents.log
log4j.appender.PackageEvents.MaxFileSize=10MB
log4j.appender.PackageEvents.MaxBackupIndex=2
log4j.appender.PackageEvents.layout=org.apache.log4j.PatternLayout
log4j.appender.PackageEvents.layout.ConversionPattern=%d{ISO8601}: %m%n
log4j.appender.XMLOutFormatForPackageEvents=org.apache.log4j.FileAppender
log4j.appender.XMLOutFormatForPackageEvents.File=C:/users/sasaboy/Shark/output/Shark/logs/chainsaw-packageevents.log
log4j.appender.XMLOutFormatForPackageEvents.append=false
log4j.appender.XMLOutFormatForPackageEvents.layout=org.apache.log4j.xml.XMLLayout
log4j.appender.SharkExecution=org.apache.log4j.RollingFileAppender
log4j.appender.SharkExecution.File=C:/users/sasaboy/Shark/output/Shark/logs/SharkExecutionFlow.log
log4j.appender.SharkExecution.MaxFileSize=10MB
log4j.appender.SharkExecution.MaxBackupIndex=2
log4j.appender.SharkExecution.layout=org.apache.log4j.PatternLayout
log4j.appender.SharkExecution.layout.ConversionPattern=%d{ISO8601}: %m%n
log4j.appender.XMLOutFormatForExecution=org.apache.log4j.FileAppender
log4j.appender.XMLOutFormatForExecution.File=C:/users/sasaboy/Shark/output/Shark/logs/chainsaw-execution.log
log4j.appender.XMLOutFormatForExecution.append=false
log4j.appender.XMLOutFormatForExecution.layout=org.apache.log4j.xml.XMLLayout
log4j.appender.NTEventLog=org.apache.log4j.nt.NTEventLogAppender
log4j.appender.NTEventLog.source=SharkCORBA-Service
log4j.appender.NTEventLog.append=false
log4j.appender.NTEventLog.layout=org.apache.log4j.PatternLayout
log4j.appender.NTEventLog.layout.ConversionPattern="%d{ISO8601}: [%t], %p, %c: %m%n"
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601}: %m%n
log4j.logger.Persistence=INFO,Database
#log4j.logger.Persistence=INFO,Database,XMLOutFormatForPersistence
log4j.logger.PackageEventLogger=INFO,PackageEvents
#log4j.logger.PackageEventLogger=INFO,PackageEvents,XMLOutFormatForPackageEvents
log4j.logger.Shark=INFO,Console,SharkExecution
#log4j.logger.Shark=INFO,Console,SharkExecution,XMLOutFormatForExecution
标准的logger实现配置在服务器端是不被配置的。(就是没有配置log4j实现),但是log4j在使用时从客户端配置。
下面的log 输出是被默认创建的:
l Server端执行flow log:输出每一个重大的shark操作,像包加载,活动完成等等。这些log在shark实行时也被显示到控制台上。
l 包处理事件:输出每一个包定义文件的操作执行,这些操作包括:
ü 从外部库中加载包到shark内存
ü 从shark中释放包
ü 在shark内存中更新已经存在的包
服务器持久化log:输出每一个涉及DODS实例持久化实现和数据库操作的通信的操作。