repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.setAcquireRetryDelay | public void setAcquireRetryDelay(long acquireRetryDelay, TimeUnit timeUnit) {
this.acquireRetryDelayInMs = TimeUnit.MILLISECONDS.convert(acquireRetryDelay, timeUnit);
} | java | public void setAcquireRetryDelay(long acquireRetryDelay, TimeUnit timeUnit) {
this.acquireRetryDelayInMs = TimeUnit.MILLISECONDS.convert(acquireRetryDelay, timeUnit);
} | [
"public",
"void",
"setAcquireRetryDelay",
"(",
"long",
"acquireRetryDelay",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"this",
".",
"acquireRetryDelayInMs",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"acquireRetryDelay",
",",
"timeUnit",
")",
";",
"}"
... | Sets the number of ms to wait before attempting to obtain a connection again after a failure.
@param acquireRetryDelay the acquireRetryDelay to set
@param timeUnit time granularity | [
"Sets",
"the",
"number",
"of",
"ms",
"to",
"wait",
"before",
"attempting",
"to",
"obtain",
"a",
"connection",
"again",
"after",
"a",
"failure",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L767-L769 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.setQueryExecuteTimeLimit | public void setQueryExecuteTimeLimit(long queryExecuteTimeLimit, TimeUnit timeUnit) {
this.queryExecuteTimeLimitInMs = TimeUnit.MILLISECONDS.convert(queryExecuteTimeLimit, timeUnit);
} | java | public void setQueryExecuteTimeLimit(long queryExecuteTimeLimit, TimeUnit timeUnit) {
this.queryExecuteTimeLimitInMs = TimeUnit.MILLISECONDS.convert(queryExecuteTimeLimit, timeUnit);
} | [
"public",
"void",
"setQueryExecuteTimeLimit",
"(",
"long",
"queryExecuteTimeLimit",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"this",
".",
"queryExecuteTimeLimitInMs",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"queryExecuteTimeLimit",
",",
"timeUnit",
")... | Queries taking longer than this limit to execute are logged.
@param queryExecuteTimeLimit the limit to set in milliseconds.
@param timeUnit | [
"Queries",
"taking",
"longer",
"than",
"this",
"limit",
"to",
"execute",
"are",
"logged",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L919-L921 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.setConnectionTimeout | public void setConnectionTimeout(long connectionTimeout, TimeUnit timeUnit) {
this.connectionTimeoutInMs = TimeUnit.MILLISECONDS.convert(connectionTimeout, timeUnit);
} | java | public void setConnectionTimeout(long connectionTimeout, TimeUnit timeUnit) {
this.connectionTimeoutInMs = TimeUnit.MILLISECONDS.convert(connectionTimeout, timeUnit);
} | [
"public",
"void",
"setConnectionTimeout",
"(",
"long",
"connectionTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"this",
".",
"connectionTimeoutInMs",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"connectionTimeout",
",",
"timeUnit",
")",
";",
"}"
... | Sets the maximum time to wait before a call to getConnection is timed out.
Setting this to zero is similar to setting it to Long.MAX_VALUE
@param connectionTimeout
@param timeUnit the unit of the connectionTimeout argument | [
"Sets",
"the",
"maximum",
"time",
"to",
"wait",
"before",
"a",
"call",
"to",
"getConnection",
"is",
"timed",
"out",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L1027-L1029 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.setCloseConnectionWatchTimeout | public void setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout, TimeUnit timeUnit) {
this.closeConnectionWatchTimeoutInMs = TimeUnit.MILLISECONDS.convert(closeConnectionWatchTimeout, timeUnit);
} | java | public void setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout, TimeUnit timeUnit) {
this.closeConnectionWatchTimeoutInMs = TimeUnit.MILLISECONDS.convert(closeConnectionWatchTimeout, timeUnit);
} | [
"public",
"void",
"setCloseConnectionWatchTimeout",
"(",
"long",
"closeConnectionWatchTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"this",
".",
"closeConnectionWatchTimeoutInMs",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"closeConnectionWatchTimeout",
... | Sets the time to wait when close connection watch threads are enabled. 0 = wait forever.
@param closeConnectionWatchTimeout the watchTimeout to set
@param timeUnit Time granularity | [
"Sets",
"the",
"time",
"to",
"wait",
"when",
"close",
"connection",
"watch",
"threads",
"are",
"enabled",
".",
"0",
"=",
"wait",
"forever",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L1106-L1108 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.setMaxConnectionAge | public void setMaxConnectionAge(long maxConnectionAge, TimeUnit timeUnit) {
this.maxConnectionAgeInSeconds = TimeUnit.SECONDS.convert(maxConnectionAge, timeUnit);
} | java | public void setMaxConnectionAge(long maxConnectionAge, TimeUnit timeUnit) {
this.maxConnectionAgeInSeconds = TimeUnit.SECONDS.convert(maxConnectionAge, timeUnit);
} | [
"public",
"void",
"setMaxConnectionAge",
"(",
"long",
"maxConnectionAge",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"this",
".",
"maxConnectionAgeInSeconds",
"=",
"TimeUnit",
".",
"SECONDS",
".",
"convert",
"(",
"maxConnectionAge",
",",
"timeUnit",
")",
";",
"}"
] | Sets the maxConnectionAge. Any connections older than this setting will be closed
off whether it is idle or not. Connections currently in use will not be affected until they
are returned to the pool.
@param maxConnectionAge the maxConnectionAge to set.
@param timeUnit the unit of the maxConnectionAge argument. | [
"Sets",
"the",
"maxConnectionAge",
".",
"Any",
"connections",
"older",
"than",
"this",
"setting",
"will",
"be",
"closed",
"off",
"whether",
"it",
"is",
"idle",
"or",
"not",
".",
"Connections",
"currently",
"in",
"use",
"will",
"not",
"be",
"affected",
"until... | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L1200-L1202 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.parseXML | private Properties parseXML(Document doc, String sectionName) {
int found = -1;
Properties results = new Properties();
NodeList config = null;
if (sectionName == null){
config = doc.getElementsByTagName("default-config");
found = 0;
} else {
config = doc.getElementsByTagName("named-config");
if(co... | java | private Properties parseXML(Document doc, String sectionName) {
int found = -1;
Properties results = new Properties();
NodeList config = null;
if (sectionName == null){
config = doc.getElementsByTagName("default-config");
found = 0;
} else {
config = doc.getElementsByTagName("named-config");
if(co... | [
"private",
"Properties",
"parseXML",
"(",
"Document",
"doc",
",",
"String",
"sectionName",
")",
"{",
"int",
"found",
"=",
"-",
"1",
";",
"Properties",
"results",
"=",
"new",
"Properties",
"(",
")",
";",
"NodeList",
"config",
"=",
"null",
";",
"if",
"(",
... | Parses the given XML doc to extract the properties and return them into a java.util.Properties.
@param doc to parse
@param sectionName which section to extract
@return Properties map | [
"Parses",
"the",
"given",
"XML",
"doc",
"to",
"extract",
"the",
"properties",
"and",
"return",
"them",
"into",
"a",
"java",
".",
"util",
".",
"Properties",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L1485-L1535 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.loadClass | protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
if (this.classLoader == null){
return Class.forName(clazz);
}
return Class.forName(clazz, true, this.classLoader);
} | java | protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
if (this.classLoader == null){
return Class.forName(clazz);
}
return Class.forName(clazz, true, this.classLoader);
} | [
"protected",
"Class",
"<",
"?",
">",
"loadClass",
"(",
"String",
"clazz",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"this",
".",
"classLoader",
"==",
"null",
")",
"{",
"return",
"Class",
".",
"forName",
"(",
"clazz",
")",
";",
"}",
"return... | Loads the given class, respecting the given classloader.
@param clazz class to load
@return Loaded class
@throws ClassNotFoundException | [
"Loads",
"the",
"given",
"class",
"respecting",
"the",
"given",
"classloader",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L1755-L1762 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.hasSameConfiguration | public boolean hasSameConfiguration(BoneCPConfig that){
if ( that != null && Objects.equal(this.acquireIncrement, that.getAcquireIncrement())
&& Objects.equal(this.acquireRetryDelayInMs, that.getAcquireRetryDelayInMs())
&& Objects.equal(this.closeConnectionWatch, that.isCloseConnectionWatch())
&& Objects.... | java | public boolean hasSameConfiguration(BoneCPConfig that){
if ( that != null && Objects.equal(this.acquireIncrement, that.getAcquireIncrement())
&& Objects.equal(this.acquireRetryDelayInMs, that.getAcquireRetryDelayInMs())
&& Objects.equal(this.closeConnectionWatch, that.isCloseConnectionWatch())
&& Objects.... | [
"public",
"boolean",
"hasSameConfiguration",
"(",
"BoneCPConfig",
"that",
")",
"{",
"if",
"(",
"that",
"!=",
"null",
"&&",
"Objects",
".",
"equal",
"(",
"this",
".",
"acquireIncrement",
",",
"that",
".",
"getAcquireIncrement",
"(",
")",
")",
"&&",
"Objects",... | Returns true if this instance has the same config as a given config.
@param that
@return true if the instance has the same config, false otherwise. | [
"Returns",
"true",
"if",
"this",
"instance",
"has",
"the",
"same",
"config",
"as",
"a",
"given",
"config",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L1797-L1832 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/AbstractConnectionStrategy.java | AbstractConnectionStrategy.preConnection | protected long preConnection() throws SQLException{
long statsObtainTime = 0;
if (this.pool.poolShuttingDown){
throw new SQLException(this.pool.shutdownStackTrace);
}
if (this.pool.statisticsEnabled){
statsObtainTime = System.nanoTime();
this.pool.statistics.incrementConnectionsRequested... | java | protected long preConnection() throws SQLException{
long statsObtainTime = 0;
if (this.pool.poolShuttingDown){
throw new SQLException(this.pool.shutdownStackTrace);
}
if (this.pool.statisticsEnabled){
statsObtainTime = System.nanoTime();
this.pool.statistics.incrementConnectionsRequested... | [
"protected",
"long",
"preConnection",
"(",
")",
"throws",
"SQLException",
"{",
"long",
"statsObtainTime",
"=",
"0",
";",
"if",
"(",
"this",
".",
"pool",
".",
"poolShuttingDown",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"this",
".",
"pool",
".",
"shut... | Prep for a new connection
@return if stats are enabled, return the nanoTime when this connection was requested.
@throws SQLException | [
"Prep",
"for",
"a",
"new",
"connection"
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/AbstractConnectionStrategy.java#L48-L62 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/AbstractConnectionStrategy.java | AbstractConnectionStrategy.postConnection | protected void postConnection(ConnectionHandle handle, long statsObtainTime){
handle.renewConnection(); // mark it as being logically "open"
// Give an application a chance to do something with it.
if (handle.getConnectionHook() != null){
handle.getConnectionHook().onCheckOut(handle);
}
if (thi... | java | protected void postConnection(ConnectionHandle handle, long statsObtainTime){
handle.renewConnection(); // mark it as being logically "open"
// Give an application a chance to do something with it.
if (handle.getConnectionHook() != null){
handle.getConnectionHook().onCheckOut(handle);
}
if (thi... | [
"protected",
"void",
"postConnection",
"(",
"ConnectionHandle",
"handle",
",",
"long",
"statsObtainTime",
")",
"{",
"handle",
".",
"renewConnection",
"(",
")",
";",
"// mark it as being logically \"open\"\r",
"// Give an application a chance to do something with it.\r",
"if",
... | After obtaining a connection, perform additional tasks.
@param handle
@param statsObtainTime | [
"After",
"obtaining",
"a",
"connection",
"perform",
"additional",
"tasks",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/AbstractConnectionStrategy.java#L69-L85 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPDataSource.java | BoneCPDataSource.getPool | public BoneCP getPool() {
FinalWrapper<BoneCP> wrapper = this.pool;
return wrapper == null ? null : wrapper.value;
} | java | public BoneCP getPool() {
FinalWrapper<BoneCP> wrapper = this.pool;
return wrapper == null ? null : wrapper.value;
} | [
"public",
"BoneCP",
"getPool",
"(",
")",
"{",
"FinalWrapper",
"<",
"BoneCP",
">",
"wrapper",
"=",
"this",
".",
"pool",
";",
"return",
"wrapper",
"==",
"null",
"?",
"null",
":",
"wrapper",
".",
"value",
";",
"}"
] | Returns a handle to the pool. Useful to obtain a handle to the
statistics for example.
@return pool | [
"Returns",
"a",
"handle",
"to",
"the",
"pool",
".",
"Useful",
"to",
"obtain",
"a",
"handle",
"to",
"the",
"statistics",
"for",
"example",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPDataSource.java#L297-L300 | train |
wwadge/bonecp | bonecp-hbnprovider/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java | BoneCPConnectionProvider.configure | public void configure(Properties props) throws HibernateException {
try{
this.config = new BoneCPConfig(props);
// old hibernate config
String url = props.getProperty(CONFIG_CONNECTION_URL);
String username = props.getProperty(CONFIG_CONNECTION_USERNAME);
String password = props.getProperty(CON... | java | public void configure(Properties props) throws HibernateException {
try{
this.config = new BoneCPConfig(props);
// old hibernate config
String url = props.getProperty(CONFIG_CONNECTION_URL);
String username = props.getProperty(CONFIG_CONNECTION_USERNAME);
String password = props.getProperty(CON... | [
"public",
"void",
"configure",
"(",
"Properties",
"props",
")",
"throws",
"HibernateException",
"{",
"try",
"{",
"this",
".",
"config",
"=",
"new",
"BoneCPConfig",
"(",
"props",
")",
";",
"// old hibernate config\r",
"String",
"url",
"=",
"props",
".",
"getPro... | Pool configuration.
@param props
@throws HibernateException | [
"Pool",
"configuration",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp-hbnprovider/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java#L94-L145 | train |
wwadge/bonecp | bonecp-hbnprovider/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java | BoneCPConnectionProvider.createPool | protected BoneCP createPool(BoneCPConfig config) {
try{
return new BoneCP(config);
} catch (SQLException e) {
throw new HibernateException(e);
}
} | java | protected BoneCP createPool(BoneCPConfig config) {
try{
return new BoneCP(config);
} catch (SQLException e) {
throw new HibernateException(e);
}
} | [
"protected",
"BoneCP",
"createPool",
"(",
"BoneCPConfig",
"config",
")",
"{",
"try",
"{",
"return",
"new",
"BoneCP",
"(",
"config",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"HibernateException",
"(",
"e",
")",
";",
"}",... | Creates the given connection pool with the given configuration. Extracted here to make unit mocking easier.
@param config configuration object.
@return BoneCP connection pool handle. | [
"Creates",
"the",
"given",
"connection",
"pool",
"with",
"the",
"given",
"configuration",
".",
"Extracted",
"here",
"to",
"make",
"unit",
"mocking",
"easier",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp-hbnprovider/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java#L165-L171 | train |
wwadge/bonecp | bonecp-hbnprovider/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java | BoneCPConnectionProvider.mapToProperties | private Properties mapToProperties(Map<String, String> map) {
Properties p = new Properties();
for (Map.Entry<String,String> entry : map.entrySet()) {
p.put(entry.getKey(), entry.getValue());
}
return p;
} | java | private Properties mapToProperties(Map<String, String> map) {
Properties p = new Properties();
for (Map.Entry<String,String> entry : map.entrySet()) {
p.put(entry.getKey(), entry.getValue());
}
return p;
} | [
"private",
"Properties",
"mapToProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
... | Legacy conversion.
@param map
@return Properties | [
"Legacy",
"conversion",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp-hbnprovider/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java#L260-L266 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/CachedConnectionStrategy.java | CachedConnectionStrategy.stealExistingAllocations | protected synchronized void stealExistingAllocations(){
for (ConnectionHandle handle: this.threadFinalizableRefs.keySet()){
// if they're not in use, pretend they are in use now and close them off.
// this method assumes that the strategy has been flipped back to non-caching mode
// prior to this met... | java | protected synchronized void stealExistingAllocations(){
for (ConnectionHandle handle: this.threadFinalizableRefs.keySet()){
// if they're not in use, pretend they are in use now and close them off.
// this method assumes that the strategy has been flipped back to non-caching mode
// prior to this met... | [
"protected",
"synchronized",
"void",
"stealExistingAllocations",
"(",
")",
"{",
"for",
"(",
"ConnectionHandle",
"handle",
":",
"this",
".",
"threadFinalizableRefs",
".",
"keySet",
"(",
")",
")",
"{",
"// if they're not in use, pretend they are in use now and close them off.... | Tries to close off all the unused assigned connections back to the pool. Assumes that
the strategy mode has already been flipped prior to calling this routine.
Called whenever our no of connection requests > no of threads. | [
"Tries",
"to",
"close",
"off",
"all",
"the",
"unused",
"assigned",
"connections",
"back",
"to",
"the",
"pool",
".",
"Assumes",
"that",
"the",
"strategy",
"mode",
"has",
"already",
"been",
"flipped",
"prior",
"to",
"calling",
"this",
"routine",
".",
"Called",... | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/CachedConnectionStrategy.java#L84-L103 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/CachedConnectionStrategy.java | CachedConnectionStrategy.threadWatch | protected void threadWatch(final ConnectionHandle c) {
this.threadFinalizableRefs.put(c, new FinalizableWeakReference<Thread>(Thread.currentThread(), this.finalizableRefQueue) {
public void finalizeReferent() {
try {
if (!CachedConnectionStrategy.this.pool.poolShuttingDown){
logger.debug("Mo... | java | protected void threadWatch(final ConnectionHandle c) {
this.threadFinalizableRefs.put(c, new FinalizableWeakReference<Thread>(Thread.currentThread(), this.finalizableRefQueue) {
public void finalizeReferent() {
try {
if (!CachedConnectionStrategy.this.pool.poolShuttingDown){
logger.debug("Mo... | [
"protected",
"void",
"threadWatch",
"(",
"final",
"ConnectionHandle",
"c",
")",
"{",
"this",
".",
"threadFinalizableRefs",
".",
"put",
"(",
"c",
",",
"new",
"FinalizableWeakReference",
"<",
"Thread",
">",
"(",
"Thread",
".",
"currentThread",
"(",
")",
",",
"... | Keep track of this handle tied to which thread so that if the thread is terminated
we can reclaim our connection handle. We also
@param c connection handle to track. | [
"Keep",
"track",
"of",
"this",
"handle",
"tied",
"to",
"which",
"thread",
"so",
"that",
"if",
"the",
"thread",
"is",
"terminated",
"we",
"can",
"reclaim",
"our",
"connection",
"handle",
".",
"We",
"also"
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/CachedConnectionStrategy.java#L109-L123 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.shutdown | public synchronized void shutdown(){
if (!this.poolShuttingDown){
logger.info("Shutting down connection pool...");
this.poolShuttingDown = true;
this.shutdownStackTrace = captureStackTrace(SHUTDOWN_LOCATION_TRACE);
this.keepAliveScheduler.shutdownNow(); // stop threads from firing.
this.maxAliv... | java | public synchronized void shutdown(){
if (!this.poolShuttingDown){
logger.info("Shutting down connection pool...");
this.poolShuttingDown = true;
this.shutdownStackTrace = captureStackTrace(SHUTDOWN_LOCATION_TRACE);
this.keepAliveScheduler.shutdownNow(); // stop threads from firing.
this.maxAliv... | [
"public",
"synchronized",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"poolShuttingDown",
")",
"{",
"logger",
".",
"info",
"(",
"\"Shutting down connection pool...\"",
")",
";",
"this",
".",
"poolShuttingDown",
"=",
"true",
";",
"this",
"... | Closes off this connection pool. | [
"Closes",
"off",
"this",
"connection",
"pool",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L155-L189 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.unregisterDriver | protected void unregisterDriver(){
String jdbcURL = this.config.getJdbcUrl();
if ((jdbcURL != null) && this.config.isDeregisterDriverOnClose()){
logger.info("Unregistering JDBC driver for : "+jdbcURL);
try {
DriverManager.deregisterDriver(DriverManager.getDriver(jdbcURL));
} catch (SQLException e... | java | protected void unregisterDriver(){
String jdbcURL = this.config.getJdbcUrl();
if ((jdbcURL != null) && this.config.isDeregisterDriverOnClose()){
logger.info("Unregistering JDBC driver for : "+jdbcURL);
try {
DriverManager.deregisterDriver(DriverManager.getDriver(jdbcURL));
} catch (SQLException e... | [
"protected",
"void",
"unregisterDriver",
"(",
")",
"{",
"String",
"jdbcURL",
"=",
"this",
".",
"config",
".",
"getJdbcUrl",
"(",
")",
";",
"if",
"(",
"(",
"jdbcURL",
"!=",
"null",
")",
"&&",
"this",
".",
"config",
".",
"isDeregisterDriverOnClose",
"(",
"... | Drops a driver from the DriverManager's list. | [
"Drops",
"a",
"driver",
"from",
"the",
"DriverManager",
"s",
"list",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L192-L202 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.destroyConnection | protected void destroyConnection(ConnectionHandle conn) {
postDestroyConnection(conn);
conn.setInReplayMode(true); // we're dead, stop attempting to replay anything
try {
conn.internalClose();
} catch (SQLException e) {
logger.error("Error in attempting to close connection", e);
}
} | java | protected void destroyConnection(ConnectionHandle conn) {
postDestroyConnection(conn);
conn.setInReplayMode(true); // we're dead, stop attempting to replay anything
try {
conn.internalClose();
} catch (SQLException e) {
logger.error("Error in attempting to close connection", e);
}
} | [
"protected",
"void",
"destroyConnection",
"(",
"ConnectionHandle",
"conn",
")",
"{",
"postDestroyConnection",
"(",
"conn",
")",
";",
"conn",
".",
"setInReplayMode",
"(",
"true",
")",
";",
"// we're dead, stop attempting to replay anything\r",
"try",
"{",
"conn",
".",
... | Physically close off the internal connection.
@param conn | [
"Physically",
"close",
"off",
"the",
"internal",
"connection",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L214-L222 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.postDestroyConnection | protected void postDestroyConnection(ConnectionHandle handle){
ConnectionPartition partition = handle.getOriginatingPartition();
if (this.finalizableRefQueue != null && handle.getInternalConnection() != null){ //safety
this.finalizableRefs.remove(handle.getInternalConnection());
// assert o != null : ... | java | protected void postDestroyConnection(ConnectionHandle handle){
ConnectionPartition partition = handle.getOriginatingPartition();
if (this.finalizableRefQueue != null && handle.getInternalConnection() != null){ //safety
this.finalizableRefs.remove(handle.getInternalConnection());
// assert o != null : ... | [
"protected",
"void",
"postDestroyConnection",
"(",
"ConnectionHandle",
"handle",
")",
"{",
"ConnectionPartition",
"partition",
"=",
"handle",
".",
"getOriginatingPartition",
"(",
")",
";",
"if",
"(",
"this",
".",
"finalizableRefQueue",
"!=",
"null",
"&&",
"handle",
... | Update counters and call hooks.
@param handle connection handle. | [
"Update",
"counters",
"and",
"call",
"hooks",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L227-L244 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.obtainInternalConnection | protected Connection obtainInternalConnection(ConnectionHandle connectionHandle) throws SQLException {
boolean tryAgain = false;
Connection result = null;
Connection oldRawConnection = connectionHandle.getInternalConnection();
String url = this.getConfig().getJdbcUrl();
int acquireRetryAttempts = thi... | java | protected Connection obtainInternalConnection(ConnectionHandle connectionHandle) throws SQLException {
boolean tryAgain = false;
Connection result = null;
Connection oldRawConnection = connectionHandle.getInternalConnection();
String url = this.getConfig().getJdbcUrl();
int acquireRetryAttempts = thi... | [
"protected",
"Connection",
"obtainInternalConnection",
"(",
"ConnectionHandle",
"connectionHandle",
")",
"throws",
"SQLException",
"{",
"boolean",
"tryAgain",
"=",
"false",
";",
"Connection",
"result",
"=",
"null",
";",
"Connection",
"oldRawConnection",
"=",
"connection... | Obtains a database connection, retrying if necessary.
@param connectionHandle
@return A DB connection.
@throws SQLException | [
"Obtains",
"a",
"database",
"connection",
"retrying",
"if",
"necessary",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L251-L317 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.registerUnregisterJMX | protected void registerUnregisterJMX(boolean doRegister) {
if (this.mbs == null ){ // this way makes it easier for mocking.
this.mbs = ManagementFactory.getPlatformMBeanServer();
}
try {
String suffix = "";
if (this.config.getPoolName()!=null){
suffix="-"+this.config.getPoolName();
}
... | java | protected void registerUnregisterJMX(boolean doRegister) {
if (this.mbs == null ){ // this way makes it easier for mocking.
this.mbs = ManagementFactory.getPlatformMBeanServer();
}
try {
String suffix = "";
if (this.config.getPoolName()!=null){
suffix="-"+this.config.getPoolName();
}
... | [
"protected",
"void",
"registerUnregisterJMX",
"(",
"boolean",
"doRegister",
")",
"{",
"if",
"(",
"this",
".",
"mbs",
"==",
"null",
")",
"{",
"// this way makes it easier for mocking.\r",
"this",
".",
"mbs",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(... | Initialises JMX stuff.
@param doRegister if true, perform registration, if false unregister | [
"Initialises",
"JMX",
"stuff",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L508-L541 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.watchConnection | protected void watchConnection(ConnectionHandle connectionHandle) {
String message = captureStackTrace(UNCLOSED_EXCEPTION_MESSAGE);
this.closeConnectionExecutor.submit(new CloseThreadMonitor(Thread.currentThread(), connectionHandle, message, this.closeConnectionWatchTimeoutInMs));
} | java | protected void watchConnection(ConnectionHandle connectionHandle) {
String message = captureStackTrace(UNCLOSED_EXCEPTION_MESSAGE);
this.closeConnectionExecutor.submit(new CloseThreadMonitor(Thread.currentThread(), connectionHandle, message, this.closeConnectionWatchTimeoutInMs));
} | [
"protected",
"void",
"watchConnection",
"(",
"ConnectionHandle",
"connectionHandle",
")",
"{",
"String",
"message",
"=",
"captureStackTrace",
"(",
"UNCLOSED_EXCEPTION_MESSAGE",
")",
";",
"this",
".",
"closeConnectionExecutor",
".",
"submit",
"(",
"new",
"CloseThreadMoni... | Starts off a new thread to monitor this connection attempt.
@param connectionHandle to monitor | [
"Starts",
"off",
"a",
"new",
"thread",
"to",
"monitor",
"this",
"connection",
"attempt",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L557-L560 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.getAsyncConnection | public ListenableFuture<Connection> getAsyncConnection(){
return this.asyncExecutor.submit(new Callable<Connection>() {
public Connection call() throws Exception {
return getConnection();
}});
} | java | public ListenableFuture<Connection> getAsyncConnection(){
return this.asyncExecutor.submit(new Callable<Connection>() {
public Connection call() throws Exception {
return getConnection();
}});
} | [
"public",
"ListenableFuture",
"<",
"Connection",
">",
"getAsyncConnection",
"(",
")",
"{",
"return",
"this",
".",
"asyncExecutor",
".",
"submit",
"(",
"new",
"Callable",
"<",
"Connection",
">",
"(",
")",
"{",
"public",
"Connection",
"call",
"(",
")",
"throws... | Obtain a connection asynchronously by queueing a request to obtain a connection in a separate thread.
Use as follows:<p>
Future<Connection> result = pool.getAsyncConnection();<p>
... do something else in your application here ...<p>
Connection connection = result.get(); // get the connection<p>
@return A Future... | [
"Obtain",
"a",
"connection",
"asynchronously",
"by",
"queueing",
"a",
"request",
"to",
"obtain",
"a",
"connection",
"in",
"a",
"separate",
"thread",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L588-L595 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.maybeSignalForMoreConnections | protected void maybeSignalForMoreConnections(ConnectionPartition connectionPartition) {
if (!connectionPartition.isUnableToCreateMoreTransactions()
&& !this.poolShuttingDown &&
connectionPartition.getAvailableConnections()*100/connectionPartition.getMaxConnections() <= this.poolAvailabilityThreshold){
... | java | protected void maybeSignalForMoreConnections(ConnectionPartition connectionPartition) {
if (!connectionPartition.isUnableToCreateMoreTransactions()
&& !this.poolShuttingDown &&
connectionPartition.getAvailableConnections()*100/connectionPartition.getMaxConnections() <= this.poolAvailabilityThreshold){
... | [
"protected",
"void",
"maybeSignalForMoreConnections",
"(",
"ConnectionPartition",
"connectionPartition",
")",
"{",
"if",
"(",
"!",
"connectionPartition",
".",
"isUnableToCreateMoreTransactions",
"(",
")",
"&&",
"!",
"this",
".",
"poolShuttingDown",
"&&",
"connectionPartit... | Tests if this partition has hit a threshold and signal to the pool watch thread to create new connections
@param connectionPartition to test for. | [
"Tests",
"if",
"this",
"partition",
"has",
"hit",
"a",
"threshold",
"and",
"signal",
"to",
"the",
"pool",
"watch",
"thread",
"to",
"create",
"new",
"connections"
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L601-L608 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.internalReleaseConnection | protected void internalReleaseConnection(ConnectionHandle connectionHandle) throws SQLException {
if (!this.cachedPoolStrategy){
connectionHandle.clearStatementCaches(false);
}
if (connectionHandle.getReplayLog() != null){
connectionHandle.getReplayLog().clear();
connectionHandle.recoveryResult.g... | java | protected void internalReleaseConnection(ConnectionHandle connectionHandle) throws SQLException {
if (!this.cachedPoolStrategy){
connectionHandle.clearStatementCaches(false);
}
if (connectionHandle.getReplayLog() != null){
connectionHandle.getReplayLog().clear();
connectionHandle.recoveryResult.g... | [
"protected",
"void",
"internalReleaseConnection",
"(",
"ConnectionHandle",
"connectionHandle",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"this",
".",
"cachedPoolStrategy",
")",
"{",
"connectionHandle",
".",
"clearStatementCaches",
"(",
"false",
")",
";",
"... | Release a connection by placing the connection back in the pool.
@param connectionHandle Connection being released.
@throws SQLException | [
"Release",
"a",
"connection",
"by",
"placing",
"the",
"connection",
"back",
"in",
"the",
"pool",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L637-L671 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.putConnectionBackInPartition | protected void putConnectionBackInPartition(ConnectionHandle connectionHandle) throws SQLException {
if (this.cachedPoolStrategy && ((CachedConnectionStrategy)this.connectionStrategy).tlConnections.dumbGet().getValue()){
connectionHandle.logicallyClosed.set(true);
((CachedConnectionStrategy)this.connection... | java | protected void putConnectionBackInPartition(ConnectionHandle connectionHandle) throws SQLException {
if (this.cachedPoolStrategy && ((CachedConnectionStrategy)this.connectionStrategy).tlConnections.dumbGet().getValue()){
connectionHandle.logicallyClosed.set(true);
((CachedConnectionStrategy)this.connection... | [
"protected",
"void",
"putConnectionBackInPartition",
"(",
"ConnectionHandle",
"connectionHandle",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"cachedPoolStrategy",
"&&",
"(",
"(",
"CachedConnectionStrategy",
")",
"this",
".",
"connectionStrategy",
")",
... | Places a connection back in the originating partition.
@param connectionHandle to place back
@throws SQLException on error | [
"Places",
"a",
"connection",
"back",
"in",
"the",
"originating",
"partition",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L679-L692 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.isConnectionHandleAlive | public boolean isConnectionHandleAlive(ConnectionHandle connection) {
Statement stmt = null;
boolean result = false;
boolean logicallyClosed = connection.logicallyClosed.get();
try {
connection.logicallyClosed.compareAndSet(true, false); // avoid checks later on if it's marked as closed.
String test... | java | public boolean isConnectionHandleAlive(ConnectionHandle connection) {
Statement stmt = null;
boolean result = false;
boolean logicallyClosed = connection.logicallyClosed.get();
try {
connection.logicallyClosed.compareAndSet(true, false); // avoid checks later on if it's marked as closed.
String test... | [
"public",
"boolean",
"isConnectionHandleAlive",
"(",
"ConnectionHandle",
"connection",
")",
"{",
"Statement",
"stmt",
"=",
"null",
";",
"boolean",
"result",
"=",
"false",
";",
"boolean",
"logicallyClosed",
"=",
"connection",
".",
"logicallyClosed",
".",
"get",
"("... | Sends a dummy statement to the server to keep the connection alive
@param connection Connection handle to perform activity on
@return true if test query worked, false otherwise | [
"Sends",
"a",
"dummy",
"statement",
"to",
"the",
"server",
"to",
"keep",
"the",
"connection",
"alive"
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L699-L731 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.getTotalLeased | public int getTotalLeased(){
int total=0;
for (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){
total+=this.partitions[i].getCreatedConnections()-this.partitions[i].getAvailableConnections();
}
return total;
} | java | public int getTotalLeased(){
int total=0;
for (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){
total+=this.partitions[i].getCreatedConnections()-this.partitions[i].getAvailableConnections();
}
return total;
} | [
"public",
"int",
"getTotalLeased",
"(",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"partitionCount",
"&&",
"this",
".",
"partitions",
"[",
"i",
"]",
"!=",
"null",
";",
"i",
"++",
")",
... | Return total number of connections currently in use by an application
@return no of leased connections | [
"Return",
"total",
"number",
"of",
"connections",
"currently",
"in",
"use",
"by",
"an",
"application"
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L752-L758 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java | BoneCP.getTotalCreatedConnections | public int getTotalCreatedConnections(){
int total=0;
for (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){
total+=this.partitions[i].getCreatedConnections();
}
return total;
} | java | public int getTotalCreatedConnections(){
int total=0;
for (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){
total+=this.partitions[i].getCreatedConnections();
}
return total;
} | [
"public",
"int",
"getTotalCreatedConnections",
"(",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"partitionCount",
"&&",
"this",
".",
"partitions",
"[",
"i",
"]",
"!=",
"null",
";",
"i",
"++... | Return total number of connections created in all partitions.
@return number of created connections | [
"Return",
"total",
"number",
"of",
"connections",
"created",
"in",
"all",
"partitions",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCP.java#L777-L783 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/ConnectionPartition.java | ConnectionPartition.addFreeConnection | protected void addFreeConnection(ConnectionHandle connectionHandle) throws SQLException{
connectionHandle.setOriginatingPartition(this);
// assume success to avoid racing where we insert an item in a queue and having that item immediately
// taken and closed off thus decrementing the created connection count.
... | java | protected void addFreeConnection(ConnectionHandle connectionHandle) throws SQLException{
connectionHandle.setOriginatingPartition(this);
// assume success to avoid racing where we insert an item in a queue and having that item immediately
// taken and closed off thus decrementing the created connection count.
... | [
"protected",
"void",
"addFreeConnection",
"(",
"ConnectionHandle",
"connectionHandle",
")",
"throws",
"SQLException",
"{",
"connectionHandle",
".",
"setOriginatingPartition",
"(",
"this",
")",
";",
"// assume success to avoid racing where we insert an item in a queue and having tha... | Adds a free connection.
@param connectionHandle
@throws SQLException on error | [
"Adds",
"a",
"free",
"connection",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/ConnectionPartition.java#L108-L129 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/DefaultConnectionStrategy.java | DefaultConnectionStrategy.terminateAllConnections | public void terminateAllConnections(){
this.terminationLock.lock();
try{
// close off all connections.
for (int i=0; i < this.pool.partitionCount; i++) {
this.pool.partitions[i].setUnableToCreateMoreTransactions(false); // we can create new ones now, this is an optimization
List<ConnectionHandle... | java | public void terminateAllConnections(){
this.terminationLock.lock();
try{
// close off all connections.
for (int i=0; i < this.pool.partitionCount; i++) {
this.pool.partitions[i].setUnableToCreateMoreTransactions(false); // we can create new ones now, this is an optimization
List<ConnectionHandle... | [
"public",
"void",
"terminateAllConnections",
"(",
")",
"{",
"this",
".",
"terminationLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"// close off all connections.\r",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"pool",
".",
"partitionCoun... | Closes off all connections in all partitions. | [
"Closes",
"off",
"all",
"connections",
"in",
"all",
"partitions",
"."
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/DefaultConnectionStrategy.java#L103-L119 | train |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/StatementHandle.java | StatementHandle.queryTimerEnd | protected void queryTimerEnd(String sql, long queryStartTime) {
if ((this.queryExecuteTimeLimit != 0)
&& (this.connectionHook != null)){
long timeElapsed = (System.nanoTime() - queryStartTime);
if (timeElapsed > this.queryExecuteTimeLimit){
this.connectionHook.onQueryExecuteTimeLimitExceeded(... | java | protected void queryTimerEnd(String sql, long queryStartTime) {
if ((this.queryExecuteTimeLimit != 0)
&& (this.connectionHook != null)){
long timeElapsed = (System.nanoTime() - queryStartTime);
if (timeElapsed > this.queryExecuteTimeLimit){
this.connectionHook.onQueryExecuteTimeLimitExceeded(... | [
"protected",
"void",
"queryTimerEnd",
"(",
"String",
"sql",
",",
"long",
"queryStartTime",
")",
"{",
"if",
"(",
"(",
"this",
".",
"queryExecuteTimeLimit",
"!=",
"0",
")",
"&&",
"(",
"this",
".",
"connectionHook",
"!=",
"null",
")",
")",
"{",
"long",
"tim... | Call the onQueryExecuteTimeLimitExceeded hook if necessary
@param sql sql statement that took too long
@param queryStartTime time when query was started. | [
"Call",
"the",
"onQueryExecuteTimeLimitExceeded",
"hook",
"if",
"necessary"
] | 74bc3287025fc137ca28909f0f7693edae37a15d | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/StatementHandle.java#L274-L290 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/common/ProcessUtil.java | ProcessUtil.getMBeanServerConnection | public static MBeanServerConnection getMBeanServerConnection(Process p, boolean startAgent) {
try {
final JMXServiceURL serviceURL = getLocalConnectorAddress(p, startAgent);
final JMXConnector connector = JMXConnectorFactory.connect(serviceURL);
final MBeanServerConnection mb... | java | public static MBeanServerConnection getMBeanServerConnection(Process p, boolean startAgent) {
try {
final JMXServiceURL serviceURL = getLocalConnectorAddress(p, startAgent);
final JMXConnector connector = JMXConnectorFactory.connect(serviceURL);
final MBeanServerConnection mb... | [
"public",
"static",
"MBeanServerConnection",
"getMBeanServerConnection",
"(",
"Process",
"p",
",",
"boolean",
"startAgent",
")",
"{",
"try",
"{",
"final",
"JMXServiceURL",
"serviceURL",
"=",
"getLocalConnectorAddress",
"(",
"p",
",",
"startAgent",
")",
";",
"final",... | Connects to a child JVM process
@param p the process to which to connect
@param startAgent whether to installed the JMX agent in the target process if not already in place
@return an {@link MBeanServerConnection} to the process's MBean server | [
"Connects",
"to",
"a",
"child",
"JVM",
"process"
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/common/ProcessUtil.java#L67-L76 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/common/ProcessUtil.java | ProcessUtil.getLocalConnectorAddress | public static JMXServiceURL getLocalConnectorAddress(Process p, boolean startAgent) {
return getLocalConnectorAddress(Integer.toString(getPid(p)), startAgent);
} | java | public static JMXServiceURL getLocalConnectorAddress(Process p, boolean startAgent) {
return getLocalConnectorAddress(Integer.toString(getPid(p)), startAgent);
} | [
"public",
"static",
"JMXServiceURL",
"getLocalConnectorAddress",
"(",
"Process",
"p",
",",
"boolean",
"startAgent",
")",
"{",
"return",
"getLocalConnectorAddress",
"(",
"Integer",
".",
"toString",
"(",
"getPid",
"(",
"p",
")",
")",
",",
"startAgent",
")",
";",
... | Returns the JMX connector address of a child process.
@param p the process to which to connect
@param startAgent whether to installed the JMX agent in the target process if not already in place
@return a {@link JMXServiceURL} to the process's MBean server | [
"Returns",
"the",
"JMX",
"connector",
"address",
"of",
"a",
"child",
"process",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/common/ProcessUtil.java#L85-L87 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setAttribute | public final Jar setAttribute(String name, String value) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Manifest cannot be modified after entries are added.");
getManifest().getMainAttributes().putValue(name, value);
return this;
} | java | public final Jar setAttribute(String name, String value) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Manifest cannot be modified after entries are added.");
getManifest().getMainAttributes().putValue(name, value);
return this;
} | [
"public",
"final",
"Jar",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"verifyNotSealed",
"(",
")",
";",
"if",
"(",
"jos",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Manifest cannot be modified after entries are... | Sets an attribute in the main section of the manifest.
@param name the attribute's name
@param value the attribute's value
@return {@code this}
@throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods. | [
"Sets",
"an",
"attribute",
"in",
"the",
"main",
"section",
"of",
"the",
"manifest",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L135-L141 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setAttribute | public final Jar setAttribute(String section, String name, String value) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Manifest cannot be modified after entries are added.");
Attributes attr = getManifest().getAttributes(section);
if (attr == null) {
... | java | public final Jar setAttribute(String section, String name, String value) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Manifest cannot be modified after entries are added.");
Attributes attr = getManifest().getAttributes(section);
if (attr == null) {
... | [
"public",
"final",
"Jar",
"setAttribute",
"(",
"String",
"section",
",",
"String",
"name",
",",
"String",
"value",
")",
"{",
"verifyNotSealed",
"(",
")",
";",
"if",
"(",
"jos",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Manifest cann... | Sets an attribute in a non-main section of the manifest.
@param section the section's name
@param name the attribute's name
@param value the attribute's value
@return {@code this}
@throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods. | [
"Sets",
"an",
"attribute",
"in",
"a",
"non",
"-",
"main",
"section",
"of",
"the",
"manifest",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L152-L163 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setListAttribute | public Jar setListAttribute(String name, Collection<?> values) {
return setAttribute(name, join(values));
} | java | public Jar setListAttribute(String name, Collection<?> values) {
return setAttribute(name, join(values));
} | [
"public",
"Jar",
"setListAttribute",
"(",
"String",
"name",
",",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"return",
"setAttribute",
"(",
"name",
",",
"join",
"(",
"values",
")",
")",
";",
"}"
] | Sets an attribute in the main section of the manifest to a list.
The list elements will be joined with a single whitespace character.
@param name the attribute's name
@param values the attribute's value
@return {@code this}
@throws IllegalStateException if entries have been added or the JAR has been written prior to... | [
"Sets",
"an",
"attribute",
"in",
"the",
"main",
"section",
"of",
"the",
"manifest",
"to",
"a",
"list",
".",
"The",
"list",
"elements",
"will",
"be",
"joined",
"with",
"a",
"single",
"whitespace",
"character",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L174-L176 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setMapAttribute | public Jar setMapAttribute(String name, Map<String, ?> values) {
return setAttribute(name, join(values));
} | java | public Jar setMapAttribute(String name, Map<String, ?> values) {
return setAttribute(name, join(values));
} | [
"public",
"Jar",
"setMapAttribute",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"?",
">",
"values",
")",
"{",
"return",
"setAttribute",
"(",
"name",
",",
"join",
"(",
"values",
")",
")",
";",
"}"
] | Sets an attribute in the main section of the manifest to a map.
The map entries will be joined with a single whitespace character, and each key-value pair will be joined with a '='.
@param name the attribute's name
@param values the attribute's value
@return {@code this}
@throws IllegalStateException if entries have... | [
"Sets",
"an",
"attribute",
"in",
"the",
"main",
"section",
"of",
"the",
"manifest",
"to",
"a",
"map",
".",
"The",
"map",
"entries",
"will",
"be",
"joined",
"with",
"a",
"single",
"whitespace",
"character",
"and",
"each",
"key",
"-",
"value",
"pair",
"wil... | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L201-L203 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.getAttribute | public String getAttribute(String section, String name) {
Attributes attr = getManifest().getAttributes(section);
return attr != null ? attr.getValue(name) : null;
} | java | public String getAttribute(String section, String name) {
Attributes attr = getManifest().getAttributes(section);
return attr != null ? attr.getValue(name) : null;
} | [
"public",
"String",
"getAttribute",
"(",
"String",
"section",
",",
"String",
"name",
")",
"{",
"Attributes",
"attr",
"=",
"getManifest",
"(",
")",
".",
"getAttributes",
"(",
"section",
")",
";",
"return",
"attr",
"!=",
"null",
"?",
"attr",
".",
"getValue",... | Returns an attribute's value from a non-main section of this JAR's manifest.
@param section the manifest's section
@param name the attribute's name | [
"Returns",
"an",
"attribute",
"s",
"value",
"from",
"a",
"non",
"-",
"main",
"section",
"of",
"this",
"JAR",
"s",
"manifest",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L234-L237 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.getListAttribute | public List<String> getListAttribute(String section, String name) {
return split(getAttribute(section, name));
} | java | public List<String> getListAttribute(String section, String name) {
return split(getAttribute(section, name));
} | [
"public",
"List",
"<",
"String",
">",
"getListAttribute",
"(",
"String",
"section",
",",
"String",
"name",
")",
"{",
"return",
"split",
"(",
"getAttribute",
"(",
"section",
",",
"name",
")",
")",
";",
"}"
] | Returns an attribute's list value from a non-main section of this JAR's manifest.
The attributes string value will be split on whitespace into the returned list.
The returned list may be safely modified.
@param section the manifest's section
@param name the attribute's name | [
"Returns",
"an",
"attribute",
"s",
"list",
"value",
"from",
"a",
"non",
"-",
"main",
"section",
"of",
"this",
"JAR",
"s",
"manifest",
".",
"The",
"attributes",
"string",
"value",
"will",
"be",
"split",
"on",
"whitespace",
"into",
"the",
"returned",
"list",... | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L258-L260 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.getMapAttribute | public Map<String, String> getMapAttribute(String name, String defaultValue) {
return mapSplit(getAttribute(name), defaultValue);
} | java | public Map<String, String> getMapAttribute(String name, String defaultValue) {
return mapSplit(getAttribute(name), defaultValue);
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getMapAttribute",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"return",
"mapSplit",
"(",
"getAttribute",
"(",
"name",
")",
",",
"defaultValue",
")",
";",
"}"
] | Returns an attribute's map value from this JAR's manifest's main section.
The attributes string value will be split on whitespace into map entries, and each entry will be split on '=' to get the key-value pair.
The returned map may be safely modified.
@param name the attribute's name | [
"Returns",
"an",
"attribute",
"s",
"map",
"value",
"from",
"this",
"JAR",
"s",
"manifest",
"s",
"main",
"section",
".",
"The",
"attributes",
"string",
"value",
"will",
"be",
"split",
"on",
"whitespace",
"into",
"map",
"entries",
"and",
"each",
"entry",
"wi... | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L269-L271 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.addClass | public Jar addClass(Class<?> clazz) throws IOException {
final String resource = clazz.getName().replace('.', '/') + ".class";
return addEntry(resource, clazz.getClassLoader().getResourceAsStream(resource));
} | java | public Jar addClass(Class<?> clazz) throws IOException {
final String resource = clazz.getName().replace('.', '/') + ".class";
return addEntry(resource, clazz.getClassLoader().getResourceAsStream(resource));
} | [
"public",
"Jar",
"addClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"IOException",
"{",
"final",
"String",
"resource",
"=",
"clazz",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
";",
... | Adds a class entry to this JAR.
@param clazz the class to add to the JAR.
@return {@code this} | [
"Adds",
"a",
"class",
"entry",
"to",
"this",
"JAR",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L379-L382 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.addPackageOf | public Jar addPackageOf(Class<?> clazz, Filter filter) throws IOException {
try {
final String path = clazz.getPackage().getName().replace('.', '/');
URL dirURL = clazz.getClassLoader().getResource(path);
if (dirURL != null && dirURL.getProtocol().equals("file"))
... | java | public Jar addPackageOf(Class<?> clazz, Filter filter) throws IOException {
try {
final String path = clazz.getPackage().getName().replace('.', '/');
URL dirURL = clazz.getClassLoader().getResource(path);
if (dirURL != null && dirURL.getProtocol().equals("file"))
... | [
"public",
"Jar",
"addPackageOf",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Filter",
"filter",
")",
"throws",
"IOException",
"{",
"try",
"{",
"final",
"String",
"path",
"=",
"clazz",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
".",
"replace... | Adds the contents of a Java package to this JAR.
@param clazz a class whose package we wish to add to the JAR.
@param filter a filter to select particular classes
@return {@code this} | [
"Adds",
"the",
"contents",
"of",
"a",
"Java",
"package",
"to",
"this",
"JAR",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L487-L519 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setJarPrefix | public Jar setJarPrefix(String value) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Really executable cannot be set after entries are added.");
if (value != null && jarPrefixFile != null)
throw new IllegalStateException("A prefix has already been ... | java | public Jar setJarPrefix(String value) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Really executable cannot be set after entries are added.");
if (value != null && jarPrefixFile != null)
throw new IllegalStateException("A prefix has already been ... | [
"public",
"Jar",
"setJarPrefix",
"(",
"String",
"value",
")",
"{",
"verifyNotSealed",
"(",
")",
";",
"if",
"(",
"jos",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Really executable cannot be set after entries are added.\"",
")",
";",
"if",
... | Sets a string that will be prepended to the JAR file's data.
@param value the prefix, or {@code null} for none.
@return {@code this} | [
"Sets",
"a",
"string",
"that",
"will",
"be",
"prepended",
"to",
"the",
"JAR",
"file",
"s",
"data",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L592-L600 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setJarPrefix | public Jar setJarPrefix(Path file) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Really executable cannot be set after entries are added.");
if (file != null && jarPrefixStr != null)
throw new IllegalStateException("A prefix has already been set (... | java | public Jar setJarPrefix(Path file) {
verifyNotSealed();
if (jos != null)
throw new IllegalStateException("Really executable cannot be set after entries are added.");
if (file != null && jarPrefixStr != null)
throw new IllegalStateException("A prefix has already been set (... | [
"public",
"Jar",
"setJarPrefix",
"(",
"Path",
"file",
")",
"{",
"verifyNotSealed",
"(",
")",
";",
"if",
"(",
"jos",
"!=",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Really executable cannot be set after entries are added.\"",
")",
";",
"if",
"("... | Sets a file whose contents will be prepended to the JAR file's data.
@param file the prefix file, or {@code null} for none.
@return {@code this} | [
"Sets",
"a",
"file",
"whose",
"contents",
"will",
"be",
"prepended",
"to",
"the",
"JAR",
"file",
"s",
"data",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L608-L616 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.write | public <T extends OutputStream> T write(T os) throws IOException {
close();
if (!(this.os instanceof ByteArrayOutputStream))
throw new IllegalStateException("Cannot write to another target if setOutputStream has been called");
final byte[] content = ((ByteArrayOutputStream) this.os)... | java | public <T extends OutputStream> T write(T os) throws IOException {
close();
if (!(this.os instanceof ByteArrayOutputStream))
throw new IllegalStateException("Cannot write to another target if setOutputStream has been called");
final byte[] content = ((ByteArrayOutputStream) this.os)... | [
"public",
"<",
"T",
"extends",
"OutputStream",
">",
"T",
"write",
"(",
"T",
"os",
")",
"throws",
"IOException",
"{",
"close",
"(",
")",
";",
"if",
"(",
"!",
"(",
"this",
".",
"os",
"instanceof",
"ByteArrayOutputStream",
")",
")",
"throw",
"new",
"Illeg... | Writes this JAR to an output stream, and closes the stream. | [
"Writes",
"this",
"JAR",
"to",
"an",
"output",
"stream",
"and",
"closes",
"the",
"stream",
"."
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L702-L716 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java | CapsuleLauncher.newCapsule | public Capsule newCapsule(String mode, Path wrappedJar) {
final String oldMode = properties.getProperty(PROP_MODE);
final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(capsuleClass.getClassLoader());
try {
set... | java | public Capsule newCapsule(String mode, Path wrappedJar) {
final String oldMode = properties.getProperty(PROP_MODE);
final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(capsuleClass.getClassLoader());
try {
set... | [
"public",
"Capsule",
"newCapsule",
"(",
"String",
"mode",
",",
"Path",
"wrappedJar",
")",
"{",
"final",
"String",
"oldMode",
"=",
"properties",
".",
"getProperty",
"(",
"PROP_MODE",
")",
";",
"final",
"ClassLoader",
"oldCl",
"=",
"Thread",
".",
"currentThread"... | Creates a new capsule
@param mode the capsule mode, or {@code null} for the default mode
@param wrappedJar a path to a capsule JAR that will be launched (wrapped) by the empty capsule in {@code jarFile}
or {@code null} if no wrapped capsule is wanted
@return the capsule. | [
"Creates",
"a",
"new",
"capsule"
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java#L137-L159 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java | CapsuleLauncher.findJavaHomes | @SuppressWarnings("unchecked")
public static Map<String, List<Path>> findJavaHomes() {
try {
return (Map<String, List<Path>>) accessible(Class.forName(CAPSULE_CLASS_NAME).getDeclaredMethod("getJavaHomes")).invoke(null);
} catch (ReflectiveOperationException e) {
throw new Ass... | java | @SuppressWarnings("unchecked")
public static Map<String, List<Path>> findJavaHomes() {
try {
return (Map<String, List<Path>>) accessible(Class.forName(CAPSULE_CLASS_NAME).getDeclaredMethod("getJavaHomes")).invoke(null);
} catch (ReflectiveOperationException e) {
throw new Ass... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"Path",
">",
">",
"findJavaHomes",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"Path",
">",
">",
")"... | Returns all known Java installations
@return a map from the version strings to their respective paths of the Java installations. | [
"Returns",
"all",
"known",
"Java",
"installations"
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java#L257-L264 | train |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java | CapsuleLauncher.enableJMX | public static List<String> enableJMX(List<String> jvmArgs) {
final String arg = "-D" + OPT_JMX_REMOTE;
if (jvmArgs.contains(arg))
return jvmArgs;
final List<String> cmdLine2 = new ArrayList<>(jvmArgs);
cmdLine2.add(arg);
return cmdLine2;
} | java | public static List<String> enableJMX(List<String> jvmArgs) {
final String arg = "-D" + OPT_JMX_REMOTE;
if (jvmArgs.contains(arg))
return jvmArgs;
final List<String> cmdLine2 = new ArrayList<>(jvmArgs);
cmdLine2.add(arg);
return cmdLine2;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"enableJMX",
"(",
"List",
"<",
"String",
">",
"jvmArgs",
")",
"{",
"final",
"String",
"arg",
"=",
"\"-D\"",
"+",
"OPT_JMX_REMOTE",
";",
"if",
"(",
"jvmArgs",
".",
"contains",
"(",
"arg",
")",
")",
"return... | Adds an option to the JVM arguments to enable JMX connection
@param jvmArgs the JVM args
@return a new list of JVM args | [
"Adds",
"an",
"option",
"to",
"the",
"JVM",
"arguments",
"to",
"enable",
"JMX",
"connection"
] | 291a54e501a32aaf0284707b8c1fbff6a566822b | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/CapsuleLauncher.java#L272-L279 | train |
vitalidze/chromecast-java-api-v2 | src/main/java/su/litvak/chromecast/api/v2/ChromeCast.java | ChromeCast.setVolumeByIncrement | public final void setVolumeByIncrement(float level) throws IOException {
Volume volume = this.getStatus().volume;
float total = volume.level;
if (volume.increment <= 0f) {
throw new ChromeCastException("Volume.increment is <= 0");
}
// With floating points we always... | java | public final void setVolumeByIncrement(float level) throws IOException {
Volume volume = this.getStatus().volume;
float total = volume.level;
if (volume.increment <= 0f) {
throw new ChromeCastException("Volume.increment is <= 0");
}
// With floating points we always... | [
"public",
"final",
"void",
"setVolumeByIncrement",
"(",
"float",
"level",
")",
"throws",
"IOException",
"{",
"Volume",
"volume",
"=",
"this",
".",
"getStatus",
"(",
")",
".",
"volume",
";",
"float",
"total",
"=",
"volume",
".",
"level",
";",
"if",
"(",
"... | ChromeCast does not allow you to jump levels too quickly to avoid blowing speakers.
Setting by increment allows us to easily get the level we want
@param level volume level from 0 to 1 to set
@throws IOException
@see <a href="https://developers.google.com/cast/docs/design_checklist/sender#sender-control-volume">sender... | [
"ChromeCast",
"does",
"not",
"allow",
"you",
"to",
"jump",
"levels",
"too",
"quickly",
"to",
"avoid",
"blowing",
"speakers",
".",
"Setting",
"by",
"increment",
"allows",
"us",
"to",
"easily",
"get",
"the",
"level",
"we",
"want"
] | 3d8c0d7e735464f1cb64c5aa349e486d18a3b2ad | https://github.com/vitalidze/chromecast-java-api-v2/blob/3d8c0d7e735464f1cb64c5aa349e486d18a3b2ad/src/main/java/su/litvak/chromecast/api/v2/ChromeCast.java#L300-L323 | train |
vitalidze/chromecast-java-api-v2 | src/main/java/su/litvak/chromecast/api/v2/Channel.java | Channel.connect | private void connect() throws IOException, GeneralSecurityException {
synchronized (closedSync) {
if (socket == null || socket.isClosed()) {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, new TrustManager[] { new X509TrustAllManager() }, new SecureRandom... | java | private void connect() throws IOException, GeneralSecurityException {
synchronized (closedSync) {
if (socket == null || socket.isClosed()) {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, new TrustManager[] { new X509TrustAllManager() }, new SecureRandom... | [
"private",
"void",
"connect",
"(",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"synchronized",
"(",
"closedSync",
")",
"{",
"if",
"(",
"socket",
"==",
"null",
"||",
"socket",
".",
"isClosed",
"(",
")",
")",
"{",
"SSLContext",
"sc",
... | Establish connection to the ChromeCast device | [
"Establish",
"connection",
"to",
"the",
"ChromeCast",
"device"
] | 3d8c0d7e735464f1cb64c5aa349e486d18a3b2ad | https://github.com/vitalidze/chromecast-java-api-v2/blob/3d8c0d7e735464f1cb64c5aa349e486d18a3b2ad/src/main/java/su/litvak/chromecast/api/v2/Channel.java#L288-L344 | train |
komamitsu/fluency | fluency-core/src/main/java/org/komamitsu/fluency/util/ExecutorServiceUtils.java | ExecutorServiceUtils.newSingleThreadDaemonExecutor | public static ExecutorService newSingleThreadDaemonExecutor() {
return Executors.newSingleThreadExecutor(r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});
} | java | public static ExecutorService newSingleThreadDaemonExecutor() {
return Executors.newSingleThreadExecutor(r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});
} | [
"public",
"static",
"ExecutorService",
"newSingleThreadDaemonExecutor",
"(",
")",
"{",
"return",
"Executors",
".",
"newSingleThreadExecutor",
"(",
"r",
"->",
"{",
"Thread",
"t",
"=",
"Executors",
".",
"defaultThreadFactory",
"(",
")",
".",
"newThread",
"(",
"r",
... | Creates an Executor that is based on daemon threads.
This allows the program to quit without explicitly
calling shutdown on the pool
@return the newly created single-threaded Executor | [
"Creates",
"an",
"Executor",
"that",
"is",
"based",
"on",
"daemon",
"threads",
".",
"This",
"allows",
"the",
"program",
"to",
"quit",
"without",
"explicitly",
"calling",
"shutdown",
"on",
"the",
"pool"
] | 76d07ba292d2666d143eaaedb28be97deb928a38 | https://github.com/komamitsu/fluency/blob/76d07ba292d2666d143eaaedb28be97deb928a38/fluency-core/src/main/java/org/komamitsu/fluency/util/ExecutorServiceUtils.java#L38-L44 | train |
komamitsu/fluency | fluency-core/src/main/java/org/komamitsu/fluency/util/ExecutorServiceUtils.java | ExecutorServiceUtils.newScheduledDaemonThreadPool | public static ScheduledExecutorService newScheduledDaemonThreadPool(int corePoolSize) {
return Executors.newScheduledThreadPool(corePoolSize, r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});
} | java | public static ScheduledExecutorService newScheduledDaemonThreadPool(int corePoolSize) {
return Executors.newScheduledThreadPool(corePoolSize, r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});
} | [
"public",
"static",
"ScheduledExecutorService",
"newScheduledDaemonThreadPool",
"(",
"int",
"corePoolSize",
")",
"{",
"return",
"Executors",
".",
"newScheduledThreadPool",
"(",
"corePoolSize",
",",
"r",
"->",
"{",
"Thread",
"t",
"=",
"Executors",
".",
"defaultThreadFa... | Creates a scheduled thread pool where each thread has the daemon
property set to true. This allows the program to quit without
explicitly calling shutdown on the pool
@param corePoolSize the number of threads to keep in the pool,
even if they are idle
@return a newly created scheduled thread pool | [
"Creates",
"a",
"scheduled",
"thread",
"pool",
"where",
"each",
"thread",
"has",
"the",
"daemon",
"property",
"set",
"to",
"true",
".",
"This",
"allows",
"the",
"program",
"to",
"quit",
"without",
"explicitly",
"calling",
"shutdown",
"on",
"the",
"pool"
] | 76d07ba292d2666d143eaaedb28be97deb928a38 | https://github.com/komamitsu/fluency/blob/76d07ba292d2666d143eaaedb28be97deb928a38/fluency-core/src/main/java/org/komamitsu/fluency/util/ExecutorServiceUtils.java#L56-L62 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.createMenuDrawer | private static MenuDrawer createMenuDrawer(Activity activity, int dragMode, Position position, Type type) {
MenuDrawer drawer;
if (type == Type.STATIC) {
drawer = new StaticDrawer(activity);
} else if (type == Type.OVERLAY) {
drawer = new OverlayDrawer(activity, dragMod... | java | private static MenuDrawer createMenuDrawer(Activity activity, int dragMode, Position position, Type type) {
MenuDrawer drawer;
if (type == Type.STATIC) {
drawer = new StaticDrawer(activity);
} else if (type == Type.OVERLAY) {
drawer = new OverlayDrawer(activity, dragMod... | [
"private",
"static",
"MenuDrawer",
"createMenuDrawer",
"(",
"Activity",
"activity",
",",
"int",
"dragMode",
",",
"Position",
"position",
",",
"Type",
"type",
")",
"{",
"MenuDrawer",
"drawer",
";",
"if",
"(",
"type",
"==",
"Type",
".",
"STATIC",
")",
"{",
"... | Constructs the appropriate MenuDrawer based on the position. | [
"Constructs",
"the",
"appropriate",
"MenuDrawer",
"based",
"on",
"the",
"position",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L478-L501 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.attachToContent | private static void attachToContent(Activity activity, MenuDrawer menuDrawer) {
/**
* Do not call mActivity#setContentView.
* E.g. if using with a ListActivity, Activity#setContentView is overridden and dispatched to
* MenuDrawer#setContentView, which then again would call Activity#se... | java | private static void attachToContent(Activity activity, MenuDrawer menuDrawer) {
/**
* Do not call mActivity#setContentView.
* E.g. if using with a ListActivity, Activity#setContentView is overridden and dispatched to
* MenuDrawer#setContentView, which then again would call Activity#se... | [
"private",
"static",
"void",
"attachToContent",
"(",
"Activity",
"activity",
",",
"MenuDrawer",
"menuDrawer",
")",
"{",
"/**\n * Do not call mActivity#setContentView.\n * E.g. if using with a ListActivity, Activity#setContentView is overridden and dispatched to\n * Me... | Attaches the menu drawer to the content view. | [
"Attaches",
"the",
"menu",
"drawer",
"to",
"the",
"content",
"view",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L506-L515 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.attachToDecor | private static void attachToDecor(Activity activity, MenuDrawer menuDrawer) {
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);
decorView.removeAllViews();
decorView.addView(menuDrawer, LayoutParams.MATCH_P... | java | private static void attachToDecor(Activity activity, MenuDrawer menuDrawer) {
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);
decorView.removeAllViews();
decorView.addView(menuDrawer, LayoutParams.MATCH_P... | [
"private",
"static",
"void",
"attachToDecor",
"(",
"Activity",
"activity",
",",
"MenuDrawer",
"menuDrawer",
")",
"{",
"ViewGroup",
"decorView",
"=",
"(",
"ViewGroup",
")",
"activity",
".",
"getWindow",
"(",
")",
".",
"getDecorView",
"(",
")",
";",
"ViewGroup",... | Attaches the menu drawer to the window. | [
"Attaches",
"the",
"menu",
"drawer",
"to",
"the",
"window",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L520-L528 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.setActiveView | public void setActiveView(View v, int position) {
final View oldView = mActiveView;
mActiveView = v;
mActivePosition = position;
if (mAllowIndicatorAnimation && oldView != null) {
startAnimatingIndicator();
}
invalidate();
} | java | public void setActiveView(View v, int position) {
final View oldView = mActiveView;
mActiveView = v;
mActivePosition = position;
if (mAllowIndicatorAnimation && oldView != null) {
startAnimatingIndicator();
}
invalidate();
} | [
"public",
"void",
"setActiveView",
"(",
"View",
"v",
",",
"int",
"position",
")",
"{",
"final",
"View",
"oldView",
"=",
"mActiveView",
";",
"mActiveView",
"=",
"v",
";",
"mActivePosition",
"=",
"position",
";",
"if",
"(",
"mAllowIndicatorAnimation",
"&&",
"o... | Set the active view.
If the mdActiveIndicator attribute is set, this View will have the indicator drawn next to it.
@param v The active view.
@param position Optional position, usually used with ListView. v.setTag(R.id.mdActiveViewPosition, position)
must be called first. | [
"Set",
"the",
"active",
"view",
".",
"If",
"the",
"mdActiveIndicator",
"attribute",
"is",
"set",
"this",
"View",
"will",
"have",
"the",
"indicator",
"drawn",
"next",
"to",
"it",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1005-L1015 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.getIndicatorStartPos | private int getIndicatorStartPos() {
switch (getPosition()) {
case TOP:
return mIndicatorClipRect.left;
case RIGHT:
return mIndicatorClipRect.top;
case BOTTOM:
return mIndicatorClipRect.left;
default:
... | java | private int getIndicatorStartPos() {
switch (getPosition()) {
case TOP:
return mIndicatorClipRect.left;
case RIGHT:
return mIndicatorClipRect.top;
case BOTTOM:
return mIndicatorClipRect.left;
default:
... | [
"private",
"int",
"getIndicatorStartPos",
"(",
")",
"{",
"switch",
"(",
"getPosition",
"(",
")",
")",
"{",
"case",
"TOP",
":",
"return",
"mIndicatorClipRect",
".",
"left",
";",
"case",
"RIGHT",
":",
"return",
"mIndicatorClipRect",
".",
"top",
";",
"case",
... | Returns the start position of the indicator.
@return The start position of the indicator. | [
"Returns",
"the",
"start",
"position",
"of",
"the",
"indicator",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1071-L1082 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.animateIndicatorInvalidate | private void animateIndicatorInvalidate() {
if (mIndicatorScroller.computeScrollOffset()) {
mIndicatorOffset = mIndicatorScroller.getCurr();
invalidate();
if (!mIndicatorScroller.isFinished()) {
postOnAnimation(mIndicatorRunnable);
return;
... | java | private void animateIndicatorInvalidate() {
if (mIndicatorScroller.computeScrollOffset()) {
mIndicatorOffset = mIndicatorScroller.getCurr();
invalidate();
if (!mIndicatorScroller.isFinished()) {
postOnAnimation(mIndicatorRunnable);
return;
... | [
"private",
"void",
"animateIndicatorInvalidate",
"(",
")",
"{",
"if",
"(",
"mIndicatorScroller",
".",
"computeScrollOffset",
"(",
")",
")",
"{",
"mIndicatorOffset",
"=",
"mIndicatorScroller",
".",
"getCurr",
"(",
")",
";",
"invalidate",
"(",
")",
";",
"if",
"(... | Callback when each frame in the indicator animation should be drawn. | [
"Callback",
"when",
"each",
"frame",
"in",
"the",
"indicator",
"animation",
"should",
"be",
"drawn",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1100-L1112 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.setDropShadowColor | public void setDropShadowColor(int color) {
GradientDrawable.Orientation orientation = getDropShadowOrientation();
final int endColor = color & 0x00FFFFFF;
mDropShadowDrawable = new GradientDrawable(orientation,
new int[] {
color,
... | java | public void setDropShadowColor(int color) {
GradientDrawable.Orientation orientation = getDropShadowOrientation();
final int endColor = color & 0x00FFFFFF;
mDropShadowDrawable = new GradientDrawable(orientation,
new int[] {
color,
... | [
"public",
"void",
"setDropShadowColor",
"(",
"int",
"color",
")",
"{",
"GradientDrawable",
".",
"Orientation",
"orientation",
"=",
"getDropShadowOrientation",
"(",
")",
";",
"final",
"int",
"endColor",
"=",
"color",
"&",
"0x00FFFFFF",
";",
"mDropShadowDrawable",
"... | Sets the color of the drop shadow.
@param color The color of the drop shadow. | [
"Sets",
"the",
"color",
"of",
"the",
"drop",
"shadow",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1196-L1206 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.setSlideDrawable | public void setSlideDrawable(Drawable drawable) {
mSlideDrawable = new SlideDrawable(drawable);
mSlideDrawable.setIsRtl(ViewHelper.getLayoutDirection(this) == LAYOUT_DIRECTION_RTL);
if (mActionBarHelper != null) {
mActionBarHelper.setDisplayShowHomeAsUpEnabled(true);
if... | java | public void setSlideDrawable(Drawable drawable) {
mSlideDrawable = new SlideDrawable(drawable);
mSlideDrawable.setIsRtl(ViewHelper.getLayoutDirection(this) == LAYOUT_DIRECTION_RTL);
if (mActionBarHelper != null) {
mActionBarHelper.setDisplayShowHomeAsUpEnabled(true);
if... | [
"public",
"void",
"setSlideDrawable",
"(",
"Drawable",
"drawable",
")",
"{",
"mSlideDrawable",
"=",
"new",
"SlideDrawable",
"(",
"drawable",
")",
";",
"mSlideDrawable",
".",
"setIsRtl",
"(",
"ViewHelper",
".",
"getLayoutDirection",
"(",
"this",
")",
"==",
"LAYOU... | Sets the drawable used as the drawer indicator.
@param drawable The drawable used as the drawer indicator. | [
"Sets",
"the",
"drawable",
"used",
"as",
"the",
"drawer",
"indicator",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1323-L1335 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.getContentContainer | public ViewGroup getContentContainer() {
if (mDragMode == MENU_DRAG_CONTENT) {
return mContentContainer;
} else {
return (ViewGroup) findViewById(android.R.id.content);
}
} | java | public ViewGroup getContentContainer() {
if (mDragMode == MENU_DRAG_CONTENT) {
return mContentContainer;
} else {
return (ViewGroup) findViewById(android.R.id.content);
}
} | [
"public",
"ViewGroup",
"getContentContainer",
"(",
")",
"{",
"if",
"(",
"mDragMode",
"==",
"MENU_DRAG_CONTENT",
")",
"{",
"return",
"mContentContainer",
";",
"}",
"else",
"{",
"return",
"(",
"ViewGroup",
")",
"findViewById",
"(",
"android",
".",
"R",
".",
"i... | Returns the ViewGroup used as a parent for the content view.
@return The content view's parent. | [
"Returns",
"the",
"ViewGroup",
"used",
"as",
"a",
"parent",
"for",
"the",
"content",
"view",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1397-L1403 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.setMenuView | public void setMenuView(int layoutResId) {
mMenuContainer.removeAllViews();
mMenuView = LayoutInflater.from(getContext()).inflate(layoutResId, mMenuContainer, false);
mMenuContainer.addView(mMenuView);
} | java | public void setMenuView(int layoutResId) {
mMenuContainer.removeAllViews();
mMenuView = LayoutInflater.from(getContext()).inflate(layoutResId, mMenuContainer, false);
mMenuContainer.addView(mMenuView);
} | [
"public",
"void",
"setMenuView",
"(",
"int",
"layoutResId",
")",
"{",
"mMenuContainer",
".",
"removeAllViews",
"(",
")",
";",
"mMenuView",
"=",
"LayoutInflater",
".",
"from",
"(",
"getContext",
"(",
")",
")",
".",
"inflate",
"(",
"layoutResId",
",",
"mMenuCo... | Set the menu view from a layout resource.
@param layoutResId Resource ID to be inflated. | [
"Set",
"the",
"menu",
"view",
"from",
"a",
"layout",
"resource",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1410-L1414 | train |
SimonVT/android-menudrawer | menudrawer-samples/src/net/simonvt/menudrawer/samples/BottomDrawerSample.java | BottomDrawerSample.onClick | @Override
public void onClick(View v) {
String tag = (String) v.getTag();
mContentTextView.setText(String.format("%s clicked.", tag));
mMenuDrawer.setActiveView(v);
} | java | @Override
public void onClick(View v) {
String tag = (String) v.getTag();
mContentTextView.setText(String.format("%s clicked.", tag));
mMenuDrawer.setActiveView(v);
} | [
"@",
"Override",
"public",
"void",
"onClick",
"(",
"View",
"v",
")",
"{",
"String",
"tag",
"=",
"(",
"String",
")",
"v",
".",
"getTag",
"(",
")",
";",
"mContentTextView",
".",
"setText",
"(",
"String",
".",
"format",
"(",
"\"%s clicked.\"",
",",
"tag",... | Click handler for bottom drawer items. | [
"Click",
"handler",
"for",
"bottom",
"drawer",
"items",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer-samples/src/net/simonvt/menudrawer/samples/BottomDrawerSample.java#L37-L42 | train |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/DraggableDrawer.java | DraggableDrawer.animateOffsetTo | protected void animateOffsetTo(int position, int velocity, boolean animate) {
endDrag();
endPeek();
final int startX = (int) mOffsetPixels;
final int dx = position - startX;
if (dx == 0 || !animate) {
setOffsetPixels(position);
setDrawerState(position == ... | java | protected void animateOffsetTo(int position, int velocity, boolean animate) {
endDrag();
endPeek();
final int startX = (int) mOffsetPixels;
final int dx = position - startX;
if (dx == 0 || !animate) {
setOffsetPixels(position);
setDrawerState(position == ... | [
"protected",
"void",
"animateOffsetTo",
"(",
"int",
"position",
",",
"int",
"velocity",
",",
"boolean",
"animate",
")",
"{",
"endDrag",
"(",
")",
";",
"endPeek",
"(",
")",
";",
"final",
"int",
"startX",
"=",
"(",
"int",
")",
"mOffsetPixels",
";",
"final"... | Moves the drawer to the position passed.
@param position The position the content is moved to.
@param velocity Optional velocity if called by releasing a drag event.
@param animate Whether the move is animated. | [
"Moves",
"the",
"drawer",
"to",
"the",
"position",
"passed",
"."
] | 59e8d18e109c77d911b8b63232d66d5f0551cf6a | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/DraggableDrawer.java#L351-L375 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java | ParsedLineIterator.pollParsedWord | public ParsedWord pollParsedWord() {
if(hasNextWord()) {
//set correct next char
if(parsedLine.words().size() > (word+1))
character = parsedLine.words().get(word+1).lineIndex();
else
character = -1;
return parsedLine.words().get(wor... | java | public ParsedWord pollParsedWord() {
if(hasNextWord()) {
//set correct next char
if(parsedLine.words().size() > (word+1))
character = parsedLine.words().get(word+1).lineIndex();
else
character = -1;
return parsedLine.words().get(wor... | [
"public",
"ParsedWord",
"pollParsedWord",
"(",
")",
"{",
"if",
"(",
"hasNextWord",
"(",
")",
")",
"{",
"//set correct next char",
"if",
"(",
"parsedLine",
".",
"words",
"(",
")",
".",
"size",
"(",
")",
">",
"(",
"word",
"+",
"1",
")",
")",
"character",... | Polls the next ParsedWord from the stack.
@return next ParsedWord | [
"Polls",
"the",
"next",
"ParsedWord",
"from",
"the",
"stack",
"."
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java#L63-L74 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java | ParsedLineIterator.pollChar | public char pollChar() {
if(hasNextChar()) {
if(hasNextWord() &&
character+1 >= parsedLine.words().get(word).lineIndex()+
parsedLine.words().get(word).word().length())
word++;
return parsedLine.line().charAt(character++);
... | java | public char pollChar() {
if(hasNextChar()) {
if(hasNextWord() &&
character+1 >= parsedLine.words().get(word).lineIndex()+
parsedLine.words().get(word).word().length())
word++;
return parsedLine.line().charAt(character++);
... | [
"public",
"char",
"pollChar",
"(",
")",
"{",
"if",
"(",
"hasNextChar",
"(",
")",
")",
"{",
"if",
"(",
"hasNextWord",
"(",
")",
"&&",
"character",
"+",
"1",
">=",
"parsedLine",
".",
"words",
"(",
")",
".",
"get",
"(",
"word",
")",
".",
"lineIndex",
... | Polls the next char from the stack
@return next char | [
"Polls",
"the",
"next",
"char",
"from",
"the",
"stack"
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java#L111-L120 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java | ParsedLineIterator.updateIteratorPosition | public void updateIteratorPosition(int length) {
if(length > 0) {
//make sure we dont go OB
if((length + character) > parsedLine.line().length())
length = parsedLine.line().length() - character;
//move word counter to the correct word
while(hasNex... | java | public void updateIteratorPosition(int length) {
if(length > 0) {
//make sure we dont go OB
if((length + character) > parsedLine.line().length())
length = parsedLine.line().length() - character;
//move word counter to the correct word
while(hasNex... | [
"public",
"void",
"updateIteratorPosition",
"(",
"int",
"length",
")",
"{",
"if",
"(",
"length",
">",
"0",
")",
"{",
"//make sure we dont go OB",
"if",
"(",
"(",
"length",
"+",
"character",
")",
">",
"parsedLine",
".",
"line",
"(",
")",
".",
"length",
"(... | Update the current position with specified length.
The input will append to the current position of the iterator.
@param length update length | [
"Update",
"the",
"current",
"position",
"with",
"specified",
"length",
".",
"The",
"input",
"will",
"append",
"to",
"the",
"current",
"position",
"of",
"the",
"iterator",
"."
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java#L162-L178 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/impl/parser/AeshCommandLineParser.java | AeshCommandLineParser.printHelp | @Override
public String printHelp() {
List<CommandLineParser<CI>> parsers = getChildParsers();
if (parsers != null && parsers.size() > 0) {
StringBuilder sb = new StringBuilder();
sb.append(processedCommand.printHelp(helpNames()))
.append(Config.getLineSep... | java | @Override
public String printHelp() {
List<CommandLineParser<CI>> parsers = getChildParsers();
if (parsers != null && parsers.size() > 0) {
StringBuilder sb = new StringBuilder();
sb.append(processedCommand.printHelp(helpNames()))
.append(Config.getLineSep... | [
"@",
"Override",
"public",
"String",
"printHelp",
"(",
")",
"{",
"List",
"<",
"CommandLineParser",
"<",
"CI",
">>",
"parsers",
"=",
"getChildParsers",
"(",
")",
";",
"if",
"(",
"parsers",
"!=",
"null",
"&&",
"parsers",
".",
"size",
"(",
")",
">",
"0",
... | Returns a usage String based on the defined command and options.
Useful when printing "help" info etc. | [
"Returns",
"a",
"usage",
"String",
"based",
"on",
"the",
"defined",
"command",
"and",
"options",
".",
"Useful",
"when",
"printing",
"help",
"info",
"etc",
"."
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/impl/parser/AeshCommandLineParser.java#L215-L244 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/impl/parser/AeshCommandLineParser.java | AeshCommandLineParser.parse | @Override
public void parse(String line, Mode mode) {
parse(lineParser.parseLine(line, line.length()).iterator(), mode);
} | java | @Override
public void parse(String line, Mode mode) {
parse(lineParser.parseLine(line, line.length()).iterator(), mode);
} | [
"@",
"Override",
"public",
"void",
"parse",
"(",
"String",
"line",
",",
"Mode",
"mode",
")",
"{",
"parse",
"(",
"lineParser",
".",
"parseLine",
"(",
"line",
",",
"line",
".",
"length",
"(",
")",
")",
".",
"iterator",
"(",
")",
",",
"mode",
")",
";"... | Parse a command line with the defined command as base of the rules.
If any options are found, but not defined in the command object an
CommandLineParserException will be thrown.
Also, if a required option is not found or options specified with value,
but is not given any value an CommandLineParserException will be thro... | [
"Parse",
"a",
"command",
"line",
"with",
"the",
"defined",
"command",
"as",
"base",
"of",
"the",
"rules",
".",
"If",
"any",
"options",
"are",
"found",
"but",
"not",
"defined",
"in",
"the",
"command",
"object",
"an",
"CommandLineParserException",
"will",
"be"... | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/impl/parser/AeshCommandLineParser.java#L559-L562 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/impl/populator/AeshCommandPopulator.java | AeshCommandPopulator.populateObject | @Override
public void populateObject(ProcessedCommand<Command<CI>, CI> processedCommand, InvocationProviders invocationProviders,
AeshContext aeshContext, CommandLineParser.Mode mode)
throws CommandLineParserException, OptionValidatorException {
if(processedCommand... | java | @Override
public void populateObject(ProcessedCommand<Command<CI>, CI> processedCommand, InvocationProviders invocationProviders,
AeshContext aeshContext, CommandLineParser.Mode mode)
throws CommandLineParserException, OptionValidatorException {
if(processedCommand... | [
"@",
"Override",
"public",
"void",
"populateObject",
"(",
"ProcessedCommand",
"<",
"Command",
"<",
"CI",
">",
",",
"CI",
">",
"processedCommand",
",",
"InvocationProviders",
"invocationProviders",
",",
"AeshContext",
"aeshContext",
",",
"CommandLineParser",
".",
"Mo... | Populate a Command instance with the values parsed from a command line
If any parser errors are detected it will throw an exception
@param processedCommand command line
@param mode do validation or not
@throws CommandLineParserException any incorrectness in the parser will abort the populate | [
"Populate",
"a",
"Command",
"instance",
"with",
"the",
"values",
"parsed",
"from",
"a",
"command",
"line",
"If",
"any",
"parser",
"errors",
"are",
"detected",
"it",
"will",
"throw",
"an",
"exception"
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/impl/populator/AeshCommandPopulator.java#L55-L89 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/impl/internal/ProcessedCommand.java | ProcessedCommand.getOptionLongNamesWithDash | public List<TerminalString> getOptionLongNamesWithDash() {
List<ProcessedOption> opts = getOptions();
List<TerminalString> names = new ArrayList<>(opts.size());
for (ProcessedOption o : opts) {
if(o.getValues().size() == 0 &&
o.activator().isActivated(new ParsedCo... | java | public List<TerminalString> getOptionLongNamesWithDash() {
List<ProcessedOption> opts = getOptions();
List<TerminalString> names = new ArrayList<>(opts.size());
for (ProcessedOption o : opts) {
if(o.getValues().size() == 0 &&
o.activator().isActivated(new ParsedCo... | [
"public",
"List",
"<",
"TerminalString",
">",
"getOptionLongNamesWithDash",
"(",
")",
"{",
"List",
"<",
"ProcessedOption",
">",
"opts",
"=",
"getOptions",
"(",
")",
";",
"List",
"<",
"TerminalString",
">",
"names",
"=",
"new",
"ArrayList",
"<>",
"(",
"opts",... | Return all option names that not already have a value
and is enabled | [
"Return",
"all",
"option",
"names",
"that",
"not",
"already",
"have",
"a",
"value",
"and",
"is",
"enabled"
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/impl/internal/ProcessedCommand.java#L319-L329 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/impl/internal/ProcessedCommand.java | ProcessedCommand.printHelp | public String printHelp(String commandName) {
int maxLength = 0;
int width = 80;
List<ProcessedOption> opts = getOptions();
for (ProcessedOption o : opts) {
if(o.getFormattedLength() > maxLength)
maxLength = o.getFormattedLength();
}
StringBui... | java | public String printHelp(String commandName) {
int maxLength = 0;
int width = 80;
List<ProcessedOption> opts = getOptions();
for (ProcessedOption o : opts) {
if(o.getFormattedLength() > maxLength)
maxLength = o.getFormattedLength();
}
StringBui... | [
"public",
"String",
"printHelp",
"(",
"String",
"commandName",
")",
"{",
"int",
"maxLength",
"=",
"0",
";",
"int",
"width",
"=",
"80",
";",
"List",
"<",
"ProcessedOption",
">",
"opts",
"=",
"getOptions",
"(",
")",
";",
"for",
"(",
"ProcessedOption",
"o",... | Returns a description String based on the defined command and options.
Useful when printing "help" info etc. | [
"Returns",
"a",
"description",
"String",
"based",
"on",
"the",
"defined",
"command",
"and",
"options",
".",
"Useful",
"when",
"printing",
"help",
"info",
"etc",
"."
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/impl/internal/ProcessedCommand.java#L390-L440 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/impl/internal/ProcessedCommand.java | ProcessedCommand.hasUniqueLongOption | public boolean hasUniqueLongOption(String optionName) {
if(hasLongOption(optionName)) {
for(ProcessedOption o : getOptions()) {
if(o.name().startsWith(optionName) && !o.name().equals(optionName))
return false;
}
return true;
}
... | java | public boolean hasUniqueLongOption(String optionName) {
if(hasLongOption(optionName)) {
for(ProcessedOption o : getOptions()) {
if(o.name().startsWith(optionName) && !o.name().equals(optionName))
return false;
}
return true;
}
... | [
"public",
"boolean",
"hasUniqueLongOption",
"(",
"String",
"optionName",
")",
"{",
"if",
"(",
"hasLongOption",
"(",
"optionName",
")",
")",
"{",
"for",
"(",
"ProcessedOption",
"o",
":",
"getOptions",
"(",
")",
")",
"{",
"if",
"(",
"o",
".",
"name",
"(",
... | not start with another option name | [
"not",
"start",
"with",
"another",
"option",
"name"
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/impl/internal/ProcessedCommand.java#L486-L495 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/io/scanner/ClassFileBuffer.java | ClassFileBuffer.seek | public void seek(final int position) throws IOException {
if (position < 0) {
throw new IllegalArgumentException("position < 0: " + position);
}
if (position > size) {
throw new EOFException();
}
this.pointer = position;
} | java | public void seek(final int position) throws IOException {
if (position < 0) {
throw new IllegalArgumentException("position < 0: " + position);
}
if (position > size) {
throw new EOFException();
}
this.pointer = position;
} | [
"public",
"void",
"seek",
"(",
"final",
"int",
"position",
")",
"throws",
"IOException",
"{",
"if",
"(",
"position",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"position < 0: \"",
"+",
"position",
")",
";",
"}",
"if",
"(",
"posi... | Sets the file-pointer offset, measured from the beginning of this file,
at which the next read or write occurs. | [
"Sets",
"the",
"file",
"-",
"pointer",
"offset",
"measured",
"from",
"the",
"beginning",
"of",
"this",
"file",
"at",
"which",
"the",
"next",
"read",
"or",
"write",
"occurs",
"."
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/io/scanner/ClassFileBuffer.java#L87-L95 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/settings/SettingsImpl.java | SettingsImpl.editMode | @Override
public EditMode editMode() {
if(readInputrc) {
try {
return EditModeBuilder.builder().parseInputrc(new FileInputStream(inputrc())).create();
}
catch(FileNotFoundException e) {
return EditModeBuilder.builder(mode()).create();
... | java | @Override
public EditMode editMode() {
if(readInputrc) {
try {
return EditModeBuilder.builder().parseInputrc(new FileInputStream(inputrc())).create();
}
catch(FileNotFoundException e) {
return EditModeBuilder.builder(mode()).create();
... | [
"@",
"Override",
"public",
"EditMode",
"editMode",
"(",
")",
"{",
"if",
"(",
"readInputrc",
")",
"{",
"try",
"{",
"return",
"EditModeBuilder",
".",
"builder",
"(",
")",
".",
"parseInputrc",
"(",
"new",
"FileInputStream",
"(",
"inputrc",
"(",
")",
")",
")... | Get EditMode based on os and mode
@return edit mode | [
"Get",
"EditMode",
"based",
"on",
"os",
"and",
"mode"
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/settings/SettingsImpl.java#L205-L217 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/command/settings/SettingsImpl.java | SettingsImpl.logFile | @Override
public String logFile() {
if(logFile == null) {
logFile = Config.getTmpDir()+Config.getPathSeparator()+"aesh.log";
}
return logFile;
} | java | @Override
public String logFile() {
if(logFile == null) {
logFile = Config.getTmpDir()+Config.getPathSeparator()+"aesh.log";
}
return logFile;
} | [
"@",
"Override",
"public",
"String",
"logFile",
"(",
")",
"{",
"if",
"(",
"logFile",
"==",
"null",
")",
"{",
"logFile",
"=",
"Config",
".",
"getTmpDir",
"(",
")",
"+",
"Config",
".",
"getPathSeparator",
"(",
")",
"+",
"\"aesh.log\"",
";",
"}",
"return"... | Get log file
@return log file | [
"Get",
"log",
"file"
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/command/settings/SettingsImpl.java#L414-L420 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/io/scanner/AnnotationDetector.java | AnnotationDetector.detect | public void detect(final String... packageNames) throws IOException {
final String[] pkgNameFilter = new String[packageNames.length];
for (int i = 0; i < pkgNameFilter.length; ++i) {
pkgNameFilter[i] = packageNames[i].replace('.', '/');
if (!pkgNameFilter[i].endsWith("/")) {
... | java | public void detect(final String... packageNames) throws IOException {
final String[] pkgNameFilter = new String[packageNames.length];
for (int i = 0; i < pkgNameFilter.length; ++i) {
pkgNameFilter[i] = packageNames[i].replace('.', '/');
if (!pkgNameFilter[i].endsWith("/")) {
... | [
"public",
"void",
"detect",
"(",
"final",
"String",
"...",
"packageNames",
")",
"throws",
"IOException",
"{",
"final",
"String",
"[",
"]",
"pkgNameFilter",
"=",
"new",
"String",
"[",
"packageNames",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"... | Report all Java ClassFile files available on the class path within
the specified packages and sub packages.
@see #detect(File...) | [
"Report",
"all",
"Java",
"ClassFile",
"files",
"available",
"on",
"the",
"class",
"path",
"within",
"the",
"specified",
"packages",
"and",
"sub",
"packages",
"."
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/io/scanner/AnnotationDetector.java#L243-L281 | train |
aeshell/aesh | aesh/src/main/java/org/aesh/io/scanner/FileIterator.java | FileIterator.addReverse | private void addReverse(final File[] files) {
for (int i = files.length - 1; i >= 0; --i) {
stack.add(files[i]);
}
} | java | private void addReverse(final File[] files) {
for (int i = files.length - 1; i >= 0; --i) {
stack.add(files[i]);
}
} | [
"private",
"void",
"addReverse",
"(",
"final",
"File",
"[",
"]",
"files",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"files",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"stack",
".",
"add",
"(",
"files",
"[",
"i",
"]"... | Add the specified files in reverse order. | [
"Add",
"the",
"specified",
"files",
"in",
"reverse",
"order",
"."
] | fd7d38d333c5dbf116a9778523a4d1df61f027a3 | https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/io/scanner/FileIterator.java#L113-L117 | train |
weld/core | impl/src/main/java/org/jboss/weld/serialization/ContextualStoreImpl.java | ContextualStoreImpl.getContextual | public <C extends Contextual<I>, I> C getContextual(String id) {
return this.<C, I>getContextual(new StringBeanIdentifier(id));
} | java | public <C extends Contextual<I>, I> C getContextual(String id) {
return this.<C, I>getContextual(new StringBeanIdentifier(id));
} | [
"public",
"<",
"C",
"extends",
"Contextual",
"<",
"I",
">",
",",
"I",
">",
"C",
"getContextual",
"(",
"String",
"id",
")",
"{",
"return",
"this",
".",
"<",
"C",
",",
"I",
">",
"getContextual",
"(",
"new",
"StringBeanIdentifier",
"(",
"id",
")",
")",
... | Given a particular id, return the correct contextual. For contextuals
which aren't passivation capable, the contextual can't be found in another
container, and null will be returned.
@param id An identifier for the contextual
@return the contextual | [
"Given",
"a",
"particular",
"id",
"return",
"the",
"correct",
"contextual",
".",
"For",
"contextuals",
"which",
"aren",
"t",
"passivation",
"capable",
"the",
"contextual",
"can",
"t",
"be",
"found",
"in",
"another",
"container",
"and",
"null",
"will",
"be",
... | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/serialization/ContextualStoreImpl.java#L83-L85 | train |
weld/core | modules/web/src/main/java/org/jboss/weld/module/web/servlet/ConversationContextActivator.java | ConversationContextActivator.processDestructionQueue | private void processDestructionQueue(HttpServletRequest request) {
Object contextsAttribute = request.getAttribute(DESTRUCTION_QUEUE_ATTRIBUTE_NAME);
if (contextsAttribute instanceof Map) {
Map<String, List<ContextualInstance<?>>> contexts = cast(contextsAttribute);
synchronized ... | java | private void processDestructionQueue(HttpServletRequest request) {
Object contextsAttribute = request.getAttribute(DESTRUCTION_QUEUE_ATTRIBUTE_NAME);
if (contextsAttribute instanceof Map) {
Map<String, List<ContextualInstance<?>>> contexts = cast(contextsAttribute);
synchronized ... | [
"private",
"void",
"processDestructionQueue",
"(",
"HttpServletRequest",
"request",
")",
"{",
"Object",
"contextsAttribute",
"=",
"request",
".",
"getAttribute",
"(",
"DESTRUCTION_QUEUE_ATTRIBUTE_NAME",
")",
";",
"if",
"(",
"contextsAttribute",
"instanceof",
"Map",
")",... | If needed, destroy the remaining conversation contexts after an HTTP session was invalidated within the current request.
@param request | [
"If",
"needed",
"destroy",
"the",
"remaining",
"conversation",
"contexts",
"after",
"an",
"HTTP",
"session",
"was",
"invalidated",
"within",
"the",
"current",
"request",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/web/src/main/java/org/jboss/weld/module/web/servlet/ConversationContextActivator.java#L193-L212 | train |
weld/core | modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanAwareInjectionPointBean.java | SessionBeanAwareInjectionPointBean.unregisterContextualInstance | public static void unregisterContextualInstance(EjbDescriptor<?> descriptor) {
Set<Class<?>> classes = CONTEXTUAL_SESSION_BEANS.get();
classes.remove(descriptor.getBeanClass());
if (classes.isEmpty()) {
CONTEXTUAL_SESSION_BEANS.remove();
}
} | java | public static void unregisterContextualInstance(EjbDescriptor<?> descriptor) {
Set<Class<?>> classes = CONTEXTUAL_SESSION_BEANS.get();
classes.remove(descriptor.getBeanClass());
if (classes.isEmpty()) {
CONTEXTUAL_SESSION_BEANS.remove();
}
} | [
"public",
"static",
"void",
"unregisterContextualInstance",
"(",
"EjbDescriptor",
"<",
"?",
">",
"descriptor",
")",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
"=",
"CONTEXTUAL_SESSION_BEANS",
".",
"get",
"(",
")",
";",
"classes",
".",
"remove",... | Indicates that contextual session bean instance has been constructed. | [
"Indicates",
"that",
"contextual",
"session",
"bean",
"instance",
"has",
"been",
"constructed",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanAwareInjectionPointBean.java#L99-L105 | train |
weld/core | impl/src/main/java/org/jboss/weld/injection/StaticMethodInjectionPoint.java | StaticMethodInjectionPoint.getParameterValues | protected Object[] getParameterValues(Object specialVal, BeanManagerImpl manager, CreationalContext<?> ctx, CreationalContext<?> transientReferenceContext) {
if (getInjectionPoints().isEmpty()) {
if (specialInjectionPointIndex == -1) {
return Arrays2.EMPTY_ARRAY;
} else {... | java | protected Object[] getParameterValues(Object specialVal, BeanManagerImpl manager, CreationalContext<?> ctx, CreationalContext<?> transientReferenceContext) {
if (getInjectionPoints().isEmpty()) {
if (specialInjectionPointIndex == -1) {
return Arrays2.EMPTY_ARRAY;
} else {... | [
"protected",
"Object",
"[",
"]",
"getParameterValues",
"(",
"Object",
"specialVal",
",",
"BeanManagerImpl",
"manager",
",",
"CreationalContext",
"<",
"?",
">",
"ctx",
",",
"CreationalContext",
"<",
"?",
">",
"transientReferenceContext",
")",
"{",
"if",
"(",
"get... | Helper method for getting the current parameter values from a list of annotated parameters.
@param parameters The list of annotated parameter to look up
@param manager The Bean manager
@return The object array of looked up values | [
"Helper",
"method",
"for",
"getting",
"the",
"current",
"parameter",
"values",
"from",
"a",
"list",
"of",
"annotated",
"parameters",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/injection/StaticMethodInjectionPoint.java#L117-L138 | train |
weld/core | impl/src/main/java/org/jboss/weld/bootstrap/SpecializationAndEnablementRegistry.java | SpecializationAndEnablementRegistry.resolveSpecializedBeans | public Set<? extends AbstractBean<?, ?>> resolveSpecializedBeans(Bean<?> specializingBean) {
if (specializingBean instanceof AbstractClassBean<?>) {
AbstractClassBean<?> abstractClassBean = (AbstractClassBean<?>) specializingBean;
if (abstractClassBean.isSpecializing()) {
... | java | public Set<? extends AbstractBean<?, ?>> resolveSpecializedBeans(Bean<?> specializingBean) {
if (specializingBean instanceof AbstractClassBean<?>) {
AbstractClassBean<?> abstractClassBean = (AbstractClassBean<?>) specializingBean;
if (abstractClassBean.isSpecializing()) {
... | [
"public",
"Set",
"<",
"?",
"extends",
"AbstractBean",
"<",
"?",
",",
"?",
">",
">",
"resolveSpecializedBeans",
"(",
"Bean",
"<",
"?",
">",
"specializingBean",
")",
"{",
"if",
"(",
"specializingBean",
"instanceof",
"AbstractClassBean",
"<",
"?",
">",
")",
"... | Returns a set of beans specialized by this bean. An empty set is returned if this bean does not specialize another beans. | [
"Returns",
"a",
"set",
"of",
"beans",
"specialized",
"by",
"this",
"bean",
".",
"An",
"empty",
"set",
"is",
"returned",
"if",
"this",
"bean",
"does",
"not",
"specialize",
"another",
"beans",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/SpecializationAndEnablementRegistry.java#L129-L143 | train |
weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java | DecoratorProxyFactory.addHandlerInitializerMethod | private void addHandlerInitializerMethod(ClassFile proxyClassType, ClassMethod staticConstructor) throws Exception {
ClassMethod classMethod = proxyClassType.addMethod(AccessFlag.PRIVATE, INIT_MH_METHOD_NAME, BytecodeUtils.VOID_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT);
final CodeAttribute b = classMethod.ge... | java | private void addHandlerInitializerMethod(ClassFile proxyClassType, ClassMethod staticConstructor) throws Exception {
ClassMethod classMethod = proxyClassType.addMethod(AccessFlag.PRIVATE, INIT_MH_METHOD_NAME, BytecodeUtils.VOID_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT);
final CodeAttribute b = classMethod.ge... | [
"private",
"void",
"addHandlerInitializerMethod",
"(",
"ClassFile",
"proxyClassType",
",",
"ClassMethod",
"staticConstructor",
")",
"throws",
"Exception",
"{",
"ClassMethod",
"classMethod",
"=",
"proxyClassType",
".",
"addMethod",
"(",
"AccessFlag",
".",
"PRIVATE",
",",... | calls _initMH on the method handler and then stores the result in the
methodHandler field as then new methodHandler | [
"calls",
"_initMH",
"on",
"the",
"method",
"handler",
"and",
"then",
"stores",
"the",
"result",
"in",
"the",
"methodHandler",
"field",
"as",
"then",
"new",
"methodHandler"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java#L81-L93 | train |
weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java | DecoratorProxyFactory.isEqual | private static boolean isEqual(Method m, Method a) {
if (m.getName().equals(a.getName()) && m.getParameterTypes().length == a.getParameterTypes().length && m.getReturnType().isAssignableFrom(a.getReturnType())) {
for (int i = 0; i < m.getParameterTypes().length; i++) {
if (!(m.getPar... | java | private static boolean isEqual(Method m, Method a) {
if (m.getName().equals(a.getName()) && m.getParameterTypes().length == a.getParameterTypes().length && m.getReturnType().isAssignableFrom(a.getReturnType())) {
for (int i = 0; i < m.getParameterTypes().length; i++) {
if (!(m.getPar... | [
"private",
"static",
"boolean",
"isEqual",
"(",
"Method",
"m",
",",
"Method",
"a",
")",
"{",
"if",
"(",
"m",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"a",
".",
"getName",
"(",
")",
")",
"&&",
"m",
".",
"getParameterTypes",
"(",
")",
".",
"le... | m is more generic than a | [
"m",
"is",
"more",
"generic",
"than",
"a"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java#L163-L173 | train |
weld/core | environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java | WeldServletLifecycle.createDeployment | protected CDI11Deployment createDeployment(ServletContext context, CDI11Bootstrap bootstrap) {
ImmutableSet.Builder<Metadata<Extension>> extensionsBuilder = ImmutableSet.builder();
extensionsBuilder.addAll(bootstrap.loadExtensions(WeldResourceLoader.getClassLoader()));
if (isDevModeEnabled) {
... | java | protected CDI11Deployment createDeployment(ServletContext context, CDI11Bootstrap bootstrap) {
ImmutableSet.Builder<Metadata<Extension>> extensionsBuilder = ImmutableSet.builder();
extensionsBuilder.addAll(bootstrap.loadExtensions(WeldResourceLoader.getClassLoader()));
if (isDevModeEnabled) {
... | [
"protected",
"CDI11Deployment",
"createDeployment",
"(",
"ServletContext",
"context",
",",
"CDI11Bootstrap",
"bootstrap",
")",
"{",
"ImmutableSet",
".",
"Builder",
"<",
"Metadata",
"<",
"Extension",
">>",
"extensionsBuilder",
"=",
"ImmutableSet",
".",
"builder",
"(",
... | Create servlet deployment.
Can be overridden with custom servlet deployment. e.g. exact resources listing in restricted env like GAE
@param context the servlet context
@param bootstrap the bootstrap
@return new servlet deployment | [
"Create",
"servlet",
"deployment",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java#L276-L332 | train |
weld/core | environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java | WeldServletLifecycle.findContainer | protected Container findContainer(ContainerContext ctx, StringBuilder dump) {
Container container = null;
// 1. Custom container class
String containerClassName = ctx.getServletContext().getInitParameter(Container.CONTEXT_PARAM_CONTAINER_CLASS);
if (containerClassName != null) {
... | java | protected Container findContainer(ContainerContext ctx, StringBuilder dump) {
Container container = null;
// 1. Custom container class
String containerClassName = ctx.getServletContext().getInitParameter(Container.CONTEXT_PARAM_CONTAINER_CLASS);
if (containerClassName != null) {
... | [
"protected",
"Container",
"findContainer",
"(",
"ContainerContext",
"ctx",
",",
"StringBuilder",
"dump",
")",
"{",
"Container",
"container",
"=",
"null",
";",
"// 1. Custom container class",
"String",
"containerClassName",
"=",
"ctx",
".",
"getServletContext",
"(",
")... | Find container env.
@param ctx the container context
@param dump the exception dump
@return valid container or null | [
"Find",
"container",
"env",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/WeldServletLifecycle.java#L341-L366 | train |
weld/core | impl/src/main/java/org/jboss/weld/resolution/ResolvableBuilder.java | ResolvableBuilder.createMetadataProvider | private Resolvable createMetadataProvider(Class<?> rawType) {
Set<Type> types = Collections.<Type>singleton(rawType);
return new ResolvableImpl(rawType, types, declaringBean, qualifierInstances, delegate);
} | java | private Resolvable createMetadataProvider(Class<?> rawType) {
Set<Type> types = Collections.<Type>singleton(rawType);
return new ResolvableImpl(rawType, types, declaringBean, qualifierInstances, delegate);
} | [
"private",
"Resolvable",
"createMetadataProvider",
"(",
"Class",
"<",
"?",
">",
"rawType",
")",
"{",
"Set",
"<",
"Type",
">",
"types",
"=",
"Collections",
".",
"<",
"Type",
">",
"singleton",
"(",
"rawType",
")",
";",
"return",
"new",
"ResolvableImpl",
"(",... | just as facade but we keep the qualifiers so that we can recognize Bean from @Intercepted Bean. | [
"just",
"as",
"facade",
"but",
"we",
"keep",
"the",
"qualifiers",
"so",
"that",
"we",
"can",
"recognize",
"Bean",
"from"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/ResolvableBuilder.java#L143-L146 | train |
weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/InterceptedSubclassFactory.java | InterceptedSubclassFactory.hasAbstractPackagePrivateSuperClassWithImplementation | private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) {
Class<?> superClass = clazz.getSuperclass();
while (superClass != null) {
if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifi... | java | private boolean hasAbstractPackagePrivateSuperClassWithImplementation(Class<?> clazz, BridgeMethod bridgeMethod) {
Class<?> superClass = clazz.getSuperclass();
while (superClass != null) {
if (Modifier.isAbstract(superClass.getModifiers()) && Reflections.isPackagePrivate(superClass.getModifi... | [
"private",
"boolean",
"hasAbstractPackagePrivateSuperClassWithImplementation",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"BridgeMethod",
"bridgeMethod",
")",
"{",
"Class",
"<",
"?",
">",
"superClass",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
";",
"while",
... | Returns true if super class of the parameter exists and is abstract and package private. In such case we want to omit such method.
See WELD-2507 and Oracle issue - https://bugs.java.com/view_bug.do?bug_id=6342411
@return true if the super class exists and is abstract and package private | [
"Returns",
"true",
"if",
"super",
"class",
"of",
"the",
"parameter",
"exists",
"and",
"is",
"abstract",
"and",
"package",
"private",
".",
"In",
"such",
"case",
"we",
"want",
"to",
"omit",
"such",
"method",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/InterceptedSubclassFactory.java#L273-L289 | train |
weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/InterceptedSubclassFactory.java | InterceptedSubclassFactory.addSpecialMethods | protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) {
try {
// Add special methods for interceptors
for (Method method : LifecycleMixin.class.getMethods()) {
BeanLogger.LOG.addingMethodToProxy(method);
MethodInformatio... | java | protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) {
try {
// Add special methods for interceptors
for (Method method : LifecycleMixin.class.getMethods()) {
BeanLogger.LOG.addingMethodToProxy(method);
MethodInformatio... | [
"protected",
"void",
"addSpecialMethods",
"(",
"ClassFile",
"proxyClassType",
",",
"ClassMethod",
"staticConstructor",
")",
"{",
"try",
"{",
"// Add special methods for interceptors",
"for",
"(",
"Method",
"method",
":",
"LifecycleMixin",
".",
"class",
".",
"getMethods"... | Adds methods requiring special implementations rather than just
delegation.
@param proxyClassType the Javassist class description for the proxy type | [
"Adds",
"methods",
"requiring",
"special",
"implementations",
"rather",
"than",
"just",
"delegation",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/InterceptedSubclassFactory.java#L472-L493 | train |
weld/core | impl/src/main/java/org/jboss/weld/util/Decorators.java | Decorators.checkDelegateType | public static void checkDelegateType(Decorator<?> decorator) {
Set<Type> types = new HierarchyDiscovery(decorator.getDelegateType()).getTypeClosure();
for (Type decoratedType : decorator.getDecoratedTypes()) {
if(!types.contains(decoratedType)) {
throw BeanLogger.LOG.delega... | java | public static void checkDelegateType(Decorator<?> decorator) {
Set<Type> types = new HierarchyDiscovery(decorator.getDelegateType()).getTypeClosure();
for (Type decoratedType : decorator.getDecoratedTypes()) {
if(!types.contains(decoratedType)) {
throw BeanLogger.LOG.delega... | [
"public",
"static",
"void",
"checkDelegateType",
"(",
"Decorator",
"<",
"?",
">",
"decorator",
")",
"{",
"Set",
"<",
"Type",
">",
"types",
"=",
"new",
"HierarchyDiscovery",
"(",
"decorator",
".",
"getDelegateType",
"(",
")",
")",
".",
"getTypeClosure",
"(",
... | Check whether the delegate type implements or extends all decorated types.
@param decorator
@throws DefinitionException If the delegate type doesn't implement or extend all decorated types | [
"Check",
"whether",
"the",
"delegate",
"type",
"implements",
"or",
"extends",
"all",
"decorated",
"types",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Decorators.java#L134-L143 | train |
weld/core | impl/src/main/java/org/jboss/weld/util/Decorators.java | Decorators.checkAbstractMethods | public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) {
if (decoratedTypes == null) {
decoratedTypes = new HashSet<Type>(type.getInterfaceClosure());
decoratedTypes.remove(Serializable.class);
}
... | java | public static <T> void checkAbstractMethods(Set<Type> decoratedTypes, EnhancedAnnotatedType<T> type, BeanManagerImpl beanManager) {
if (decoratedTypes == null) {
decoratedTypes = new HashSet<Type>(type.getInterfaceClosure());
decoratedTypes.remove(Serializable.class);
}
... | [
"public",
"static",
"<",
"T",
">",
"void",
"checkAbstractMethods",
"(",
"Set",
"<",
"Type",
">",
"decoratedTypes",
",",
"EnhancedAnnotatedType",
"<",
"T",
">",
"type",
",",
"BeanManagerImpl",
"beanManager",
")",
"{",
"if",
"(",
"decoratedTypes",
"==",
"null",
... | Check all abstract methods are declared by the decorated types.
@param type
@param beanManager
@param delegateType
@throws DefinitionException If any of the abstract methods is not declared by the decorated types | [
"Check",
"all",
"abstract",
"methods",
"are",
"declared",
"by",
"the",
"decorated",
"types",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Decorators.java#L153-L177 | train |
weld/core | impl/src/main/java/org/jboss/weld/bean/AbstractBean.java | AbstractBean.checkSpecialization | public void checkSpecialization() {
if (isSpecializing()) {
boolean isNameDefined = getAnnotated().isAnnotationPresent(Named.class);
String previousSpecializedBeanName = null;
for (AbstractBean<?, ?> specializedBean : getSpecializedBeans()) {
String name = spe... | java | public void checkSpecialization() {
if (isSpecializing()) {
boolean isNameDefined = getAnnotated().isAnnotationPresent(Named.class);
String previousSpecializedBeanName = null;
for (AbstractBean<?, ?> specializedBean : getSpecializedBeans()) {
String name = spe... | [
"public",
"void",
"checkSpecialization",
"(",
")",
"{",
"if",
"(",
"isSpecializing",
"(",
")",
")",
"{",
"boolean",
"isNameDefined",
"=",
"getAnnotated",
"(",
")",
".",
"isAnnotationPresent",
"(",
"Named",
".",
"class",
")",
";",
"String",
"previousSpecialized... | Validates specialization if this bean specializes another bean. | [
"Validates",
"specialization",
"if",
"this",
"bean",
"specializes",
"another",
"bean",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java#L116-L158 | train |
weld/core | impl/src/main/java/org/jboss/weld/bootstrap/BeanDeploymentModule.java | BeanDeploymentModule.fireEvent | public void fireEvent(Type eventType, Object event, Annotation... qualifiers) {
final EventMetadata metadata = new EventMetadataImpl(eventType, null, qualifiers);
notifier.fireEvent(eventType, event, metadata, qualifiers);
} | java | public void fireEvent(Type eventType, Object event, Annotation... qualifiers) {
final EventMetadata metadata = new EventMetadataImpl(eventType, null, qualifiers);
notifier.fireEvent(eventType, event, metadata, qualifiers);
} | [
"public",
"void",
"fireEvent",
"(",
"Type",
"eventType",
",",
"Object",
"event",
",",
"Annotation",
"...",
"qualifiers",
")",
"{",
"final",
"EventMetadata",
"metadata",
"=",
"new",
"EventMetadataImpl",
"(",
"eventType",
",",
"null",
",",
"qualifiers",
")",
";"... | Fire an event and notify observers that belong to this module.
@param eventType
@param event
@param qualifiers | [
"Fire",
"an",
"event",
"and",
"notify",
"observers",
"that",
"belong",
"to",
"this",
"module",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeploymentModule.java#L91-L94 | train |
weld/core | impl/src/main/java/org/jboss/weld/util/Defaults.java | Defaults.getJlsDefaultValue | @SuppressWarnings("unchecked")
public static <T> T getJlsDefaultValue(Class<T> type) {
if(!type.isPrimitive()) {
return null;
}
return (T) JLS_PRIMITIVE_DEFAULT_VALUES.get(type);
} | java | @SuppressWarnings("unchecked")
public static <T> T getJlsDefaultValue(Class<T> type) {
if(!type.isPrimitive()) {
return null;
}
return (T) JLS_PRIMITIVE_DEFAULT_VALUES.get(type);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getJlsDefaultValue",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"!",
"type",
".",
"isPrimitive",
"(",
")",
")",
"{",
"return",
"null",
";",
"}... | See also JLS8, 4.12.5 Initial Values of Variables.
@param type
@return the default value for the given type as defined by JLS | [
"See",
"also",
"JLS8",
"4",
".",
"12",
".",
"5",
"Initial",
"Values",
"of",
"Variables",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Defaults.java#L53-L59 | train |
weld/core | probe/core/src/main/java/org/jboss/weld/probe/ProbeExtension.java | ProbeExtension.afterDeploymentValidation | public void afterDeploymentValidation(@Observes @Priority(1) AfterDeploymentValidation event, BeanManager beanManager) {
BeanManagerImpl manager = BeanManagerProxy.unwrap(beanManager);
probe.init(manager);
if (isJMXSupportEnabled(manager)) {
try {
MBeanServer mbs = Ma... | java | public void afterDeploymentValidation(@Observes @Priority(1) AfterDeploymentValidation event, BeanManager beanManager) {
BeanManagerImpl manager = BeanManagerProxy.unwrap(beanManager);
probe.init(manager);
if (isJMXSupportEnabled(manager)) {
try {
MBeanServer mbs = Ma... | [
"public",
"void",
"afterDeploymentValidation",
"(",
"@",
"Observes",
"@",
"Priority",
"(",
"1",
")",
"AfterDeploymentValidation",
"event",
",",
"BeanManager",
"beanManager",
")",
"{",
"BeanManagerImpl",
"manager",
"=",
"BeanManagerProxy",
".",
"unwrap",
"(",
"beanMa... | any possible bean invocations from other ADV observers | [
"any",
"possible",
"bean",
"invocations",
"from",
"other",
"ADV",
"observers"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/probe/core/src/main/java/org/jboss/weld/probe/ProbeExtension.java#L165-L178 | train |
weld/core | impl/src/main/java/org/jboss/weld/metadata/Selectors.java | Selectors.matchPath | static boolean matchPath(String[] tokenizedPattern, String[] strDirs, boolean isCaseSensitive) {
int patIdxStart = 0;
int patIdxEnd = tokenizedPattern.length - 1;
int strIdxStart = 0;
int strIdxEnd = strDirs.length - 1;
// up to first '**'
while (patIdxStart <= patIdxEnd... | java | static boolean matchPath(String[] tokenizedPattern, String[] strDirs, boolean isCaseSensitive) {
int patIdxStart = 0;
int patIdxEnd = tokenizedPattern.length - 1;
int strIdxStart = 0;
int strIdxEnd = strDirs.length - 1;
// up to first '**'
while (patIdxStart <= patIdxEnd... | [
"static",
"boolean",
"matchPath",
"(",
"String",
"[",
"]",
"tokenizedPattern",
",",
"String",
"[",
"]",
"strDirs",
",",
"boolean",
"isCaseSensitive",
")",
"{",
"int",
"patIdxStart",
"=",
"0",
";",
"int",
"patIdxEnd",
"=",
"tokenizedPattern",
".",
"length",
"... | Core implementation of matchPath. It is isolated so that it can be called
from TokenizedPattern. | [
"Core",
"implementation",
"of",
"matchPath",
".",
"It",
"is",
"isolated",
"so",
"that",
"it",
"can",
"be",
"called",
"from",
"TokenizedPattern",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/Selectors.java#L81-L183 | train |
weld/core | impl/src/main/java/org/jboss/weld/metadata/Selectors.java | Selectors.tokenize | static String[] tokenize(String str) {
char sep = '.';
int start = 0;
int len = str.length();
int count = 0;
for (int pos = 0; pos < len; pos++) {
if (str.charAt(pos) == sep) {
if (pos != start) {
count++;
}
... | java | static String[] tokenize(String str) {
char sep = '.';
int start = 0;
int len = str.length();
int count = 0;
for (int pos = 0; pos < len; pos++) {
if (str.charAt(pos) == sep) {
if (pos != start) {
count++;
}
... | [
"static",
"String",
"[",
"]",
"tokenize",
"(",
"String",
"str",
")",
"{",
"char",
"sep",
"=",
"'",
"'",
";",
"int",
"start",
"=",
"0",
";",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"in... | Tokenize the the string as a package hierarchy
@param str
@return | [
"Tokenize",
"the",
"the",
"string",
"as",
"a",
"package",
"hierarchy"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/Selectors.java#L347-L381 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.