Class ClusterService
java.lang.Object
org.jumpmind.symmetric.service.impl.AbstractService
org.jumpmind.symmetric.service.impl.ClusterService
- All Implemented Interfaces:
IClusterService,IService
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String[]protected IExtensionServiceprotected static Stringprotected static booleanprotected static final org.slf4j.Loggerprotected INodeServiceprotected Stringprotected static final String[]Fields inherited from class org.jumpmind.symmetric.service.impl.AbstractService
parameterService, platform, sqlTemplate, sqlTemplateDirty, symmetricDialect, tablePrefix -
Constructor Summary
ConstructorsConstructorDescriptionClusterService(IParameterService parameterService, ISymmetricDialect dialect, INodeService nodeService, IExtensionService extensionService) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaquireInfiniteLock(String action) protected voidvoidvoidclearInfiniteLock(String action) protected voiddisableSharedLock(String action) protected static StringgenerateInstanceId(String hostName) The instance id is similar in intent to the serverId, but it is generated by the system on initial startup, and semi-permanently cached as a file on the local file system.Get a unique identifier that represents the JVM instance this server is currently running in.voidinit()protected final voidprotected voidstatic StringinitInstanceId(IClusterInstanceGenerator generator) protected voidinsertLock(Lock lock) booleanbooleanisInfiniteLocked(String action) booleanbooleanbooleanbooleanprotected booleanlockCluster(String action, Date timeToBreakLock, Date timeLockAcquired, String argServerId) protected booleanlockExclusive(String action) protected booleanlockShared(String action) protected booleanvoidbooleanrefreshLock(String action) voidvoidremoveLock(String action) voidvoidprotected booleanunlockCluster(String action, String argServerId) protected booleanunlockExclusive(String action) protected booleanunlockShared(String action) protected voidupdateCacheLockTime(String action, Date timeLockAcquired) Methods inherited from class org.jumpmind.symmetric.service.impl.AbstractService
assertNotNull, buildBatchOrderBy, buildBatchParams, buildBatchWhere, buildBatchWhereFromFilter, close, createSqlReplacementTokens, getJdbcTemplate, getParameterService, getSql, getSymmetricDialect, getTablePrefix, getTargetDialect, getTargetPlatform, getTargetPlatform, isCalledFromSymmetricAdminTool, isSet, isStreamClosedByClient, isSymmetricTable, logOnce, maxDate, readAcks, sendAck, setSqlMap, synchronize, toNodeIds, toNodeIds
-
Field Details
-
actions
-
isUpgradedInstanceId
protected static boolean isUpgradedInstanceId -
log
protected static final org.slf4j.Logger log -
serverId
-
instanceId
-
nodeService
-
extensionService
-
lockCache
-
-
Constructor Details
-
ClusterService
public ClusterService(IParameterService parameterService, ISymmetricDialect dialect, INodeService nodeService, IExtensionService extensionService)
-
-
Method Details
-
init
public void init()- Specified by:
initin interfaceIClusterService
-
refreshLockEntries
public void refreshLockEntries()- Specified by:
refreshLockEntriesin interfaceIClusterService
-
initInstanceId
protected void initInstanceId() -
initInstanceId
-
checkSymDbOwnership
protected void checkSymDbOwnership() -
getInstanceId
- Specified by:
getInstanceIdin interfaceIClusterService
-
persistToTableForSnapshot
public void persistToTableForSnapshot()- Specified by:
persistToTableForSnapshotin interfaceIClusterService
-
insertLock
-
initCache
protected final void initCache() -
addLock
- Specified by:
addLockin interfaceIClusterService
-
removeLock
- Specified by:
removeLockin interfaceIClusterService
-
clearAllLocks
public void clearAllLocks()- Specified by:
clearAllLocksin interfaceIClusterService
-
lock
- Specified by:
lockin interfaceIClusterService
-
lock
- Specified by:
lockin interfaceIClusterService
-
lock
- Specified by:
lockin interfaceIClusterService
-
lockCluster
-
updateCacheLockTime
-
lockExclusive
-
lockWait
-
findLocks
- Specified by:
findLocksin interfaceIClusterService
-
generateInstanceId
The instance id is similar in intent to the serverId, but it is generated by the system on initial startup, and semi-permanently cached as a file on the local file system. The intension is to uniquely identity SymmetricDS installations, and protect against situations where things are misconfigured and potentially pointed at the wrong databases, or pointed at the same database without the cluster.lock.enabled parameter turned on. -
getServerId
Get a unique identifier that represents the JVM instance this server is currently running in.- Specified by:
getServerIdin interfaceIClusterService
-
unlock
- Specified by:
unlockin interfaceIClusterService
-
unlock
- Specified by:
unlockin interfaceIClusterService
-
unlockCluster
-
unlockExclusive
-
isLocked
- Specified by:
isLockedin interfaceIClusterService
-
isInfiniteLocked
- Specified by:
isInfiniteLockedin interfaceIClusterService
-
aquireInfiniteLock
- Specified by:
aquireInfiniteLockin interfaceIClusterService
-
clearInfiniteLock
- Specified by:
clearInfiniteLockin interfaceIClusterService
-
refreshLock
- Specified by:
refreshLockin interfaceIClusterService
-
isClusteringEnabled
public boolean isClusteringEnabled()- Specified by:
isClusteringEnabledin interfaceIClusterService
-