|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ros.internal.node.topic.DefaultTopicParticipant
org.ros.internal.node.topic.DefaultPublisher<T>
public class DefaultPublisher<T>
Default implementation of a Publisher.
| Constructor Summary | |
|---|---|
DefaultPublisher(NodeIdentifier nodeIdentifier,
TopicDeclaration topicDeclaration,
MessageSerializer<T> serializer,
MessageFactory messageFactory,
java.util.concurrent.ScheduledExecutorService executorService)
|
|
| Method Summary | |
|---|---|
void |
addListener(PublisherListener<T> listener)
Add a new lifecycle listener to the Publisher. |
void |
addSubscriber(SubscriberIdentifier subscriberIdentifer,
org.jboss.netty.channel.Channel channel)
Add a Subscriber connection to this Publisher. |
org.jboss.netty.buffer.ChannelBuffer |
finishHandshake(java.util.Map<java.lang.String,java.lang.String> incomingHeader)
Complete connection handshake on buffer. |
PublisherDeclaration |
getDeclaration()
|
PublisherIdentifier |
getIdentifier()
|
boolean |
getLatchMode()
|
int |
getNumberOfSubscribers()
Get the number of Subscribers currently connected to the
Publisher. |
int |
getQueueLimit()
|
boolean |
hasSubscribers()
|
T |
newMessage()
Create a new message. |
void |
publish(T message)
Publishes a message. |
void |
removeListener(PublisherListener<T> listener)
Remove a lifecycle listener from the Publisher. |
void |
setLatchMode(boolean enabled)
|
void |
setQueueLimit(int limit)
|
void |
shutdown()
Shuts down and unregisters the Publisher using the default timeout
for PublisherListener.onShutdown(Publisher) callbacks. |
void |
shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
Shuts down and unregisters the Publisher. |
void |
signalOnMasterRegistrationFailure()
Signal all PublisherListeners that the Publisher has failed
to register with the master. |
void |
signalOnMasterRegistrationSuccess()
Signal all PublisherListeners that the Publisher has
successfully registered with the master. |
void |
signalOnMasterUnregistrationFailure()
Signal all PublisherListeners that the Publisher has failed
to unregister with the master. |
void |
signalOnMasterUnregistrationSuccess()
Signal all PublisherListeners that the Publisher has
successfully unregistered with the master. |
java.lang.String |
toString()
|
| Methods inherited from class org.ros.internal.node.topic.DefaultTopicParticipant |
|---|
getTopicDeclaration, getTopicDeclarationAsList, getTopicDeclarationHeader, getTopicMessageType, getTopicName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.ros.internal.node.topic.TopicParticipant |
|---|
getTopicMessageType, getTopicName |
| Constructor Detail |
|---|
public DefaultPublisher(NodeIdentifier nodeIdentifier,
TopicDeclaration topicDeclaration,
MessageSerializer<T> serializer,
MessageFactory messageFactory,
java.util.concurrent.ScheduledExecutorService executorService)
| Method Detail |
|---|
public void setLatchMode(boolean enabled)
setLatchMode in interface Publisher<T>enabled - true if published messages should be latched,
false otherwisepublic boolean getLatchMode()
getLatchMode in interface Publisher<T>true if published messages will be latched, false
otherwise
public void shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
PublisherPublisher. Shutdown is delayed by at
most the specified timeout to allow
PublisherListener.onShutdown(Publisher) callbacks to complete.
PublisherListener.onShutdown(Publisher) callbacks are executed in
separate threads.
shutdown in interface Publisher<T>public void shutdown()
PublisherPublisher using the default timeout
for PublisherListener.onShutdown(Publisher) callbacks.
PublisherListener.onShutdown(Publisher) callbacks are executed in
separate threads.
shutdown in interface Publisher<T>Publisher.shutdown(long, TimeUnit)public PublisherIdentifier getIdentifier()
public PublisherDeclaration getDeclaration()
public boolean hasSubscribers()
hasSubscribers in interface Publisher<T>true if getNumberOfSubscribers() > 0, false
otherwisepublic int getNumberOfSubscribers()
PublisherSubscribers currently connected to the
Publisher.
This counts the number of Subscriber registered. If a
Subscriber does not shutdown properly it will not be unregistered
and thus will contribute to this count.
getNumberOfSubscribers in interface Publisher<T>Subscribers currently connected to the
Publisherpublic T newMessage()
Publisher
newMessage in interface Publisher<T>public void publish(T message)
PublisherPublisher has been associated with.
publish in interface Publisher<T>message - the message to publishpublic org.jboss.netty.buffer.ChannelBuffer finishHandshake(java.util.Map<java.lang.String,java.lang.String> incomingHeader)
public void addSubscriber(SubscriberIdentifier subscriberIdentifer,
org.jboss.netty.channel.Channel channel)
Subscriber connection to this Publisher.
subscriberIdentifer - the SubscriberIdentifier of the new subscriberchannel - the communication Channel to the Subscriberpublic void addListener(PublisherListener<T> listener)
PublisherPublisher.
addListener in interface Publisher<T>listener - the PublisherListener to addpublic void removeListener(PublisherListener<T> listener)
PublisherPublisher.
Nothing will happen if the given listener is not registered.
removeListener in interface Publisher<T>listener - the PublisherListener to removepublic void signalOnMasterRegistrationSuccess()
PublisherListeners that the Publisher has
successfully registered with the master.
Each listener is called in a separate thread.
signalOnMasterRegistrationSuccess in class DefaultTopicParticipantpublic void signalOnMasterRegistrationFailure()
PublisherListeners that the Publisher has failed
to register with the master.
Each listener is called in a separate thread.
signalOnMasterRegistrationFailure in class DefaultTopicParticipantpublic void signalOnMasterUnregistrationSuccess()
PublisherListeners that the Publisher has
successfully unregistered with the master.
Each listener is called in a separate thread.
signalOnMasterUnregistrationSuccess in class DefaultTopicParticipantpublic void signalOnMasterUnregistrationFailure()
PublisherListeners that the Publisher has failed
to unregister with the master.
Each listener is called in a separate thread.
signalOnMasterUnregistrationFailure in class DefaultTopicParticipantpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setQueueLimit(int limit)
setQueueLimit in interface Publisher<T>limit - the maximum number of messages to queue (i.e. buffer) for sendingpublic int getQueueLimit()
getQueueLimit in interface Publisher<T>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||