Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1886 - in development/laboratory/planet/components/space: api/src/main/org/jpos/space/api tiny/src/main/org/jpos/space/tiny

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1886 - in development/laboratory/planet/components/space: api/src/main/org/jpos/space/api tiny/src/main/org/jpos/space/tiny
  • Date: Thu, 24 Feb 2005 06:43:12 +0100

Author: niclas
Date: Thu Feb 24 06:43:09 2005
New Revision: 1886

Modified:

development/laboratory/planet/components/space/api/src/main/org/jpos/space/api/SpaceStore.java

development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TinySpace.java

development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TransientStore.java
Log:
Some mistakes was sneaking in.

Modified:
development/laboratory/planet/components/space/api/src/main/org/jpos/space/api/SpaceStore.java
==============================================================================
---
development/laboratory/planet/components/space/api/src/main/org/jpos/space/api/SpaceStore.java
(original)
+++
development/laboratory/planet/components/space/api/src/main/org/jpos/space/api/SpaceStore.java
Thu Feb 24 06:43:09 2005
@@ -4,17 +4,30 @@

public interface SpaceStore
{
- /** Adds a key/value pair to the store.
+ /** Stores a key/value pair to the store.
+ * <p>
+ * The SpaceStore operated a fifo buffer for each key, and the
+ * values are stored at the end of the fifo, and recalled from
+ * the beginning.
+ * </p>
+ * @param key the key to the value to be stored.
+ * @param value the value to be associated with the key.
*/
- void add( Object key, Object value );
+ void store( Object key, Object value );

/** Returns a value associated with the key.
+ * <p>
* If more than one value is available, the oldest one is returned.
+ * </p>
+ * @return the oldest value stored with the given key.
+ *
*/
- Object get( Object key );
+ Object recall( Object key );

/** Removes a value associated with the key.
+ * <p>
* If more than one value is available, the oldest one is removed.
+ * </p>
*/
void remove( Object key );
}
\ No newline at end of file

Modified:
development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TinySpace.java
==============================================================================
---
development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TinySpace.java
(original)
+++
development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TinySpace.java
Thu Feb 24 06:43:09 2005
@@ -102,7 +102,7 @@
Iterator listeners = null;
synchronized( this )
{
- m_store.add( key, value );
+ m_store.store( key, value );
notifyAll();
}
if( listeners != null )
@@ -134,19 +134,16 @@
obj = look( key, timeout );
m_store.remove( key );
}
- if( listeners != null )
+ Iterator listeners = getSpaceListeners();
+ while( listeners.hasNext() )
{
- Iterator listeners = getSpaceListeners();
- while( listeners.hasNext() )
+ SpaceListener listener = (SpaceListener) listeners.next();
+ try
{
- SpaceListener listener = (SpaceListener) listeners.next();
- try
- {
- listener.taken( key, obj );
- } catch( Exception e )
- {
- m_logger.error( "Exception in SpaceListener.placed()", e
);
- }
+ listener.taken( key, obj );
+ } catch( Exception e )
+ {
+ m_logger.error( "Exception in SpaceListener.placed()", e );
}
}
return obj;
@@ -214,7 +211,7 @@

private Object probe( Object key )
{
- Object obj = m_store.get( key );
+ Object obj = m_store.recall( key );
return obj;
}
}
\ No newline at end of file

Modified:
development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TransientStore.java
==============================================================================
---
development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TransientStore.java
(original)
+++
development/laboratory/planet/components/space/tiny/src/main/org/jpos/space/tiny/TransientStore.java
Thu Feb 24 06:43:09 2005
@@ -16,7 +16,7 @@
* @version $Id$
* @since 2.0
*
- * @metro.component lifestyle="request"
+ * @metro.component name="transient-store" lifestyle="transient"
* @metro.service type="org.jpos.space.api.SpaceStore"
*/
public final class TransientStore
@@ -35,16 +35,24 @@
m_map = new HashMap();
}

- public void add( Object key, Object value, long timeout )
+ public void store( Object key, Object value )
{
+ if( m_logger.isDebugEnabled() )
+ {
+ m_logger.debug( "store: " + key + " = " + value );
+ }
LinkedList bucket = (LinkedList) m_map.get( key );
if( bucket == null )
bucket = new LinkedList();
bucket.addLast( value );
}

- public Object get( Object key )
+ public Object recall( Object key )
{
+ if( m_logger.isDebugEnabled() )
+ {
+ m_logger.debug( "recall: " + key );
+ }
LinkedList bucket = (LinkedList) m_map.get( key );
if( bucket == null )
return null;



  • svn commit: r1886 - in development/laboratory/planet/components/space: api/src/main/org/jpos/space/api tiny/src/main/org/jpos/space/tiny, niclas, 02/24/2005

Archive powered by MHonArc 2.6.24.

Top of Page