id
int32
0
165k
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
106,300
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
106,301
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
106,302
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
106,303
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
106,304
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
106,305
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
106,306
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
106,307
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
106,308
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
106,309
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
106,310
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
106,311
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
106,312
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
106,313
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
106,314
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
106,315
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
106,316
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
106,317
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
106,318
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
106,319
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
106,320
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
106,321
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
106,322
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
106,323
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
106,324
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
106,325
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
106,326
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
106,327
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
106,328
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
106,329
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
106,330
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
106,331
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
106,332
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
106,333
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
106,334
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
106,335
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
106,336
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
106,337
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
106,338
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
106,339
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
106,340
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
106,341
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
106,342
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
106,343
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
106,344
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
106,345
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
106,346
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
106,347
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
106,348
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
106,349
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
106,350
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
106,351
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
106,352
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
106,353
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
106,354
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
106,355
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
106,356
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
106,357
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
106,358
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
106,359
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
106,360
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
106,361
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
106,362
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
106,363
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
106,364
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
106,365
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
106,366
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java
GetterFactory.getGetter
@SuppressWarnings("unchecked") public static Getter getGetter(Class type, String name) { return getGettersAsMap(type).get(name); }
java
@SuppressWarnings("unchecked") public static Getter getGetter(Class type, String name) { return getGettersAsMap(type).get(name); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Getter", "getGetter", "(", "Class", "type", ",", "String", "name", ")", "{", "return", "getGettersAsMap", "(", "type", ")", ".", "get", "(", "name", ")", ";", "}" ]
Search getter for given class and property name. @param type Class @param name Property name @return Getter or null if not found
[ "Search", "getter", "for", "given", "class", "and", "property", "name", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java#L112-L115
106,367
virgo47/javasimon
core/src/main/java/org/javasimon/utils/LoggingCallback.java
LoggingCallback.onStopwatchStop
@Override public void onStopwatchStop(Split split, StopwatchSample sample) { logger.log(level, "SIMON STOP: " + sample.simonToString() + " (" + split.runningFor() + ")"); }
java
@Override public void onStopwatchStop(Split split, StopwatchSample sample) { logger.log(level, "SIMON STOP: " + sample.simonToString() + " (" + split.runningFor() + ")"); }
[ "@", "Override", "public", "void", "onStopwatchStop", "(", "Split", "split", ",", "StopwatchSample", "sample", ")", "{", "logger", ".", "log", "(", "level", ",", "\"SIMON STOP: \"", "+", "sample", ".", "simonToString", "(", ")", "+", "\" (\"", "+", "split", ...
Logs Simon stop on a specified log level.
[ "Logs", "Simon", "stop", "on", "a", "specified", "log", "level", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/LoggingCallback.java#L28-L31
106,368
virgo47/javasimon
core/src/main/java/org/javasimon/utils/LoggingCallback.java
LoggingCallback.onManagerWarning
@Override public void onManagerWarning(String warning, Exception cause) { logger.log(level, "SIMON WARNING: " + warning, cause); }
java
@Override public void onManagerWarning(String warning, Exception cause) { logger.log(level, "SIMON WARNING: " + warning, cause); }
[ "@", "Override", "public", "void", "onManagerWarning", "(", "String", "warning", ",", "Exception", "cause", ")", "{", "logger", ".", "log", "(", "level", ",", "\"SIMON WARNING: \"", "+", "warning", ",", "cause", ")", ";", "}" ]
Logs the warning on a specified log level. @param warning warning message @param cause throwable cause
[ "Logs", "the", "warning", "on", "a", "specified", "log", "level", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/LoggingCallback.java#L39-L42
106,369
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/plugin/QuantilesDetailPlugin.java
QuantilesDetailPlugin.htmlMessage
private void htmlMessage(DetailHtmlBuilder htmlBuilder, String message) throws IOException { htmlBuilder.beginRow() .labelCell("Message").valueCell(" colspan=\"3\"", message) .endRow(); }
java
private void htmlMessage(DetailHtmlBuilder htmlBuilder, String message) throws IOException { htmlBuilder.beginRow() .labelCell("Message").valueCell(" colspan=\"3\"", message) .endRow(); }
[ "private", "void", "htmlMessage", "(", "DetailHtmlBuilder", "htmlBuilder", ",", "String", "message", ")", "throws", "IOException", "{", "htmlBuilder", ".", "beginRow", "(", ")", ".", "labelCell", "(", "\"Message\"", ")", ".", "valueCell", "(", "\" colspan=\\\"3\\\...
Generate an HTML message row
[ "Generate", "an", "HTML", "message", "row" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/plugin/QuantilesDetailPlugin.java#L64-L68
106,370
virgo47/javasimon
spring/src/main/java/org/javasimon/spring/MonitoringInterceptor.java
MonitoringInterceptor.processInvoke
protected Object processInvoke(MethodInvocation invocation, Split split) throws Throwable { try { return invocation.proceed(); } catch (Throwable t) { split.stop(tagByExceptionType ? t.getClass().getSimpleName() : EXCEPTION_TAG); throw t; } }
java
protected Object processInvoke(MethodInvocation invocation, Split split) throws Throwable { try { return invocation.proceed(); } catch (Throwable t) { split.stop(tagByExceptionType ? t.getClass().getSimpleName() : EXCEPTION_TAG); throw t; } }
[ "protected", "Object", "processInvoke", "(", "MethodInvocation", "invocation", ",", "Split", "split", ")", "throws", "Throwable", "{", "try", "{", "return", "invocation", ".", "proceed", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "split", ...
Method stops the split @param invocation method invocation @param split running split for this monitored action @return return object from the method
[ "Method", "stops", "the", "split" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/spring/src/main/java/org/javasimon/spring/MonitoringInterceptor.java#L59-L66
106,371
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java
AutoQuantilesCallback.getOrCreateBucketsValues
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") private List<Long> getOrCreateBucketsValues(final Stopwatch stopwatch) { synchronized (stopwatch) { List<Long> values = getBucketsValues(stopwatch); if (values == null) { values = new ArrayList<>((int) warmupCounter); stopwatch....
java
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") private List<Long> getOrCreateBucketsValues(final Stopwatch stopwatch) { synchronized (stopwatch) { List<Long> values = getBucketsValues(stopwatch); if (values == null) { values = new ArrayList<>((int) warmupCounter); stopwatch....
[ "@", "SuppressWarnings", "(", "\"SynchronizationOnLocalVariableOrMethodParameter\"", ")", "private", "List", "<", "Long", ">", "getOrCreateBucketsValues", "(", "final", "Stopwatch", "stopwatch", ")", "{", "synchronized", "(", "stopwatch", ")", "{", "List", "<", "Long"...
Get the bucket values attribute or create it if it does not exist.
[ "Get", "the", "bucket", "values", "attribute", "or", "create", "it", "if", "it", "does", "not", "exist", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java#L78-L88
106,372
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java
AutoQuantilesCallback.getBucketsValues
@SuppressWarnings("unchecked") private List<Long> getBucketsValues(final Stopwatch stopwatch) { return (List<Long>) stopwatch.getAttribute(ATTR_NAME_BUCKETS_VALUES); }
java
@SuppressWarnings("unchecked") private List<Long> getBucketsValues(final Stopwatch stopwatch) { return (List<Long>) stopwatch.getAttribute(ATTR_NAME_BUCKETS_VALUES); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "List", "<", "Long", ">", "getBucketsValues", "(", "final", "Stopwatch", "stopwatch", ")", "{", "return", "(", "List", "<", "Long", ">", ")", "stopwatch", ".", "getAttribute", "(", "ATTR_NAME_BUCKE...
Get the bucket values attribute.
[ "Get", "the", "bucket", "values", "attribute", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java#L91-L94
106,373
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java
AutoQuantilesCallback.createBuckets
protected final Buckets createBuckets(Stopwatch stopwatch) { if (stopwatch.getCounter() > warmupCounter) { Buckets buckets = createBucketsAfterWarmup(stopwatch); // Add retained splits to buckets buckets.addValues(getBucketsValues(stopwatch)); removeBucketsValues(stopwatch); return buckets; } ...
java
protected final Buckets createBuckets(Stopwatch stopwatch) { if (stopwatch.getCounter() > warmupCounter) { Buckets buckets = createBucketsAfterWarmup(stopwatch); // Add retained splits to buckets buckets.addValues(getBucketsValues(stopwatch)); removeBucketsValues(stopwatch); return buckets; } ...
[ "protected", "final", "Buckets", "createBuckets", "(", "Stopwatch", "stopwatch", ")", "{", "if", "(", "stopwatch", ".", "getCounter", "(", ")", ">", "warmupCounter", ")", "{", "Buckets", "buckets", "=", "createBucketsAfterWarmup", "(", "stopwatch", ")", ";", "...
When warmup ends, buckets are create and retained splits are sorted in the buckets.
[ "When", "warmup", "ends", "buckets", "are", "create", "and", "retained", "splits", "are", "sorted", "in", "the", "buckets", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java#L124-L134
106,374
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java
AutoQuantilesCallback.onSimonCreated
@Override public void onSimonCreated(Simon simon) { if (simon instanceof Stopwatch) { Stopwatch stopwatch = (Stopwatch) simon; getOrCreateBucketsValues(stopwatch); } }
java
@Override public void onSimonCreated(Simon simon) { if (simon instanceof Stopwatch) { Stopwatch stopwatch = (Stopwatch) simon; getOrCreateBucketsValues(stopwatch); } }
[ "@", "Override", "public", "void", "onSimonCreated", "(", "Simon", "simon", ")", "{", "if", "(", "simon", "instanceof", "Stopwatch", ")", "{", "Stopwatch", "stopwatch", "=", "(", "Stopwatch", ")", "simon", ";", "getOrCreateBucketsValues", "(", "stopwatch", ")"...
When simon is created, the list containing Split values is added to stopwatch attributes.
[ "When", "simon", "is", "created", "the", "list", "containing", "Split", "values", "is", "added", "to", "stopwatch", "attributes", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/AutoQuantilesCallback.java#L137-L143
106,375
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java
CallTreeDetailPlugin.htmlTreeNode
private DetailHtmlBuilder htmlTreeNode(CallTreeNode node, DetailHtmlBuilder htmlBuilder, StringifierFactory htmlStringifierFactory) throws IOException { htmlBuilder.begin("li") .text(node.getName()).text(":&nbsp;"); if (node.getParent()!=null) { htmlBuilder .text(htmlStringifierFactory.toString(node....
java
private DetailHtmlBuilder htmlTreeNode(CallTreeNode node, DetailHtmlBuilder htmlBuilder, StringifierFactory htmlStringifierFactory) throws IOException { htmlBuilder.begin("li") .text(node.getName()).text(":&nbsp;"); if (node.getParent()!=null) { htmlBuilder .text(htmlStringifierFactory.toString(node....
[ "private", "DetailHtmlBuilder", "htmlTreeNode", "(", "CallTreeNode", "node", ",", "DetailHtmlBuilder", "htmlBuilder", ",", "StringifierFactory", "htmlStringifierFactory", ")", "throws", "IOException", "{", "htmlBuilder", ".", "begin", "(", "\"li\"", ")", ".", "text", ...
Generate a HTML call tree node list
[ "Generate", "a", "HTML", "call", "tree", "node", "list" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java#L73-L93
106,376
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java
CallTreeDetailPlugin.jsonMessage
private ObjectJS jsonMessage(String message, StringifierFactory jsonStringifierFactory) { ObjectJS callTreeJS = new ObjectJS(); callTreeJS.setSimpleAttribute("message", message, jsonStringifierFactory.getStringifier(String.class)); return callTreeJS; }
java
private ObjectJS jsonMessage(String message, StringifierFactory jsonStringifierFactory) { ObjectJS callTreeJS = new ObjectJS(); callTreeJS.setSimpleAttribute("message", message, jsonStringifierFactory.getStringifier(String.class)); return callTreeJS; }
[ "private", "ObjectJS", "jsonMessage", "(", "String", "message", ",", "StringifierFactory", "jsonStringifierFactory", ")", "{", "ObjectJS", "callTreeJS", "=", "new", "ObjectJS", "(", ")", ";", "callTreeJS", ".", "setSimpleAttribute", "(", "\"message\"", ",", "message...
Generate a JSON message object
[ "Generate", "a", "JSON", "message", "object" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java#L122-L126
106,377
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java
CallTreeDetailPlugin.jsonTreeNode
private ObjectJS jsonTreeNode(CallTreeNode node, StringifierFactory jsonStringifierFactory) { final ObjectJS nodeJS = ObjectJS.create(node, jsonStringifierFactory); if (!node.getChildren().isEmpty()) { final ArrayJS childNodesJS=new ArrayJS(node.getChildren().size()); for(CallTreeNode childNode:node.getCh...
java
private ObjectJS jsonTreeNode(CallTreeNode node, StringifierFactory jsonStringifierFactory) { final ObjectJS nodeJS = ObjectJS.create(node, jsonStringifierFactory); if (!node.getChildren().isEmpty()) { final ArrayJS childNodesJS=new ArrayJS(node.getChildren().size()); for(CallTreeNode childNode:node.getCh...
[ "private", "ObjectJS", "jsonTreeNode", "(", "CallTreeNode", "node", ",", "StringifierFactory", "jsonStringifierFactory", ")", "{", "final", "ObjectJS", "nodeJS", "=", "ObjectJS", ".", "create", "(", "node", ",", "jsonStringifierFactory", ")", ";", "if", "(", "!", ...
Generate a JSON call tree node object
[ "Generate", "a", "JSON", "call", "tree", "node", "object" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java#L130-L140
106,378
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java
CallTreeDetailPlugin.executeJson
@Override public ObjectJS executeJson(ActionContext context, StringifierFactory jsonStringifierFactory, Simon simon) { ObjectJS callTreeJS; if (isCallTreeCallbackRegistered(context)) { CallTree callTree = getData(simon); if (callTree == null) { callTreeJS = jsonMessage(NO_DATA_MESSAGE, jsonStringif...
java
@Override public ObjectJS executeJson(ActionContext context, StringifierFactory jsonStringifierFactory, Simon simon) { ObjectJS callTreeJS; if (isCallTreeCallbackRegistered(context)) { CallTree callTree = getData(simon); if (callTree == null) { callTreeJS = jsonMessage(NO_DATA_MESSAGE, jsonStringif...
[ "@", "Override", "public", "ObjectJS", "executeJson", "(", "ActionContext", "context", ",", "StringifierFactory", "jsonStringifierFactory", ",", "Simon", "simon", ")", "{", "ObjectJS", "callTreeJS", ";", "if", "(", "isCallTreeCallbackRegistered", "(", "context", ")", ...
Generate a JSON call tree object or an error string if no call tree
[ "Generate", "a", "JSON", "call", "tree", "object", "or", "an", "error", "string", "if", "no", "call", "tree" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java#L145-L160
106,379
virgo47/javasimon
core/src/main/java/org/javasimon/utils/GoogleInteractiveChartGenerator.java
GoogleInteractiveChartGenerator.barChart
public static String barChart(StopwatchSample[] samples, String title, double divisor, String unit) { final StringBuilder result = new StringBuilder("<html>\n" + " <head>\n" + " <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>\n" + " <script type=\"text/javascript\">\n" ...
java
public static String barChart(StopwatchSample[] samples, String title, double divisor, String unit) { final StringBuilder result = new StringBuilder("<html>\n" + " <head>\n" + " <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>\n" + " <script type=\"text/javascript\">\n" ...
[ "public", "static", "String", "barChart", "(", "StopwatchSample", "[", "]", "samples", ",", "String", "title", ",", "double", "divisor", ",", "String", "unit", ")", "{", "final", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "\"<html>\\n\"", "+"...
Generates Google bar chart HTML5 source code for the provided samples. @param samples stopwatch samples @param title chart title @param divisor value divisor. For example: if values are in ns and ms are required, divisor should be set to 1000000. @param unit unit shown after values under every bar - TODO currently not...
[ "Generates", "Google", "bar", "chart", "HTML5", "source", "code", "for", "the", "provided", "samples", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/GoogleInteractiveChartGenerator.java#L29-L68
106,380
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/JmxReporter.java
JmxReporter.forManager
static public JmxReporter forManager(Manager manager) { JmxReporter reporter = new JmxReporter(manager); reporter.setBeanName(DEFAULT_BEAN_NAME); reporter.simonDomain = DEFAULT_SIMON_DOMAIN; reporter.beanServer = ManagementFactory.getPlatformMBeanServer(); return reporter; }
java
static public JmxReporter forManager(Manager manager) { JmxReporter reporter = new JmxReporter(manager); reporter.setBeanName(DEFAULT_BEAN_NAME); reporter.simonDomain = DEFAULT_SIMON_DOMAIN; reporter.beanServer = ManagementFactory.getPlatformMBeanServer(); return reporter; }
[ "static", "public", "JmxReporter", "forManager", "(", "Manager", "manager", ")", "{", "JmxReporter", "reporter", "=", "new", "JmxReporter", "(", "manager", ")", ";", "reporter", ".", "setBeanName", "(", "DEFAULT_BEAN_NAME", ")", ";", "reporter", ".", "simonDomai...
Creates new JmxReporter for the specified manager with default values. @param manager manager that will be used by JmxReporter @return new JmxReporter
[ "Creates", "new", "JmxReporter", "for", "the", "specified", "manager", "with", "default", "values", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/JmxReporter.java#L74-L82
106,381
virgo47/javasimon
core/src/main/java/org/javasimon/jmx/JmxReporter.java
JmxReporter.start
public JmxReporter start() { SimonManagerMXBean simonManagerMXBean = new SimonManagerMXBeanImpl(manager); registerMXBean(simonManagerMXBean, beanName); if (registerSimons) { jmxRegisterCallback = new JmxRegisterCallback(beanServer, simonDomain); if (registerExistingSimons) { jmxRegisterCallback.setRegi...
java
public JmxReporter start() { SimonManagerMXBean simonManagerMXBean = new SimonManagerMXBeanImpl(manager); registerMXBean(simonManagerMXBean, beanName); if (registerSimons) { jmxRegisterCallback = new JmxRegisterCallback(beanServer, simonDomain); if (registerExistingSimons) { jmxRegisterCallback.setRegi...
[ "public", "JmxReporter", "start", "(", ")", "{", "SimonManagerMXBean", "simonManagerMXBean", "=", "new", "SimonManagerMXBeanImpl", "(", "manager", ")", ";", "registerMXBean", "(", "simonManagerMXBean", ",", "beanName", ")", ";", "if", "(", "registerSimons", ")", "...
Starts JmxReporter - registers all required beans in JMX bean server.
[ "Starts", "JmxReporter", "-", "registers", "all", "required", "beans", "in", "JMX", "bean", "server", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/jmx/JmxReporter.java#L206-L218
106,382
virgo47/javasimon
core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java
LastSplits.processFunction
private <T> T processFunction(SplitFunction<T> function) { synchronized (splits) { if (splits.isEmpty()) { return null; } for (Split split : splits) { function.evaluate(split); } return function.result(); } }
java
private <T> T processFunction(SplitFunction<T> function) { synchronized (splits) { if (splits.isEmpty()) { return null; } for (Split split : splits) { function.evaluate(split); } return function.result(); } }
[ "private", "<", "T", ">", "T", "processFunction", "(", "SplitFunction", "<", "T", ">", "function", ")", "{", "synchronized", "(", "splits", ")", "{", "if", "(", "splits", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "for", "(", "...
Evaluate a function over the list of splits. @param <T> Function result type @param function Function to evaluate @return Function result, null if no splits
[ "Evaluate", "a", "function", "over", "the", "list", "of", "splits", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java#L80-L90
106,383
virgo47/javasimon
core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java
LastSplits.getMean
public Double getMean() { return processFunction(new AbstractSplitFunction<Double>(0.0D) { @Override public void evaluate(long runningFor) { result += (double) runningFor; } @Override public Double result() { return result / (double) splits.size(); } }); }
java
public Double getMean() { return processFunction(new AbstractSplitFunction<Double>(0.0D) { @Override public void evaluate(long runningFor) { result += (double) runningFor; } @Override public Double result() { return result / (double) splits.size(); } }); }
[ "public", "Double", "getMean", "(", ")", "{", "return", "processFunction", "(", "new", "AbstractSplitFunction", "<", "Double", ">", "(", "0.0D", ")", "{", "@", "Override", "public", "void", "evaluate", "(", "long", "runningFor", ")", "{", "result", "+=", "...
Compute mean duration of splits in the buffer @return Mean or average
[ "Compute", "mean", "duration", "of", "splits", "in", "the", "buffer" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java#L154-L167
106,384
virgo47/javasimon
core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java
LastSplits.getMin
public Long getMin() { return processFunction(new AbstractSplitFunction<Long>(Long.MAX_VALUE) { @Override public void evaluate(long runningFor) { if (runningFor < result) { result = runningFor; } } }); }
java
public Long getMin() { return processFunction(new AbstractSplitFunction<Long>(Long.MAX_VALUE) { @Override public void evaluate(long runningFor) { if (runningFor < result) { result = runningFor; } } }); }
[ "public", "Long", "getMin", "(", ")", "{", "return", "processFunction", "(", "new", "AbstractSplitFunction", "<", "Long", ">", "(", "Long", ".", "MAX_VALUE", ")", "{", "@", "Override", "public", "void", "evaluate", "(", "long", "runningFor", ")", "{", "if"...
Compute the smallest duration of splits in the buffer @return Minimum
[ "Compute", "the", "smallest", "duration", "of", "splits", "in", "the", "buffer" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java#L174-L183
106,385
virgo47/javasimon
core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java
LastSplits.getMax
public Long getMax() { return processFunction(new AbstractSplitFunction<Long>(Long.MIN_VALUE) { @Override public void evaluate(long runningFor) { if (runningFor > result) { result = runningFor; } } }); }
java
public Long getMax() { return processFunction(new AbstractSplitFunction<Long>(Long.MIN_VALUE) { @Override public void evaluate(long runningFor) { if (runningFor > result) { result = runningFor; } } }); }
[ "public", "Long", "getMax", "(", ")", "{", "return", "processFunction", "(", "new", "AbstractSplitFunction", "<", "Long", ">", "(", "Long", ".", "MIN_VALUE", ")", "{", "@", "Override", "public", "void", "evaluate", "(", "long", "runningFor", ")", "{", "if"...
Compute the longest duration of splits in the buffer @return Maximum
[ "Compute", "the", "longest", "duration", "of", "splits", "in", "the", "buffer" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java#L190-L199
106,386
virgo47/javasimon
core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java
LastSplits.getSplitsAsString
private String getSplitsAsString() { return processFunction(new AbstractSplitFunction<StringBuilder>(new StringBuilder()) { private boolean first = true; @Override public void evaluate(long runningFor) { if (first) { first = false; } else { result.append(','); } result.a...
java
private String getSplitsAsString() { return processFunction(new AbstractSplitFunction<StringBuilder>(new StringBuilder()) { private boolean first = true; @Override public void evaluate(long runningFor) { if (first) { first = false; } else { result.append(','); } result.a...
[ "private", "String", "getSplitsAsString", "(", ")", "{", "return", "processFunction", "(", "new", "AbstractSplitFunction", "<", "StringBuilder", ">", "(", "new", "StringBuilder", "(", ")", ")", "{", "private", "boolean", "first", "=", "true", ";", "@", "Overri...
Transforms split values into a String @return Splits presented in a String
[ "Transforms", "split", "values", "into", "a", "String" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/lastsplits/LastSplits.java#L253-L267
106,387
virgo47/javasimon
core/src/main/java/org/javasimon/callback/FilterRule.java
FilterRule.checkCondition
public synchronized boolean checkCondition(Simon simon, Object... params) throws ScriptException { if (condition == null) { return true; } if (simon instanceof Stopwatch) { return checkStopwtach((Stopwatch) simon, params); } if (simon instanceof Counter) { return checkCounter((Counter) simon,...
java
public synchronized boolean checkCondition(Simon simon, Object... params) throws ScriptException { if (condition == null) { return true; } if (simon instanceof Stopwatch) { return checkStopwtach((Stopwatch) simon, params); } if (simon instanceof Counter) { return checkCounter((Counter) simon,...
[ "public", "synchronized", "boolean", "checkCondition", "(", "Simon", "simon", ",", "Object", "...", "params", ")", "throws", "ScriptException", "{", "if", "(", "condition", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "simon", "instanceof",...
Checks the Simon and optional parameters against the condition specified for a rule. @param simon related Simon @param params optional parameters, e.g. value that is added to a Counter @return true if no condition is specified or the condition is satisfied, otherwise false @throws javax.script.ScriptException possible...
[ "Checks", "the", "Simon", "and", "optional", "parameters", "against", "the", "condition", "specified", "for", "a", "rule", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/FilterRule.java#L174-L185
106,388
virgo47/javasimon
jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java
SimonConnectionConfiguration.getProperty
private static String getProperty(String driverId, String propertyName) { String propertyValue = PROPERTIES.getProperty(DEFAULT_PREFIX + "." + driverId + "." + propertyName); if (propertyValue != null) { propertyValue = propertyValue.trim(); if (propertyValue.isEmpty()) { propertyValue = null; } } ...
java
private static String getProperty(String driverId, String propertyName) { String propertyValue = PROPERTIES.getProperty(DEFAULT_PREFIX + "." + driverId + "." + propertyName); if (propertyValue != null) { propertyValue = propertyValue.trim(); if (propertyValue.isEmpty()) { propertyValue = null; } } ...
[ "private", "static", "String", "getProperty", "(", "String", "driverId", ",", "String", "propertyName", ")", "{", "String", "propertyValue", "=", "PROPERTIES", ".", "getProperty", "(", "DEFAULT_PREFIX", "+", "\".\"", "+", "driverId", "+", "\".\"", "+", "property...
Gets value of the specified property. @param driverId Driver Id @param propertyName Property name @return property value or {@code null}
[ "Gets", "value", "of", "the", "specified", "property", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java#L156-L165
106,389
virgo47/javasimon
jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java
SimonConnectionConfiguration.isSimonUrl
public static boolean isSimonUrl(String url) { return url != null && url.toLowerCase().startsWith(SimonConnectionConfiguration.URL_PREFIX); }
java
public static boolean isSimonUrl(String url) { return url != null && url.toLowerCase().startsWith(SimonConnectionConfiguration.URL_PREFIX); }
[ "public", "static", "boolean", "isSimonUrl", "(", "String", "url", ")", "{", "return", "url", "!=", "null", "&&", "url", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "SimonConnectionConfiguration", ".", "URL_PREFIX", ")", ";", "}" ]
Tests whether URL is a Simon JDBC connection URL.
[ "Tests", "whether", "URL", "is", "a", "Simon", "JDBC", "connection", "URL", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java#L215-L217
106,390
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java
CallTreeNode.getPercent
public Integer getPercent() { Integer percent; if (parent == null) { percent = null; } else { percent = (int) (getTotal() * 100L / getParent().getTotal()); } return percent; }
java
public Integer getPercent() { Integer percent; if (parent == null) { percent = null; } else { percent = (int) (getTotal() * 100L / getParent().getTotal()); } return percent; }
[ "public", "Integer", "getPercent", "(", ")", "{", "Integer", "percent", ";", "if", "(", "parent", "==", "null", ")", "{", "percent", "=", "null", ";", "}", "else", "{", "percent", "=", "(", "int", ")", "(", "getTotal", "(", ")", "*", "100L", "/", ...
Returns the part of time spent in this node compared to parent. @return Percent time
[ "Returns", "the", "part", "of", "time", "spent", "in", "this", "node", "compared", "to", "parent", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java#L101-L109
106,391
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java
CallTreeNode.addChild
public CallTreeNode addChild(String name) { if (children == null) { children = new HashMap<>(); } CallTreeNode child = new CallTreeNode(name); children.put(name, child); child.parent = this; return child; }
java
public CallTreeNode addChild(String name) { if (children == null) { children = new HashMap<>(); } CallTreeNode child = new CallTreeNode(name); children.put(name, child); child.parent = this; return child; }
[ "public", "CallTreeNode", "addChild", "(", "String", "name", ")", "{", "if", "(", "children", "==", "null", ")", "{", "children", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "CallTreeNode", "child", "=", "new", "CallTreeNode", "(", "name", ")", ";...
Adds a child to this tree node. @param name Child Simon name @return Created child node
[ "Adds", "a", "child", "to", "this", "tree", "node", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java#L117-L125
106,392
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java
CallTreeNode.getChild
public CallTreeNode getChild(String name) { return (children == null) ? null : children.get(name); }
java
public CallTreeNode getChild(String name) { return (children == null) ? null : children.get(name); }
[ "public", "CallTreeNode", "getChild", "(", "String", "name", ")", "{", "return", "(", "children", "==", "null", ")", "?", "null", ":", "children", ".", "get", "(", "name", ")", ";", "}" ]
Returns the child node by Simon name. @param name Simon name @return Child corresponding to given name, or null if any
[ "Returns", "the", "child", "node", "by", "Simon", "name", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java#L133-L135
106,393
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java
CallTreeNode.getChildren
public Collection<CallTreeNode> getChildren() { return children == null ? Collections.<CallTreeNode>emptyList() : children.values(); }
java
public Collection<CallTreeNode> getChildren() { return children == null ? Collections.<CallTreeNode>emptyList() : children.values(); }
[ "public", "Collection", "<", "CallTreeNode", ">", "getChildren", "(", ")", "{", "return", "children", "==", "null", "?", "Collections", ".", "<", "CallTreeNode", ">", "emptyList", "(", ")", ":", "children", ".", "values", "(", ")", ";", "}" ]
Returns all child nodes. @return children
[ "Returns", "all", "child", "nodes", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java#L142-L144
106,394
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java
CallTreeNode.getOrAddChild
public CallTreeNode getOrAddChild(String name) { CallTreeNode child = getChild(name); if (child == null) { child = addChild(name); } return child; }
java
public CallTreeNode getOrAddChild(String name) { CallTreeNode child = getChild(name); if (child == null) { child = addChild(name); } return child; }
[ "public", "CallTreeNode", "getOrAddChild", "(", "String", "name", ")", "{", "CallTreeNode", "child", "=", "getChild", "(", "name", ")", ";", "if", "(", "child", "==", "null", ")", "{", "child", "=", "addChild", "(", "name", ")", ";", "}", "return", "ch...
Returns a child node with given name or creates it if it does not exists. @param name Simon name @return Child node
[ "Returns", "a", "child", "node", "with", "given", "name", "or", "creates", "it", "if", "it", "does", "not", "exists", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java#L152-L158
106,395
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java
CallTreeNode.print
private void print(PrintWriter printWriter, String prefix, Long parentTotal) { long total = getTotal(); printWriter.print(prefix); printWriter.print(name); printWriter.print(' '); if (parentTotal != null && parentTotal != 0L) { printWriter.print(total * 100 / parentTotal); printWriter.print("%, "...
java
private void print(PrintWriter printWriter, String prefix, Long parentTotal) { long total = getTotal(); printWriter.print(prefix); printWriter.print(name); printWriter.print(' '); if (parentTotal != null && parentTotal != 0L) { printWriter.print(total * 100 / parentTotal); printWriter.print("%, "...
[ "private", "void", "print", "(", "PrintWriter", "printWriter", ",", "String", "prefix", ",", "Long", "parentTotal", ")", "{", "long", "total", "=", "getTotal", "(", ")", ";", "printWriter", ".", "print", "(", "prefix", ")", ";", "printWriter", ".", "print"...
Recursively prints this tree node to given print writer. @param printWriter Output print writer @param prefix Line prefix (used internally for indentation) @param parentTotal Duration of parent node (used to compute duration ratio for child nodes), null for root nodes
[ "Recursively", "prints", "this", "tree", "node", "to", "given", "print", "writer", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeNode.java#L176-L195
106,396
virgo47/javasimon
examples/src/main/java/org/javasimon/examples/jmx/JmxTaskProcessingSimulator.java
JmxTaskProcessingSimulator.main
@SuppressWarnings("InfiniteLoopStatement") public static void main(String[] args) throws Exception { LoggingCallback loggingCallback = new LoggingCallback(); loggingCallback.setLevel(Level.INFO); SimonManager.callback().addCallback(loggingCallback); Random random = new Random(); register(); try { while...
java
@SuppressWarnings("InfiniteLoopStatement") public static void main(String[] args) throws Exception { LoggingCallback loggingCallback = new LoggingCallback(); loggingCallback.setLevel(Level.INFO); SimonManager.callback().addCallback(loggingCallback); Random random = new Random(); register(); try { while...
[ "@", "SuppressWarnings", "(", "\"InfiniteLoopStatement\"", ")", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "LoggingCallback", "loggingCallback", "=", "new", "LoggingCallback", "(", ")", ";", "loggingCallba...
Entry point to the JMX task processing simulator. @param args unused @throws Exception whatever may happen in this crazy world
[ "Entry", "point", "to", "the", "JMX", "task", "processing", "simulator", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/jmx/JmxTaskProcessingSimulator.java#L92-L118
106,397
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonVisitors.java
SimonVisitors.visitTree
public static void visitTree(Simon simon, SimonVisitor visitor) throws IOException { visitor.visit(simon); for (Simon childSimon : simon.getChildren()) { visitTree(childSimon, visitor); } }
java
public static void visitTree(Simon simon, SimonVisitor visitor) throws IOException { visitor.visit(simon); for (Simon childSimon : simon.getChildren()) { visitTree(childSimon, visitor); } }
[ "public", "static", "void", "visitTree", "(", "Simon", "simon", ",", "SimonVisitor", "visitor", ")", "throws", "IOException", "{", "visitor", ".", "visit", "(", "simon", ")", ";", "for", "(", "Simon", "childSimon", ":", "simon", ".", "getChildren", "(", ")...
Visit Simons recursively as a tree starting from the specified Simon. @param simon Parent simon @param visitor Visitor @throws IOException
[ "Visit", "Simons", "recursively", "as", "a", "tree", "starting", "from", "the", "specified", "Simon", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonVisitors.java#L58-L63
106,398
virgo47/javasimon
core/src/main/java/org/javasimon/utils/StopwatchAggregate.java
StopwatchAggregate.addSample
void addSample(StopwatchSample sample) { total += sample.getTotal(); counter += sample.getCounter(); if (min > sample.getMin()) { min = sample.getMin(); minTimestamp = sample.getMinTimestamp(); } if (max < sample.getMax()) { max = sample.getMax(); maxTimestamp = sample.getMaxTimestamp(); } ...
java
void addSample(StopwatchSample sample) { total += sample.getTotal(); counter += sample.getCounter(); if (min > sample.getMin()) { min = sample.getMin(); minTimestamp = sample.getMinTimestamp(); } if (max < sample.getMax()) { max = sample.getMax(); maxTimestamp = sample.getMaxTimestamp(); } ...
[ "void", "addSample", "(", "StopwatchSample", "sample", ")", "{", "total", "+=", "sample", ".", "getTotal", "(", ")", ";", "counter", "+=", "sample", ".", "getCounter", "(", ")", ";", "if", "(", "min", ">", "sample", ".", "getMin", "(", ")", ")", "{",...
Add stopwatch sample to current statistics aggregate. @param sample - stopwatch sample that will be added to statistics aggregate
[ "Add", "stopwatch", "sample", "to", "current", "statistics", "aggregate", "." ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/StopwatchAggregate.java#L115-L135
106,399
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/FixedQuantilesCallback.java
FixedQuantilesCallback.createBuckets
@Override protected Buckets createBuckets(Stopwatch stopwatch) { return createBuckets(stopwatch, min * SimonClock.NANOS_IN_MILLIS, max * SimonClock.NANOS_IN_MILLIS, bucketNb); }
java
@Override protected Buckets createBuckets(Stopwatch stopwatch) { return createBuckets(stopwatch, min * SimonClock.NANOS_IN_MILLIS, max * SimonClock.NANOS_IN_MILLIS, bucketNb); }
[ "@", "Override", "protected", "Buckets", "createBuckets", "(", "Stopwatch", "stopwatch", ")", "{", "return", "createBuckets", "(", "stopwatch", ",", "min", "*", "SimonClock", ".", "NANOS_IN_MILLIS", ",", "max", "*", "SimonClock", ".", "NANOS_IN_MILLIS", ",", "bu...
Create buckets using callback attributes @param stopwatch Target stopwatch @return Created buckets
[ "Create", "buckets", "using", "callback", "attributes" ]
17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/FixedQuantilesCallback.java#L49-L52