|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.semispace.SemiSpace
public class SemiSpace
A tuple space implementation which can be distributed with terracotta. This is the main class from which the SemiSpace interface is obtained.
Nested Class Summary | |
---|---|
protected class |
SemiSpace.WrappedInternalWriter
Need to wrap write in own thread in order to make terracotta pick it up. |
Field Summary | |
---|---|
static long |
ONE_DAY
|
Method Summary | ||
---|---|---|
protected boolean |
cancelElement(Long id,
boolean isTake,
String className)
|
|
protected boolean |
cancelListener(ListenerHolder holder)
|
|
Long[] |
findAllHolderIds()
|
|
String |
findOrWaitLeaseForTemplate(Map<String,String> templateSet,
long timeout,
boolean isToTakeTheLease)
Public for the benefit of the webservices interface. |
|
SemiSpaceAdminInterface |
getAdmin()
Return admin element |
|
protected SemiSpaceStatistics |
getStatistics()
For the benefit of junit test(s) - defensively copied statistics |
|
com.thoughtworks.xstream.XStream |
getXStream()
Exposing xstream instance in order to allow outside manipulation of aliases and classloader affiliation. |
|
void |
harvest()
Harvest old elements from diverse listeners. |
|
SemiEventRegistration |
notify(Map<String,String> searchProps,
SemiEventListener listener,
long duration)
Basically the same as the notify method demanded by the interface, except that it accepts search properties directly. |
|
SemiEventRegistration |
notify(Object tmpl,
SemiEventListener listener,
long duration)
None of the parameters can be null |
|
protected void |
notifyListeners(DistributedEvent distributedEvent)
Distributed notification method. |
|
int |
numberOfBlockingRead()
Need present statistics here due to spring JMX configuration. |
|
int |
numberOfBlockingTake()
Need present statistics here due to spring JMX configuration. |
|
int |
numberOfMissedRead()
Need present statistics here due to spring JMX configuration. |
|
int |
numberOfMissedTake()
Need present statistics here due to spring JMX configuration. |
|
int |
numberOfNumberOfListeners()
Need present statistics here due to spring JMX configuration. |
|
int |
numberOfRead()
Need present statistics here due to spring JMX configuration. |
|
int |
numberOfSpaceElements()
Return the number of elements in the space. |
|
int |
numberOfTake()
Need present statistics here due to spring JMX configuration. |
|
int |
numberOfWrite()
Need present statistics here due to spring JMX configuration. |
|
Object |
processTemplate(Object template)
Create a pre-processed template object that can be used to reduce the amount of work required to match templates during a take. |
|
|
read(T tmpl,
long timeout)
Read an object from the space, which has matching fields (or getters) with the template |
|
Holder |
readHolderById(long hId)
Used for retrieving element with basis in id |
|
|
readIfExists(T tmpl)
Same as read, with duration 0 |
|
protected boolean |
renewElement(Holder holder,
long duration)
|
|
protected boolean |
renewListener(ListenerHolder holder,
long duration)
|
|
protected Map<String,String> |
retrievePropertiesFromObject(Object examine)
Protected for the benefit of junit test(s) |
|
static SemiSpaceInterface |
retrieveSpace()
|
|
void |
setAdmin(SemiSpaceAdminInterface admin)
Preparing for future injection of admin. |
|
|
take(T tmpl,
long timeout)
Same as read, except that the object is removed from the space. |
|
|
takeIfExists(T tmpl)
Same as take, with a duration of 0 |
|
SemiLease |
write(Object entry,
long leaseTimeMs)
Notice that the lease time is the time in milliseconds the element is wants to live, not the system time plus the time to live. |
|
SemiLease |
writeToElements(String entryClassName,
long leaseTimeMs,
String xml,
Map<String,String> searchMap)
This method is public for the benefit of the web services, which shortcuts the writing process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long ONE_DAY
Method Detail |
---|
public static SemiSpaceInterface retrieveSpace()
public SemiEventRegistration notify(Object tmpl, SemiEventListener listener, long duration)
notify
in interface SemiSpaceInterface
tmpl
- Template to be matched.listener
- Listener to be notified when object with a matching template is foundduration
- How long this particular listener is valid.
SemiSpaceInterface.notify(Object, SemiEventListener, long)
public SemiEventRegistration notify(Map<String,String> searchProps, SemiEventListener listener, long duration)
protected void notifyListeners(DistributedEvent distributedEvent)
public SemiLease write(Object entry, long leaseTimeMs)
write
in interface SemiSpaceInterface
entry
- Object to be written into the spaceleaseTimeMs
- Life time in milliseconds of the written object
public SemiLease writeToElements(String entryClassName, long leaseTimeMs, String xml, Map<String,String> searchMap)
public <T> T read(T tmpl, long timeout)
SemiSpaceInterface
read
in interface SemiSpaceInterface
tmpl
- Object of exactly the same type as what
is wanted as return value, with zero or more none-null fields or getters.timeout
- How long you are willing to wait for an answer / match.
public String findOrWaitLeaseForTemplate(Map<String,String> templateSet, long timeout, boolean isToTakeTheLease)
timeout
- how long to wait in milliseconds. If timeout is zero or negative, query once.isToTakeTheLease
- true if the element shall be marked as taken.
public <T> T readIfExists(T tmpl)
SemiSpaceInterface
readIfExists
in interface SemiSpaceInterface
SemiSpaceInterface.read(Object, long)
public Holder readHolderById(long hId)
public <T> T take(T tmpl, long timeout)
SemiSpaceInterface
take
in interface SemiSpaceInterface
SemiSpaceInterface.read(Object, long)
public <T> T takeIfExists(T tmpl)
SemiSpaceInterface
takeIfExists
in interface SemiSpaceInterface
SemiSpaceInterface.take(Object, long)
,
SemiSpaceInterface.read(Object, long)
public Object processTemplate(Object template)
template
- The object to preprocess
protected Map<String,String> retrievePropertiesFromObject(Object examine)
examine
- Non-null objectpublic void setAdmin(SemiSpaceAdminInterface admin)
This is tested in junit test (and under terracotta).
public SemiSpaceAdminInterface getAdmin()
public void harvest()
public int numberOfSpaceElements()
public int numberOfBlockingRead()
public int numberOfBlockingTake()
public int numberOfMissedRead()
public int numberOfMissedTake()
public int numberOfNumberOfListeners()
public int numberOfRead()
public int numberOfTake()
public int numberOfWrite()
protected SemiSpaceStatistics getStatistics()
protected boolean cancelListener(ListenerHolder holder)
protected boolean renewListener(ListenerHolder holder, long duration)
protected boolean cancelElement(Long id, boolean isTake, String className)
isTake
- true if reason for the cancellation is a take.protected boolean renewElement(Holder holder, long duration)
public Long[] findAllHolderIds()
HolderContainer.findAllHolderIds()
public com.thoughtworks.xstream.XStream getXStream()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |