001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */
005: package com.tc.objectserver.api;
006:
007: import com.tc.net.groups.NodeID;
008: import com.tc.object.ObjectID;
009: import com.tc.objectserver.context.ObjectManagerResultsContext;
010: import com.tc.objectserver.core.api.GarbageCollector;
011: import com.tc.objectserver.core.api.ManagedObject;
012: import com.tc.objectserver.persistence.api.PersistenceTransaction;
013: import com.tc.text.PrettyPrintable;
014: import com.tc.util.ObjectIDSet2;
015:
016: import java.util.Collection;
017: import java.util.Iterator;
018: import java.util.List;
019: import java.util.Map;
020: import java.util.Set;
021:
022: /**
023: * manages all access to objects on the server. This will be single threaded and only accessed via it's event handler.
024: *
025: * @author steve
026: */
027: public interface ObjectManager extends ManagedObjectProvider,
028: PrettyPrintable {
029:
030: public void stop();
031:
032: /**
033: * release object so that if anyone needs it they can have it
034: *
035: * @param object
036: */
037: public void release(PersistenceTransaction tx, ManagedObject object);
038:
039: /**
040: * release all objects
041: */
042: public void releaseAll(Collection objects);
043:
044: /**
045: * release for objects that can not have changed while checked out
046: */
047: public void releaseReadOnly(ManagedObject object);
048:
049: /**
050: * Release all objects in the given collection.
051: *
052: * @param collection
053: */
054: public void releaseAll(PersistenceTransaction tx,
055: Collection collection);
056:
057: /**
058: * Looks up the objects associated with the Object Lookups from the clients. What it does is if all the objects are
059: * available it calls setResult() o ObjectManagerResultsContext. If not then it calls makesPending on
060: * ObjectManagerResultsContext and hangs on to the request until it can be fullfilled.
061: *
062: * @param nodeID - nodeID of the client that is interested in lookup
063: * @param maxCount - max number of objects reachable from the requested objects that should be looked up
064: * @param context - ResultContext that gets notifications.
065: * @return true if all the objects are successfully looked up.
066: */
067: public boolean lookupObjectsAndSubObjectsFor(NodeID nodeID,
068: ObjectManagerResultsContext responseContext, int maxCount);
069:
070: /**
071: * Looks up the objects associated with the transaction. What it does is if all the objects are available to be
072: * updated it calls setResult() on ObjectManagerResultsContext. If not then it calls makesPending on
073: * ObjectManagerResultsContext and hangs on to the request until it can be fullfilled.
074: *
075: * @param nodeID - nodeID of the client that is interested in lookup
076: * @param context - ResultContext that gets notifications.
077: * @return true if all the objects are successfully looked up.
078: */
079: public boolean lookupObjectsFor(NodeID nodeID,
080: ObjectManagerResultsContext context);
081:
082: /**
083: * The list of rootnames
084: *
085: * @return
086: */
087: public Iterator getRoots();
088:
089: public Map getRootNamesToIDsMap();
090:
091: public void createRoot(String name, ObjectID id);
092:
093: public ObjectID lookupRootID(String name);
094:
095: public GarbageCollector getGarbageCollector();
096:
097: public void setGarbageCollector(GarbageCollector gc);
098:
099: /**
100: * Called by GC thread (in object manager)
101: */
102: public void waitUntilReadyToGC();
103:
104: /**
105: * Called by GC thread (in object manager)
106: *
107: * @param toDelete
108: */
109: public void notifyGCComplete(Set toDelete);
110:
111: public void setStatsListener(ObjectManagerStatsListener listener);
112:
113: public void start();
114:
115: public void dump();
116:
117: public int getCheckedOutCount();
118:
119: public Set getRootIDs();
120:
121: public ObjectIDSet2 getAllObjectIDs();
122:
123: public void addFaultedObject(ObjectID oid, ManagedObject mo,
124: boolean removeOnRelease);
125:
126: // XXX::TODO:: This will change
127: public void flushAndEvict(List objects2Flush);
128:
129: }
|