Class AdvertiseListenerImpl
- java.lang.Object
-
- org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl
-
- All Implemented Interfaces:
AutoCloseable
,AdvertiseListener
public class AdvertiseListenerImpl extends Object implements AdvertiseListener
Listens for advertise messages sent by mod_cluster reverse proxy.- Author:
- Mladen Turk, Radoslav Husar
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ENCODING
static String
RFC_822_FMT
-
Constructor Summary
Constructors Constructor Description AdvertiseListenerImpl(MCMPHandler commHandler, AdvertiseConfiguration config, DatagramChannelFactory channelFactory)
Constructors a new AdvertiseListenerImpl
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clearBuffer(Buffer buffer)
JDK-compatible clear operating onBuffer
instead ofByteBuffer
.void
close()
Stops the advertise listener.static void
flipBuffer(Buffer buffer)
JDK-compatible flip operating onBuffer
instead ofByteBuffer
.AdvertisedServer
getServer(String name)
Get AdvertiseServer server.boolean
isListening()
Returnstrue
if listener is accepting the advertise messages; false if the listener was stopped or is experiencing network problems.
-
-
-
Field Detail
-
DEFAULT_ENCODING
public static final String DEFAULT_ENCODING
- See Also:
- Constant Field Values
-
RFC_822_FMT
public static final String RFC_822_FMT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AdvertiseListenerImpl
public AdvertiseListenerImpl(MCMPHandler commHandler, AdvertiseConfiguration config, DatagramChannelFactory channelFactory) throws IOException
Constructors a new AdvertiseListenerImpl- Parameters:
commHandler
- event handler that will be used for status and new server notificationsconfig
- advertise configurationchannelFactory
- a multicast channel factory- Throws:
IOException
-
-
Method Detail
-
getServer
public AdvertisedServer getServer(String name)
Get AdvertiseServer server.- Parameters:
name
- Server name to get.
-
close
public void close() throws IOException
Stops the advertise listener.- Specified by:
close
in interfaceAdvertiseListener
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
- If an I/O error occurs while closing the underlying channel.- See Also:
MulticastChannel.close()
-
isListening
public boolean isListening()
Description copied from interface:AdvertiseListener
Returnstrue
if listener is accepting the advertise messages; false if the listener was stopped or is experiencing network problems.- Specified by:
isListening
in interfaceAdvertiseListener
-
flipBuffer
public static void flipBuffer(Buffer buffer)
JDK-compatible flip operating onBuffer
instead ofByteBuffer
. See MODCLUSTER-743.- Parameters:
buffer
- a buffer to flip
-
clearBuffer
public static void clearBuffer(Buffer buffer)
JDK-compatible clear operating onBuffer
instead ofByteBuffer
. See MODCLUSTER-743.- Parameters:
buffer
- a buffer to clear
-
-