|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.javagroups.service.AbstractService
AbstractService
is a superclass for all service implementations.
Each service has two communication channels: one for inter-service
communication with group memebership enabled, and one for client communication
witout group membership. This allows creation of full featured services with
replication and load balancing and light-weight clients that can call service
methods by sending specific messages.
Field Summary | |
protected boolean |
blocked
|
protected java.lang.Object |
blockMonitor
|
protected Channel |
clientChannel
|
protected java.util.LinkedList |
members
|
protected boolean |
runThread
|
protected PullPushAdapter |
serviceAdapter
|
protected Channel |
serviceChannel
|
protected java.lang.Object |
threadMonitor
|
Constructor Summary | |
AbstractService(Channel serviceChannel,
Channel clientChannel)
Main constructor to create services. |
Method Summary | |
void |
block()
This method is called when service is supposed to stop sending messages to channel until new view is installed. |
Address |
getAddress()
Get address of this service in service group. |
abstract java.lang.String |
getName()
Get name of this service. |
boolean |
isBlocked()
This method returns true if inter-service communication
processes should temporarily stop sending messages to service channel. |
boolean |
isCoordinator()
Check if this service is a coordinator of service group. |
protected void |
setMessageListener(MessageListener listener)
Set message listener for service message channel. |
void |
start()
Start standalone thread that will run until explicitly stopped. |
void |
stop()
Stop standalone thread started with start() method. |
void |
suspect(Address suspectedMember)
This method is called when a member of service group is suspected to be failed. |
void |
viewAccepted(View view)
This method is called when new view is installed. |
void |
waitOnBlocked()
Stop current thread's execution until inter-service channel is unblocked. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Channel serviceChannel
protected PullPushAdapter serviceAdapter
protected Channel clientChannel
protected java.util.LinkedList members
protected boolean blocked
protected java.lang.Object blockMonitor
protected java.lang.Object threadMonitor
protected boolean runThread
Constructor Detail |
public AbstractService(Channel serviceChannel, Channel clientChannel)
PullPushAdapter
for inter-service channel and
tries to retrive initial service state.serviceChannel
- instance of Channel
class that will be
used for inter-service communication. This channel must provide group
membership service and reliable group multicast.clientChannel
- instance of Channel
class that will be used
for client-service communication. This channel should provide reliable
group multicast and unicast, but specific service implementation might
put weaker requirements.Method Detail |
public abstract java.lang.String getName()
getAddress()
value.protected void setMessageListener(MessageListener listener)
public Address getAddress()
public boolean isCoordinator()
true
if this service is a coordinator of service
group.public boolean isBlocked()
true
if inter-service communication
processes should temporarily stop sending messages to service channel.public void waitOnBlocked() throws java.lang.InterruptedException
public void block()
block
in interface MembershipListener
public void suspect(Address suspectedMember)
suspect
in interface MembershipListener
public void viewAccepted(View view)
#getChannel()
method.viewAccepted
in interface MembershipListener
view
- new view that was accepted.public void start()
public void stop()
start()
method. If no thread
were started this method does nothing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |