solar.service.pack.proto
Class SingleBufferHandle

java.lang.Object
  |
  +--solar.service.pack.proto.SingleBufferHandle
All Implemented Interfaces:
BufferHandle

class SingleBufferHandle
extends java.lang.Object
implements BufferHandle

Manages a single subscription.

Version:
$Id: SingleBufferHandle.java,v 1.7 2003/10/13 19:34:26 glchen Exp $
Author:
Guanling Chen

Field Summary
protected  Buffer _buffer
           
protected  BufferPacker _packer
           
protected  java.lang.Object _policy
           
protected  Id _pubId
           
protected  Id _subId
           
protected  java.lang.Object _subkey
           
protected  boolean _suspended
           
protected  int _suspendLimit
           
 
Constructor Summary
SingleBufferHandle(Id pubId, java.lang.Object subkey, int suspendLimit)
           
 
Method Summary
 void addSubscriber(Id subId, java.lang.Object policy, Buffer buffer)
          Add a subscriber with specified policy.
 BufferedEvent getBufferedEvent()
          Return the next event from buffers in this handle.
 Id getPubId()
          Return the publisher ID of this handle.
 java.lang.Object getSubKey()
          Return the key of subscription, ID or link address.
 boolean hasSubscriber(Id subId)
          Return whether this handle contains specified subscriber.
 boolean isSuspended()
          Return whether this handle is suspended.
 void pack()
          Pack the buffers in this handle.
 void putEvent(Id pubId, Id subId, Event evt)
          Put a subscribed event into this handle.
 void putEvents(Id pubId, Id subId, Buffer buffer)
          Put a list of events into this handle.
 Buffer removeSubscriber(Id subId)
          Remove an existing subscriber and return its associated buffer.
 void resume()
          Resume all buffers in this handle to output.
 int size()
          Total number of events in this handle.
 void suspend()
          Suspend all buffers in this handle from output.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_subId

protected Id _subId

_pubId

protected Id _pubId

_subkey

protected java.lang.Object _subkey

_policy

protected java.lang.Object _policy

_buffer

protected Buffer _buffer

_suspended

protected boolean _suspended

_suspendLimit

protected int _suspendLimit

_packer

protected BufferPacker _packer
Constructor Detail

SingleBufferHandle

public SingleBufferHandle(Id pubId,
                          java.lang.Object subkey,
                          int suspendLimit)
Method Detail

size

public int size()
Description copied from interface: BufferHandle
Total number of events in this handle.

Specified by:
size in interface BufferHandle

getPubId

public Id getPubId()
Description copied from interface: BufferHandle
Return the publisher ID of this handle.

Specified by:
getPubId in interface BufferHandle

getSubKey

public java.lang.Object getSubKey()
Description copied from interface: BufferHandle
Return the key of subscription, ID or link address.

Specified by:
getSubKey in interface BufferHandle

hasSubscriber

public boolean hasSubscriber(Id subId)
Description copied from interface: BufferHandle
Return whether this handle contains specified subscriber.

Specified by:
hasSubscriber in interface BufferHandle

addSubscriber

public void addSubscriber(Id subId,
                          java.lang.Object policy,
                          Buffer buffer)
Description copied from interface: BufferHandle
Add a subscriber with specified policy.

Specified by:
addSubscriber in interface BufferHandle

removeSubscriber

public Buffer removeSubscriber(Id subId)
Description copied from interface: BufferHandle
Remove an existing subscriber and return its associated buffer.

Specified by:
removeSubscriber in interface BufferHandle

putEvent

public void putEvent(Id pubId,
                     Id subId,
                     Event evt)
              throws BufferFullException
Description copied from interface: BufferHandle
Put a subscribed event into this handle.

Specified by:
putEvent in interface BufferHandle
BufferFullException

putEvents

public void putEvents(Id pubId,
                      Id subId,
                      Buffer buffer)
               throws BufferFullException
Description copied from interface: BufferHandle
Put a list of events into this handle.

Specified by:
putEvents in interface BufferHandle
BufferFullException

getBufferedEvent

public BufferedEvent getBufferedEvent()
Description copied from interface: BufferHandle
Return the next event from buffers in this handle.

Specified by:
getBufferedEvent in interface BufferHandle

pack

public void pack()
Description copied from interface: BufferHandle
Pack the buffers in this handle.

Specified by:
pack in interface BufferHandle

suspend

public void suspend()
Description copied from interface: BufferHandle
Suspend all buffers in this handle from output.

Specified by:
suspend in interface BufferHandle

resume

public void resume()
Description copied from interface: BufferHandle
Resume all buffers in this handle to output.

Specified by:
resume in interface BufferHandle

isSuspended

public boolean isSuspended()
Description copied from interface: BufferHandle
Return whether this handle is suspended.

Specified by:
isSuspended in interface BufferHandle

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object