solar.service.pack.proto
Class GroupBufferHandle

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

class GroupBufferHandle
extends java.lang.Object
implements BufferHandle

Manages a group of subscriptions, such as those coming from same link.

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

Field Summary
protected  java.lang.Object _plock
           
protected  java.util.Hashtable _policy
           
protected  java.util.Hashtable _privateBuffers
           
protected  Id _pubId
           
protected  Buffer _sharedBuffer
           
protected  int _size
           
protected  java.lang.Object _subkey
           
protected  boolean _suspended
           
protected  int _suspendLimit
           
protected  cern.jet.random.Uniform _unigen
           
 
Constructor Summary
GroupBufferHandle(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.
private  void putSubEvent(Id subId, Event evt)
           
private  void putSubEvents(Id subId, Buffer buffer)
           
 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

_unigen

protected cern.jet.random.Uniform _unigen

_size

protected int _size

_pubId

protected Id _pubId

_subkey

protected java.lang.Object _subkey

_policy

protected java.util.Hashtable _policy

_sharedBuffer

protected Buffer _sharedBuffer

_suspended

protected boolean _suspended

_suspendLimit

protected int _suspendLimit

_plock

protected java.lang.Object _plock

_privateBuffers

protected java.util.Hashtable _privateBuffers
Constructor Detail

GroupBufferHandle

public GroupBufferHandle(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

putSubEvent

private void putSubEvent(Id subId,
                         Event evt)
                  throws BufferFullException
BufferFullException

putSubEvents

private void putSubEvents(Id subId,
                          Buffer buffer)
                   throws BufferFullException
BufferFullException