Package org.copperengine.core.persistent
Class MySqlDialect
- java.lang.Object
-
- org.copperengine.core.persistent.AbstractSqlDialect
-
- org.copperengine.core.persistent.MySqlDialect
-
- All Implemented Interfaces:
DatabaseDialect
,org.copperengine.management.DatabaseDialectMXBean
public class MySqlDialect extends AbstractSqlDialect
MySQL implementation of theDatabaseDialect
interface.
-
-
Field Summary
-
Fields inherited from class org.copperengine.core.persistent.AbstractSqlDialect
ACQUIRE_BLOCKING_WAIT_SEC, dbBatchingLatencyMSec, defaultStaleResponseRemovalTimeout, multiEngineMode, queryUpdateQueueState, selectQueueSizeStmtStatistic, serializer, supportsClob, supportsMultipleEngines
-
-
Constructor Summary
Constructors Constructor Description MySqlDialect()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addLimitation(java.lang.StringBuilder sql, int max)
protected void
addLimitationAndOffset(java.lang.StringBuilder sql, int max, int offset)
BatchCommand
createBatchCommand4error(Workflow<?> w, java.lang.Throwable t, DBProcessingState dbProcessingState, Acknowledge ack)
BatchCommand
createBatchCommand4NotifyNoEarlyResponseHandling(Response<?> response, Acknowledge ack)
protected java.sql.PreparedStatement
createDeleteStaleResponsesStmt(java.sql.Connection c, int MAX_ROWS)
protected java.sql.PreparedStatement
createDequeueStmt(java.sql.Connection c, java.lang.String ppoolId, int max)
protected java.sql.PreparedStatement
createQueryAllActiveStmt(java.sql.Connection c, java.lang.String className, int max)
protected java.sql.PreparedStatement
createUpdateStateStmt(java.sql.Connection c, int max)
protected void
doLock(java.sql.Connection con, java.lang.String lockContext)
Note: For MySQL the advisory lock only applies to the current connection, if the connection terminates, it will release the lock automatically.protected void
doReleaseLock(java.sql.Connection con, java.lang.String lockContext)
Releases the lock on the lockContext, use together withAbstractSqlDialect.lock(Connection, String)
java.lang.String
getDialectDescription()
void
insert(java.util.List<Workflow<?>> wfs, java.sql.Connection con)
-
Methods inherited from class org.copperengine.core.persistent.AbstractSqlDialect
checkDbConsistency, computeLockId, countAuditTrailInstances, countWorkflowInstances, createBatchCommand4Finish, createBatchCommand4Notify, createBatchCommand4registerCallback, createReadStmt, decode, deleteBroken, deleteFiltered, deleteStaleResponse, deleteWaiting, dequeue, getDbBatchingLatencyMSec, getDefaultStaleResponseRemovalTimeout, getResourceAsString, getResourceAsString, getWorkflowPersistencePlugin, insert, isBlank, isRemoveWhenFinished, lock, notify, queryAllActive, queryAuditTrailInstances, queryAuditTrailMessage, queryObjectState, queryQueueSize, queryWorkflowInstances, read, readDatabaseClock, releaseLock, restart, restartAll, restartFiltered, resumeBrokenBusinessProcesses, setDbBatchingLatencyMSec, setDefaultStaleResponseRemovalTimeout, setEngineId, setEngineIdProvider, setMultiEngineMode, setRemoveWhenFinished, setRuntimeStatisticsCollector, setSerializer, setWfRepository, setWorkflowPersistencePlugin, shutdown, splitt, startup, updateQueueState
-
-
-
-
Method Detail
-
createUpdateStateStmt
protected java.sql.PreparedStatement createUpdateStateStmt(java.sql.Connection c, int max) throws java.sql.SQLException
- Specified by:
createUpdateStateStmt
in classAbstractSqlDialect
- Throws:
java.sql.SQLException
-
createDequeueStmt
protected java.sql.PreparedStatement createDequeueStmt(java.sql.Connection c, java.lang.String ppoolId, int max) throws java.sql.SQLException
- Specified by:
createDequeueStmt
in classAbstractSqlDialect
- Throws:
java.sql.SQLException
-
createDeleteStaleResponsesStmt
protected java.sql.PreparedStatement createDeleteStaleResponsesStmt(java.sql.Connection c, int MAX_ROWS) throws java.sql.SQLException
- Specified by:
createDeleteStaleResponsesStmt
in classAbstractSqlDialect
- Throws:
java.sql.SQLException
-
createBatchCommand4error
public BatchCommand createBatchCommand4error(Workflow<?> w, java.lang.Throwable t, DBProcessingState dbProcessingState, Acknowledge ack)
- Specified by:
createBatchCommand4error
in interfaceDatabaseDialect
- Specified by:
createBatchCommand4error
in classAbstractSqlDialect
-
createBatchCommand4NotifyNoEarlyResponseHandling
public BatchCommand createBatchCommand4NotifyNoEarlyResponseHandling(Response<?> response, Acknowledge ack) throws java.lang.Exception
- Specified by:
createBatchCommand4NotifyNoEarlyResponseHandling
in classAbstractSqlDialect
- Throws:
java.lang.Exception
-
insert
public void insert(java.util.List<Workflow<?>> wfs, java.sql.Connection con) throws DuplicateIdException, java.lang.Exception
- Specified by:
insert
in interfaceDatabaseDialect
- Overrides:
insert
in classAbstractSqlDialect
- Throws:
DuplicateIdException
java.lang.Exception
-
getDialectDescription
public java.lang.String getDialectDescription()
-
createQueryAllActiveStmt
protected java.sql.PreparedStatement createQueryAllActiveStmt(java.sql.Connection c, java.lang.String className, int max) throws java.sql.SQLException
- Specified by:
createQueryAllActiveStmt
in classAbstractSqlDialect
- Throws:
java.sql.SQLException
-
doLock
protected void doLock(java.sql.Connection con, java.lang.String lockContext) throws java.sql.SQLException
Note: For MySQL the advisory lock only applies to the current connection, if the connection terminates, it will release the lock automatically. If you try to lock multiple times on the same lockContext, for the same connection, you need to release multiple times, it won't deadlock since version 5.7.5, please consult: http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock- Overrides:
doLock
in classAbstractSqlDialect
- Parameters:
con
- connection object on which the lock will be acquired onlockContext
- String for the lock name (Will be transformed to an int byAbstractSqlDialect.computeLockId(String)
.- Throws:
java.sql.SQLException
- If anything goes wrong in acquiring the lock on the database
-
doReleaseLock
protected void doReleaseLock(java.sql.Connection con, java.lang.String lockContext)
Description copied from class:AbstractSqlDialect
Releases the lock on the lockContext, use together withAbstractSqlDialect.lock(Connection, String)
- Overrides:
doReleaseLock
in classAbstractSqlDialect
- Parameters:
con
- connection object on which the lock will be released onlockContext
- String for the lock name
-
addLimitation
protected void addLimitation(java.lang.StringBuilder sql, int max)
- Specified by:
addLimitation
in classAbstractSqlDialect
-
addLimitationAndOffset
protected void addLimitationAndOffset(java.lang.StringBuilder sql, int max, int offset)
- Specified by:
addLimitationAndOffset
in classAbstractSqlDialect
-
-