Class TribesReceiver
- java.lang.Object
-
- org.appng.core.controller.messaging.TribesReceiver
-
-
Constructor Summary
Constructors Constructor Description TribesReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Serializable msg, org.apache.catalina.tribes.Member sender)
TribesReceiver
configure(Serializer eventSerializer)
Configures the receiverSender
createSender()
protected String
getGroupAddress()
protected Integer
getGroupPort()
protected org.apache.catalina.tribes.ChannelInterceptor
getMessageDispatchInterceptor()
protected InetAddress
getNodeAddress()
protected boolean
isSameAddress(String hostAddress)
void
messageReceived(Serializable msg, org.apache.catalina.tribes.Member sender)
void
registerHandler(EventHandler<?> handler)
Registers a newEventHandler
void
run()
void
runWith(ExecutorService executorService)
Since a receiver runs as a thread, the givenExecutorService
should be used to run this thread.void
setDefaultHandler(EventHandler<?> defaultHandler)
Sets the defaultEventHandler
, used when no other handler is registered for a certain event typeprotected void
setGroupAddress(String address)
protected void
setGroupPort(Integer port)
-
-
-
Method Detail
-
configure
public TribesReceiver configure(Serializer eventSerializer)
Description copied from interface:Receiver
Configures the receiver- Specified by:
configure
in interfaceReceiver
- Parameters:
eventSerializer
- theSerializer
for this receiver- Returns:
- the configured receiver
-
runWith
public void runWith(ExecutorService executorService)
Description copied from interface:Receiver
Since a receiver runs as a thread, the givenExecutorService
should be used to run this thread.- Specified by:
runWith
in interfaceReceiver
- Parameters:
executorService
- theExecutorService
to run this receiver with
-
createSender
public Sender createSender()
Description copied from interface:Receiver
Creates and returns aSender
capable of sendingEvent
s that can be received by this type of receiver.- Specified by:
createSender
in interfaceReceiver
- Returns:
- the
Sender
-
getMessageDispatchInterceptor
protected org.apache.catalina.tribes.ChannelInterceptor getMessageDispatchInterceptor() throws ReflectiveOperationException
- Throws:
ReflectiveOperationException
-
messageReceived
public void messageReceived(Serializable msg, org.apache.catalina.tribes.Member sender)
- Specified by:
messageReceived
in interfaceorg.apache.catalina.tribes.ChannelListener
-
accept
public boolean accept(Serializable msg, org.apache.catalina.tribes.Member sender)
- Specified by:
accept
in interfaceorg.apache.catalina.tribes.ChannelListener
-
getNodeAddress
protected InetAddress getNodeAddress() throws UnknownHostException
- Throws:
UnknownHostException
-
registerHandler
public void registerHandler(EventHandler<?> handler)
Description copied from interface:Receiver
Registers a newEventHandler
- Specified by:
registerHandler
in interfaceReceiver
- Parameters:
handler
- theEventHandler
to register
-
setDefaultHandler
public void setDefaultHandler(EventHandler<?> defaultHandler)
Description copied from interface:Receiver
Sets the defaultEventHandler
, used when no other handler is registered for a certain event type- Specified by:
setDefaultHandler
in interfaceReceiver
- Parameters:
defaultHandler
- the defaultEventHandler
to use
-
getGroupPort
protected Integer getGroupPort()
-
getGroupAddress
protected String getGroupAddress()
-
setGroupPort
protected void setGroupPort(Integer port)
-
setGroupAddress
protected void setGroupAddress(String address)
-
isSameAddress
protected boolean isSameAddress(String hostAddress) throws UnknownHostException, SocketException
- Throws:
UnknownHostException
SocketException
-
-