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 IExtensionService
protected static String
protected static boolean
protected static final org.slf4j.Logger
protected INodeService
protected String
protected 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 TypeMethodDescriptionvoid
void
aquireInfiniteLock
(String action) protected void
void
void
clearInfiniteLock
(String action) protected void
disableSharedLock
(String action) protected static String
generateInstanceId
(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.void
init()
protected final void
protected void
static String
initInstanceId
(IClusterInstanceGenerator generator) protected void
insertLock
(Lock lock) boolean
boolean
isInfiniteLocked
(String action) boolean
boolean
boolean
boolean
protected boolean
lockCluster
(String action, Date timeToBreakLock, Date timeLockAcquired, String argServerId) protected boolean
lockExclusive
(String action) protected boolean
lockShared
(String action) protected boolean
void
boolean
refreshLock
(String action) void
void
removeLock
(String action) void
void
protected boolean
unlockCluster
(String action, String argServerId) protected boolean
unlockExclusive
(String action) protected boolean
unlockShared
(String action) protected void
updateCacheLockTime
(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:
init
in interfaceIClusterService
-
refreshLockEntries
public void refreshLockEntries()- Specified by:
refreshLockEntries
in interfaceIClusterService
-
initInstanceId
protected void initInstanceId() -
initInstanceId
-
checkSymDbOwnership
protected void checkSymDbOwnership() -
getInstanceId
- Specified by:
getInstanceId
in interfaceIClusterService
-
persistToTableForSnapshot
public void persistToTableForSnapshot()- Specified by:
persistToTableForSnapshot
in interfaceIClusterService
-
insertLock
-
initCache
protected final void initCache() -
addLock
- Specified by:
addLock
in interfaceIClusterService
-
removeLock
- Specified by:
removeLock
in interfaceIClusterService
-
clearAllLocks
public void clearAllLocks()- Specified by:
clearAllLocks
in interfaceIClusterService
-
lock
- Specified by:
lock
in interfaceIClusterService
-
lock
- Specified by:
lock
in interfaceIClusterService
-
lock
- Specified by:
lock
in interfaceIClusterService
-
lockCluster
-
updateCacheLockTime
-
lockExclusive
-
lockWait
-
findLocks
- Specified by:
findLocks
in 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:
getServerId
in interfaceIClusterService
-
unlock
- Specified by:
unlock
in interfaceIClusterService
-
unlock
- Specified by:
unlock
in interfaceIClusterService
-
unlockCluster
-
unlockExclusive
-
isLocked
- Specified by:
isLocked
in interfaceIClusterService
-
isInfiniteLocked
- Specified by:
isInfiniteLocked
in interfaceIClusterService
-
aquireInfiniteLock
- Specified by:
aquireInfiniteLock
in interfaceIClusterService
-
clearInfiniteLock
- Specified by:
clearInfiniteLock
in interfaceIClusterService
-
refreshLock
- Specified by:
refreshLock
in interfaceIClusterService
-
isClusteringEnabled
public boolean isClusteringEnabled()- Specified by:
isClusteringEnabled
in interfaceIClusterService
-