org.red5.server.messaging
Class InMemoryPushPushPipe

java.lang.Object
  extended by org.red5.server.messaging.AbstractPipe
      extended by org.red5.server.messaging.InMemoryPushPushPipe
All Implemented Interfaces:
IMessageInput, IMessageOutput, IPipe

public class InMemoryPushPushPipe
extends AbstractPipe

A simple in-memory version of push-push pipe. It is triggered by an active provider to push messages through it to an event-driven consumer.

Author:
The Red5 Project ([email protected]), Steven Gong ([email protected])

Field Summary
 
Fields inherited from class org.red5.server.messaging.AbstractPipe
consumers, listeners, providers
 
Constructor Summary
InMemoryPushPushPipe()
           
 
Method Summary
 IMessage pullMessage()
          Pull message from this input endpoint.
 IMessage pullMessage(long wait)
          Pull message from this input endpoint.
 void pushMessage(IMessage message)
          Pushes a message out to all the PushableConsumers.
 boolean subscribe(IConsumer consumer, Map<String,Object> paramMap)
          Connect consumer to this pipe.
 boolean subscribe(IProvider provider, Map<String,Object> paramMap)
          Connect provider to this pipe.
 
Methods inherited from class org.red5.server.messaging.AbstractPipe
addPipeConnectionListener, close, fireConsumerConnectionEvent, firePipeConnectionEvent, fireProviderConnectionEvent, getConsumers, getListeners, getProviders, removePipeConnectionListener, sendOOBControlMessage, sendOOBControlMessage, setListeners, unsubscribe, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryPushPushPipe

public InMemoryPushPushPipe()
Method Detail

subscribe

public boolean subscribe(IConsumer consumer,
                         Map<String,Object> paramMap)
Connect consumer to this pipe. Doesn't allow to connect one consumer twice. Does register event listeners if instance of IPipeConnectionListener is given.

Specified by:
subscribe in interface IMessageInput
Overrides:
subscribe in class AbstractPipe
Parameters:
consumer - Consumer
paramMap - Parameters passed with connection, used in concrete pipe implementations
Returns:
true if consumer was added, false otherwise

subscribe

public boolean subscribe(IProvider provider,
                         Map<String,Object> paramMap)
Connect provider to this pipe. Doesn't allow to connect one provider twice. Does register event listeners if instance of IPipeConnectionListener is given.

Specified by:
subscribe in interface IMessageOutput
Overrides:
subscribe in class AbstractPipe
Parameters:
provider - Provider
paramMap - Parameters passed with connection, used in concrete pipe implementations
Returns:
true if provider was added, false otherwise

pullMessage

public IMessage pullMessage()
Pull message from this input endpoint. Return w/o waiting.

Returns:
The pulled message or null if message is not available.

pullMessage

public IMessage pullMessage(long wait)
Pull message from this input endpoint. Wait wait milliseconds if message is not available.

Parameters:
wait - milliseconds to wait when message is not available.
Returns:
The pulled message or null if message is not available.

pushMessage

public void pushMessage(IMessage message)
                 throws IOException
Pushes a message out to all the PushableConsumers.

Parameters:
message - the message to be pushed to consumers.
Throws:
IOException - If message could not be written.


Copyright © 2006-2012 The Red5 Project