|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--solar.service.BaseService | +--solar.service.pack.ScribePackService
The PACK service that runs at the server side and is built on top of Scribe.
Nested Class Summary | |
(package private) class |
ScribePackService.Forwarder
Responsible to delivery events to children in multicast tree. |
(package private) class |
ScribePackService.Handler
Responsible to delivery events to local subscribers only. |
(package private) class |
ScribePackService.RootTask
Periodically update the (pubId, rootAddress) mapping. |
(package private) class |
ScribePackService.Sender
Responsible to delivery events to attached clients only. |
(package private) class |
ScribePackService.SubscribeTask
Periodically refresh the subscription in the Scribe network. |
Field Summary | |
protected RpcService |
_coreRpc
|
protected TransportService |
_coreTransport
|
protected Address |
_coreTransportAddress
|
protected java.lang.String |
_coreTransportName
|
protected DispatchService |
_dispatch
|
protected java.lang.String |
_edgeTransportName
|
protected EndPointManager |
_epman
|
protected java.util.Hashtable |
_fakeids
|
protected ForwardProtocol |
_fwdproto
|
protected InputProtocol |
_inproto
|
protected static org.apache.log4j.Logger |
_log
Logging facility. |
protected OutputProtocol |
_outproto
|
protected java.lang.String |
_packName
|
protected OutputProtocol |
_pubrootproto
|
protected java.util.Hashtable |
_roottasks
|
protected ScribeManager |
_scribeman
|
protected java.util.Hashtable |
_scribeProxies
|
protected java.util.Hashtable |
_scribeRoots
|
protected OutputProtocol |
_subrootproto
|
protected java.util.Hashtable |
_subtasks
|
protected java.util.Timer |
_timer
|
Fields inherited from class solar.service.BaseService |
_inited, _manager, _name |
Fields inherited from interface solar.service.rpc.RpcConstants |
RPC_BLOCK, RPC_HANDLER, RPC_REPLY, RPC_REQUEST, RPC_TIMEOUT |
Fields inherited from interface solar.service.pack.PackConstants |
PACK_ACK, PACK_BUFFER_LIMIT, PACK_EVENT, PACK_FORWARD, PACK_LASTHOP, PACK_MEMORY_LIMIT, PACK_POLICY, PACK_PUBID, PACK_SUBID, PACK_SUSPEND_LIMIT |
Constructor Summary | |
ScribePackService()
|
Method Summary | |
private void |
addFakeId(Id pubId,
Id fakeId)
|
private void |
addRootTask(Id id,
ScribePackService.RootTask roottask)
|
private void |
addScribeProxy(Id id,
Address proxy)
|
private void |
addScribeRoot(Id id,
Address root)
|
private void |
addSubscribeTask(Id pubId,
Id subId,
ScribePackService.SubscribeTask subtask)
|
void |
attachPublisher(Id pubId,
Publisher publisher)
Attach a PACK publisher to the service. |
void |
attachSubscriber(Id subId,
Subscriber subscriber)
Attach a PACK subscriber to the service. |
private java.lang.Object |
callRpc(Address dest,
Request request)
|
void |
detachPublisher(Id pubId)
Detach a PACK publisher from the service. |
void |
detachSubscriber(Id subId)
Detach a PACK subscriber from the service. |
protected void |
doAttachPublisher(Id pubId,
Id session,
Address address,
Publisher publisher)
|
protected void |
doAttachSubscriber(Id subId,
Id session,
Address address,
Subscriber subscriber)
|
protected void |
doDetachPublisher(Id pubId)
|
protected void |
doDetachSubscriber(Id subId)
|
protected void |
doPublish(Id pubId,
Event evt)
|
protected void |
doSubscribe(Id pubId,
Id subId,
java.lang.Object policy)
|
private java.util.Set |
getFakeIds(Id pubId)
|
private Address |
getScribeProxy(Id id)
|
private Address |
getScribeRoot(Id id)
|
void |
handleEvent(Event evt)
Processing an event. |
protected void |
handlePackEvent(PackEvent evt)
|
java.lang.Object |
handleRequest(Request request)
Processing a request. |
protected void |
handleSubscribeEvent(SubscribeEvent evt)
|
void |
init()
Initiate the service, do not try to init dependent services here. |
void |
initDependents()
Initialize dependent services here. |
private boolean |
isLocal(Address dest)
Is the specified address actually same as local address. |
static Id |
makeFakeId(Id pubId,
Id subId)
|
Guid |
makeGuid(Id id)
Return a global unique ID. |
private Id |
makeSession()
Return a new session ID. |
void |
publish(Id pubId,
Event evt)
Publish an event to all subscribers. |
private void |
removeRootTask(Id id)
|
private void |
removeScribeProxy(Id id)
|
private void |
removeScribeRoot(Id id)
|
private void |
removeSubscribeTask(Id subId)
|
private void |
removeSubscribeTask(Id pubId,
Id subId)
|
private void |
sendToClient(Address dest,
Event evt)
Send an event to client using edge_transport. |
private boolean |
sendToParent(Id pubId,
Event evt)
Send an event to a topic's parent, return false if parent is null. |
private boolean |
sendToProxy(Id id,
Event evt)
Send an event to a topic's proxy, return false if proxy is local. |
private boolean |
sendToRoot(Id id,
Event evt)
Send an event to a topic's root, return false if root is local. |
void |
subscribe(Id pubId,
Id subId,
java.lang.Object policy)
Make a subscription to a PACK publisher. |
Methods inherited from class solar.service.BaseService |
assertInited, getDependentService, getName, getServiceManager, handleDispatchUnit, handleEvent, hasInited, init, setInited, setName, setServiceManager, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface solar.service.Service |
getName, getServiceManager, handleDispatchUnit, hasInited, setName, setServiceManager, start, stop |
Field Detail |
protected static org.apache.log4j.Logger _log
protected java.lang.String _packName
protected java.lang.String _coreTransportName
protected java.lang.String _edgeTransportName
protected Address _coreTransportAddress
protected RpcService _coreRpc
protected DispatchService _dispatch
protected TransportService _coreTransport
protected ScribeManager _scribeman
protected java.util.Hashtable _scribeRoots
protected java.util.Hashtable _scribeProxies
protected InputProtocol _inproto
protected OutputProtocol _outproto
protected ForwardProtocol _fwdproto
protected OutputProtocol _pubrootproto
protected OutputProtocol _subrootproto
protected java.util.Hashtable _fakeids
protected EndPointManager _epman
protected java.util.Timer _timer
protected java.util.Hashtable _subtasks
protected java.util.Hashtable _roottasks
Constructor Detail |
public ScribePackService()
Method Detail |
public void init() throws ServiceException
Service
init
in interface Service
init
in class BaseService
ServiceException
public void initDependents() throws ServiceException
Service
initDependents
in interface Service
initDependents
in class BaseService
ServiceException
public java.lang.Object handleRequest(Request request) throws java.lang.Exception
RequestHandler
handleRequest
in interface RequestHandler
handleRequest
in class BaseService
java.lang.Exception
public void handleEvent(Event evt) throws java.lang.Exception
EventHandler
handleEvent
in interface EventHandler
handleEvent
in class BaseService
java.lang.Exception
protected void handleSubscribeEvent(SubscribeEvent evt) throws java.lang.Exception
java.lang.Exception
protected void handlePackEvent(PackEvent evt) throws java.lang.Exception
java.lang.Exception
public void attachPublisher(Id pubId, Publisher publisher) throws PackException
PackService
attachPublisher
in interface PackService
PackException
public void detachPublisher(Id pubId) throws PackException
PackService
detachPublisher
in interface PackService
PackException
public void attachSubscriber(Id subId, Subscriber subscriber) throws PackException
PackService
attachSubscriber
in interface PackService
PackException
public void detachSubscriber(Id subId) throws PackException
PackService
detachSubscriber
in interface PackService
PackException
public void subscribe(Id pubId, Id subId, java.lang.Object policy) throws PackException
PackService
subscribe
in interface PackService
PackException
public void publish(Id pubId, Event evt) throws PackException
PackService
publish
in interface PackService
PackException
public Guid makeGuid(Id id)
PackService
makeGuid
in interface PackService
public static Id makeFakeId(Id pubId, Id subId)
protected void doAttachPublisher(Id pubId, Id session, Address address, Publisher publisher)
protected void doDetachPublisher(Id pubId) throws java.lang.Exception
java.lang.Exception
protected void doAttachSubscriber(Id subId, Id session, Address address, Subscriber subscriber)
protected void doDetachSubscriber(Id subId) throws java.lang.Exception
java.lang.Exception
protected void doSubscribe(Id pubId, Id subId, java.lang.Object policy) throws PackException
PackException
protected void doPublish(Id pubId, Event evt) throws PackException
PackException
private java.lang.Object callRpc(Address dest, Request request) throws java.lang.Exception
java.lang.Exception
private boolean isLocal(Address dest)
private void sendToClient(Address dest, Event evt) throws java.lang.Exception
java.lang.Exception
private boolean sendToParent(Id pubId, Event evt) throws java.lang.Exception
java.lang.Exception
private boolean sendToRoot(Id id, Event evt) throws java.lang.Exception
java.lang.Exception
private boolean sendToProxy(Id id, Event evt) throws java.lang.Exception
java.lang.Exception
private Id makeSession()
private void addRootTask(Id id, ScribePackService.RootTask roottask)
private void removeRootTask(Id id)
private void addSubscribeTask(Id pubId, Id subId, ScribePackService.SubscribeTask subtask)
private void removeSubscribeTask(Id pubId, Id subId)
private void removeSubscribeTask(Id subId)
private void addScribeRoot(Id id, Address root)
private void removeScribeRoot(Id id)
private Address getScribeRoot(Id id)
private void addScribeProxy(Id id, Address proxy)
private void removeScribeProxy(Id id)
private Address getScribeProxy(Id id)
private void addFakeId(Id pubId, Id fakeId)
private java.util.Set getFakeIds(Id pubId)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |