public class ClusterNode extends Object implements Runnable, NamespaceEventChannel, NodeTypeEventChannel, RecordConsumer, ClusterRecordProcessor, WorkspaceEventChannel, PrivilegeEventChannel
Modifier and Type | Field and Description |
---|---|
static String |
SYSTEM_PROPERTY_NODE_ID
System property specifying a node id to use.
|
Constructor and Description |
---|
ClusterNode() |
Modifier and Type | Method and Description |
---|---|
void |
consume(Record record)
Consume a record.
|
LockEventChannel |
createLockChannel(String workspace)
Create a
LockEventChannel for some workspace. |
UpdateEventChannel |
createUpdateChannel(String workspace)
Create an
UpdateEventChannel for some workspace. |
protected void |
disableAutoSync()
Disable periodic background synchronization.
|
void |
ended(DefaultClusterOperation operation,
boolean successful)
Invoked when a cluster operation has ended.
|
String |
getId()
Return the unique identifier of the records this consumer
will be able to handle.
|
Journal |
getJournal()
Return the journal created by this cluster node.
|
long |
getRevision()
Return the revision this consumer has last seen.
|
long |
getStopDelay()
Return the stop delay.
|
protected void |
init()
Initialize this cluster node (overridable).
|
void |
init(ClusterContext clusterContext)
Initialize this cluster node.
|
void |
process(ChangeLogRecord record)
Process a change log record.
|
void |
process(LockRecord record)
Process a lock record.
|
void |
process(NamespaceRecord record)
Process a namespace record.
|
void |
process(NodeTypeRecord record)
Process a node type record
|
void |
process(PrivilegeRecord record)
Process a privilege record
|
void |
process(WorkspaceRecord record)
Process a workspace record
|
void |
registered(Collection ntDefs)
Called when one or more node types have been registered.
|
void |
registeredPrivileges(Collection<PrivilegeDefinition> definitions) |
void |
remapped(String oldPrefix,
String newPrefix,
String uri)
Called when a namespace has been remapped.
|
void |
reregistered(QNodeTypeDefinition ntDef)
Called when a node types has been re-registered.
|
void |
run()
Run loop that will sync this node after some delay.
|
void |
setListener(NamespaceEventListener listener)
Set listener that will receive information about incoming, external namespace events.
|
void |
setListener(NodeTypeEventListener listener)
Set listener that will receive information about incoming, external node type events.
|
void |
setListener(PrivilegeEventListener listener) |
void |
setListener(WorkspaceListener listener) |
void |
setRevision(long revision)
Set the revision this consumer has last seen.
|
void |
setStopDelay(long stopDelay)
Set the stop delay, i.e.
|
void |
start()
Starts this cluster node.
|
void |
stop()
Stops this cluster node.
|
void |
sync()
Synchronize contents from journal.
|
void |
syncOnStartup()
Synchronize contents from journal when a
ClusterNode starts up. |
void |
unregistered(Collection qnames)
Called when one or more node types have been unregistered.
|
void |
workspaceCreated(String workspaceName,
ClonedInputSource inputSource) |
public static final String SYSTEM_PROPERTY_NODE_ID
public void init(ClusterContext clusterContext) throws ClusterException
clusterContext
- The cluster context.ClusterException
- if an error occursprotected void init() throws ClusterException
ClusterException
- if an error occurspublic void setStopDelay(long stopDelay)
stopDelay
- stop delay in millisecondspublic long getStopDelay()
setStopDelay(long)
protected void disableAutoSync()
public void start() throws ClusterException
ClusterException
- if an error occurspublic void run()
public void sync() throws ClusterException
ClusterException
- if an error occurspublic void syncOnStartup() throws ClusterException
ClusterNode
starts up.ClusterException
- if an error occurspublic void stop()
public UpdateEventChannel createUpdateChannel(String workspace)
UpdateEventChannel
for some workspace.workspace
- workspace namepublic LockEventChannel createLockChannel(String workspace)
LockEventChannel
for some workspace.workspace
- workspace namepublic Journal getJournal()
public void remapped(String oldPrefix, String newPrefix, String uri)
remapped
in interface NamespaceEventChannel
oldPrefix
- old prefix. if null
this is a fresh mappingnewPrefix
- new prefix. if null
this is an unmap operationuri
- uri to map prefix topublic void setListener(NamespaceEventListener listener)
NamespaceEventChannel
setListener
in interface NamespaceEventChannel
listener
- namespace event listenerpublic void registered(Collection ntDefs)
registered
in interface NodeTypeEventChannel
ntDefs
- collection of node type definitionspublic void reregistered(QNodeTypeDefinition ntDef)
reregistered
in interface NodeTypeEventChannel
ntDef
- node type definitionpublic void unregistered(Collection qnames)
unregistered
in interface NodeTypeEventChannel
qnames
- collection of node type qnamespublic void setListener(NodeTypeEventListener listener)
setListener
in interface NodeTypeEventChannel
listener
- node type event listenerpublic void registeredPrivileges(Collection<PrivilegeDefinition> definitions)
registeredPrivileges
in interface PrivilegeEventChannel
PrivilegeEventChannel.registeredPrivileges(java.util.Collection)
public void setListener(PrivilegeEventListener listener)
setListener
in interface PrivilegeEventChannel
public String getId()
getId
in interface RecordConsumer
public long getRevision()
getRevision
in interface RecordConsumer
public void consume(Record record)
consume
in interface RecordConsumer
record
- record to consumepublic void setRevision(long revision)
setRevision
in interface RecordConsumer
revision
- revisionpublic void process(ChangeLogRecord record)
process
in interface ClusterRecordProcessor
record
- change log recordpublic void process(LockRecord record)
process
in interface ClusterRecordProcessor
record
- lock recordpublic void process(NamespaceRecord record)
process
in interface ClusterRecordProcessor
record
- namespace recordpublic void process(NodeTypeRecord record)
process
in interface ClusterRecordProcessor
record
- node type recordpublic void process(PrivilegeRecord record)
ClusterRecordProcessor
process
in interface ClusterRecordProcessor
record
- privilege recordpublic void process(WorkspaceRecord record)
ClusterRecordProcessor
process
in interface ClusterRecordProcessor
record
- workspace recordpublic void setListener(WorkspaceListener listener)
setListener
in interface WorkspaceEventChannel
public void workspaceCreated(String workspaceName, ClonedInputSource inputSource)
workspaceCreated
in interface WorkspaceEventChannel
public void ended(DefaultClusterOperation operation, boolean successful)
successful
,
attempts to fill the journal record and update it, otherwise cancels
the update.operation
- cluster operationsuccessful
- true
if the operation was successful and
the journal record should be updated;
false
to revoke changesCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.