repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
tzaeschke/zoodb
src/org/zoodb/internal/Session.java
Session.checkObjectForRefresh
private ZooPC checkObjectForRefresh(Object pc) { if (!(pc instanceof ZooPC)) { throw DBLogger.newUser("The object is not persistent capable: " + pc.getClass()); } ZooPC pci = (ZooPC) pc; if (!pci.jdoZooIsPersistent()) { return pci; } ...
java
private ZooPC checkObjectForRefresh(Object pc) { if (!(pc instanceof ZooPC)) { throw DBLogger.newUser("The object is not persistent capable: " + pc.getClass()); } ZooPC pci = (ZooPC) pc; if (!pci.jdoZooIsPersistent()) { return pci; } ...
[ "private", "ZooPC", "checkObjectForRefresh", "(", "Object", "pc", ")", "{", "if", "(", "!", "(", "pc", "instanceof", "ZooPC", ")", ")", "{", "throw", "DBLogger", ".", "newUser", "(", "\"The object is not persistent capable: \"", "+", "pc", ".", "getClass", "("...
For refresh, we can ignore things like deletion or transience. @param pc @return the refreshed object
[ "For", "refresh", "we", "can", "ignore", "things", "like", "deletion", "or", "transience", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/Session.java#L651-L665
train
tzaeschke/zoodb
src/org/zoodb/jdo/spi/PersistenceCapableImpl.java
PersistenceCapableImpl.jdoReplaceStateManager
@Override public final void jdoReplaceStateManager (javax.jdo.spi.StateManager sm) { // throws exception if current sm didn't request the change if (jdoStateManager != null) { jdoStateManager = jdoStateManager.replacingStateManager (this, sm); } else { // the following will throw an exception if not author...
java
@Override public final void jdoReplaceStateManager (javax.jdo.spi.StateManager sm) { // throws exception if current sm didn't request the change if (jdoStateManager != null) { jdoStateManager = jdoStateManager.replacingStateManager (this, sm); } else { // the following will throw an exception if not author...
[ "@", "Override", "public", "final", "void", "jdoReplaceStateManager", "(", "javax", ".", "jdo", ".", "spi", ".", "StateManager", "sm", ")", "{", "// throws exception if current sm didn't request the change", "if", "(", "jdoStateManager", "!=", "null", ")", "{", "jdo...
The generated method asks the current StateManager to approve the change or validates the caller's authority to set the state.
[ "The", "generated", "method", "asks", "the", "current", "StateManager", "to", "approve", "the", "change", "or", "validates", "the", "caller", "s", "authority", "to", "set", "the", "state", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/spi/PersistenceCapableImpl.java#L142-L153
train
tzaeschke/zoodb
src/org/zoodb/jdo/spi/PersistenceCapableImpl.java
PersistenceCapableImpl.jdoCopyKeyFieldsFromObjectId
@Override public void jdoCopyKeyFieldsFromObjectId (ObjectIdFieldConsumer fc, Object oid) { fc.storeIntField (2, ((IntIdentity)oid).getKey()); }
java
@Override public void jdoCopyKeyFieldsFromObjectId (ObjectIdFieldConsumer fc, Object oid) { fc.storeIntField (2, ((IntIdentity)oid).getKey()); }
[ "@", "Override", "public", "void", "jdoCopyKeyFieldsFromObjectId", "(", "ObjectIdFieldConsumer", "fc", ",", "Object", "oid", ")", "{", "fc", ".", "storeIntField", "(", "2", ",", "(", "(", "IntIdentity", ")", "oid", ")", ".", "getKey", "(", ")", ")", ";", ...
The generated methods copy key fields from the object id instance to the PersistenceCapable instance or to the ObjectIdFieldConsumer.
[ "The", "generated", "methods", "copy", "key", "fields", "from", "the", "object", "id", "instance", "to", "the", "PersistenceCapable", "instance", "or", "to", "the", "ObjectIdFieldConsumer", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/spi/PersistenceCapableImpl.java#L514-L517
train
tzaeschke/zoodb
src/org/zoodb/internal/server/SessionManager.java
SessionManager.writeMainPage
private void writeMainPage(int userPage, int oidPage, int schemaPage, int indexPage, int freeSpaceIndexPage, int pageCount, StorageChannelOutput out, long lastUsedOid, long txId) { rootPageID = (rootPageID + 1) % 2; out.seekPageForWrite(PAGE_TYPE.ROOT_PAGE, rootPages[rootPageID]); //********** ...
java
private void writeMainPage(int userPage, int oidPage, int schemaPage, int indexPage, int freeSpaceIndexPage, int pageCount, StorageChannelOutput out, long lastUsedOid, long txId) { rootPageID = (rootPageID + 1) % 2; out.seekPageForWrite(PAGE_TYPE.ROOT_PAGE, rootPages[rootPageID]); //********** ...
[ "private", "void", "writeMainPage", "(", "int", "userPage", ",", "int", "oidPage", ",", "int", "schemaPage", ",", "int", "indexPage", ",", "int", "freeSpaceIndexPage", ",", "int", "pageCount", ",", "StorageChannelOutput", "out", ",", "long", "lastUsedOid", ",", ...
Writes the main page. @param pageCount
[ "Writes", "the", "main", "page", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/SessionManager.java#L165-L195
train
tzaeschke/zoodb
src/org/zoodb/jdo/impl/PersistenceManagerImpl.java
PersistenceManagerImpl.refresh
@Override public void refresh(Object pc) { DBTracer.logCall(this, pc); checkOpen(); nativeConnection.refreshObject(pc); }
java
@Override public void refresh(Object pc) { DBTracer.logCall(this, pc); checkOpen(); nativeConnection.refreshObject(pc); }
[ "@", "Override", "public", "void", "refresh", "(", "Object", "pc", ")", "{", "DBTracer", ".", "logCall", "(", "this", ",", "pc", ")", ";", "checkOpen", "(", ")", ";", "nativeConnection", ".", "refreshObject", "(", "pc", ")", ";", "}" ]
Refreshes and places a ReadLock on the object. @see PersistenceManager#refresh(java.lang.Object)
[ "Refreshes", "and", "places", "a", "ReadLock", "on", "the", "object", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/impl/PersistenceManagerImpl.java#L247-L252
train
tzaeschke/zoodb
src/org/zoodb/jdo/impl/PersistenceManagerImpl.java
PersistenceManagerImpl.refreshAll
@Override public void refreshAll(Object ... pcs) { DBTracer.logCall(this, pcs); checkOpen(); for (Object o: pcs) { nativeConnection.refreshObject(o); } }
java
@Override public void refreshAll(Object ... pcs) { DBTracer.logCall(this, pcs); checkOpen(); for (Object o: pcs) { nativeConnection.refreshObject(o); } }
[ "@", "Override", "public", "void", "refreshAll", "(", "Object", "...", "pcs", ")", "{", "DBTracer", ".", "logCall", "(", "this", ",", "pcs", ")", ";", "checkOpen", "(", ")", ";", "for", "(", "Object", "o", ":", "pcs", ")", "{", "nativeConnection", "....
Refreshes and places a ReadLock on the objects. @see PersistenceManager#refreshAll(Object...)
[ "Refreshes", "and", "places", "a", "ReadLock", "on", "the", "objects", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/impl/PersistenceManagerImpl.java#L258-L265
train
tzaeschke/zoodb
src/org/zoodb/tools/ZooCheckDb.java
ZooCheckDb.main
public static void main(String[] args) { String dbName; if (args.length == 0) { dbName = DB_NAME; } else { dbName = args[0]; } if (!ZooHelper.getDataStoreManager().dbExists(dbName)) { err.println("ERROR Database not found: " + dbName); return; } out.println("Checking database: " + dbName...
java
public static void main(String[] args) { String dbName; if (args.length == 0) { dbName = DB_NAME; } else { dbName = args[0]; } if (!ZooHelper.getDataStoreManager().dbExists(dbName)) { err.println("ERROR Database not found: " + dbName); return; } out.println("Checking database: " + dbName...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "String", "dbName", ";", "if", "(", "args", ".", "length", "==", "0", ")", "{", "dbName", "=", "DB_NAME", ";", "}", "else", "{", "dbName", "=", "args", "[", "0", "]", ...
private static final String DB_NAME = "StackServerFault";
[ "private", "static", "final", "String", "DB_NAME", "=", "StackServerFault", ";" ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/tools/ZooCheckDb.java#L40-L70
train
tzaeschke/zoodb
src/org/zoodb/internal/DataDeSerializer.java
DataDeSerializer.readObject
public ZooPC readObject(int page, int offs, boolean skipIfCached) { long clsOid = in.startReading(page, offs); long ts = in.getHeaderTimestamp(); //Read first object: long oid = in.readLong(); //check cache ZooPC pc = cache.findCoByOID(oid); if (skipIfCached && ...
java
public ZooPC readObject(int page, int offs, boolean skipIfCached) { long clsOid = in.startReading(page, offs); long ts = in.getHeaderTimestamp(); //Read first object: long oid = in.readLong(); //check cache ZooPC pc = cache.findCoByOID(oid); if (skipIfCached && ...
[ "public", "ZooPC", "readObject", "(", "int", "page", ",", "int", "offs", ",", "boolean", "skipIfCached", ")", "{", "long", "clsOid", "=", "in", ".", "startReading", "(", "page", ",", "offs", ")", ";", "long", "ts", "=", "in", ".", "getHeaderTimestamp", ...
This method returns an object that is read from the input stream. @param page page id @param offs offset in page @param skipIfCached Set 'true' to skip objects that are already in the cache @return The read object.
[ "This", "method", "returns", "an", "object", "that", "is", "read", "from", "the", "input", "stream", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/DataDeSerializer.java#L152-L194
train
tzaeschke/zoodb
src/org/zoodb/internal/query/QueryMergingIterator.java
QueryMergingIterator.addColl
public void addColl(Collection<E> collection) { if (current == null) { current = collection.iterator(); } else { collections.add(collection); } }
java
public void addColl(Collection<E> collection) { if (current == null) { current = collection.iterator(); } else { collections.add(collection); } }
[ "public", "void", "addColl", "(", "Collection", "<", "E", ">", "collection", ")", "{", "if", "(", "current", "==", "null", ")", "{", "current", "=", "collection", ".", "iterator", "(", ")", ";", "}", "else", "{", "collections", ".", "add", "(", "coll...
Adds a collection to the merged iterator. The iterator of the collection is only requested after other iterators are exhausted. This can help avoiding concurrent modification exceptions. @param collection The collection that should be added to the iterator.
[ "Adds", "a", "collection", "to", "the", "merged", "iterator", ".", "The", "iterator", "of", "the", "collection", "is", "only", "requested", "after", "other", "iterators", "are", "exhausted", ".", "This", "can", "help", "avoiding", "concurrent", "modification", ...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/query/QueryMergingIterator.java#L99-L105
train
tzaeschke/zoodb
src/org/zoodb/internal/OidBuffer.java
OidBuffer.ensureValidity
public void ensureValidity(long oid) { if (oids == null) { return; } if (oid >= oids[oids.length-1]) { nextValidOidPos = -1; return; } while (oid >= oids[nextValidOidPos]) { nextValidOidPos++; } }
java
public void ensureValidity(long oid) { if (oids == null) { return; } if (oid >= oids[oids.length-1]) { nextValidOidPos = -1; return; } while (oid >= oids[nextValidOidPos]) { nextValidOidPos++; } }
[ "public", "void", "ensureValidity", "(", "long", "oid", ")", "{", "if", "(", "oids", "==", "null", ")", "{", "return", ";", "}", "if", "(", "oid", ">=", "oids", "[", "oids", ".", "length", "-", "1", "]", ")", "{", "nextValidOidPos", "=", "-", "1"...
This needs to be called when users provide their own OIDs. The OID buffer needs to ensure that it will never return an OID that has been previously used by a user. @param oid OID to check
[ "This", "needs", "to", "be", "called", "when", "users", "provide", "their", "own", "OIDs", ".", "The", "OID", "buffer", "needs", "to", "ensure", "that", "it", "will", "never", "return", "an", "OID", "that", "has", "been", "previously", "used", "by", "a",...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/OidBuffer.java#L75-L86
train
tzaeschke/zoodb
src/org/zoodb/internal/ObjectGraphTraverser.java
ObjectGraphTraverser.traverse
public final void traverse() { //We have to check for && because 'traversalRequired' is not triggered by new objects, //but new objects may have new objects referenced that are not marked as persistent. //See issue #57. if (!traversalRequired && !cache.hasDirtyPojos()) { //shortcut retur...
java
public final void traverse() { //We have to check for && because 'traversalRequired' is not triggered by new objects, //but new objects may have new objects referenced that are not marked as persistent. //See issue #57. if (!traversalRequired && !cache.hasDirtyPojos()) { //shortcut retur...
[ "public", "final", "void", "traverse", "(", ")", "{", "//We have to check for && because 'traversalRequired' is not triggered by new objects,", "//but new objects may have new objects referenced that are not marked as persistent.", "//See issue #57.", "if", "(", "!", "traversalRequired", ...
This class is only public so it can be accessed by the test harness. Please do not use.
[ "This", "class", "is", "only", "public", "so", "it", "can", "be", "accessed", "by", "the", "test", "harness", ".", "Please", "do", "not", "use", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ObjectGraphTraverser.java#L167-L200
train
tzaeschke/zoodb
src/org/zoodb/internal/ObjectGraphTraverser.java
ObjectGraphTraverser.traverse
public final void traverse(ZooPC pc) { try { traverseObject(pc); traverseWorkList(); } finally { workList.clear(); toBecomePersistent.clear(); //We have to clear the seenObjects here, see also issue #58. seenObjects.clear(); } }
java
public final void traverse(ZooPC pc) { try { traverseObject(pc); traverseWorkList(); } finally { workList.clear(); toBecomePersistent.clear(); //We have to clear the seenObjects here, see also issue #58. seenObjects.clear(); } }
[ "public", "final", "void", "traverse", "(", "ZooPC", "pc", ")", "{", "try", "{", "traverseObject", "(", "pc", ")", ";", "traverseWorkList", "(", ")", ";", "}", "finally", "{", "workList", ".", "clear", "(", ")", ";", "toBecomePersistent", ".", "clear", ...
This can be used to enforce traversal of an object even if it is PERSITENT_CLEAN. This can be necessary for objects that transition from DETACHED_CLEAN to PERSITENT_CLEAN and whose children need to make this transition transitively. @param pc Object to check.
[ "This", "can", "be", "used", "to", "enforce", "traversal", "of", "an", "object", "even", "if", "it", "is", "PERSITENT_CLEAN", ".", "This", "can", "be", "necessary", "for", "objects", "that", "transition", "from", "DETACHED_CLEAN", "to", "PERSITENT_CLEAN", "and...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ObjectGraphTraverser.java#L208-L218
train
tzaeschke/zoodb
src/org/zoodb/internal/ObjectGraphTraverser.java
ObjectGraphTraverser.doPersistentContainer
@SuppressWarnings("rawtypes") private final void doPersistentContainer(Object container) { if (container instanceof DBArrayList) { doCollection((DBArrayList)container); } else if (container instanceof DBLargeVector) { // doEnumeration(((DBLargeVector)container).elements(), contai...
java
@SuppressWarnings("rawtypes") private final void doPersistentContainer(Object container) { if (container instanceof DBArrayList) { doCollection((DBArrayList)container); } else if (container instanceof DBLargeVector) { // doEnumeration(((DBLargeVector)container).elements(), contai...
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "final", "void", "doPersistentContainer", "(", "Object", "container", ")", "{", "if", "(", "container", "instanceof", "DBArrayList", ")", "{", "doCollection", "(", "(", "DBArrayList", ")", "container", ...
Handles persistent Collection classes.
[ "Handles", "persistent", "Collection", "classes", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ObjectGraphTraverser.java#L366-L382
train
tzaeschke/zoodb
src/org/zoodb/internal/ObjectGraphTraverser.java
ObjectGraphTraverser.getFields
private final Field[] getFields (Class<? extends Object> cls) { Field[] ret = SEEN_CLASSES.get(cls); if (ret != null) { return ret; } List<Field> retL = new ArrayList<Field>(); for (Field f: cls.getDeclaredFields ()) { if (!isSimpleType(f)) { retL.add...
java
private final Field[] getFields (Class<? extends Object> cls) { Field[] ret = SEEN_CLASSES.get(cls); if (ret != null) { return ret; } List<Field> retL = new ArrayList<Field>(); for (Field f: cls.getDeclaredFields ()) { if (!isSimpleType(f)) { retL.add...
[ "private", "final", "Field", "[", "]", "getFields", "(", "Class", "<", "?", "extends", "Object", ">", "cls", ")", "{", "Field", "[", "]", "ret", "=", "SEEN_CLASSES", ".", "get", "(", "cls", ")", ";", "if", "(", "ret", "!=", "null", ")", "{", "ret...
Returns a List containing all of the Field objects for the given class. The fields include all public and private fields from the given class and its super classes. @param c Class object @return Returns list of interesting fields
[ "Returns", "a", "List", "containing", "all", "of", "the", "Field", "objects", "for", "the", "given", "class", ".", "The", "fields", "include", "all", "public", "and", "private", "fields", "from", "the", "given", "class", "and", "its", "super", "classes", "...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ObjectGraphTraverser.java#L411-L435
train
tzaeschke/zoodb
src/org/zoodb/internal/ZooFieldDef.java
ZooFieldDef.create
public static ZooFieldDef create(ZooClassDef declaringType, String fieldName, ZooClassDef fieldType, int arrayDim) { String typeName = fieldType.getClassName(); JdoType jdoType; if (arrayDim > 0) { jdoType = JdoType.ARRAY; } else { jdoType = JdoType.REFERENCE; } long fieldOid = decla...
java
public static ZooFieldDef create(ZooClassDef declaringType, String fieldName, ZooClassDef fieldType, int arrayDim) { String typeName = fieldType.getClassName(); JdoType jdoType; if (arrayDim > 0) { jdoType = JdoType.ARRAY; } else { jdoType = JdoType.REFERENCE; } long fieldOid = decla...
[ "public", "static", "ZooFieldDef", "create", "(", "ZooClassDef", "declaringType", ",", "String", "fieldName", ",", "ZooClassDef", "fieldType", ",", "int", "arrayDim", ")", "{", "String", "typeName", "=", "fieldType", ".", "getClassName", "(", ")", ";", "JdoType"...
Creates references and reference arrays to persistent classes. @param declaringType the type that contains the field @param fieldName the name of the field @param fieldType The ZooClassDef of the target class of a reference. @param arrayDim the dimensionality of the array (if the field is an array) @return ZooFieldDef
[ "Creates", "references", "and", "reference", "arrays", "to", "persistent", "classes", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ZooFieldDef.java#L267-L280
train
tzaeschke/zoodb
examples/org/zoodb/jdo/ex3/Example3Main.java
Example3Main.queryForCoursesByTeacher
@SuppressWarnings("unchecked") private void queryForCoursesByTeacher(String name) { System.out.println(">> Query for courses by teacher " + name + " returned:"); //using reference in query Query q = pm.newQuery(Course.class, "teacher.name == '" + name + "'"); Collection<Course> courses = (Collection<Course>)q....
java
@SuppressWarnings("unchecked") private void queryForCoursesByTeacher(String name) { System.out.println(">> Query for courses by teacher " + name + " returned:"); //using reference in query Query q = pm.newQuery(Course.class, "teacher.name == '" + name + "'"); Collection<Course> courses = (Collection<Course>)q....
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "queryForCoursesByTeacher", "(", "String", "name", ")", "{", "System", ".", "out", ".", "println", "(", "\">> Query for courses by teacher \"", "+", "name", "+", "\" returned:\"", ")", ";", "//...
Example for a path query on Course.teacher.name == myName. @param name
[ "Example", "for", "a", "path", "query", "on", "Course", ".", "teacher", ".", "name", "==", "myName", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/examples/org/zoodb/jdo/ex3/Example3Main.java#L142-L151
train
tzaeschke/zoodb
examples/org/zoodb/jdo/ex2/Example2Main.java
Example2Main.queryForCoursesWithXStudents
@SuppressWarnings("unchecked") private void queryForCoursesWithXStudents(int studentCount) { System.out.println(">> Query for courses with " + studentCount + " students:"); //using Java method in query Query q = pm.newQuery(Course.class, "students.size() == " + studentCount + ""); Collection<Course> courses = ...
java
@SuppressWarnings("unchecked") private void queryForCoursesWithXStudents(int studentCount) { System.out.println(">> Query for courses with " + studentCount + " students:"); //using Java method in query Query q = pm.newQuery(Course.class, "students.size() == " + studentCount + ""); Collection<Course> courses = ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "queryForCoursesWithXStudents", "(", "int", "studentCount", ")", "{", "System", ".", "out", ".", "println", "(", "\">> Query for courses with \"", "+", "studentCount", "+", "\" students:\"", ")", ...
This example demonstrates how many Java methods of Java SE classes can be used in queries. Not that not all methods can be used.
[ "This", "example", "demonstrates", "how", "many", "Java", "methods", "of", "Java", "SE", "classes", "can", "be", "used", "in", "queries", ".", "Not", "that", "not", "all", "methods", "can", "be", "used", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/examples/org/zoodb/jdo/ex2/Example2Main.java#L176-L185
train
tzaeschke/zoodb
examples/org/zoodb/jdo/ex2/Example2Main.java
Example2Main.queryForCoursesWithTeachersWithFirstAndLastName
@SuppressWarnings("unchecked") private void queryForCoursesWithTeachersWithFirstAndLastName() { System.out.println(">> Query for courses whose teacher have a frist and last name:"); //using Java method in query Query q = pm.newQuery(Course.class, "teacher.name.indexOf(' ') >= 1"); Collection<Course> courses = ...
java
@SuppressWarnings("unchecked") private void queryForCoursesWithTeachersWithFirstAndLastName() { System.out.println(">> Query for courses whose teacher have a frist and last name:"); //using Java method in query Query q = pm.newQuery(Course.class, "teacher.name.indexOf(' ') >= 1"); Collection<Course> courses = ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "queryForCoursesWithTeachersWithFirstAndLastName", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\">> Query for courses whose teacher have a frist and last name:\"", ")", ";", "//using Java me...
This example combines a path query with a Java method call on the String class.
[ "This", "example", "combines", "a", "path", "query", "with", "a", "Java", "method", "call", "on", "the", "String", "class", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/examples/org/zoodb/jdo/ex2/Example2Main.java#L191-L201
train
tzaeschke/zoodb
src/org/zoodb/internal/server/DiskAccessOneFile.java
DiskAccessOneFile.readObject
@Override public ZooPC readObject(DataDeSerializer dds, long oid) { FilePos oie = oidIndex.findOid(oid); if (oie == null) { throw DBLogger.newObjectNotFoundException("OID not found: " + Util.oidToString(oid)); } return dds.readObject(oie.getPage(), oie.getOffs(), false); }
java
@Override public ZooPC readObject(DataDeSerializer dds, long oid) { FilePos oie = oidIndex.findOid(oid); if (oie == null) { throw DBLogger.newObjectNotFoundException("OID not found: " + Util.oidToString(oid)); } return dds.readObject(oie.getPage(), oie.getOffs(), false); }
[ "@", "Override", "public", "ZooPC", "readObject", "(", "DataDeSerializer", "dds", ",", "long", "oid", ")", "{", "FilePos", "oie", "=", "oidIndex", ".", "findOid", "(", "oid", ")", ";", "if", "(", "oie", "==", "null", ")", "{", "throw", "DBLogger", ".",...
Locate an object. This version allows providing a data de-serializer. This will be handy later if we want to implement some concurrency, which requires using multiple of the stateful DeSerializers. @param dds DataDeSerializer @param oid Object ID @return Path name of the object (later: position of obj)
[ "Locate", "an", "object", ".", "This", "version", "allows", "providing", "a", "data", "de", "-", "serializer", ".", "This", "will", "be", "handy", "later", "if", "we", "want", "to", "implement", "some", "concurrency", "which", "requires", "using", "multiple"...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/DiskAccessOneFile.java#L391-L399
train
tzaeschke/zoodb
src/org/zoodb/internal/server/DiskAccessOneFile.java
DiskAccessOneFile.defineIndex
@Override public void defineIndex(ZooClassDef def, ZooFieldDef field, boolean isUnique) { SchemaIndexEntry se = schemaIndex.getSchema(def); LongLongIndex fieldInd = se.defineIndex(field, isUnique); //fill index with existing objects PagedPosIndex ind = se.getObjectIndexLatestSchemaVersion(); PagedPosIndex...
java
@Override public void defineIndex(ZooClassDef def, ZooFieldDef field, boolean isUnique) { SchemaIndexEntry se = schemaIndex.getSchema(def); LongLongIndex fieldInd = se.defineIndex(field, isUnique); //fill index with existing objects PagedPosIndex ind = se.getObjectIndexLatestSchemaVersion(); PagedPosIndex...
[ "@", "Override", "public", "void", "defineIndex", "(", "ZooClassDef", "def", ",", "ZooFieldDef", "field", ",", "boolean", "isUnique", ")", "{", "SchemaIndexEntry", "se", "=", "schemaIndex", ".", "getSchema", "(", "def", ")", ";", "LongLongIndex", "fieldInd", "...
Defines an index and populates it. All objects are put into the cache. This is not necessarily useful, but it is a one-off operation. Otherwise we would need a special purpose implementation of the deserializer, which would have the need for a cache removed.
[ "Defines", "an", "index", "and", "populates", "it", ".", "All", "objects", "are", "put", "into", "the", "cache", ".", "This", "is", "not", "necessarily", "useful", "but", "it", "is", "a", "one", "-", "off", "operation", ".", "Otherwise", "we", "would", ...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/DiskAccessOneFile.java#L609-L647
train
tzaeschke/zoodb
src/org/zoodb/internal/server/DiskAccessOneFile.java
DiskAccessOneFile.getObjectClass
@Override public long getObjectClass(long oid) { FilePos oie = oidIndex.findOid(oid); if (oie == null) { throw DBLogger.newObjectNotFoundException("OID not found: " + Util.oidToString(oid)); } try { fileInAP.seekPage(PAGE_TYPE.DATA, oie.getPage(), oie.getOffs()); return DataDeSerializerNoClass.getC...
java
@Override public long getObjectClass(long oid) { FilePos oie = oidIndex.findOid(oid); if (oie == null) { throw DBLogger.newObjectNotFoundException("OID not found: " + Util.oidToString(oid)); } try { fileInAP.seekPage(PAGE_TYPE.DATA, oie.getPage(), oie.getOffs()); return DataDeSerializerNoClass.getC...
[ "@", "Override", "public", "long", "getObjectClass", "(", "long", "oid", ")", "{", "FilePos", "oie", "=", "oidIndex", ".", "findOid", "(", "oid", ")", ";", "if", "(", "oie", "==", "null", ")", "{", "throw", "DBLogger", ".", "newObjectNotFoundException", ...
Get the class of a given object.
[ "Get", "the", "class", "of", "a", "given", "object", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/DiskAccessOneFile.java#L658-L672
train
tzaeschke/zoodb
src/org/zoodb/internal/util/DBLogger.java
DBLogger.newFatalDataStore
public static RuntimeException newFatalDataStore(String msg, Throwable t) { return newEx(FATAL_DATA_STORE_EXCEPTION, msg, t); }
java
public static RuntimeException newFatalDataStore(String msg, Throwable t) { return newEx(FATAL_DATA_STORE_EXCEPTION, msg, t); }
[ "public", "static", "RuntimeException", "newFatalDataStore", "(", "String", "msg", ",", "Throwable", "t", ")", "{", "return", "newEx", "(", "FATAL_DATA_STORE_EXCEPTION", ",", "msg", ",", "t", ")", ";", "}" ]
THese always result in the session being closed! @param msg The error message @param t The Throwable to report @return Fatal data store exception.
[ "THese", "always", "result", "in", "the", "session", "being", "closed!" ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/DBLogger.java#L171-L173
train
tzaeschke/zoodb
src/org/zoodb/internal/server/index/AbstractPagedIndex.java
AbstractPagedIndex.preallocatePagesForWriteMap
final void preallocatePagesForWriteMap(Map<AbstractIndexPage, Integer> map, FreeSpaceManager fsm) { getRoot().createWriteMap(map, fsm); }
java
final void preallocatePagesForWriteMap(Map<AbstractIndexPage, Integer> map, FreeSpaceManager fsm) { getRoot().createWriteMap(map, fsm); }
[ "final", "void", "preallocatePagesForWriteMap", "(", "Map", "<", "AbstractIndexPage", ",", "Integer", ">", "map", ",", "FreeSpaceManager", "fsm", ")", "{", "getRoot", "(", ")", ".", "createWriteMap", "(", "map", ",", "fsm", ")", ";", "}" ]
Method to preallocate pages for a write command. @param map
[ "Method", "to", "preallocate", "pages", "for", "a", "write", "command", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/AbstractPagedIndex.java#L144-L147
train
tzaeschke/zoodb
src/org/zoodb/internal/server/index/AbstractPagedIndex.java
AbstractPagedIndex.writeToPreallocated
final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) { return getRoot().writeToPreallocated(out, map); }
java
final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) { return getRoot().writeToPreallocated(out, map); }
[ "final", "int", "writeToPreallocated", "(", "StorageChannelOutput", "out", ",", "Map", "<", "AbstractIndexPage", ",", "Integer", ">", "map", ")", "{", "return", "getRoot", "(", ")", ".", "writeToPreallocated", "(", "out", ",", "map", ")", ";", "}" ]
Special write method that uses only pre-allocated pages. @param map @return the root page Id.
[ "Special", "write", "method", "that", "uses", "only", "pre", "-", "allocated", "pages", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/AbstractPagedIndex.java#L154-L156
train
tzaeschke/zoodb
src/org/zoodb/internal/GenericObject.java
GenericObject.newEmptyInstance
static GenericObject newEmptyInstance(ZooClassDef def, AbstractCache cache) { long oid = def.getProvidedContext().getNode().getOidBuffer().allocateOid(); return newEmptyInstance(oid, def, cache); }
java
static GenericObject newEmptyInstance(ZooClassDef def, AbstractCache cache) { long oid = def.getProvidedContext().getNode().getOidBuffer().allocateOid(); return newEmptyInstance(oid, def, cache); }
[ "static", "GenericObject", "newEmptyInstance", "(", "ZooClassDef", "def", ",", "AbstractCache", "cache", ")", "{", "long", "oid", "=", "def", ".", "getProvidedContext", "(", ")", ".", "getNode", "(", ")", ".", "getOidBuffer", "(", ")", ".", "allocateOid", "(...
Creates new instances. @param def @return A new empty generic object.
[ "Creates", "new", "instances", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/GenericObject.java#L135-L138
train
tzaeschke/zoodb
src/org/zoodb/internal/GenericObject.java
GenericObject.evolve
public void evolve(SchemaOperation op) { //TODO this is horrible!!! ArrayList<Object> fV = new ArrayList<Object>(Arrays.asList(fixedValues)); ArrayList<Object> vV = new ArrayList<Object>(Arrays.asList(variableValues)); //TODO resize only once to correct size if (op instanceof SchemaOperation.SchemaFieldDef...
java
public void evolve(SchemaOperation op) { //TODO this is horrible!!! ArrayList<Object> fV = new ArrayList<Object>(Arrays.asList(fixedValues)); ArrayList<Object> vV = new ArrayList<Object>(Arrays.asList(variableValues)); //TODO resize only once to correct size if (op instanceof SchemaOperation.SchemaFieldDef...
[ "public", "void", "evolve", "(", "SchemaOperation", "op", ")", "{", "//TODO this is horrible!!!", "ArrayList", "<", "Object", ">", "fV", "=", "new", "ArrayList", "<", "Object", ">", "(", "Arrays", ".", "asList", "(", "fixedValues", ")", ")", ";", "ArrayList"...
Schema evolution of in-memory objects, operation by operation. @param op Schema operation object
[ "Schema", "evolution", "of", "in", "-", "memory", "objects", "operation", "by", "operation", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/GenericObject.java#L315-L335
train
tzaeschke/zoodb
src/org/zoodb/internal/GenericObject.java
GenericObject.setDbCollection
public void setDbCollection(Object collection) { if (collection != null) { dbCollectionData = collection; isDbCollection = true; } else { dbCollectionData = null; isDbCollection = false; } }
java
public void setDbCollection(Object collection) { if (collection != null) { dbCollectionData = collection; isDbCollection = true; } else { dbCollectionData = null; isDbCollection = false; } }
[ "public", "void", "setDbCollection", "(", "Object", "collection", ")", "{", "if", "(", "collection", "!=", "null", ")", "{", "dbCollectionData", "=", "collection", ";", "isDbCollection", "=", "true", ";", "}", "else", "{", "dbCollectionData", "=", "null", ";...
This is used to represent DBCollection objects as GenericObjects. @param collection collection object
[ "This", "is", "used", "to", "represent", "DBCollection", "objects", "as", "GenericObjects", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/GenericObject.java#L390-L399
train
tzaeschke/zoodb
src/org/zoodb/internal/GenericObject.java
GenericObject.verifyPcNotDirty
void verifyPcNotDirty() { if (handle == null || handle.internalGetPCI() == null || !handle.internalGetPCI().jdoZooIsDirty()) { ZooPC pc = jdoZooGetContext().getSession().internalGetCache().findCoByOID( jdoZooGetOid()); if (pc == null || !pc.jdoZooIsDirty()) { return; } } throw DBLogger.newU...
java
void verifyPcNotDirty() { if (handle == null || handle.internalGetPCI() == null || !handle.internalGetPCI().jdoZooIsDirty()) { ZooPC pc = jdoZooGetContext().getSession().internalGetCache().findCoByOID( jdoZooGetOid()); if (pc == null || !pc.jdoZooIsDirty()) { return; } } throw DBLogger.newU...
[ "void", "verifyPcNotDirty", "(", ")", "{", "if", "(", "handle", "==", "null", "||", "handle", ".", "internalGetPCI", "(", ")", "==", "null", "||", "!", "handle", ".", "internalGetPCI", "(", ")", ".", "jdoZooIsDirty", "(", ")", ")", "{", "ZooPC", "pc", ...
This method verifies that this GO has no PCI representation or that the PCI representation is not dirty or new. Otherwise it will throw an exception in order to prevent the dirty state of the GO and the PC to result in conflicting updates in the database.
[ "This", "method", "verifies", "that", "this", "GO", "has", "no", "PCI", "representation", "or", "that", "the", "PCI", "representation", "is", "not", "dirty", "or", "new", ".", "Otherwise", "it", "will", "throw", "an", "exception", "in", "order", "to", "pre...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/GenericObject.java#L438-L450
train
tzaeschke/zoodb
src/org/zoodb/internal/util/BucketStack.java
BucketStack.pop
public E pop() { modCount++; if (size == 0) { throw new NoSuchElementException(); } size--; if (cntInBucket == 1) { cntInBucket = bucketSize; return buckets.removeLast()[0]; } return buckets.getLast()[--cntInBucket]; }
java
public E pop() { modCount++; if (size == 0) { throw new NoSuchElementException(); } size--; if (cntInBucket == 1) { cntInBucket = bucketSize; return buckets.removeLast()[0]; } return buckets.getLast()[--cntInBucket]; }
[ "public", "E", "pop", "(", ")", "{", "modCount", "++", ";", "if", "(", "size", "==", "0", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "size", "--", ";", "if", "(", "cntInBucket", "==", "1", ")", "{", "cntInBucket", "=", ...
Removes the element at the specified position in this list. Only the last element in the list can be removed. @return the element that was removed from the list @throws NoSuchElementException if no elements remain
[ "Removes", "the", "element", "at", "the", "specified", "position", "in", "this", "list", ".", "Only", "the", "last", "element", "in", "the", "list", "can", "be", "removed", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/BucketStack.java#L130-L144
train
tzaeschke/zoodb
src/org/zoodb/internal/util/CritBit64.java
CritBit64.compare
private static int compare(long v1, long v2) { int pos = 0; if (v1 != v2) { long x = v1 ^ v2; pos += Long.numberOfLeadingZeros(x); return pos; } return -1; }
java
private static int compare(long v1, long v2) { int pos = 0; if (v1 != v2) { long x = v1 ^ v2; pos += Long.numberOfLeadingZeros(x); return pos; } return -1; }
[ "private", "static", "int", "compare", "(", "long", "v1", ",", "long", "v2", ")", "{", "int", "pos", "=", "0", ";", "if", "(", "v1", "!=", "v2", ")", "{", "long", "x", "=", "v1", "^", "v2", ";", "pos", "+=", "Long", ".", "numberOfLeadingZeros", ...
Compares two values. @param v1 @param v2 @return Position of the differing bit, or -1 if both values are equal
[ "Compares", "two", "values", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/CritBit64.java#L313-L321
train
tzaeschke/zoodb
src/org/zoodb/internal/util/CritBit64.java
CritBit64.contains
public boolean contains(long key) { if (size == 0) { return false; } if (size == 1) { int posDiff = compare(key, rootKey); if (posDiff == -1) { return true; } return false; } Node<V> n = root; while (true) { if (!doesInfixMatch(n, key)) { return false; } //infix match...
java
public boolean contains(long key) { if (size == 0) { return false; } if (size == 1) { int posDiff = compare(key, rootKey); if (posDiff == -1) { return true; } return false; } Node<V> n = root; while (true) { if (!doesInfixMatch(n, key)) { return false; } //infix match...
[ "public", "boolean", "contains", "(", "long", "key", ")", "{", "if", "(", "size", "==", "0", ")", "{", "return", "false", ";", "}", "if", "(", "size", "==", "1", ")", "{", "int", "posDiff", "=", "compare", "(", "key", ",", "rootKey", ")", ";", ...
Check whether a given key exists in the tree. @param key The key @return {@code true} if the key exists otherwise {@code false}
[ "Check", "whether", "a", "given", "key", "exists", "in", "the", "tree", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/CritBit64.java#L336-L369
train
tzaeschke/zoodb
src/org/zoodb/internal/util/CritBit64.java
CritBit64.get
public V get(long key) { if (size == 0) { return null; } if (size == 1) { int posDiff = compare(key, rootKey); if (posDiff == -1) { return rootVal; } return null; } Node<V> n = root; while (true) { if (!doesInfixMatch(n, key)) { return null; } //infix matches, so now w...
java
public V get(long key) { if (size == 0) { return null; } if (size == 1) { int posDiff = compare(key, rootKey); if (posDiff == -1) { return rootVal; } return null; } Node<V> n = root; while (true) { if (!doesInfixMatch(n, key)) { return null; } //infix matches, so now w...
[ "public", "V", "get", "(", "long", "key", ")", "{", "if", "(", "size", "==", "0", ")", "{", "return", "null", ";", "}", "if", "(", "size", "==", "1", ")", "{", "int", "posDiff", "=", "compare", "(", "key", ",", "rootKey", ")", ";", "if", "(",...
Get the value for a given key. @param key The key @return the values associated with {@code key} or {@code null} if the key does not exist.
[ "Get", "the", "value", "for", "a", "given", "key", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/CritBit64.java#L376-L413
train
tzaeschke/zoodb
src/org/zoodb/internal/util/CritBit64.java
CritBit64.remove
public V remove(long key) { if (size == 0) { return null; } if (size == 1) { int posDiff = compare(key, rootKey); if (posDiff == -1) { size--; rootKey = 0; V prev = rootVal; rootVal = null; return prev; } return null; } Node<V> n = root; Node<V> parent = null; boolean is...
java
public V remove(long key) { if (size == 0) { return null; } if (size == 1) { int posDiff = compare(key, rootKey); if (posDiff == -1) { size--; rootKey = 0; V prev = rootVal; rootVal = null; return prev; } return null; } Node<V> n = root; Node<V> parent = null; boolean is...
[ "public", "V", "remove", "(", "long", "key", ")", "{", "if", "(", "size", "==", "0", ")", "{", "return", "null", ";", "}", "if", "(", "size", "==", "1", ")", "{", "int", "posDiff", "=", "compare", "(", "key", ",", "rootKey", ")", ";", "if", "...
Remove a key and its value @param key The key @return The value of the key of {@code null} if the value was not found.
[ "Remove", "a", "key", "and", "its", "value" ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/CritBit64.java#L420-L489
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoHelper.java
ZooJdoHelper.openDB
public static PersistenceManager openDB(String dbName) { DBTracer.logCall(ZooJdoHelper.class, dbName); ZooJdoProperties props = new ZooJdoProperties(dbName); PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(props); PersistenceManager pm = pmf.getPersistenceManager();...
java
public static PersistenceManager openDB(String dbName) { DBTracer.logCall(ZooJdoHelper.class, dbName); ZooJdoProperties props = new ZooJdoProperties(dbName); PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(props); PersistenceManager pm = pmf.getPersistenceManager();...
[ "public", "static", "PersistenceManager", "openDB", "(", "String", "dbName", ")", "{", "DBTracer", ".", "logCall", "(", "ZooJdoHelper", ".", "class", ",", "dbName", ")", ";", "ZooJdoProperties", "props", "=", "new", "ZooJdoProperties", "(", "dbName", ")", ";",...
Open a database. This is short for: <br> <code> ZooJdoProperties props = new ZooJdoProperties(dbName); <br> PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(props); <br> PersistenceManager pm = pmf.getPersistenceManager(); <br> </code> @param dbName Name of the database to connect to. @return...
[ "Open", "a", "database", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoHelper.java#L50-L56
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoHelper.java
ZooJdoHelper.openOrCreateDB
public static PersistenceManager openOrCreateDB(String dbName) { DBTracer.logCall(ZooJdoHelper.class, dbName); if (!dbExists(dbName)) { createDb(dbName); } return openDB(dbName); }
java
public static PersistenceManager openOrCreateDB(String dbName) { DBTracer.logCall(ZooJdoHelper.class, dbName); if (!dbExists(dbName)) { createDb(dbName); } return openDB(dbName); }
[ "public", "static", "PersistenceManager", "openOrCreateDB", "(", "String", "dbName", ")", "{", "DBTracer", ".", "logCall", "(", "ZooJdoHelper", ".", "class", ",", "dbName", ")", ";", "if", "(", "!", "dbExists", "(", "dbName", ")", ")", "{", "createDb", "("...
Open a database. Create the database file if it doesn't exist. This is short for: <br> <code> ZooJdoProperties props = new ZooJdoProperties(dbName); <br> PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(props); <br> PersistenceManager pm = pmf.getPersistenceManager(); <br> if (!dbExists(dbName...
[ "Open", "a", "database", ".", "Create", "the", "database", "file", "if", "it", "doesn", "t", "exist", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoHelper.java#L76-L82
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoHelper.java
ZooJdoHelper.schema
public static ZooSchema schema(PersistenceManager pm) { DBTracer.logCall(ZooJdoHelper.class, pm); return ((PersistenceManagerImpl)pm).getSession().schema(); }
java
public static ZooSchema schema(PersistenceManager pm) { DBTracer.logCall(ZooJdoHelper.class, pm); return ((PersistenceManagerImpl)pm).getSession().schema(); }
[ "public", "static", "ZooSchema", "schema", "(", "PersistenceManager", "pm", ")", "{", "DBTracer", ".", "logCall", "(", "ZooJdoHelper", ".", "class", ",", "pm", ")", ";", "return", "(", "(", "PersistenceManagerImpl", ")", "pm", ")", ".", "getSession", "(", ...
Get access to ZooDB schema management methods. @param pm The PersistenceManager @return the schema management API
[ "Get", "access", "to", "ZooDB", "schema", "management", "methods", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoHelper.java#L90-L93
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoHelper.java
ZooJdoHelper.createIndex
public static void createIndex(PersistenceManager pm, Class<?> cls, String fieldName, boolean isUnique) { DBTracer.logCall(ZooJdoHelper.class, pm, cls, fieldName, isUnique); ZooSchema s = schema(pm); ZooClass c = s.getClass(cls); if (c == null) { c = s.addClass(cls); } ...
java
public static void createIndex(PersistenceManager pm, Class<?> cls, String fieldName, boolean isUnique) { DBTracer.logCall(ZooJdoHelper.class, pm, cls, fieldName, isUnique); ZooSchema s = schema(pm); ZooClass c = s.getClass(cls); if (c == null) { c = s.addClass(cls); } ...
[ "public", "static", "void", "createIndex", "(", "PersistenceManager", "pm", ",", "Class", "<", "?", ">", "cls", ",", "String", "fieldName", ",", "boolean", "isUnique", ")", "{", "DBTracer", ".", "logCall", "(", "ZooJdoHelper", ".", "class", ",", "pm", ",",...
A convenience method for creating indices. Creates an index on the specified field for the current class and all sub-classes. The method will create a schema for the class if none exists. @param pm The PersistenceManager @param cls The class @param fieldName The field name @param isUnique Whether the index should be on...
[ "A", "convenience", "method", "for", "creating", "indices", ".", "Creates", "an", "index", "on", "the", "specified", "field", "for", "the", "current", "class", "and", "all", "sub", "-", "classes", ".", "The", "method", "will", "create", "a", "schema", "for...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoHelper.java#L104-L113
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoHelper.java
ZooJdoHelper.getStatistics
public static DBStatistics getStatistics(PersistenceManager pm) { DBTracer.logCall(ZooJdoHelper.class, pm); Session s = (Session) pm.getDataStoreConnection().getNativeConnection(); return new DBStatistics(s); }
java
public static DBStatistics getStatistics(PersistenceManager pm) { DBTracer.logCall(ZooJdoHelper.class, pm); Session s = (Session) pm.getDataStoreConnection().getNativeConnection(); return new DBStatistics(s); }
[ "public", "static", "DBStatistics", "getStatistics", "(", "PersistenceManager", "pm", ")", "{", "DBTracer", ".", "logCall", "(", "ZooJdoHelper", ".", "class", ",", "pm", ")", ";", "Session", "s", "=", "(", "Session", ")", "pm", ".", "getDataStoreConnection", ...
Get access to the statistics API of ZooDB. @param pm The PersistenceManager @return the statistics manager
[ "Get", "access", "to", "the", "statistics", "API", "of", "ZooDB", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoHelper.java#L120-L124
train
tzaeschke/zoodb
src/org/zoodb/internal/ZooSchemaImpl.java
ZooSchemaImpl.addClass
@Override public ZooClass addClass(Class<?> cls) { DBTracer.logCall(this, cls); checkValidity(true); return sm.createSchema(null, cls); }
java
@Override public ZooClass addClass(Class<?> cls) { DBTracer.logCall(this, cls); checkValidity(true); return sm.createSchema(null, cls); }
[ "@", "Override", "public", "ZooClass", "addClass", "(", "Class", "<", "?", ">", "cls", ")", "{", "DBTracer", ".", "logCall", "(", "this", ",", "cls", ")", ";", "checkValidity", "(", "true", ")", ";", "return", "sm", ".", "createSchema", "(", "null", ...
Define a new database class schema based on the given Java class. @param cls The Java class for which a schema should be defined @return New schema object @see ZooSchema#addClass(Class)
[ "Define", "a", "new", "database", "class", "schema", "based", "on", "the", "given", "Java", "class", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ZooSchemaImpl.java#L56-L61
train
tzaeschke/zoodb
src/org/zoodb/internal/ZooSchemaImpl.java
ZooSchemaImpl.defineEmptyClass
@Override public ZooClass defineEmptyClass(String className) { DBTracer.logCall(this, className); checkValidity(true); if (!checkJavaClassNameConformity(className)) { throw new IllegalArgumentException("Not a valid class name: \"" + className + "\""); } return sm.declareSchema(className, null)...
java
@Override public ZooClass defineEmptyClass(String className) { DBTracer.logCall(this, className); checkValidity(true); if (!checkJavaClassNameConformity(className)) { throw new IllegalArgumentException("Not a valid class name: \"" + className + "\""); } return sm.declareSchema(className, null)...
[ "@", "Override", "public", "ZooClass", "defineEmptyClass", "(", "String", "className", ")", "{", "DBTracer", ".", "logCall", "(", "this", ",", "className", ")", ";", "checkValidity", "(", "true", ")", ";", "if", "(", "!", "checkJavaClassNameConformity", "(", ...
This declares a new database class schema. This method creates an empty class with no attributes. It does not consider any existing Java classes of the same name. @param className Class name @return New schema object @see ZooSchema#defineEmptyClass(String)
[ "This", "declares", "a", "new", "database", "class", "schema", ".", "This", "method", "creates", "an", "empty", "class", "with", "no", "attributes", ".", "It", "does", "not", "consider", "any", "existing", "Java", "classes", "of", "the", "same", "name", "....
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ZooSchemaImpl.java#L96-L104
train
tzaeschke/zoodb
src/org/zoodb/internal/util/FormattedStringBuilder.java
FormattedStringBuilder.append
public FormattedStringBuilder append(Throwable t) { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream p = new PrintStream(os); t.printStackTrace(p); p.close(); return append(os.toString()); }
java
public FormattedStringBuilder append(Throwable t) { ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream p = new PrintStream(os); t.printStackTrace(p); p.close(); return append(os.toString()); }
[ "public", "FormattedStringBuilder", "append", "(", "Throwable", "t", ")", "{", "ByteArrayOutputStream", "os", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "PrintStream", "p", "=", "new", "PrintStream", "(", "os", ")", ";", "t", ".", "printStackTrace", "...
Appends the stack trace of the Throwable argument to this sequence. @param t Exception to print. @return The updated instance of FormattedStringBuilder.
[ "Appends", "the", "stack", "trace", "of", "the", "Throwable", "argument", "to", "this", "sequence", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/FormattedStringBuilder.java#L117-L123
train
tzaeschke/zoodb
examples/org/zoodb/jdo/ex1/ExampleMain.java
ExampleMain.readDB
@SuppressWarnings("unchecked") private static void readDB(String dbName) { PersistenceManager pm = ZooJdoHelper.openDB(dbName); pm.currentTransaction().begin(); //Extents are one way to get objects from a database: System.out.println("Person extent: "); Extent<Person> ext = pm....
java
@SuppressWarnings("unchecked") private static void readDB(String dbName) { PersistenceManager pm = ZooJdoHelper.openDB(dbName); pm.currentTransaction().begin(); //Extents are one way to get objects from a database: System.out.println("Person extent: "); Extent<Person> ext = pm....
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "readDB", "(", "String", "dbName", ")", "{", "PersistenceManager", "pm", "=", "ZooJdoHelper", ".", "openDB", "(", "dbName", ")", ";", "pm", ".", "currentTransaction", "(", ")", ...
Read data from a database. Extents are fast, but allow filtering only on the class. Queries are a bit more powerful than Extents. @param dbName Database name.
[ "Read", "data", "from", "a", "database", ".", "Extents", "are", "fast", "but", "allow", "filtering", "only", "on", "the", "class", ".", "Queries", "are", "a", "bit", "more", "powerful", "than", "Extents", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/examples/org/zoodb/jdo/ex1/ExampleMain.java#L55-L87
train
tzaeschke/zoodb
examples/org/zoodb/jdo/ex1/ExampleMain.java
ExampleMain.populateDB
private static void populateDB(String dbName) { PersistenceManager pm = ZooJdoHelper.openDB(dbName); pm.currentTransaction().begin(); // create instances Person lisa = new Person("Lisa"); //make Lisa persistent. pm.makePersistent(lisa); //add Bart to Li...
java
private static void populateDB(String dbName) { PersistenceManager pm = ZooJdoHelper.openDB(dbName); pm.currentTransaction().begin(); // create instances Person lisa = new Person("Lisa"); //make Lisa persistent. pm.makePersistent(lisa); //add Bart to Li...
[ "private", "static", "void", "populateDB", "(", "String", "dbName", ")", "{", "PersistenceManager", "pm", "=", "ZooJdoHelper", ".", "openDB", "(", "dbName", ")", ";", "pm", ".", "currentTransaction", "(", ")", ".", "begin", "(", ")", ";", "// create instance...
Populate a database. ZooDB supports persistence by reachability. This means that if 'lisa' is stored in the database, 'bart' will also be stored because it is referenced from 'lisa'. The zooActivate(...) methods in {@code Person.addFriend()} ensure that 'bart' is flagged as modified when {@code addFriend()} is called,...
[ "Populate", "a", "database", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/examples/org/zoodb/jdo/ex1/ExampleMain.java#L101-L121
train
tzaeschke/zoodb
examples/org/zoodb/jdo/ex1/ExampleMain.java
ExampleMain.createDB
private static void createDB(String dbName) { // remove database if it exists if (ZooHelper.dbExists(dbName)) { ZooHelper.removeDb(dbName); } // create database // By default, all database files will be created in %USER_HOME%/zoodb ZooHelper.createDb(dbName);...
java
private static void createDB(String dbName) { // remove database if it exists if (ZooHelper.dbExists(dbName)) { ZooHelper.removeDb(dbName); } // create database // By default, all database files will be created in %USER_HOME%/zoodb ZooHelper.createDb(dbName);...
[ "private", "static", "void", "createDB", "(", "String", "dbName", ")", "{", "// remove database if it exists", "if", "(", "ZooHelper", ".", "dbExists", "(", "dbName", ")", ")", "{", "ZooHelper", ".", "removeDb", "(", "dbName", ")", ";", "}", "// create databas...
Create a database. @param dbName Name of the database to create.
[ "Create", "a", "database", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/examples/org/zoodb/jdo/ex1/ExampleMain.java#L129-L138
train
tzaeschke/zoodb
examples/org/zoodb/jdo/ex1/ExampleMain.java
ExampleMain.closeDB
private static void closeDB(PersistenceManager pm) { if (pm.currentTransaction().isActive()) { pm.currentTransaction().rollback(); } pm.close(); pm.getPersistenceManagerFactory().close(); }
java
private static void closeDB(PersistenceManager pm) { if (pm.currentTransaction().isActive()) { pm.currentTransaction().rollback(); } pm.close(); pm.getPersistenceManagerFactory().close(); }
[ "private", "static", "void", "closeDB", "(", "PersistenceManager", "pm", ")", "{", "if", "(", "pm", ".", "currentTransaction", "(", ")", ".", "isActive", "(", ")", ")", "{", "pm", ".", "currentTransaction", "(", ")", ".", "rollback", "(", ")", ";", "}"...
Close the database connection. @param pm The current PersistenceManager.
[ "Close", "the", "database", "connection", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/examples/org/zoodb/jdo/ex1/ExampleMain.java#L146-L152
train
tzaeschke/zoodb
src/org/zoodb/internal/server/StorageWriter.java
StorageWriter.seekPageForWrite
@Override public void seekPageForWrite(PAGE_TYPE type, int pageId) { //isAutoPaging = false; writeData(); isWriting = true; currentPage = pageId; buf.clear(); currentDataType = type; if (type != PAGE_TYPE.DB_HEADER) { writeHeader(); } }
java
@Override public void seekPageForWrite(PAGE_TYPE type, int pageId) { //isAutoPaging = false; writeData(); isWriting = true; currentPage = pageId; buf.clear(); currentDataType = type; if (type != PAGE_TYPE.DB_HEADER) { writeHeader(); } }
[ "@", "Override", "public", "void", "seekPageForWrite", "(", "PAGE_TYPE", "type", ",", "int", "pageId", ")", "{", "//isAutoPaging = false;", "writeData", "(", ")", ";", "isWriting", "=", "true", ";", "currentPage", "=", "pageId", ";", "buf", ".", "clear", "("...
Assumes autoPaging=false;
[ "Assumes", "autoPaging", "=", "false", ";" ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/StorageWriter.java#L74-L85
train
tzaeschke/zoodb
src/org/zoodb/internal/server/StorageWriter.java
StorageWriter.allocateAndSeekAP
@Override public int allocateAndSeekAP(PAGE_TYPE type, int prevPage, long header) { //isAutoPaging = true; currentDataType = type; classOid = header; int pageId = allocateAndSeekPage(prevPage); //auto-paging is true return pageId; }
java
@Override public int allocateAndSeekAP(PAGE_TYPE type, int prevPage, long header) { //isAutoPaging = true; currentDataType = type; classOid = header; int pageId = allocateAndSeekPage(prevPage); //auto-paging is true return pageId; }
[ "@", "Override", "public", "int", "allocateAndSeekAP", "(", "PAGE_TYPE", "type", ",", "int", "prevPage", ",", "long", "header", ")", "{", "//isAutoPaging = true;", "currentDataType", "=", "type", ";", "classOid", "=", "header", ";", "int", "pageId", "=", "allo...
Assumes autoPaging=true; @return the page ID of the allocated page
[ "Assumes", "autoPaging", "=", "true", ";" ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/StorageWriter.java#L102-L111
train
tzaeschke/zoodb
src/org/zoodb/internal/server/StorageWriter.java
StorageWriter.noCheckWrite
@Override public void noCheckWrite(long[] array) { LongBuffer lb = buf.asLongBuffer(); lb.put(array); buf.position(buf.position() + S_LONG * array.length); }
java
@Override public void noCheckWrite(long[] array) { LongBuffer lb = buf.asLongBuffer(); lb.put(array); buf.position(buf.position() + S_LONG * array.length); }
[ "@", "Override", "public", "void", "noCheckWrite", "(", "long", "[", "]", "array", ")", "{", "LongBuffer", "lb", "=", "buf", ".", "asLongBuffer", "(", ")", ";", "lb", ".", "put", "(", "array", ")", ";", "buf", ".", "position", "(", "buf", ".", "pos...
The no-check methods are thought to be faster, because they don't need range checking. Furthermore, they ensure that a page can be filled to the last byte. without a new page being allocated.
[ "The", "no", "-", "check", "methods", "are", "thought", "to", "be", "faster", "because", "they", "don", "t", "need", "range", "checking", ".", "Furthermore", "they", "ensure", "that", "a", "page", "can", "be", "filled", "to", "the", "last", "byte", ".", ...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/StorageWriter.java#L198-L203
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoProperties.java
ZooJdoProperties.setOptimistic
public ZooJdoProperties setOptimistic(boolean flag) { DBTracer.logCall(this, flag); put(Constants.PROPERTY_OPTIMISTIC, Boolean.toString(flag)); if (flag) { throw new UnsupportedOperationException(); } return this; }
java
public ZooJdoProperties setOptimistic(boolean flag) { DBTracer.logCall(this, flag); put(Constants.PROPERTY_OPTIMISTIC, Boolean.toString(flag)); if (flag) { throw new UnsupportedOperationException(); } return this; }
[ "public", "ZooJdoProperties", "setOptimistic", "(", "boolean", "flag", ")", "{", "DBTracer", ".", "logCall", "(", "this", ",", "flag", ")", ";", "put", "(", "Constants", ".", "PROPERTY_OPTIMISTIC", ",", "Boolean", ".", "toString", "(", "flag", ")", ")", ";...
Whether the transactions should be optimistic, that means whether objects should become non-transactional during commit. This is for example useful when objects should be accessible outside transactions. This is optimistic, because less consistency guarantees are given. @param flag The flag @return this @see Constants#...
[ "Whether", "the", "transactions", "should", "be", "optimistic", "that", "means", "whether", "objects", "should", "become", "non", "-", "transactional", "during", "commit", ".", "This", "is", "for", "example", "useful", "when", "objects", "should", "be", "accessi...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoProperties.java#L111-L118
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoProperties.java
ZooJdoProperties.setIgnoreCache
public ZooJdoProperties setIgnoreCache(boolean flag) { DBTracer.logCall(this, flag); put(Constants.PROPERTY_IGNORE_CACHE, Boolean.toString(flag)); return this; }
java
public ZooJdoProperties setIgnoreCache(boolean flag) { DBTracer.logCall(this, flag); put(Constants.PROPERTY_IGNORE_CACHE, Boolean.toString(flag)); return this; }
[ "public", "ZooJdoProperties", "setIgnoreCache", "(", "boolean", "flag", ")", "{", "DBTracer", ".", "logCall", "(", "this", ",", "flag", ")", ";", "put", "(", "Constants", ".", "PROPERTY_IGNORE_CACHE", ",", "Boolean", ".", "toString", "(", "flag", ")", ")", ...
Whether queries should ignore objects in the cache. Default is 'false'. @param flag The flag @return this @see Constants#PROPERTY_IGNORE_CACHE
[ "Whether", "queries", "should", "ignore", "objects", "in", "the", "cache", ".", "Default", "is", "false", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoProperties.java#L127-L131
train
tzaeschke/zoodb
src/org/zoodb/jdo/ZooJdoProperties.java
ZooJdoProperties.setZooFailOnEmptyQueries
public ZooJdoProperties setZooFailOnEmptyQueries(boolean flag) { DBTracer.logCall(this, flag); put(ZooConstants.PROPERTY_FAIL_ON_CLOSED_QUERIES, Boolean.toString(flag)); return this; }
java
public ZooJdoProperties setZooFailOnEmptyQueries(boolean flag) { DBTracer.logCall(this, flag); put(ZooConstants.PROPERTY_FAIL_ON_CLOSED_QUERIES, Boolean.toString(flag)); return this; }
[ "public", "ZooJdoProperties", "setZooFailOnEmptyQueries", "(", "boolean", "flag", ")", "{", "DBTracer", ".", "logCall", "(", "this", ",", "flag", ")", ";", "put", "(", "ZooConstants", ".", "PROPERTY_FAIL_ON_CLOSED_QUERIES", ",", "Boolean", ".", "toString", "(", ...
Property that defines how access to closed Queries and Extent should be handled. Queries and Extents are automatically closed at transaction boundaries. y default, as specified in JDO 3.1, closed queries and extents behave as if they were empty. ZooDB allows to change this behavior such that access to closed Queries a...
[ "Property", "that", "defines", "how", "access", "to", "closed", "Queries", "and", "Extent", "should", "be", "handled", ".", "Queries", "and", "Extents", "are", "automatically", "closed", "at", "transaction", "boundaries", ".", "y", "default", "as", "specified", ...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/ZooJdoProperties.java#L225-L229
train
tzaeschke/zoodb
src/org/zoodb/internal/ZooClassDef.java
ZooClassDef.associateSuperDef
public void associateSuperDef(ZooClassDef superDef) { if (this.superDef != null) { throw new IllegalStateException(); } if (superDef == null) { throw new IllegalArgumentException(); } //class invariant if (superDef.getOid() != oidSuper) { throw new IllegalStateException("s-oid= " + oidSuper + "...
java
public void associateSuperDef(ZooClassDef superDef) { if (this.superDef != null) { throw new IllegalStateException(); } if (superDef == null) { throw new IllegalArgumentException(); } //class invariant if (superDef.getOid() != oidSuper) { throw new IllegalStateException("s-oid= " + oidSuper + "...
[ "public", "void", "associateSuperDef", "(", "ZooClassDef", "superDef", ")", "{", "if", "(", "this", ".", "superDef", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "if", "(", "superDef", "==", "null", ")", "{", "thro...
Only to be used during database startup to load the schema-tree. @param superDef The super class
[ "Only", "to", "be", "used", "during", "database", "startup", "to", "load", "the", "schema", "-", "tree", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ZooClassDef.java#L537-L553
train
tzaeschke/zoodb
src/org/zoodb/internal/client/SchemaManager.java
SchemaManager.locateClassDefinition
private ZooClassDef locateClassDefinition(Class<?> cls, Node node) { ZooClassDef def = cache.getSchema(cls, node); if (def == null || def.jdoZooIsDeleted()) { return null; } return def; }
java
private ZooClassDef locateClassDefinition(Class<?> cls, Node node) { ZooClassDef def = cache.getSchema(cls, node); if (def == null || def.jdoZooIsDeleted()) { return null; } return def; }
[ "private", "ZooClassDef", "locateClassDefinition", "(", "Class", "<", "?", ">", "cls", ",", "Node", "node", ")", "{", "ZooClassDef", "def", "=", "cache", ".", "getSchema", "(", "cls", ",", "node", ")", ";", "if", "(", "def", "==", "null", "||", "def", ...
Checks class and disk for class definition. @param cls @param node @return Class definition, may return null if no definition is found.
[ "Checks", "class", "and", "disk", "for", "class", "definition", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/client/SchemaManager.java#L82-L88
train
tzaeschke/zoodb
src/org/zoodb/internal/client/SchemaManager.java
SchemaManager.addMissingSchemas
private void addMissingSchemas(Set<String> missingSchemas) { if (missingSchemas.isEmpty()) { return; } for (String className: missingSchemas) { Class<?> cls; try { cls = Class.forName(className); } catch (ClassNotFoundException e) { throw DBLogger.newFatal("Invalid field type in schema", e); ...
java
private void addMissingSchemas(Set<String> missingSchemas) { if (missingSchemas.isEmpty()) { return; } for (String className: missingSchemas) { Class<?> cls; try { cls = Class.forName(className); } catch (ClassNotFoundException e) { throw DBLogger.newFatal("Invalid field type in schema", e); ...
[ "private", "void", "addMissingSchemas", "(", "Set", "<", "String", ">", "missingSchemas", ")", "{", "if", "(", "missingSchemas", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "for", "(", "String", "className", ":", "missingSchemas", ")", "{", "...
This method add all schemata that were found missing when checking all known schemata. @param missingSchemas
[ "This", "method", "add", "all", "schemata", "that", "were", "found", "missing", "when", "checking", "all", "known", "schemata", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/client/SchemaManager.java#L289-L303
train
tzaeschke/zoodb
src/org/zoodb/internal/client/SchemaManager.java
SchemaManager.checkSchemaFields
private void checkSchemaFields(ZooClassDef schema, Collection<ZooClassDef> cachedSchemata, Set<String> missingSchemas) { //do this only now, because only now we can check which field types //are really persistent! //TODO check for field types that became persistent only now -> error!! //--> requires schema ...
java
private void checkSchemaFields(ZooClassDef schema, Collection<ZooClassDef> cachedSchemata, Set<String> missingSchemas) { //do this only now, because only now we can check which field types //are really persistent! //TODO check for field types that became persistent only now -> error!! //--> requires schema ...
[ "private", "void", "checkSchemaFields", "(", "ZooClassDef", "schema", ",", "Collection", "<", "ZooClassDef", ">", "cachedSchemata", ",", "Set", "<", "String", ">", "missingSchemas", ")", "{", "//do this only now, because only now we can check which field types", "//are real...
Check the fields defined in this class. @param schema @param missingSchemas @param schemata
[ "Check", "the", "fields", "defined", "in", "this", "class", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/client/SchemaManager.java#L311-L323
train
tzaeschke/zoodb
src/org/zoodb/internal/client/SchemaManager.java
SchemaManager.applyOp
private void applyOp(SchemaOperation op, ZooClassDef def) { ops.add(op); for (GenericObject o: cache.getAllGenericObjects()) { if (o.jdoZooGetClassDef() == def) { o.evolve(op); } } }
java
private void applyOp(SchemaOperation op, ZooClassDef def) { ops.add(op); for (GenericObject o: cache.getAllGenericObjects()) { if (o.jdoZooGetClassDef() == def) { o.evolve(op); } } }
[ "private", "void", "applyOp", "(", "SchemaOperation", "op", ",", "ZooClassDef", "def", ")", "{", "ops", ".", "add", "(", "op", ")", ";", "for", "(", "GenericObject", "o", ":", "cache", ".", "getAllGenericObjects", "(", ")", ")", "{", "if", "(", "o", ...
Apply an operation to all objects in the cache. @param op @param def
[ "Apply", "an", "operation", "to", "all", "objects", "in", "the", "cache", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/client/SchemaManager.java#L409-L416
train
tzaeschke/zoodb
src/org/zoodb/internal/query/QueryTreeNode.java
QueryTreeNode.evaluate
public boolean evaluate(DataDeSerializerNoClass dds, long pos) { boolean first = (n1 != null ? n1.evaluate(dds, pos) : t1.evaluate(dds, pos)); //do we have a second part? if (op == null) { return first; } if ( !first && op == LOG_OP.AND) { return false; } if ( first && op == LOG_OP.OR) { ...
java
public boolean evaluate(DataDeSerializerNoClass dds, long pos) { boolean first = (n1 != null ? n1.evaluate(dds, pos) : t1.evaluate(dds, pos)); //do we have a second part? if (op == null) { return first; } if ( !first && op == LOG_OP.AND) { return false; } if ( first && op == LOG_OP.OR) { ...
[ "public", "boolean", "evaluate", "(", "DataDeSerializerNoClass", "dds", ",", "long", "pos", ")", "{", "boolean", "first", "=", "(", "n1", "!=", "null", "?", "n1", ".", "evaluate", "(", "dds", ",", "pos", ")", ":", "t1", ".", "evaluate", "(", "dds", "...
Evaluate the query directly on a byte buffer rather than on materialized objects. @param pos position in byte buffer @param dds DataDeSerializer @return Whether the object is a match.
[ "Evaluate", "the", "query", "directly", "on", "a", "byte", "buffer", "rather", "than", "on", "materialized", "objects", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/query/QueryTreeNode.java#L141-L154
train
tzaeschke/zoodb
src/org/zoodb/internal/query/QueryTreeNode.java
QueryTreeNode.createSubs
public void createSubs(List<QueryTreeNode> subQueries) { if (!isBranchIndexed()) { //nothing to do, stop searching this branch return; } //If op=OR and if and sub-nodes are indexed, then we split. if (LOG_OP.OR.equals(op)) { //clone both branches (WHY ?) QueryTreeNode node1; if (n1 !...
java
public void createSubs(List<QueryTreeNode> subQueries) { if (!isBranchIndexed()) { //nothing to do, stop searching this branch return; } //If op=OR and if and sub-nodes are indexed, then we split. if (LOG_OP.OR.equals(op)) { //clone both branches (WHY ?) QueryTreeNode node1; if (n1 !...
[ "public", "void", "createSubs", "(", "List", "<", "QueryTreeNode", ">", "subQueries", ")", "{", "if", "(", "!", "isBranchIndexed", "(", ")", ")", "{", "//nothing to do, stop searching this branch\r", "return", ";", "}", "//If op=OR and if and sub-nodes are indexed, then...
This method splits a query into multiple queries for every occurrence of OR. It walks down the query tree recursively, always doubling the tree when encountering an OR in an indexed branch. A branch is 'indexed' if one of it's terms references an indexed field. This method may introduce singular nodes (with one term o...
[ "This", "method", "splits", "a", "query", "into", "multiple", "queries", "for", "every", "occurrence", "of", "OR", ".", "It", "walks", "down", "the", "query", "tree", "recursively", "always", "doubling", "the", "tree", "when", "encountering", "an", "OR", "in...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/query/QueryTreeNode.java#L168-L240
train
tzaeschke/zoodb
src/org/zoodb/internal/query/QueryTreeNode.java
QueryTreeNode.cloneTrunk
private QueryTreeNode cloneTrunk(QueryTreeNode stop, QueryTreeNode stopClone) { QueryTreeNode node1 = null; if (n1 != null) { node1 = (n1 == stop ? stopClone : n1.cloneBranch()); } QueryTreeNode node2 = null; if (n2 != null) { node2 = n2 == stop ? stopClone : n2.cloneBranch(); } QueryTr...
java
private QueryTreeNode cloneTrunk(QueryTreeNode stop, QueryTreeNode stopClone) { QueryTreeNode node1 = null; if (n1 != null) { node1 = (n1 == stop ? stopClone : n1.cloneBranch()); } QueryTreeNode node2 = null; if (n2 != null) { node2 = n2 == stop ? stopClone : n2.cloneBranch(); } QueryTr...
[ "private", "QueryTreeNode", "cloneTrunk", "(", "QueryTreeNode", "stop", ",", "QueryTreeNode", "stopClone", ")", "{", "QueryTreeNode", "node1", "=", "null", ";", "if", "(", "n1", "!=", "null", ")", "{", "node1", "=", "(", "n1", "==", "stop", "?", "stopClone...
Clones a tree upwards to the root, except for the branch that starts with 'stop', which is replaced by 'stopClone'. @param stop @param stopClone @return A cloned branch of the query tree
[ "Clones", "a", "tree", "upwards", "to", "the", "root", "except", "for", "the", "branch", "that", "starts", "with", "stop", "which", "is", "replaced", "by", "stopClone", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/query/QueryTreeNode.java#L255-L271
train
tzaeschke/zoodb
src/org/zoodb/api/impl/ZooPC.java
ZooPC.setPersNew
private final void setPersNew() { status = ObjectState.PERSISTENT_NEW; stateFlags = PS_PERSISTENT | PS_TRANSACTIONAL | PS_DIRTY | PS_NEW; context.getSession().internalGetCache().notifyDirty(this); }
java
private final void setPersNew() { status = ObjectState.PERSISTENT_NEW; stateFlags = PS_PERSISTENT | PS_TRANSACTIONAL | PS_DIRTY | PS_NEW; context.getSession().internalGetCache().notifyDirty(this); }
[ "private", "final", "void", "setPersNew", "(", ")", "{", "status", "=", "ObjectState", ".", "PERSISTENT_NEW", ";", "stateFlags", "=", "PS_PERSISTENT", "|", "PS_TRANSACTIONAL", "|", "PS_DIRTY", "|", "PS_NEW", ";", "context", ".", "getSession", "(", ")", ".", ...
not to be used from outside
[ "not", "to", "be", "used", "from", "outside" ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/api/impl/ZooPC.java#L142-L146
train
tzaeschke/zoodb
src/org/zoodb/api/impl/ZooPC.java
ZooPC.zooActivateRead
public final void zooActivateRead() { if (DBTracer.TRACE) DBTracer.logCall(this); switch (getStatus()) { case DETACHED_CLEAN: //nothing to do return; case HOLLOW_PERSISTENT_NONTRANSACTIONAL: try { Session session = context.getSession(); session.lock(); if (session.isClosed()) { throw D...
java
public final void zooActivateRead() { if (DBTracer.TRACE) DBTracer.logCall(this); switch (getStatus()) { case DETACHED_CLEAN: //nothing to do return; case HOLLOW_PERSISTENT_NONTRANSACTIONAL: try { Session session = context.getSession(); session.lock(); if (session.isClosed()) { throw D...
[ "public", "final", "void", "zooActivateRead", "(", ")", "{", "if", "(", "DBTracer", ".", "TRACE", ")", "DBTracer", ".", "logCall", "(", "this", ")", ";", "switch", "(", "getStatus", "(", ")", ")", "{", "case", "DETACHED_CLEAN", ":", "//nothing to do", "r...
This method ensures that the specified object is in the cache. It should be called in the beginning of every method that reads persistent fields. For generated calls, we should not forget private method, because they can be called from other instances.
[ "This", "method", "ensures", "that", "the", "specified", "object", "is", "in", "the", "cache", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/api/impl/ZooPC.java#L389-L428
train
tzaeschke/zoodb
src/org/zoodb/internal/server/index/LLIndexPage.java
LLIndexPage.binarySearch
int binarySearch(int fromIndex, int toIndex, long key, long value) { if (ind.isUnique()) { return binarySearchUnique(fromIndex, toIndex, key); } return binarySearchNonUnique(fromIndex, toIndex, key, value); }
java
int binarySearch(int fromIndex, int toIndex, long key, long value) { if (ind.isUnique()) { return binarySearchUnique(fromIndex, toIndex, key); } return binarySearchNonUnique(fromIndex, toIndex, key, value); }
[ "int", "binarySearch", "(", "int", "fromIndex", ",", "int", "toIndex", ",", "long", "key", ",", "long", "value", ")", "{", "if", "(", "ind", ".", "isUnique", "(", ")", ")", "{", "return", "binarySearchUnique", "(", "fromIndex", ",", "toIndex", ",", "ke...
Binary search. @param toIndex Exclusive, search stops at (toIndex-1). @param value For non-unique trees, the value is taken into account as well.
[ "Binary", "search", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/LLIndexPage.java#L227-L232
train
tzaeschke/zoodb
src/org/zoodb/internal/server/index/LLIndexPage.java
LLIndexPage.replaceChildPage
protected void replaceChildPage(LLIndexPage indexPage, long key, long value, AbstractIndexPage subChild) { int start = binarySearch(0, nEntries, key, value); if (start < 0) { start = -(start+1); } for (int i = start; i <= nEntries; i++) { if (subPages[i] == indexPage) { markPageDirtyAndClone(); ...
java
protected void replaceChildPage(LLIndexPage indexPage, long key, long value, AbstractIndexPage subChild) { int start = binarySearch(0, nEntries, key, value); if (start < 0) { start = -(start+1); } for (int i = start; i <= nEntries; i++) { if (subPages[i] == indexPage) { markPageDirtyAndClone(); ...
[ "protected", "void", "replaceChildPage", "(", "LLIndexPage", "indexPage", ",", "long", "key", ",", "long", "value", ",", "AbstractIndexPage", "subChild", ")", "{", "int", "start", "=", "binarySearch", "(", "0", ",", "nEntries", ",", "key", ",", "value", ")",...
Replacing sub-pages occurs when the sub-page shrinks down to a single sub-sub-page, in which case we pull up the sub-sub-page to the local page, replacing the sub-page.
[ "Replacing", "sub", "-", "pages", "occurs", "when", "the", "sub", "-", "page", "shrinks", "down", "to", "a", "single", "sub", "-", "sub", "-", "page", "in", "which", "case", "we", "pull", "up", "the", "sub", "-", "sub", "-", "page", "to", "the", "l...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/LLIndexPage.java#L818-L847
train
tzaeschke/zoodb
src/org/zoodb/internal/server/index/LLIndexPage.java
LLIndexPage.deleteAndCheckRangeEmpty
public long deleteAndCheckRangeEmpty(long key, long min, long max) { LLIndexPage pageKey = locatePageForKeyUnique(key, false); int posKey = pageKey.binarySearchUnique(0, pageKey.nEntries, key); //We assume that the key exists. Otherwise we get an exception anyway in the remove-method. //-> no such calcula...
java
public long deleteAndCheckRangeEmpty(long key, long min, long max) { LLIndexPage pageKey = locatePageForKeyUnique(key, false); int posKey = pageKey.binarySearchUnique(0, pageKey.nEntries, key); //We assume that the key exists. Otherwise we get an exception anyway in the remove-method. //-> no such calcula...
[ "public", "long", "deleteAndCheckRangeEmpty", "(", "long", "key", ",", "long", "min", ",", "long", "max", ")", "{", "LLIndexPage", "pageKey", "=", "locatePageForKeyUnique", "(", "key", ",", "false", ")", ";", "int", "posKey", "=", "pageKey", ".", "binarySear...
Special method to remove entries. When removing the entry, it checks whether other entries in the given range exist. If none exist, the value is returned as free page to FSM. @param key @param min @param max @return The previous value
[ "Special", "method", "to", "remove", "entries", ".", "When", "removing", "the", "entry", "it", "checks", "whether", "other", "entries", "in", "the", "given", "range", "exist", ".", "If", "none", "exist", "the", "value", "is", "returned", "as", "free", "pag...
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/LLIndexPage.java#L887-L940
train
tzaeschke/zoodb
src/org/zoodb/internal/server/index/LLIterator.java
LLIterator.nextULL
public LongLongIndex.LLEntry nextULL() { if (!hasNextULL()) { throw new NoSuchElementException(); } LongLongIndex.LLEntry e = new LongLongIndex.LLEntry(nextKey, nextValue); if (currentPage == null) { hasValue = false; } else { gotoPosInPage(); } return e; }
java
public LongLongIndex.LLEntry nextULL() { if (!hasNextULL()) { throw new NoSuchElementException(); } LongLongIndex.LLEntry e = new LongLongIndex.LLEntry(nextKey, nextValue); if (currentPage == null) { hasValue = false; } else { gotoPosInPage(); } return e; }
[ "public", "LongLongIndex", ".", "LLEntry", "nextULL", "(", ")", "{", "if", "(", "!", "hasNextULL", "(", ")", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "LongLongIndex", ".", "LLEntry", "e", "=", "new", "LongLongIndex", ".", "...
Dirty trick to avoid delays from finding the correct method.
[ "Dirty", "trick", "to", "avoid", "delays", "from", "finding", "the", "correct", "method", "." ]
058d0ff161a8ee9d53244c433aca97ee9c654410
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/LLIterator.java#L242-L254
train
DanielYWoo/fast-object-pool
src/main/java/cn/danielw/fop/ObjectPoolPartition.java
ObjectPoolPartition.scavenge
public synchronized void scavenge() throws InterruptedException { int delta = this.totalCount - config.getMinSize(); if (delta <= 0) return; int removed = 0; long now = System.currentTimeMillis(); Poolable<T> obj; while (delta-- > 0 && (obj = objectQueue.poll()) != null) ...
java
public synchronized void scavenge() throws InterruptedException { int delta = this.totalCount - config.getMinSize(); if (delta <= 0) return; int removed = 0; long now = System.currentTimeMillis(); Poolable<T> obj; while (delta-- > 0 && (obj = objectQueue.poll()) != null) ...
[ "public", "synchronized", "void", "scavenge", "(", ")", "throws", "InterruptedException", "{", "int", "delta", "=", "this", ".", "totalCount", "-", "config", ".", "getMinSize", "(", ")", ";", "if", "(", "delta", "<=", "0", ")", "return", ";", "int", "rem...
set the scavenge interval carefully
[ "set", "the", "scavenge", "interval", "carefully" ]
9fcd44a762f867cf2270e992dcb34c58b8249de6
https://github.com/DanielYWoo/fast-object-pool/blob/9fcd44a762f867cf2270e992dcb34c58b8249de6/src/main/java/cn/danielw/fop/ObjectPoolPartition.java#L65-L86
train
virgo47/javasimon
spring/src/main/java/org/javasimon/spring/ManagerFactoryBean.java
ManagerFactoryBean.registerCallbacks
private void registerCallbacks(Manager manager) { if (callbacks != null) { for (Callback callback : callbacks) { manager.callback().addCallback(callback); } } }
java
private void registerCallbacks(Manager manager) { if (callbacks != null) { for (Callback callback : callbacks) { manager.callback().addCallback(callback); } } }
[ "private", "void", "registerCallbacks", "(", "Manager", "manager", ")", "{", "if", "(", "callbacks", "!=", "null", ")", "{", "for", "(", "Callback", "callback", ":", "callbacks", ")", "{", "manager", ".", "callback", "(", ")", ".", "addCallback", "(", "c...
Register callbacks in given manager @param manager Manager
[ "Register", "callbacks", "in", "given", "manager" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/spring/src/main/java/org/javasimon/spring/ManagerFactoryBean.java#L89-L95
train
virgo47/javasimon
spring/src/main/java/org/javasimon/spring/ManagerFactoryBean.java
ManagerFactoryBean.configureEnabled
private void configureEnabled(Manager manager) { if (enabled != manager.isEnabled()) { if (enabled) { manager.enable(); } else { manager.disable(); } } }
java
private void configureEnabled(Manager manager) { if (enabled != manager.isEnabled()) { if (enabled) { manager.enable(); } else { manager.disable(); } } }
[ "private", "void", "configureEnabled", "(", "Manager", "manager", ")", "{", "if", "(", "enabled", "!=", "manager", ".", "isEnabled", "(", ")", ")", "{", "if", "(", "enabled", ")", "{", "manager", ".", "enable", "(", ")", ";", "}", "else", "{", "manag...
When needed toggle the enabled flag of given Simon manager @param manager Simon manager
[ "When", "needed", "toggle", "the", "enabled", "flag", "of", "given", "Simon", "manager" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/spring/src/main/java/org/javasimon/spring/ManagerFactoryBean.java#L110-L118
train
virgo47/javasimon
examples/src/main/java/org/javasimon/examples/jmx/JmxCallbackExample.java
JmxCallbackExample.main
@SuppressWarnings("InfiniteLoopStatement") public static void main(String[] args) throws Exception { SimonManager.callback().addCallback(new JmxRegisterCallback("org.javasimon.examples.jmx.JmxCallbackExample")); Counter counter = SimonManager.getCounter("org.javasimon.examples.jmx.counter"); Stopwatch stopwatch...
java
@SuppressWarnings("InfiniteLoopStatement") public static void main(String[] args) throws Exception { SimonManager.callback().addCallback(new JmxRegisterCallback("org.javasimon.examples.jmx.JmxCallbackExample")); Counter counter = SimonManager.getCounter("org.javasimon.examples.jmx.counter"); Stopwatch stopwatch...
[ "@", "SuppressWarnings", "(", "\"InfiniteLoopStatement\"", ")", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "SimonManager", ".", "callback", "(", ")", ".", "addCallback", "(", "new", "JmxRegisterCallback"...
Entry point to the JMX Callback Example. @param args unused @throws Exception whatever may happen in this crazy world
[ "Entry", "point", "to", "the", "JMX", "Callback", "Example", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/jmx/JmxCallbackExample.java#L23-L40
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java
SimonTypeFactory.getValue
private static <T> SimonType getValue(Class<? extends T> type, SimonTypeMatcher<T> typeMatcher) { SimonType simonType = SIMON_TYPE_CACHE.get(type); if (simonType == null) { for (SimonType lSimonType : SimonType.values()) { if (typeMatcher.matches(type, lSimonType)) { simonType = lSimonType; if (!Pr...
java
private static <T> SimonType getValue(Class<? extends T> type, SimonTypeMatcher<T> typeMatcher) { SimonType simonType = SIMON_TYPE_CACHE.get(type); if (simonType == null) { for (SimonType lSimonType : SimonType.values()) { if (typeMatcher.matches(type, lSimonType)) { simonType = lSimonType; if (!Pr...
[ "private", "static", "<", "T", ">", "SimonType", "getValue", "(", "Class", "<", "?", "extends", "T", ">", "type", ",", "SimonTypeMatcher", "<", "T", ">", "typeMatcher", ")", "{", "SimonType", "simonType", "=", "SIMON_TYPE_CACHE", ".", "get", "(", "type", ...
Get Simon type corresponding to class.
[ "Get", "Simon", "type", "corresponding", "to", "class", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java#L40-L54
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java
SimonTypeFactory.getValueFromInstance
public static SimonType getValueFromInstance(Simon simon) { return simon == null ? null : getValueFromType(simon.getClass()); }
java
public static SimonType getValueFromInstance(Simon simon) { return simon == null ? null : getValueFromType(simon.getClass()); }
[ "public", "static", "SimonType", "getValueFromInstance", "(", "Simon", "simon", ")", "{", "return", "simon", "==", "null", "?", "null", ":", "getValueFromType", "(", "simon", ".", "getClass", "(", ")", ")", ";", "}" ]
Get simon type from simon instance. @param simon Simon @return Type
[ "Get", "simon", "type", "from", "simon", "instance", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java#L82-L84
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java
SimonTypeFactory.getValueFromInstance
public static SimonType getValueFromInstance(Sample sample) { return sample == null ? null : getValueFromSampleType(sample.getClass()); }
java
public static SimonType getValueFromInstance(Sample sample) { return sample == null ? null : getValueFromSampleType(sample.getClass()); }
[ "public", "static", "SimonType", "getValueFromInstance", "(", "Sample", "sample", ")", "{", "return", "sample", "==", "null", "?", "null", ":", "getValueFromSampleType", "(", "sample", ".", "getClass", "(", ")", ")", ";", "}" ]
Get simon type from simon sample instance. @param sample Simon sample @return Type
[ "Get", "simon", "type", "from", "simon", "sample", "instance", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java#L92-L94
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java
SimonTypeFactory.normalizeType
public static Class normalizeType(Class type) { SimonType simonType = SimonTypeFactory.getValueFromType(type); Class normalizedType; if (simonType == null) { simonType = SimonTypeFactory.getValueFromSampleType(type); if (simonType == null) { normalizedType = type; } else { normalizedType = simonT...
java
public static Class normalizeType(Class type) { SimonType simonType = SimonTypeFactory.getValueFromType(type); Class normalizedType; if (simonType == null) { simonType = SimonTypeFactory.getValueFromSampleType(type); if (simonType == null) { normalizedType = type; } else { normalizedType = simonT...
[ "public", "static", "Class", "normalizeType", "(", "Class", "type", ")", "{", "SimonType", "simonType", "=", "SimonTypeFactory", ".", "getValueFromType", "(", "type", ")", ";", "Class", "normalizedType", ";", "if", "(", "simonType", "==", "null", ")", "{", "...
Get the main interface of the type. @param type Implementation class @return Main interface class
[ "Get", "the", "main", "interface", "of", "the", "type", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonTypeFactory.java#L102-L116
train
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTree.java
CallTree.onStopwatchStart
public CallTreeNode onStopwatchStart(Split split) { final String name = split.getStopwatch().getName(); CallTreeNode currentNode; if (callStack.isEmpty()) { // Root tree node rootNode = new CallTreeNode(name); currentNode = rootNode; onRootStopwatchStart(currentNode, split); } else { // ...
java
public CallTreeNode onStopwatchStart(Split split) { final String name = split.getStopwatch().getName(); CallTreeNode currentNode; if (callStack.isEmpty()) { // Root tree node rootNode = new CallTreeNode(name); currentNode = rootNode; onRootStopwatchStart(currentNode, split); } else { // ...
[ "public", "CallTreeNode", "onStopwatchStart", "(", "Split", "split", ")", "{", "final", "String", "name", "=", "split", ".", "getStopwatch", "(", ")", ".", "getName", "(", ")", ";", "CallTreeNode", "currentNode", ";", "if", "(", "callStack", ".", "isEmpty", ...
When stopwatch is started, a new tree node is added to the parent tree node and pushed on the call stack. As a result, child tree node becomes the current tree node. @return Current (child) tree node
[ "When", "stopwatch", "is", "started", "a", "new", "tree", "node", "is", "added", "to", "the", "parent", "tree", "node", "and", "pushed", "on", "the", "call", "stack", ".", "As", "a", "result", "child", "tree", "node", "becomes", "the", "current", "tree",...
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTree.java#L42-L56
train
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTree.java
CallTree.onStopwatchStop
public CallTreeNode onStopwatchStop(Split split) { CallTreeNode currentNode = callStack.removeLast(); currentNode.addSplit(split); if (callStack.isEmpty()) { onRootStopwatchStop(currentNode, split); } return currentNode; }
java
public CallTreeNode onStopwatchStop(Split split) { CallTreeNode currentNode = callStack.removeLast(); currentNode.addSplit(split); if (callStack.isEmpty()) { onRootStopwatchStop(currentNode, split); } return currentNode; }
[ "public", "CallTreeNode", "onStopwatchStop", "(", "Split", "split", ")", "{", "CallTreeNode", "currentNode", "=", "callStack", ".", "removeLast", "(", ")", ";", "currentNode", ".", "addSplit", "(", "split", ")", ";", "if", "(", "callStack", ".", "isEmpty", "...
When stopwatch is stopped, the the split is added to current tree node and this tree node is popped from call stack. As a result, parent tree node becomes current tree node. @return Current (child) tree node
[ "When", "stopwatch", "is", "stopped", "the", "the", "split", "is", "added", "to", "current", "tree", "node", "and", "this", "tree", "node", "is", "popped", "from", "call", "stack", ".", "As", "a", "result", "parent", "tree", "node", "becomes", "current", ...
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTree.java#L65-L72
train
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTree.java
CallTree.getLogMessage
public String getLogMessage(Split context) { context.getStopwatch().setAttribute(CallTreeCallback.ATTR_NAME_LAST, this); return "Call Tree:\r\n" + rootNode.toString(); }
java
public String getLogMessage(Split context) { context.getStopwatch().setAttribute(CallTreeCallback.ATTR_NAME_LAST, this); return "Call Tree:\r\n" + rootNode.toString(); }
[ "public", "String", "getLogMessage", "(", "Split", "context", ")", "{", "context", ".", "getStopwatch", "(", ")", ".", "setAttribute", "(", "CallTreeCallback", ".", "ATTR_NAME_LAST", ",", "this", ")", ";", "return", "\"Call Tree:\\r\\n\"", "+", "rootNode", ".", ...
Transforms this call tree into a loggable message.
[ "Transforms", "this", "call", "tree", "into", "a", "loggable", "message", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTree.java#L96-L99
train
virgo47/javasimon
jdbc41/src/main/java/org/javasimon/jdbc4/Driver.java
Driver.connect
@Override public Connection connect(String simonUrl, Properties info) throws SQLException { if (!acceptsURL(simonUrl)) { return null; } SimonConnectionConfiguration url = new SimonConnectionConfiguration(simonUrl); driver = getRealDriver(url, info); return new SimonConnection(driver.connect(...
java
@Override public Connection connect(String simonUrl, Properties info) throws SQLException { if (!acceptsURL(simonUrl)) { return null; } SimonConnectionConfiguration url = new SimonConnectionConfiguration(simonUrl); driver = getRealDriver(url, info); return new SimonConnection(driver.connect(...
[ "@", "Override", "public", "Connection", "connect", "(", "String", "simonUrl", ",", "Properties", "info", ")", "throws", "SQLException", "{", "if", "(", "!", "acceptsURL", "(", "simonUrl", ")", ")", "{", "return", "null", ";", "}", "SimonConnectionConfiguratio...
Opens new Simon proxy driver connection associated with real connection to the specified database. @param simonUrl JDBC connection string (i.e. jdbc:simon:h2:file:test) @param info properties for connection @return open connection to database or null if provided url is not accepted by this driver @throws java.sql.SQLE...
[ "Opens", "new", "Simon", "proxy", "driver", "connection", "associated", "with", "real", "connection", "to", "the", "specified", "database", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/jdbc41/src/main/java/org/javasimon/jdbc4/Driver.java#L97-L107
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java
SimonConsolePlugin.addResource
public final void addResource(String path, HtmlResourceType type) { resources.add(new HtmlResource(path, type)); }
java
public final void addResource(String path, HtmlResourceType type) { resources.add(new HtmlResource(path, type)); }
[ "public", "final", "void", "addResource", "(", "String", "path", ",", "HtmlResourceType", "type", ")", "{", "resources", ".", "add", "(", "new", "HtmlResource", "(", "path", ",", "type", ")", ")", ";", "}" ]
Add a resource to this plugin. @param path Resource path @param type Resource type
[ "Add", "a", "resource", "to", "this", "plugin", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java#L54-L56
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java
SimonConsolePlugin.getResources
public static List<HtmlResource> getResources(ActionContext context, Class<? extends SimonConsolePlugin> pluginType) { List<HtmlResource> resources = new ArrayList<>(); for (SimonConsolePlugin plugin : context.getPluginManager().getPluginsByType(pluginType)) { resources.addAll(plugin.getResources()); } ...
java
public static List<HtmlResource> getResources(ActionContext context, Class<? extends SimonConsolePlugin> pluginType) { List<HtmlResource> resources = new ArrayList<>(); for (SimonConsolePlugin plugin : context.getPluginManager().getPluginsByType(pluginType)) { resources.addAll(plugin.getResources()); } ...
[ "public", "static", "List", "<", "HtmlResource", ">", "getResources", "(", "ActionContext", "context", ",", "Class", "<", "?", "extends", "SimonConsolePlugin", ">", "pluginType", ")", "{", "List", "<", "HtmlResource", ">", "resources", "=", "new", "ArrayList", ...
Gather resources used by all Detail plugins in the plugin manager @param context Context containing plugin manager @return Detail plugins resources.
[ "Gather", "resources", "used", "by", "all", "Detail", "plugins", "in", "the", "plugin", "manager" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java#L69-L75
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java
SimonConsolePlugin.toJson
public final ObjectJS toJson(StringifierFactory jsonStringifierFactory) { final ObjectJS pluginJS = new ObjectJS(); final Stringifier<String> stringStringifier = jsonStringifierFactory.getStringifier(String.class); pluginJS.setSimpleAttribute("id", getId(), stringStringifier); pluginJS.setSimpleAttribute("l...
java
public final ObjectJS toJson(StringifierFactory jsonStringifierFactory) { final ObjectJS pluginJS = new ObjectJS(); final Stringifier<String> stringStringifier = jsonStringifierFactory.getStringifier(String.class); pluginJS.setSimpleAttribute("id", getId(), stringStringifier); pluginJS.setSimpleAttribute("l...
[ "public", "final", "ObjectJS", "toJson", "(", "StringifierFactory", "jsonStringifierFactory", ")", "{", "final", "ObjectJS", "pluginJS", "=", "new", "ObjectJS", "(", ")", ";", "final", "Stringifier", "<", "String", ">", "stringStringifier", "=", "jsonStringifierFact...
Serialize plugin data into a JSON object @param jsonStringifierFactory Stringifier factory @return JSON object representing plugin
[ "Serialize", "plugin", "data", "into", "a", "JSON", "object" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java#L83-L92
train
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/SimonManagerMXBeanImpl.java
SimonManagerMXBeanImpl.sampleCounter
private org.javasimon.jmx.CounterSample sampleCounter(Simon counter) { return new CounterSample((org.javasimon.CounterSample) counter.sample()); }
java
private org.javasimon.jmx.CounterSample sampleCounter(Simon counter) { return new CounterSample((org.javasimon.CounterSample) counter.sample()); }
[ "private", "org", ".", "javasimon", ".", "jmx", ".", "CounterSample", "sampleCounter", "(", "Simon", "counter", ")", "{", "return", "new", "CounterSample", "(", "(", "org", ".", "javasimon", ".", "CounterSample", ")", "counter", ".", "sample", "(", ")", ")...
Create a JMX Counter Sample from a Sample @param counter Counter
[ "Create", "a", "JMX", "Counter", "Sample", "from", "a", "Sample" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/SimonManagerMXBeanImpl.java#L117-L119
train
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/SimonManagerMXBeanImpl.java
SimonManagerMXBeanImpl.getCounterSamples
@Override public List<CounterSample> getCounterSamples(String namePattern) { List<CounterSample> counterSamples = new ArrayList<>(); for (Simon simon : manager.getSimons(SimonPattern.createForCounter(namePattern))) { counterSamples.add(sampleCounter(simon)); } return counterSamples; }
java
@Override public List<CounterSample> getCounterSamples(String namePattern) { List<CounterSample> counterSamples = new ArrayList<>(); for (Simon simon : manager.getSimons(SimonPattern.createForCounter(namePattern))) { counterSamples.add(sampleCounter(simon)); } return counterSamples; }
[ "@", "Override", "public", "List", "<", "CounterSample", ">", "getCounterSamples", "(", "String", "namePattern", ")", "{", "List", "<", "CounterSample", ">", "counterSamples", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Simon", "simon", ":", ...
Sample all Counters whose name matches given pattern @param namePattern Name pattern, null means all Counters @return One Sample for each Counter
[ "Sample", "all", "Counters", "whose", "name", "matches", "given", "pattern" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/SimonManagerMXBeanImpl.java#L152-L159
train
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/SimonManagerMXBeanImpl.java
SimonManagerMXBeanImpl.sampleStopwatch
private org.javasimon.jmx.StopwatchSample sampleStopwatch(Simon s) { return new StopwatchSample((org.javasimon.StopwatchSample) s.sample()); }
java
private org.javasimon.jmx.StopwatchSample sampleStopwatch(Simon s) { return new StopwatchSample((org.javasimon.StopwatchSample) s.sample()); }
[ "private", "org", ".", "javasimon", ".", "jmx", ".", "StopwatchSample", "sampleStopwatch", "(", "Simon", "s", ")", "{", "return", "new", "StopwatchSample", "(", "(", "org", ".", "javasimon", ".", "StopwatchSample", ")", "s", ".", "sample", "(", ")", ")", ...
Create a JMX Stopwatch Sample from a Stopwatch @param s Stopwatch
[ "Create", "a", "JMX", "Stopwatch", "Sample", "from", "a", "Stopwatch" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/SimonManagerMXBeanImpl.java#L192-L194
train
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java
JmxRegisterCallback.onSimonDestroyed
@Override public final void onSimonDestroyed(Simon simon) { String name = constructObjectName(simon); unregisterSimon(name); }
java
@Override public final void onSimonDestroyed(Simon simon) { String name = constructObjectName(simon); unregisterSimon(name); }
[ "@", "Override", "public", "final", "void", "onSimonDestroyed", "(", "Simon", "simon", ")", "{", "String", "name", "=", "constructObjectName", "(", "simon", ")", ";", "unregisterSimon", "(", "name", ")", ";", "}" ]
When the Simon is destroyed, its MX bean is unregistered. @param simon destroyed Simon
[ "When", "the", "Simon", "is", "destroyed", "its", "MX", "bean", "is", "unregistered", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java#L94-L98
train
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java
JmxRegisterCallback.unregisterAllSimons
private synchronized void unregisterAllSimons() { Iterator<String> namesIter = registeredNames.iterator(); while (namesIter.hasNext()) { String name = namesIter.next(); try { ObjectName objectName = new ObjectName(name); mBeanServer.unregisterMBean(objectName); // I have to use iterator.remove() -...
java
private synchronized void unregisterAllSimons() { Iterator<String> namesIter = registeredNames.iterator(); while (namesIter.hasNext()) { String name = namesIter.next(); try { ObjectName objectName = new ObjectName(name); mBeanServer.unregisterMBean(objectName); // I have to use iterator.remove() -...
[ "private", "synchronized", "void", "unregisterAllSimons", "(", ")", "{", "Iterator", "<", "String", ">", "namesIter", "=", "registeredNames", ".", "iterator", "(", ")", ";", "while", "(", "namesIter", ".", "hasNext", "(", ")", ")", "{", "String", "name", "...
Unregister all previously registered Simons.
[ "Unregister", "all", "previously", "registered", "Simons", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java#L118-L132
train
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java
JmxRegisterCallback.register
protected final void register(Simon simon) { Object mBean = constructObject(simon); String name = constructObjectName(simon); registerSimonBean(mBean, name); }
java
protected final void register(Simon simon) { Object mBean = constructObject(simon); String name = constructObjectName(simon); registerSimonBean(mBean, name); }
[ "protected", "final", "void", "register", "(", "Simon", "simon", ")", "{", "Object", "mBean", "=", "constructObject", "(", "simon", ")", ";", "String", "name", "=", "constructObjectName", "(", "simon", ")", ";", "registerSimonBean", "(", "mBean", ",", "name"...
Method registering Simon MX Bean - can not be overridden, but can be used in subclasses. @param simon Simon MX Bean to be registered @since 3.1
[ "Method", "registering", "Simon", "MX", "Bean", "-", "can", "not", "be", "overridden", "but", "can", "be", "used", "in", "subclasses", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java#L145-L149
train
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java
JmxRegisterCallback.constructObject
protected SimonSuperMXBean constructObject(Simon simon) { SimonSuperMXBean simonMxBean; if (simon instanceof Counter) { simonMxBean = new CounterMXBeanImpl((Counter) simon); } else if (simon instanceof Stopwatch) { simonMxBean = new StopwatchMXBeanImpl((Stopwatch) simon); } else { onManagerWarning("Unk...
java
protected SimonSuperMXBean constructObject(Simon simon) { SimonSuperMXBean simonMxBean; if (simon instanceof Counter) { simonMxBean = new CounterMXBeanImpl((Counter) simon); } else if (simon instanceof Stopwatch) { simonMxBean = new StopwatchMXBeanImpl((Stopwatch) simon); } else { onManagerWarning("Unk...
[ "protected", "SimonSuperMXBean", "constructObject", "(", "Simon", "simon", ")", "{", "SimonSuperMXBean", "simonMxBean", ";", "if", "(", "simon", "instanceof", "Counter", ")", "{", "simonMxBean", "=", "new", "CounterMXBeanImpl", "(", "(", "Counter", ")", "simon", ...
Constructs JMX object from Simon object. Method can be overridden. @param simon Simon object @return JMX object (=MBean) representing the Simon
[ "Constructs", "JMX", "object", "from", "Simon", "object", ".", "Method", "can", "be", "overridden", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/JmxRegisterCallback.java#L175-L186
train
virgo47/javasimon
examples/src/main/java/org/javasimon/examples/LoopingRandomMethod.java
LoopingRandomMethod.main
public static void main(String[] args) { Stopwatch stopwatch = SimonManager.getStopwatch("stopwatch"); for (int i = 1; i <= 10; i++) { try (Split ignored = SimonManager.getStopwatch("stopwatch").start()) { ExampleUtils.waitRandomlySquared(50); } System.out.println("Stopwatch after round " + i + ": " + ...
java
public static void main(String[] args) { Stopwatch stopwatch = SimonManager.getStopwatch("stopwatch"); for (int i = 1; i <= 10; i++) { try (Split ignored = SimonManager.getStopwatch("stopwatch").start()) { ExampleUtils.waitRandomlySquared(50); } System.out.println("Stopwatch after round " + i + ": " + ...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "Stopwatch", "stopwatch", "=", "SimonManager", ".", "getStopwatch", "(", "\"stopwatch\"", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "10", ";", "i", "++",...
Entry point to the Example. @param args unused
[ "Entry", "point", "to", "the", "Example", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/LoopingRandomMethod.java#L16-L25
train
virgo47/javasimon
core/src/main/java/org/javasimon/callback/async/Executors.java
Executors.initAsyncExecutorService
private static synchronized ExecutorService initAsyncExecutorService() { if (ASYNC_EXECUTOR_SERVICE == null) { ASYNC_EXECUTOR_SERVICE = java.util.concurrent.Executors.newSingleThreadExecutor( new ThreadFactory() { public Thread newThread(Runnable r) { Thread thread = new Thread(r, "javasimon-as...
java
private static synchronized ExecutorService initAsyncExecutorService() { if (ASYNC_EXECUTOR_SERVICE == null) { ASYNC_EXECUTOR_SERVICE = java.util.concurrent.Executors.newSingleThreadExecutor( new ThreadFactory() { public Thread newThread(Runnable r) { Thread thread = new Thread(r, "javasimon-as...
[ "private", "static", "synchronized", "ExecutorService", "initAsyncExecutorService", "(", ")", "{", "if", "(", "ASYNC_EXECUTOR_SERVICE", "==", "null", ")", "{", "ASYNC_EXECUTOR_SERVICE", "=", "java", ".", "util", ".", "concurrent", ".", "Executors", ".", "newSingleTh...
Initializes default single threaded executor service.
[ "Initializes", "default", "single", "threaded", "executor", "service", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/async/Executors.java#L35-L47
train
virgo47/javasimon
examples/src/main/java/org/javasimon/examples/AggregationExample.java
AggregationExample.main
public static void main(String[] args) { System.out.println("Wait for it... (~10s or more)"); for (int i = 0; i < ITERATIONS; i++) { try (Split ignored = SimonManager.getStopwatch(STOPWATCH_PARENT + Manager.HIERARCHY_DELIMITER + random.nextInt(STOPWATCH_COUNT)).start()) { ExampleUtils.waitRandomlySquared...
java
public static void main(String[] args) { System.out.println("Wait for it... (~10s or more)"); for (int i = 0; i < ITERATIONS; i++) { try (Split ignored = SimonManager.getStopwatch(STOPWATCH_PARENT + Manager.HIERARCHY_DELIMITER + random.nextInt(STOPWATCH_COUNT)).start()) { ExampleUtils.waitRandomlySquared...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "System", ".", "out", ".", "println", "(", "\"Wait for it... (~10s or more)\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ITERATIONS", ";", "i", "++", ")...
Entry point to the Aggregation Example. @param args unused
[ "Entry", "point", "to", "the", "Aggregation", "Example", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/AggregationExample.java#L33-L56
train
virgo47/javasimon
jdbc41/src/main/java/org/javasimon/jdbc4/SimonStatement.java
SimonStatement.startSplit
protected Split startSplit() { Stopwatch stopwatch = SimonManager.getStopwatch(sqlCmdLabel + Manager.HIERARCHY_DELIMITER + sqlNormalizer.getNormalizedSql().hashCode()); if (stopwatch.getNote() == null) { stopwatch.setNote(sqlNormalizer.getNormalizedSql()); } return stopwatch.start(); }
java
protected Split startSplit() { Stopwatch stopwatch = SimonManager.getStopwatch(sqlCmdLabel + Manager.HIERARCHY_DELIMITER + sqlNormalizer.getNormalizedSql().hashCode()); if (stopwatch.getNote() == null) { stopwatch.setNote(sqlNormalizer.getNormalizedSql()); } return stopwatch.start(); }
[ "protected", "Split", "startSplit", "(", ")", "{", "Stopwatch", "stopwatch", "=", "SimonManager", ".", "getStopwatch", "(", "sqlCmdLabel", "+", "Manager", ".", "HIERARCHY_DELIMITER", "+", "sqlNormalizer", ".", "getNormalizedSql", "(", ")", ".", "hashCode", "(", ...
Starts the split for the SQL specific stopwatch, sets the note and returns the split. Used in the statment and prepared statement classes to measure runs of "execute" methods. @return split for the execution of the specific SQL command
[ "Starts", "the", "split", "for", "the", "SQL", "specific", "stopwatch", "sets", "the", "note", "and", "returns", "the", "split", ".", "Used", "in", "the", "statment", "and", "prepared", "statement", "classes", "to", "measure", "runs", "of", "execute", "metho...
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/jdbc41/src/main/java/org/javasimon/jdbc4/SimonStatement.java#L136-L142
train
virgo47/javasimon
jdbc41/src/main/java/org/javasimon/jdbc4/SimonStatement.java
SimonStatement.addBatch
@Override public final void addBatch(String s) throws SQLException { batchSql.add(s); stmt.addBatch(s); }
java
@Override public final void addBatch(String s) throws SQLException { batchSql.add(s); stmt.addBatch(s); }
[ "@", "Override", "public", "final", "void", "addBatch", "(", "String", "s", ")", "throws", "SQLException", "{", "batchSql", ".", "add", "(", "s", ")", ";", "stmt", ".", "addBatch", "(", "s", ")", ";", "}" ]
Adds given SQL command into batch list of sql and also into real batch. @param s sql command @throws java.sql.SQLException if real calls fails
[ "Adds", "given", "SQL", "command", "into", "batch", "list", "of", "sql", "and", "also", "into", "real", "batch", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/jdbc41/src/main/java/org/javasimon/jdbc4/SimonStatement.java#L330-L335
train
virgo47/javasimon
core/src/main/java/org/javasimon/ManagerConfiguration.java
ManagerConfiguration.readConfig
public void readConfig(Reader reader) throws IOException { try { XMLStreamReader xr = XMLInputFactory.newInstance().createXMLStreamReader(reader); try { while (!xr.isStartElement()) { xr.next(); } processStartElement(xr, "simon-configuration"); while (true) { if (isStartTag(xr, "callba...
java
public void readConfig(Reader reader) throws IOException { try { XMLStreamReader xr = XMLInputFactory.newInstance().createXMLStreamReader(reader); try { while (!xr.isStartElement()) { xr.next(); } processStartElement(xr, "simon-configuration"); while (true) { if (isStartTag(xr, "callba...
[ "public", "void", "readConfig", "(", "Reader", "reader", ")", "throws", "IOException", "{", "try", "{", "XMLStreamReader", "xr", "=", "XMLInputFactory", ".", "newInstance", "(", ")", ".", "createXMLStreamReader", "(", "reader", ")", ";", "try", "{", "while", ...
Reads config from provided buffered reader. Reader is not closed after this method finishes. @param reader reader containing configuration @throws IOException thrown if problem occurs while reading from the reader
[ "Reads", "config", "from", "provided", "buffered", "reader", ".", "Reader", "is", "not", "closed", "after", "this", "method", "finishes", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/ManagerConfiguration.java#L72-L100
train
virgo47/javasimon
core/src/main/java/org/javasimon/ManagerConfiguration.java
ManagerConfiguration.setProperty
private void setProperty(Callback callback, String property, String value) { try { if (value != null) { SimonBeanUtils.getInstance().setProperty(callback, property, value); } else { callback.getClass().getMethod(setterName(property)).invoke(callback); } } catch (NoSuchMethodException | InvocationTa...
java
private void setProperty(Callback callback, String property, String value) { try { if (value != null) { SimonBeanUtils.getInstance().setProperty(callback, property, value); } else { callback.getClass().getMethod(setterName(property)).invoke(callback); } } catch (NoSuchMethodException | InvocationTa...
[ "private", "void", "setProperty", "(", "Callback", "callback", ",", "String", "property", ",", "String", "value", ")", "{", "try", "{", "if", "(", "value", "!=", "null", ")", "{", "SimonBeanUtils", ".", "getInstance", "(", ")", ".", "setProperty", "(", "...
Sets the callback property. @param callback callback object @param property name of the property @param value value of the property
[ "Sets", "the", "callback", "property", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/ManagerConfiguration.java#L200-L210
train
virgo47/javasimon
core/src/main/java/org/javasimon/ManagerConfiguration.java
ManagerConfiguration.getConfig
SimonConfiguration getConfig(String name) { SimonState state = null; for (SimonPattern pattern : configs.keySet()) { if (pattern.matches(name)) { SimonConfiguration config = configs.get(pattern); if (config.getState() != null) { state = config.getState(); } } } return new SimonConfigurat...
java
SimonConfiguration getConfig(String name) { SimonState state = null; for (SimonPattern pattern : configs.keySet()) { if (pattern.matches(name)) { SimonConfiguration config = configs.get(pattern); if (config.getState() != null) { state = config.getState(); } } } return new SimonConfigurat...
[ "SimonConfiguration", "getConfig", "(", "String", "name", ")", "{", "SimonState", "state", "=", "null", ";", "for", "(", "SimonPattern", "pattern", ":", "configs", ".", "keySet", "(", ")", ")", "{", "if", "(", "pattern", ".", "matches", "(", "name", ")",...
Returns configuration for the Simon with the specified name. @param name Simon name @return configuration for that particular Simon
[ "Returns", "configuration", "for", "the", "Simon", "with", "the", "specified", "name", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/ManagerConfiguration.java#L230-L242
train
virgo47/javasimon
core/src/main/java/org/javasimon/SimonPattern.java
SimonPattern.matches
public boolean matches(String name) { if (name == null) { return pattern.equals(""); } if (all != null) { return all.equals(name); } if (middle != null) { return name.contains(middle); } if (start != null && !name.startsWith(start)) { return false; } return end == null || name.endsWith(en...
java
public boolean matches(String name) { if (name == null) { return pattern.equals(""); } if (all != null) { return all.equals(name); } if (middle != null) { return name.contains(middle); } if (start != null && !name.startsWith(start)) { return false; } return end == null || name.endsWith(en...
[ "public", "boolean", "matches", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "pattern", ".", "equals", "(", "\"\"", ")", ";", "}", "if", "(", "all", "!=", "null", ")", "{", "return", "all", ".", "equals", ...
Checks if Simon name matches this pattern. @param name tested name @return true if tested pattern matches this pattern
[ "Checks", "if", "Simon", "name", "matches", "this", "pattern", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/SimonPattern.java#L168-L183
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java
GetterFactory.isGetterMethod
private static boolean isGetterMethod(Method method) { return !Modifier.isStatic(method.getModifiers()) && (method.getName().startsWith("get") || method.getName().startsWith("is")) && method.getParameterTypes().length == 0; }
java
private static boolean isGetterMethod(Method method) { return !Modifier.isStatic(method.getModifiers()) && (method.getName().startsWith("get") || method.getName().startsWith("is")) && method.getParameterTypes().length == 0; }
[ "private", "static", "boolean", "isGetterMethod", "(", "Method", "method", ")", "{", "return", "!", "Modifier", ".", "isStatic", "(", "method", ".", "getModifiers", "(", ")", ")", "&&", "(", "method", ".", "getName", "(", ")", ".", "startsWith", "(", "\"...
Test whether method is a getter.
[ "Test", "whether", "method", "is", "a", "getter", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java#L24-L28
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java
GetterFactory.getPropertyName
private static String getPropertyName(Method method) { String propertyName = method.getName(); if (propertyName.startsWith("get")) { propertyName = propertyName.substring(3); } else if (propertyName.startsWith("is")) { propertyName = propertyName.substring(2); } propertyName = propertyName.substr...
java
private static String getPropertyName(Method method) { String propertyName = method.getName(); if (propertyName.startsWith("get")) { propertyName = propertyName.substring(3); } else if (propertyName.startsWith("is")) { propertyName = propertyName.substring(2); } propertyName = propertyName.substr...
[ "private", "static", "String", "getPropertyName", "(", "Method", "method", ")", "{", "String", "propertyName", "=", "method", ".", "getName", "(", ")", ";", "if", "(", "propertyName", ".", "startsWith", "(", "\"get\"", ")", ")", "{", "propertyName", "=", "...
Transform method name into property name.
[ "Transform", "method", "name", "into", "property", "name", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java#L31-L40
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java
GetterFactory.getSubType
private static String getSubType(Class type, String propertyName) { @SuppressWarnings("unchecked") Class normalizedType = SimonTypeFactory.normalizeType(type); if (normalizedType == null) { return null; } else { return subTypeProperties.getProperty(normalizedType.getName() + "." + propertyName); ...
java
private static String getSubType(Class type, String propertyName) { @SuppressWarnings("unchecked") Class normalizedType = SimonTypeFactory.normalizeType(type); if (normalizedType == null) { return null; } else { return subTypeProperties.getProperty(normalizedType.getName() + "." + propertyName); ...
[ "private", "static", "String", "getSubType", "(", "Class", "type", ",", "String", "propertyName", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Class", "normalizedType", "=", "SimonTypeFactory", ".", "normalizeType", "(", "type", ")", ";", "if",...
Get subtype for given Class and property. @param type Parent class @param propertyName Property name @return Sub type name
[ "Get", "subtype", "for", "given", "Class", "and", "property", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java#L61-L69
train
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java
GetterFactory.getGettersAsMap
private static Map<String, Getter> getGettersAsMap(Class type) { Map<String, Getter> typeGetters = GETTER_CACHE.get(type); if (typeGetters == null) { typeGetters = new HashMap<>(); for (Method method : type.getMethods()) { if (isGetterMethod(method)) { String propertyName = getPropertyName(meth...
java
private static Map<String, Getter> getGettersAsMap(Class type) { Map<String, Getter> typeGetters = GETTER_CACHE.get(type); if (typeGetters == null) { typeGetters = new HashMap<>(); for (Method method : type.getMethods()) { if (isGetterMethod(method)) { String propertyName = getPropertyName(meth...
[ "private", "static", "Map", "<", "String", ",", "Getter", ">", "getGettersAsMap", "(", "Class", "type", ")", "{", "Map", "<", "String", ",", "Getter", ">", "typeGetters", "=", "GETTER_CACHE", ".", "get", "(", "type", ")", ";", "if", "(", "typeGetters", ...
Extract all getters for given class. @param type Class @return Map property name &rarr; Getter
[ "Extract", "all", "getters", "for", "given", "class", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java#L88-L103
train