|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fulmine.AbstractLifeCycle fulmine.context.FTContext
public class FTContext
A context that exists within a cluster of peer contexts. These all exist to provide fault tolerance for a single logical application context identity. An FT cluster is identified by a 'cluster identity'. Each FT context within the cluster has the same logical application context identity but a unique FT context identity. The FT context identity always starts with the cluster identity. Only one FT context within the cluster will be 'active'. This active context is the context servicing all remote subscriptions for the logical application context. The other contexts will be in a standby mode.
The FT context actually hosts a second context that is the application
context; both the FT context and application contexts are separate
IFrameworkContext
instances. The FT context has a separate network
for its FT activities. When the FT context determines it should be active, it
activates the application context; the application context is always started
at the same time as the FT context but has its network set to 'listening
mode' (INetwork.setListeningOnlyMode(boolean)
). When the application
context is activated, its network IConnectionDiscoverer
is also
activated (IConnectionDiscoverer.enablePulsing()
); this will then
cause the application context to be discovered by other application contexts.
Should the FT context go into standby mode after this, the application
context will have its network IConnectionDiscoverer
disabled (
IConnectionDiscoverer.disablePulsing()
).
A context has 4 states;
IConnectionDiscoverer
to find any other FT contexts within the same cluster. When an FT context
finds another within the cluster, each subscribes for a 'context info' record
from the other. This record contains the following attributes:
IConnectionDiscoverer
that
will broadcast the identity of the logical application context to other
contexts (outside the FT cluster).
Application code can supply an IFTContextStateListener
to react to
whether the FT context is active or stand-by.
From a 'client' perspective, whenever an FT context takes over as being the active context in a cluster, the client will experience a network interrupt. When the new FT context is re-discovered, the client will re-connect and re-subscribe for the containers.
Field Summary | |
---|---|
static long |
HEARTBEAT_MULTIPLIER
The number of heartbeats that the FTContext activation period should be. |
Fields inherited from interface fulmine.context.IFrameworkContext |
---|
NAME |
Fields inherited from interface fulmine.rpc.IRpcManager |
---|
DEFAULT_RPC_TIMEOUT, RPC_TIMEOUT |
Constructor Summary | |
---|---|
FTContext(IFrameworkContext appContext,
IFTContextStateListener stateListener,
INetwork ftNetwork,
int number,
long activationDelayMillis)
Standard constructor for an FT context that provides FT capability to a hosted application context. |
Method Summary | |
---|---|
protected void |
activate()
Invoked by the Confirmed state and encapsulates the logic the
FTContext needs to perform to go into the active state. |
void |
addContainer(IContainer container)
Add a container to this context. |
boolean |
addRpcPublicationListener(String remoteContextIdentity,
IRpcPublicationListener listener)
Add a listener for RPC publication events. |
boolean |
addSubscriptionListener(ISubscriptionListener listener)
Add a container subscription listener. |
boolean |
containsLocalContainer(String identityRegularExpression,
IType type,
IDomain domain)
Identify if the local container exists in this context |
boolean |
containsRemoteContainer(String remoteContextIdentity,
String containerIdentity,
IType type,
IDomain domain)
Identify if the remote container exists in this context |
protected void |
doDestroy()
Overridden in subclasses to perform custom logic on destruction. |
protected void |
doStandby(IFrameworkContext context,
INetwork network,
IConnectionDiscoverer discoverer,
IConnectionBroker connectionBroker)
Standard operation for standby that stops heartbeat pulsing and recreates the IConnectionBroker |
protected void |
doStart()
Overridden in subclasses to perform custom logic on activation. |
void |
execute(Runnable task)
Add the task to a queue to be executed by a single worker thread. |
protected IFrameworkContext |
getAppContext()
|
IChannel[] |
getConnectedChannels()
Get all the currently connected channels |
IConnectionBroker |
getConnectionBroker()
Get the connection broker for the context. |
IConnectionDiscoverer |
getConnectionDiscoverer()
Get the connection discoverer in use by this context. |
IContainerFactory |
getContainerFactory()
Get the container factory for the context. |
int |
getContextHashCode()
Get a unique integer for this context. |
IContextWatchdog |
getContextWatchdog()
Get the component that will report on the state of this context |
IDistributionManager |
getDistributionManager()
Get the distribution manager assigned to the context |
int |
getEventProcessorCount()
Get the number of EventProcessor instances in this context |
String |
getEventProcessorIdentityPrefix()
Get the event processor identity prefix. |
ThreadGroup |
getEventProcessorThreadGroup()
Get the ThreadGroup for the event processors. |
IFrameReader |
getFrameReader()
Get the frame reader for this context |
IFrameWriter |
getFrameWriter()
Get the frame writer for this context |
String |
getIdentity()
Get the unique identity of this context. |
IContainer |
getLocalContainer(String identity,
IType type,
IDomain domain)
Get the identified local container. |
Collection<IContainer> |
getLocalContainers()
Get a copy of the collection of local containers in this context. |
protected AsyncLog |
getLog()
Get the log to use for the object hierarchy |
INetwork |
getNetwork()
Get the network |
IPermissionProfile |
getPermissionProfile()
Get the permission profile for the context. |
IContainer |
getRemoteContainer(String remoteContextIdentity,
String containerIdentity,
IType type,
IDomain domain)
Get the identified remote container. |
Collection<IContainer> |
getRemoteContainers(String remoteContextIdentity)
Get a copy of the collection of remote containers in this context. |
ISystemEventSource |
getSystemEventSource(Class<? extends ISystemEvent> type)
Get an ISystemEventSource that is used to propagate a single
specific type of ISystemEvent . |
IContainer |
getSystemInfo()
Get the 'system info' record that is used to encapsulate any system level information about the context. |
IRpcMarker |
invoke(IRpcResultHandler resultHandler,
String remoteContextIdentity,
String procedure,
IField... args)
Asynchronously invoke the RPC in the named remote context. |
IRpcResult |
invoke(String remoteContextIdentity,
String procedure,
IField... args)
Synchronously invoke the RPC in the named remote context. |
void |
invokeRpc(String remoteContextIdentity,
byte[] rpcData)
Send the RPC invocation to the remote context. |
boolean |
isFTContextActive()
Determine if this FT context is active. |
protected void |
prepareAppContextForStart()
Prepare the application context before calling start . |
boolean |
publishProdedure(IRpcHandler handler,
IRpcDefinition rpcDefinition)
Publish the named procedure to all known remote contexts. |
boolean |
publishRpcs(Class<?> definition,
Object handler)
Allows application code to remotely enable all methods in a handler object that are implementations of methods in an interface definition. |
void |
queueEvent(IEvent event)
Add the event to a queue for distribution to registered IEventListener instances for the event's IEventSource . |
void |
queueEvents(Collection<IEvent> events)
Bulk operation for queueing events. |
boolean |
removeContainer(IContainer container)
Remove a container from the context. |
boolean |
removeRpcPublicationListener(String remoteContextIdentity,
IRpcPublicationListener listener)
Remove an RPC publication listener. |
boolean |
removeSubscriptionListener(ISubscriptionListener listener)
Remove a container subscription listener. |
void |
requestRetransmit(String contextIdentity,
String identityRegularExpression,
IType type,
IDomain domain)
Send a request to the named remote context to retransmit the complete state of the IContainer instances with matching type and identity
subscribe for by the local context. |
void |
requestRetransmitAll(String contextIdentity)
Send a request to the named remote context to retransmit the complete state of all IContainer instances subscribed for by the local
context. |
void |
retransmit(String contextIdentity,
String identityRegularExpression,
IType type,
IDomain domain)
Retransmit the complete state of the IContainer instances with
matching type and identity to the (connected) remote context. |
void |
retransmitAll(String contextIdentity)
Retransmit the complete state of all the IContainer instances
that the (connected) remote context has subscribed for. |
void |
retransmitAllToAll()
Retransmit the complete state of all the IContainer instances to
all (connected) remote contexts that have a subscription for the
container instances. |
void |
retransmitToAll(String identityRegularExpression,
IType type,
IDomain domain)
Retransmit the complete state of the IContainer instances with
matching type and identity to all (connected) remote contexts that have a
subscription for the matching container. |
void |
schedule(TimerTask task,
long delay,
long period)
Schedule a timer task to be executed by a single worker thread. |
void |
setConnectionBroker(IConnectionBroker broker)
Set the connection broker for the context. |
void |
setConnectionDiscoverer(IConnectionDiscoverer discoverer)
Set the discover for the context. |
void |
setContextWatchdog(IContextWatchdog watchdog)
Set the component that will report on the state of this context |
void |
setDistributionManager(IDistributionManager distributionManager)
Provide a different implementation of the distribution manager. |
void |
setNetwork(INetwork network)
Set the INetwork for the context. |
void |
setPermissionProfile(IPermissionProfile profile)
Set the permission profile for the context. |
void |
setRemoteUpdateHandler(IRemoteUpdateHandler handler)
Set the object that will handle updates to local records from remote contexts via RPC calls. |
protected void |
standby()
Invoked by the Standby state and encapsulates the logic the
FTContext needs to perform to go into standby state. |
boolean |
subscribe(String contextIdentity,
String identityRegularExpression,
IType type,
IDomain domain,
IEventListener listener)
Subscribe the listener for the events generated by the IContainer
instance(s) in the identified context that match the type, domain and
identity regular expression. |
String |
toString()
|
boolean |
unpublishProdedure(IRpcDefinition rpcDefinition)
Unpublish the procedure from all connected remote contexts. |
boolean |
unpublishRpcs(Class<?> definition,
Object handler)
Allows application code to remove any previously remotely enabled methods published via IRpcPublishOperations.publishRpcs(Class, Object) |
boolean |
unsubscribe(String contextIdentity,
String identityRegularExpression,
IType type,
IDomain domain,
IEventListener listener)
Unsubscribe the listener from the IContainer instance(s)
identified by the type, domain and identity regular expression in the
specified context. |
String |
updateRemoteContainer(String remoteContextIdentity,
String identity,
IType type,
IDomain domain,
String fieldName,
String fieldValueAsString)
Update a named field with a new value in a container in a remote context. |
Methods inherited from class fulmine.AbstractLifeCycle |
---|
checkActive, destroy, finalize, isActive, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface fulmine.context.IFulmineContext |
---|
start |
Methods inherited from interface fulmine.ILifeCycle |
---|
isActive |
Methods inherited from interface fulmine.IDestroyable |
---|
destroy |
Methods inherited from interface fulmine.ILifeCycle |
---|
isActive |
Methods inherited from interface fulmine.IDestroyable |
---|
destroy |
Methods inherited from interface fulmine.ILifeCycle |
---|
isActive |
Methods inherited from interface fulmine.IDestroyable |
---|
destroy |
Methods inherited from interface fulmine.ILifeCycle |
---|
isActive |
Methods inherited from interface fulmine.IDestroyable |
---|
destroy |
Methods inherited from interface fulmine.ILifeCycle |
---|
isActive |
Methods inherited from interface fulmine.IDestroyable |
---|
destroy |
Field Detail |
---|
public static final long HEARTBEAT_MULTIPLIER
Constructor Detail |
---|
public FTContext(IFrameworkContext appContext, IFTContextStateListener stateListener, INetwork ftNetwork, int number, long activationDelayMillis)
appContext
- the application context instance that is hosted by the
clustering ability of this FT context. The FT cluster identity
comes from the IFulmineContext.getIdentity()
of the
context argument.stateListener
- the listener that will react to the FT context being active or
stand-byftNetwork
- the network that is used for FT activities; other FTContexts
joining the same network will coordinate between themselves to
identify which one should be the active contextnumber
- the FT number for the context within the cluster; determines
relative priority for becoming active between all peer FT
contexts within the same clusteractivationDelayMillis
- the delay to wait between start and provisional activation
states. This provides time for other FT context instances to
be discovered prior to entering the ProvisionalActive
state. The value must be at least equal to the ftNetwork's
heartbeat
period
multiplied by HEARTBEAT_MULTIPLIER
.
Choosing a number too low can result in newly started contexts
assuming confirmed active state before detecting any other
confirmed active instances.Method Detail |
---|
public IContextWatchdog getContextWatchdog()
IFrameworkContext
getContextWatchdog
in interface IFrameworkContext
public void setContextWatchdog(IContextWatchdog watchdog)
IFulmineContext
setContextWatchdog
in interface IFulmineContext
watchdog
- a component that can report on the state of this contextprotected final void doStart()
AbstractLifeCycle
RuntimeException
or subclass
thereof. When this method is called, the AbstractLifeCycle.isActive()
method will
return true
.
doStart
in class AbstractLifeCycle
protected void prepareAppContextForStart()
start
. Default implementation sets the application context network into
listen-only mode.
protected final void doDestroy()
AbstractLifeCycle
RuntimeException
or subclass
thereof.
doDestroy
in class AbstractLifeCycle
protected void standby()
Standby
state and encapsulates the logic the
FTContext
needs to perform to go into standby state.
protected final void doStandby(IFrameworkContext context, INetwork network, IConnectionDiscoverer discoverer, IConnectionBroker connectionBroker)
IConnectionBroker
context
- the context for the connection brokernetwork
- the network instance for the new connection brokerdiscoverer
- the discoverer to stop heartbeats forconnectionBroker
- the connection broker to stopprotected void activate()
Confirmed
state and encapsulates the logic the
FTContext
needs to perform to go into the active state.
public String toString()
toString
in class AbstractLifeCycle
protected AsyncLog getLog()
AbstractLifeCycle
getLog
in class AbstractLifeCycle
protected IFrameworkContext getAppContext()
public boolean isFTContextActive()
true
if this FT context is activesetFTContextState(String, boolean)
public void addContainer(IContainer container)
IModelManager
addContainer
in interface IModelManager
container
- the container to add to this contextpublic boolean addSubscriptionListener(ISubscriptionListener listener)
IDistributionManager
The listener will be added to a list only if it does not already exist in the list. Subscription events will be notified to all listeners in the list in the order they are added.
addSubscriptionListener
in interface IDistributionManager
listener
- a listener to add to an internal list.
true
if the listener was added, false
otherwisepublic boolean containsLocalContainer(String identityRegularExpression, IType type, IDomain domain)
IModelManager
containsLocalContainer
in interface IModelManager
type
- the type of the container to finddomain
- the domain of the container
true
if the local container existspublic boolean containsRemoteContainer(String remoteContextIdentity, String containerIdentity, IType type, IDomain domain)
IModelManager
containsRemoteContainer
in interface IModelManager
remoteContextIdentity
- the identity of the remote context where the remote container
originated fromtype
- the type of the container to finddomain
- the domain of the container
true
if the remote container existspublic void execute(Runnable task)
IEventManager
execute
in interface IEventManager
public IChannel[] getConnectedChannels()
IDistributionManager
getConnectedChannels
in interface IDistributionManager
IChannel
instancespublic IConnectionBroker getConnectionBroker()
IFrameworkContext
getConnectionBroker
in interface IFrameworkContext
null
if there is no
broker in the contextIFrameworkContext.setConnectionBroker(IConnectionBroker)
public IConnectionDiscoverer getConnectionDiscoverer()
IFrameworkContext
getConnectionDiscoverer
in interface IFrameworkContext
null
if there is
not one allocated.public IContainerFactory getContainerFactory()
IModelManager
getContainerFactory
in interface IModelManager
public int getContextHashCode()
IFulmineContext
getContextHashCode
in interface IFulmineContext
public int getEventProcessorCount()
IEventManager
EventProcessor
instances in this context
getEventProcessorCount
in interface IEventManager
public IFrameReader getFrameReader()
IDistributionManager
getFrameReader
in interface IDistributionManager
IFrameReader
for this contextpublic IFrameWriter getFrameWriter()
IDistributionManager
getFrameWriter
in interface IDistributionManager
IFrameWriter
for this contextpublic String getIdentity()
IFulmineContext
getIdentity
in interface IFulmineContext
public IContainer getLocalContainer(String identity, IType type, IDomain domain)
IModelManager
ContainerFactory
.
If the ContainerFactory
does not have a
IContainerFactory.IContainerBuilder
registered for the type
argument, a standard container is created.
This operation does not support any wildcards for the attributes (it
does not have the same contract for the identity, type and domain as
IDistributionManager.subscribe(String, String, IType, IDomain, IEventListener)
.
getLocalContainer
in interface IModelManager
identity
- the identity of the local containertype
- the type of the local containerdomain
- the domain of the local container
IContainer
native to this context and hosted in this
contextpublic Collection<IContainer> getLocalContainers()
IModelManager
getLocalContainers
in interface IModelManager
public INetwork getNetwork()
IFrameworkContext
getNetwork
in interface IFrameworkContext
public ThreadGroup getEventProcessorThreadGroup()
IEventManager
ThreadGroup
for the event processors.
getEventProcessorThreadGroup
in interface IEventManager
public IContainer getRemoteContainer(String remoteContextIdentity, String containerIdentity, IType type, IDomain domain)
IModelManager
ContainerFactory
and its state is set to be
IContainer#STALE
until it receives an update.
This method just creates the 'proxy shell' for the remote events to be
applied to. Use the
IDistributionManager.subscribe(String, String, IType, IDomain, IEventListener)
method to start receiving events for the container.
This operation does not support any wildcards for the attributes (it
does not have the same contract for the identity, type and domain as
IDistributionManager.subscribe(String, String, IType, IDomain, IEventListener)
.
getRemoteContainer
in interface IModelManager
remoteContextIdentity
- the identity of the remote context where the remote container
originates from - this is only required if the remote
container will be created. Use
IModelManager.containsRemoteContainer(String, String, IType, IDomain)
to determine if the remote container exists.type
- the type of the remote containerdomain
- the domain of the remote container
IContainer
native to the specified remote context and
hosted in this contextpublic Collection<IContainer> getRemoteContainers(String remoteContextIdentity)
IModelManager
getRemoteContainers
in interface IModelManager
remoteContextIdentity
- the remote context identity that the remote containers
originated from
public ISystemEventSource getSystemEventSource(Class<? extends ISystemEvent> type)
IEventManager
ISystemEventSource
that is used to propagate a single
specific type of ISystemEvent
. The system event source will be
created on the first invocation. The system event source is associated
with the zeroth EventProcessor
.
getSystemEventSource
in interface IEventManager
type
- the type of the system events the system event source
generates
ISystemEventSource
for the type of system eventpublic void queueEvent(IEvent event)
IEventManager
IEventListener
instances for the event's IEventSource
.
queueEvent
in interface IEventManager
event
- the event to queuepublic void queueEvents(Collection<IEvent> events)
IEventManager
queueEvents
in interface IEventManager
IEventManager.queueEvent(IEvent)
public boolean removeContainer(IContainer container)
IModelManager
removeContainer
in interface IModelManager
container
- the container to remove
true
if the container was removed,
false
if the container was not foundpublic boolean removeSubscriptionListener(ISubscriptionListener listener)
IDistributionManager
removeSubscriptionListener
in interface IDistributionManager
listener
- the listener to remove
true
if the listener was found and removed,
false
otherwisepublic void requestRetransmit(String contextIdentity, String identityRegularExpression, IType type, IDomain domain)
IRetransmissionManager
IContainer
instances with matching type and identity
subscribe for by the local context.
requestRetransmit
in interface IRetransmissionManager
contextIdentity
- the identity of the remote contextidentityRegularExpression
- the identity regular expression to match against containers
currently subscribed for by the local contexttype
- the type of the containerdomain
- the domain of the containerpublic void requestRetransmitAll(String contextIdentity)
IRetransmissionManager
IContainer
instances subscribed for by the local
context.
requestRetransmitAll
in interface IRetransmissionManager
contextIdentity
- the identity of the remote contextpublic void retransmit(String contextIdentity, String identityRegularExpression, IType type, IDomain domain)
IRetransmissionManager
IContainer
instances with
matching type and identity to the (connected) remote context. The
container must also currently be subscribed for by the remote context.
retransmit
in interface IRetransmissionManager
contextIdentity
- the identity of the remote contextidentityRegularExpression
- the identity regular expression to match against containers
currently subscribed for by the remote contexttype
- the type of the containerdomain
- the domain of the containerpublic void retransmitAll(String contextIdentity)
IRetransmissionManager
IContainer
instances
that the (connected) remote context has subscribed for.
retransmitAll
in interface IRetransmissionManager
contextIdentity
- the identity of the remote contextpublic void retransmitAllToAll()
IRetransmissionManager
IContainer
instances to
all (connected) remote contexts that have a subscription for the
container instances.
retransmitAllToAll
in interface IRetransmissionManager
public void retransmitToAll(String identityRegularExpression, IType type, IDomain domain)
IRetransmissionManager
IContainer
instances with
matching type and identity to all (connected) remote contexts that have a
subscription for the matching container.
retransmitToAll
in interface IRetransmissionManager
identityRegularExpression
- the identity regular expression to match against containers
currently subscribed for by any (connected) remote contexts.type
- the type of the containerdomain
- the domain of the containerpublic void setConnectionBroker(IConnectionBroker broker)
IFrameworkContext
IFulmineContext.start()
.
setConnectionBroker
in interface IFrameworkContext
broker
- the broker to use to create connections to remote contextspublic void setConnectionDiscoverer(IConnectionDiscoverer discoverer)
IFrameworkContext
IFulmineContext.start()
.
setConnectionDiscoverer
in interface IFrameworkContext
discoverer
- the discoverer to use to find connections to other remote
contextspublic void setDistributionManager(IDistributionManager distributionManager)
IFrameworkContext
setDistributionManager
in interface IFrameworkContext
distributionManager
- the distribution manager to usepublic IDistributionManager getDistributionManager()
IFrameworkContext
getDistributionManager
in interface IFrameworkContext
public void setNetwork(INetwork network)
IFulmineContext
INetwork
for the context. This allows the context to
communicate with other contexts that use the same network transport. This
must be called before IFulmineContext.start()
.
setNetwork
in interface IFulmineContext
network
- the networkpublic boolean subscribe(String contextIdentity, String identityRegularExpression, IType type, IDomain domain, IEventListener listener)
IDistributionManager
IContainer
instance(s) in the identified context that match the type, domain and
identity regular expression. The supplied listener will be registered
against the matching container instance(s). Events (changes to the
container instance(s)) will be received by the listener.
The container type and domain is matched exactly. However, a 'wildcard'
match for the type or domain can be specified using
ISubscription.WILDCARD_TYPE
and
ISubscription.WILDCARD_DOMAIN
. The identity regular expression
can identify an exact container identity or it can identify multiple
container identities (it is a regular expression matched against
container identities).
All subscription operations occur indefinitely; the operation examines
all current containers and then future created containers for an identity
match. The listener is registered against any matching container. The
subscription exists until either the context terminates or the
IDistributionManager.unsubscribe(String, String, IType, IDomain, IEventListener)
method is invoked with the same arguments. Using a regular expression
matching subscription allows a listener to receive updates for containers
whose identities are currently unknown or do not yet exist.
When the subscription is for a remote context (the contextIdentity does not match the local context identity), the subscription request is transmitted to the named remote context. The remote context handles the subscription using the same contract as for a local subscription. If the remote context has not yet come online, the subscription is saved until the identified remote context becomes available, at which point the subscription is transmitted.
Calling this method multiple times with the same arguments has no effect; it is idempotent.
subscribe
in interface IDistributionManager
contextIdentity
- the identity of context where the container(s) existidentityRegularExpression
- the identity regular expression that will be matched against a
container's identitytype
- the type of the containerdomain
- the domain of the containerlistener
- the listener that will be registered for receiving events from
the matching container(s)
true
if the subscription was created,
false
if it already existedIDistributionManager.unsubscribe(String, String, IType, IDomain, IEventListener)
public boolean unsubscribe(String contextIdentity, String identityRegularExpression, IType type, IDomain domain, IEventListener listener)
IDistributionManager
IContainer
instance(s)
identified by the type, domain and identity regular expression in the
specified context.
The IDistributionManager.subscribe(String, String, IType, IDomain, IEventListener)
method is idempotent so if it is called multiple times with the
same arguments, one call to
IDistributionManager.unsubscribe(String, String, IType, IDomain, IEventListener)
will
remove it.
Two subscriptions with equal type and domain but identity "foo.*" and "foo" are separate subscriptions and require two unsubscribe operations; the unsubscribe for "foo.*" does not unsubscribe the "foo" subscription.
unsubscribe
in interface IDistributionManager
contextIdentity
- the identity of the remote contextidentityRegularExpression
- the identity regular expression that will be matched against a
container's identitytype
- the type of the containerdomain
- the domain of the containerlistener
- the listener that will be unregistered from receiving events
from matching container(s)
true
if the subscription was found and removed,
false
otherwiseIDistributionManager.subscribe(String, String, IType, IDomain, IEventListener)
public String getEventProcessorIdentityPrefix()
IFrameworkContext
getEventProcessorIdentityPrefix
in interface IFrameworkContext
public void invokeRpc(String remoteContextIdentity, byte[] rpcData)
IRpcTransmissionManager
invokeRpc
in interface IRpcTransmissionManager
remoteContextIdentity
- the identity of the remote context that the RPC should be sent
torpcData
- the RPC in its byte[] formIRpcManager
public boolean addRpcPublicationListener(String remoteContextIdentity, IRpcPublicationListener listener)
IRpcManager
This is an idempotent operation.
addRpcPublicationListener
in interface IRpcManager
remoteContextIdentity
- the remote context to monitor for RPC publish/unpublish eventslistener
- a listener to receive the RPC publish/unpublish events.
true
if the listener was added, false
otherwisepublic boolean unpublishRpcs(Class<?> definition, Object handler)
IRpcPublishOperations
IRpcPublishOperations.publishRpcs(Class, Object)
unpublishRpcs
in interface IRpcPublishOperations
definition
- an interface that defines all the methods in the handler that
should be remotely disabled. This includes all methods in the
super-interfaces, if any.handler
- the object that implements the methods declared in the
definition interface. These methods will no longer be
available for remote invocation.
true
if all methods were successfully unpublishedpublic boolean publishRpcs(Class<?> definition, Object handler)
IRpcPublishOperations
There are some caveats to methods that can be remotely enabled; the method arguments and return types must be scalar and only the following types are supported:
This is a convenience method in-lieu of calling
IRpcPublishOperations.publishProdedure(IRpcHandler, IRpcDefinition)
.
publishRpcs
in interface IRpcPublishOperations
definition
- an interface that defines all the methods in the handler that
should be remotely enabled. This includes all methods in the
super-interfaces, if any.handler
- the object that implements the methods declared in the
definition interface. The handler does not necessarily have to
be an instance of the interface (i.e. does not need to
explicitly implement the interface, it only needs to implement
all the methods). All remote invocations of these methods will
be handled by this object. The remotely enabled methods
must be thread safe.
true
if all methods were successfully publishedpublic IRpcResult invoke(String remoteContextIdentity, String procedure, IField... args)
IRpcManager
It is assumed that this method is called after an RPC publication event
is received by an IRpcPublicationListener
.
invoke
in interface IRpcManager
remoteContextIdentity
- the remote context to invoke the RPC inprocedure
- the RPC nameargs
- the arguments for the RPC
IRpcManager.RPC_TIMEOUT
public IRpcMarker invoke(IRpcResultHandler resultHandler, String remoteContextIdentity, String procedure, IField... args)
IRpcManager
IRpcPublicationListener
invoke
in interface IRpcManager
resultHandler
- the handler to process the asynchronous resultremoteContextIdentity
- the remote context to invoke the RPC inprocedure
- the RPC nameargs
- the arguments for the RPC
public boolean removeRpcPublicationListener(String remoteContextIdentity, IRpcPublicationListener listener)
IRpcManager
This is an idempotent operation.
removeRpcPublicationListener
in interface IRpcManager
remoteContextIdentity
- the remote context that the listener was monitoring for RPC
publish/unpublish eventslistener
- the listener to remove
true
if the listener was found and removed,
false
otherwisepublic boolean publishProdedure(IRpcHandler handler, IRpcDefinition rpcDefinition)
IRpcPublishOperations
There can only be one handler per procedure instance. Different handlers can be used for overloaded procedures. RPC definitions cannot overload the result type, if this method is called with a definition that attempts to overload the result type, the operation is ignored and no publish happens.
After this method has completed, remote contexts will be able to invoke the RPC.
publishProdedure
in interface IRpcPublishOperations
handler
- the object that will handle any RPC invocations for this RPC
definition. This object must be thread safe.rpcDefinition
- the RPC definition
true
if the procedure was published,
false
if has already been publishedpublic boolean unpublishProdedure(IRpcDefinition rpcDefinition)
IRpcPublishOperations
unpublishProdedure
in interface IRpcPublishOperations
rpcDefinition
- the RPC definition to unpublish
true
if the procedure was unpublishedpublic IPermissionProfile getPermissionProfile()
IFulmineContext
IField
s that this context is allowed to view. If a profile has
not been set by application code, a default one should be provided.
getPermissionProfile
in interface IFulmineContext
public void setPermissionProfile(IPermissionProfile profile)
IFulmineContext
IField
s that this context will be allowed to view.
setPermissionProfile
in interface IFulmineContext
profile
- the permission profilepublic void setRemoteUpdateHandler(IRemoteUpdateHandler handler)
IFulmineContext
setRemoteUpdateHandler
in interface IFulmineContext
handler
- the handler to useIDistributionManager.updateRemoteContainer(String, String, IType,
IDomain, String, String)
public String updateRemoteContainer(String remoteContextIdentity, String identity, IType type, IDomain domain, String fieldName, String fieldValueAsString)
IDistributionManager
Note: This operation may be synchronous and may therefore block on I/O.
updateRemoteContainer
in interface IDistributionManager
remoteContextIdentity
- the identity of the remote context where the container is
hostedidentity
- the identity of the container with the field to changetype
- the type of the containerdomain
- the domain of the containerfieldName
- the field name in the container to updatefieldValueAsString
- the field value (as a string) to set as the new value for the
named field
#setRemoteUpdateHandler(IRemoteUpdateHandler)
public IContainer getSystemInfo()
IFrameworkContext
Bespoke attributes can be attached to this record by application code.
getSystemInfo
in interface IFrameworkContext
public void schedule(TimerTask task, long delay, long period)
IEventManager
schedule
in interface IEventManager
task
- task to be scheduled.delay
- delay in milliseconds before task is to be executed.period
- time in milliseconds between successive task executions.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |