net.walend.lyophil.memory
Class MemIdentifierSource

java.lang.Object
  |
  +--net.walend.lyophil.memory.MemIdentifierSource
All Implemented Interfaces:
IdentifierSource, java.io.Serializable

public class MemIdentifierSource
extends java.lang.Object
implements IdentifierSource, java.io.Serializable

A long number source that keeps them in memory.

Since:
20001230
Author:
David Walend

Field Summary
private  long counter
           
private  java.lang.Object guard
          synchronization guard for the counter.
private static long LASTID
           
 
Fields inherited from interface net.walend.lyophil.IdentifierSource
ROLE
 
Constructor Summary
MemIdentifierSource()
           
 
Method Summary
 boolean checkSetUp()
          make sure the backing storage is set up correctly
 java.io.Serializable createID()
          Return a Long unique in the system, which better not be bigger than a single VM.
 java.io.Serializable peekNextID()
          Returns the next id to be created, without assigning it as in use.
 void setUp()
          set up the backing storage
 void tearDown()
          clean up the backing storage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

guard

private final java.lang.Object guard
synchronization guard for the counter.


counter

private long counter

LASTID

private static final long LASTID
Constructor Detail

MemIdentifierSource

public MemIdentifierSource()
Method Detail

checkSetUp

public boolean checkSetUp()
Description copied from interface: IdentifierSource
make sure the backing storage is set up correctly

Specified by:
checkSetUp in interface IdentifierSource

setUp

public void setUp()
Description copied from interface: IdentifierSource
set up the backing storage

Specified by:
setUp in interface IdentifierSource

tearDown

public void tearDown()
Description copied from interface: IdentifierSource
clean up the backing storage

Specified by:
tearDown in interface IdentifierSource

peekNextID

public java.io.Serializable peekNextID()
Description copied from interface: IdentifierSource
Returns the next id to be created, without assigning it as in use. I use this method for testing.

Specified by:
peekNextID in interface IdentifierSource

createID

public java.io.Serializable createID()
Return a Long unique in the system, which better not be bigger than a single VM.

Specified by:
createID in interface IdentifierSource


Copyright (c) 2000, 2001, David Walend