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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.execute | public Runnable execute(Runnable command, long timeoutInMillis) throws InterruptedException, IllegalStateException {
try {
return execute(command, WAIT_WHEN_QUEUE_IS_FULL, timeoutInMillis);
} catch (ThreadPoolQueueIsFullException e) {
// we should not get here.
// Alex Ffdc.log(e, this, ThreadPool.class.getName(), "855"); // D477704.2
return null;
}
} | java | public Runnable execute(Runnable command, long timeoutInMillis) throws InterruptedException, IllegalStateException {
try {
return execute(command, WAIT_WHEN_QUEUE_IS_FULL, timeoutInMillis);
} catch (ThreadPoolQueueIsFullException e) {
// we should not get here.
// Alex Ffdc.log(e, this, ThreadPool.class.getName(), "855"); // D477704.2
return null;
}
} | [
"public",
"Runnable",
"execute",
"(",
"Runnable",
"command",
",",
"long",
"timeoutInMillis",
")",
"throws",
"InterruptedException",
",",
"IllegalStateException",
"{",
"try",
"{",
"return",
"execute",
"(",
"command",
",",
"WAIT_WHEN_QUEUE_IS_FULL",
",",
"timeoutInMillis",
")",
";",
"}",
"catch",
"(",
"ThreadPoolQueueIsFullException",
"e",
")",
"{",
"// we should not get here.",
"// Alex Ffdc.log(e, this, ThreadPool.class.getName(), \"855\"); // D477704.2",
"return",
"null",
";",
"}",
"}"
] | Arrange for the given command to be executed by a thread in this
pool. If the pools internal request buffer is full, the call
will block for at most timeoutInMillis milliseconds.
@param command
- the work to be dispatched.
@param timeoutInMillis
- the amount of time to block and
wait if the request buffer is full.
@return the command if it was, indeed queued to the pool or
null if the request timed out. | [
"Arrange",
"for",
"the",
"given",
"command",
"to",
"be",
"executed",
"by",
"a",
"thread",
"in",
"this",
"pool",
".",
"If",
"the",
"pools",
"internal",
"request",
"buffer",
"is",
"full",
"the",
"call",
"will",
"block",
"for",
"at",
"most",
"timeoutInMillis",
"milliseconds",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1153-L1161 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.setMonitorPlugin | public void setMonitorPlugin(MonitorPlugin plugin) throws TooManyListenersException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setMonitorPlugin", plugin);
}
if (this.monitorPlugin != null && !this.monitorPlugin.equals(plugin)) {
throw new TooManyListenersException("INTERNAL ERROR: ThreadPool.MonitorPlugin already set.");
}
this.monitorPlugin = plugin;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setMonitorPlugin", plugin);
}
} | java | public void setMonitorPlugin(MonitorPlugin plugin) throws TooManyListenersException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setMonitorPlugin", plugin);
}
if (this.monitorPlugin != null && !this.monitorPlugin.equals(plugin)) {
throw new TooManyListenersException("INTERNAL ERROR: ThreadPool.MonitorPlugin already set.");
}
this.monitorPlugin = plugin;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setMonitorPlugin", plugin);
}
} | [
"public",
"void",
"setMonitorPlugin",
"(",
"MonitorPlugin",
"plugin",
")",
"throws",
"TooManyListenersException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"setMonitorPlugin\"",
",",
"plugin",
")",
";",
"}",
"if",
"(",
"this",
".",
"monitorPlugin",
"!=",
"null",
"&&",
"!",
"this",
".",
"monitorPlugin",
".",
"equals",
"(",
"plugin",
")",
")",
"{",
"throw",
"new",
"TooManyListenersException",
"(",
"\"INTERNAL ERROR: ThreadPool.MonitorPlugin already set.\"",
")",
";",
"}",
"this",
".",
"monitorPlugin",
"=",
"plugin",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"setMonitorPlugin\"",
",",
"plugin",
")",
";",
"}",
"}"
] | Registers a MonitorPlugin with this thread pool. Only
one plugin is supported in the current implementation.
@throws TooManyListenersException
if a different
MonitorPlugin had already been registered with
this ThreadPool. | [
"Registers",
"a",
"MonitorPlugin",
"with",
"this",
"thread",
"pool",
".",
"Only",
"one",
"plugin",
"is",
"supported",
"in",
"the",
"current",
"implementation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1463-L1477 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.checkAllThreads | public void checkAllThreads() {
// if nothing is plugged in, exit early
if (this.monitorPlugin == null) {
return;
}
long currentTime = 0; // lazily initialize current time
try {
for (Iterator i = this.threads_.values().iterator(); i.hasNext();) {
Worker thread = (Worker) i.next();
synchronized (thread) { // d204471
if (thread.getStartTime() > 0) {
if (currentTime == 0) {
currentTime = System.currentTimeMillis();
}
if (!thread.isHung && this.monitorPlugin.checkThread(thread, thread.threadNumber, currentTime - thread.getStartTime())) { // PK25446
thread.isHung = true;
}
}
}
}
this.lastThreadCheckDidntComplete = false; // D222794
} catch (ConcurrentModificationException e) { // begin D222794
// NOTE: we can pretty much ignore this exception ... if
// we occasionally fail on the check, we'll be OK. So
// we simply keep track with a flag. If two consecutive
// checks fail, then we'll log to FFDC
if (this.lastThreadCheckDidntComplete) {
// Alex Ffdc.log(e, this, this.getClass().getName(), "1181", this); //
// D477704.2
}
this.lastThreadCheckDidntComplete = true;
} // end D222794
} | java | public void checkAllThreads() {
// if nothing is plugged in, exit early
if (this.monitorPlugin == null) {
return;
}
long currentTime = 0; // lazily initialize current time
try {
for (Iterator i = this.threads_.values().iterator(); i.hasNext();) {
Worker thread = (Worker) i.next();
synchronized (thread) { // d204471
if (thread.getStartTime() > 0) {
if (currentTime == 0) {
currentTime = System.currentTimeMillis();
}
if (!thread.isHung && this.monitorPlugin.checkThread(thread, thread.threadNumber, currentTime - thread.getStartTime())) { // PK25446
thread.isHung = true;
}
}
}
}
this.lastThreadCheckDidntComplete = false; // D222794
} catch (ConcurrentModificationException e) { // begin D222794
// NOTE: we can pretty much ignore this exception ... if
// we occasionally fail on the check, we'll be OK. So
// we simply keep track with a flag. If two consecutive
// checks fail, then we'll log to FFDC
if (this.lastThreadCheckDidntComplete) {
// Alex Ffdc.log(e, this, this.getClass().getName(), "1181", this); //
// D477704.2
}
this.lastThreadCheckDidntComplete = true;
} // end D222794
} | [
"public",
"void",
"checkAllThreads",
"(",
")",
"{",
"// if nothing is plugged in, exit early",
"if",
"(",
"this",
".",
"monitorPlugin",
"==",
"null",
")",
"{",
"return",
";",
"}",
"long",
"currentTime",
"=",
"0",
";",
"// lazily initialize current time",
"try",
"{",
"for",
"(",
"Iterator",
"i",
"=",
"this",
".",
"threads_",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Worker",
"thread",
"=",
"(",
"Worker",
")",
"i",
".",
"next",
"(",
")",
";",
"synchronized",
"(",
"thread",
")",
"{",
"// d204471",
"if",
"(",
"thread",
".",
"getStartTime",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"currentTime",
"==",
"0",
")",
"{",
"currentTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"if",
"(",
"!",
"thread",
".",
"isHung",
"&&",
"this",
".",
"monitorPlugin",
".",
"checkThread",
"(",
"thread",
",",
"thread",
".",
"threadNumber",
",",
"currentTime",
"-",
"thread",
".",
"getStartTime",
"(",
")",
")",
")",
"{",
"// PK25446",
"thread",
".",
"isHung",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"this",
".",
"lastThreadCheckDidntComplete",
"=",
"false",
";",
"// D222794",
"}",
"catch",
"(",
"ConcurrentModificationException",
"e",
")",
"{",
"// begin D222794",
"// NOTE: we can pretty much ignore this exception ... if",
"// we occasionally fail on the check, we'll be OK. So",
"// we simply keep track with a flag. If two consecutive",
"// checks fail, then we'll log to FFDC",
"if",
"(",
"this",
".",
"lastThreadCheckDidntComplete",
")",
"{",
"// Alex Ffdc.log(e, this, this.getClass().getName(), \"1181\", this); //",
"// D477704.2",
"}",
"this",
".",
"lastThreadCheckDidntComplete",
"=",
"true",
";",
"}",
"// end D222794",
"}"
] | Checks all active threads in this thread pool to determine if
they are hung. The definition of hung is provided by the
MonitorPlugin.
@see MonitorPlugin | [
"Checks",
"all",
"active",
"threads",
"in",
"this",
"thread",
"pool",
"to",
"determine",
"if",
"they",
"are",
"hung",
".",
"The",
"definition",
"of",
"hung",
"is",
"provided",
"by",
"the",
"MonitorPlugin",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1486-L1524 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterCellSlowStr.java | FilterCellSlowStr.findNextCell | public FilterCellSlowStr findNextCell(String nextValue) {
if (nextCell == null) {
return null;
}
return nextCell.get(nextValue);
} | java | public FilterCellSlowStr findNextCell(String nextValue) {
if (nextCell == null) {
return null;
}
return nextCell.get(nextValue);
} | [
"public",
"FilterCellSlowStr",
"findNextCell",
"(",
"String",
"nextValue",
")",
"{",
"if",
"(",
"nextCell",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"nextCell",
".",
"get",
"(",
"nextValue",
")",
";",
"}"
] | Find the next cell, for a given string, which may come after this cell
in the address tree.
@param nextValue
The next string the URL Address that is to be tested
for inclusion in the address tree
@return null if the nextValue does not have another cell connected to this
cell in the tree. Otherwise return the next cell in the tree that
is represented
by nextValue. | [
"Find",
"the",
"next",
"cell",
"for",
"a",
"given",
"string",
"which",
"may",
"come",
"after",
"this",
"cell",
"in",
"the",
"address",
"tree",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterCellSlowStr.java#L51-L56 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/tasks/GeneratePluginTask.java | GeneratePluginTask.invokeGeneratePluginCfgMBean | protected boolean invokeGeneratePluginCfgMBean(ParseLoginAddress loginAddress, String clusterName, String targetPath, String option)
{
boolean success = false;
try {
success = connection.generatePluginConfig(loginAddress, clusterName, targetPath ,option);
if (success)
success = copyFileToTargetPath(loginAddress,clusterName,targetPath);
if(success){
if(option.equalsIgnoreCase("server")){
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.complete.server"));
}
else
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.complete.collective"));
}
else
if(option.equalsIgnoreCase("server")){
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.fail.server"));
}
else
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.fail.collective"));
} catch (RuntimeMBeanException e) {
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
} catch (UnknownHostException e) {
// java.net.UnknownHostException: bad host
commandConsole.printlnErrorMessage(getMessage("common.hostError", loginAddress.getHost()));
} catch (ConnectException e) {
// java.net.ConnectException: bad port
commandConsole.printlnErrorMessage(getMessage("common.portError", loginAddress.getPort()));
} catch (IOException e) {
// java.io.IOException: bad creds or some other IO error
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
} catch (Exception e) {
String msg = e.getMessage();
if (msg != null) {
//int idx = e.getMessage().indexOf(MBEAN_NOT_PRESENT_MSG_ID);
//if (idx > -1) {
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.notEnabled"));
//}
}
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
} finally {
try {
connection.closeConnector();
} catch (IOException e) {
// java.io.IOException: some other IO error
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
}
}
return success;
} | java | protected boolean invokeGeneratePluginCfgMBean(ParseLoginAddress loginAddress, String clusterName, String targetPath, String option)
{
boolean success = false;
try {
success = connection.generatePluginConfig(loginAddress, clusterName, targetPath ,option);
if (success)
success = copyFileToTargetPath(loginAddress,clusterName,targetPath);
if(success){
if(option.equalsIgnoreCase("server")){
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.complete.server"));
}
else
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.complete.collective"));
}
else
if(option.equalsIgnoreCase("server")){
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.fail.server"));
}
else
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.fail.collective"));
} catch (RuntimeMBeanException e) {
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
} catch (UnknownHostException e) {
// java.net.UnknownHostException: bad host
commandConsole.printlnErrorMessage(getMessage("common.hostError", loginAddress.getHost()));
} catch (ConnectException e) {
// java.net.ConnectException: bad port
commandConsole.printlnErrorMessage(getMessage("common.portError", loginAddress.getPort()));
} catch (IOException e) {
// java.io.IOException: bad creds or some other IO error
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
} catch (Exception e) {
String msg = e.getMessage();
if (msg != null) {
//int idx = e.getMessage().indexOf(MBEAN_NOT_PRESENT_MSG_ID);
//if (idx > -1) {
commandConsole.printlnInfoMessage(getMessage("generateWebServerPluginTask.notEnabled"));
//}
}
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
} finally {
try {
connection.closeConnector();
} catch (IOException e) {
// java.io.IOException: some other IO error
commandConsole.printlnErrorMessage(getMessage("common.connectionError", e.getMessage()));
}
}
return success;
} | [
"protected",
"boolean",
"invokeGeneratePluginCfgMBean",
"(",
"ParseLoginAddress",
"loginAddress",
",",
"String",
"clusterName",
",",
"String",
"targetPath",
",",
"String",
"option",
")",
"{",
"boolean",
"success",
"=",
"false",
";",
"try",
"{",
"success",
"=",
"connection",
".",
"generatePluginConfig",
"(",
"loginAddress",
",",
"clusterName",
",",
"targetPath",
",",
"option",
")",
";",
"if",
"(",
"success",
")",
"success",
"=",
"copyFileToTargetPath",
"(",
"loginAddress",
",",
"clusterName",
",",
"targetPath",
")",
";",
"if",
"(",
"success",
")",
"{",
"if",
"(",
"option",
".",
"equalsIgnoreCase",
"(",
"\"server\"",
")",
")",
"{",
"commandConsole",
".",
"printlnInfoMessage",
"(",
"getMessage",
"(",
"\"generateWebServerPluginTask.complete.server\"",
")",
")",
";",
"}",
"else",
"commandConsole",
".",
"printlnInfoMessage",
"(",
"getMessage",
"(",
"\"generateWebServerPluginTask.complete.collective\"",
")",
")",
";",
"}",
"else",
"if",
"(",
"option",
".",
"equalsIgnoreCase",
"(",
"\"server\"",
")",
")",
"{",
"commandConsole",
".",
"printlnInfoMessage",
"(",
"getMessage",
"(",
"\"generateWebServerPluginTask.fail.server\"",
")",
")",
";",
"}",
"else",
"commandConsole",
".",
"printlnInfoMessage",
"(",
"getMessage",
"(",
"\"generateWebServerPluginTask.fail.collective\"",
")",
")",
";",
"}",
"catch",
"(",
"RuntimeMBeanException",
"e",
")",
"{",
"commandConsole",
".",
"printlnErrorMessage",
"(",
"getMessage",
"(",
"\"common.connectionError\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"UnknownHostException",
"e",
")",
"{",
"// java.net.UnknownHostException: bad host",
"commandConsole",
".",
"printlnErrorMessage",
"(",
"getMessage",
"(",
"\"common.hostError\"",
",",
"loginAddress",
".",
"getHost",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"ConnectException",
"e",
")",
"{",
"// java.net.ConnectException: bad port",
"commandConsole",
".",
"printlnErrorMessage",
"(",
"getMessage",
"(",
"\"common.portError\"",
",",
"loginAddress",
".",
"getPort",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// java.io.IOException: bad creds or some other IO error",
"commandConsole",
".",
"printlnErrorMessage",
"(",
"getMessage",
"(",
"\"common.connectionError\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"msg",
"=",
"e",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"msg",
"!=",
"null",
")",
"{",
"//int idx = e.getMessage().indexOf(MBEAN_NOT_PRESENT_MSG_ID);",
"//if (idx > -1) {",
"commandConsole",
".",
"printlnInfoMessage",
"(",
"getMessage",
"(",
"\"generateWebServerPluginTask.notEnabled\"",
")",
")",
";",
"//}",
"}",
"commandConsole",
".",
"printlnErrorMessage",
"(",
"getMessage",
"(",
"\"common.connectionError\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"connection",
".",
"closeConnector",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// java.io.IOException: some other IO error",
"commandConsole",
".",
"printlnErrorMessage",
"(",
"getMessage",
"(",
"\"common.connectionError\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"success",
";",
"}"
] | Invokes MBean for generatePluginConfig to generate plugin configuration file
@param controllerHost
@param controllerPort
@param user
@param password
@param targetPath
@return | [
"Invokes",
"MBean",
"for",
"generatePluginConfig",
"to",
"generate",
"plugin",
"configuration",
"file"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/tasks/GeneratePluginTask.java#L198-L258 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceFactory.java | TraceFactory.getTraceFactory | public static TraceFactory getTraceFactory(NLS nls) {
return (TraceFactory) Utils.getImpl("com.ibm.ws.objectManager.utils.TraceFactoryImpl",
new Class[] { NLS.class },
new Object[] { nls });
} | java | public static TraceFactory getTraceFactory(NLS nls) {
return (TraceFactory) Utils.getImpl("com.ibm.ws.objectManager.utils.TraceFactoryImpl",
new Class[] { NLS.class },
new Object[] { nls });
} | [
"public",
"static",
"TraceFactory",
"getTraceFactory",
"(",
"NLS",
"nls",
")",
"{",
"return",
"(",
"TraceFactory",
")",
"Utils",
".",
"getImpl",
"(",
"\"com.ibm.ws.objectManager.utils.TraceFactoryImpl\"",
",",
"new",
"Class",
"[",
"]",
"{",
"NLS",
".",
"class",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"nls",
"}",
")",
";",
"}"
] | Create a platform specific TraceFactory instance.
@param nls instance which holds the message catalogue to be used for info tracing.
@return TraceFactory instance loaded. | [
"Create",
"a",
"platform",
"specific",
"TraceFactory",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceFactory.java#L39-L43 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceFactory.java | TraceFactory.setActiveTrace | public void setActiveTrace(String activeNames,
int traceLevel)
throws java.io.IOException {
TraceFactory.activeNames = activeNames;
TraceFactory.traceLevel = traceLevel;;
} | java | public void setActiveTrace(String activeNames,
int traceLevel)
throws java.io.IOException {
TraceFactory.activeNames = activeNames;
TraceFactory.traceLevel = traceLevel;;
} | [
"public",
"void",
"setActiveTrace",
"(",
"String",
"activeNames",
",",
"int",
"traceLevel",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"TraceFactory",
".",
"activeNames",
"=",
"activeNames",
";",
"TraceFactory",
".",
"traceLevel",
"=",
"traceLevel",
";",
";",
"}"
] | Specify what to trace and start tracing it.
@param activeNames of classes to be activated separated by ":"
"*" represents any name.
@param traceLevel to be applied.
@throws java.io.IOException | [
"Specify",
"what",
"to",
"trace",
"and",
"start",
"tracing",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/TraceFactory.java#L71-L76 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientJFapCommunicator.java | ClientJFapCommunicator.setSICoreConnection | protected void setSICoreConnection(SICoreConnection connection)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setSICoreConnection", connection);
//Retrieve Client Conversation State if necessary
validateConversationState();
cConState.setSICoreConnection(connection);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setSICoreConnection");
} | java | protected void setSICoreConnection(SICoreConnection connection)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setSICoreConnection", connection);
//Retrieve Client Conversation State if necessary
validateConversationState();
cConState.setSICoreConnection(connection);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setSICoreConnection");
} | [
"protected",
"void",
"setSICoreConnection",
"(",
"SICoreConnection",
"connection",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setSICoreConnection\"",
",",
"connection",
")",
";",
"//Retrieve Client Conversation State if necessary",
"validateConversationState",
"(",
")",
";",
"cConState",
".",
"setSICoreConnection",
"(",
"connection",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setSICoreConnection\"",
")",
";",
"}"
] | Sets the SICoreConnection reference on the server
@param connection | [
"Sets",
"the",
"SICoreConnection",
"reference",
"on",
"the",
"server"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientJFapCommunicator.java#L119-L128 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ObjectCopier.java | ObjectCopier.copy | public Serializable copy(Serializable obj)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "copy : " + Util.identity(obj));
// -----------------------------------------------------------------------
// Optimize copyObject by special casing null, immutable objects,
// and primitive arrays. All of these can be handled much more
// efficiently than performing a 'deep' copy. d154342.7
// -----------------------------------------------------------------------
if (obj == null)
{
return obj;
}
Class<?> objType = obj.getClass();
// if the object is a primitive wrapper class, then return it.
if ((objType == String.class) ||
(objType == Integer.class) ||
(objType == Long.class) ||
(objType == Boolean.class) ||
(objType == Byte.class) ||
(objType == Character.class) ||
(objType == Float.class) ||
(objType == Double.class) ||
(objType == Short.class))
{
// Yes, so do nothing...
return obj;
}
Class<?> componentType = objType.getComponentType();
// If this is an array of primitives take a clone instead of deep copy
if (componentType != null && componentType.isPrimitive())
{
if (componentType == boolean.class)
return ((boolean[]) obj).clone();
if (componentType == byte.class)
return ((byte[]) obj).clone();
if (componentType == char.class)
return ((char[]) obj).clone();
if (componentType == short.class)
return ((short[]) obj).clone();
if (componentType == int.class)
return ((int[]) obj).clone();
if (componentType == long.class)
return ((long[]) obj).clone();
if (componentType == float.class)
return ((float[]) obj).clone();
if (componentType == double.class)
return ((double[]) obj).clone();
}
// End d154342.7
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "copy : making a deep copy");
return copySerializable(obj);
} | java | public Serializable copy(Serializable obj)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "copy : " + Util.identity(obj));
// -----------------------------------------------------------------------
// Optimize copyObject by special casing null, immutable objects,
// and primitive arrays. All of these can be handled much more
// efficiently than performing a 'deep' copy. d154342.7
// -----------------------------------------------------------------------
if (obj == null)
{
return obj;
}
Class<?> objType = obj.getClass();
// if the object is a primitive wrapper class, then return it.
if ((objType == String.class) ||
(objType == Integer.class) ||
(objType == Long.class) ||
(objType == Boolean.class) ||
(objType == Byte.class) ||
(objType == Character.class) ||
(objType == Float.class) ||
(objType == Double.class) ||
(objType == Short.class))
{
// Yes, so do nothing...
return obj;
}
Class<?> componentType = objType.getComponentType();
// If this is an array of primitives take a clone instead of deep copy
if (componentType != null && componentType.isPrimitive())
{
if (componentType == boolean.class)
return ((boolean[]) obj).clone();
if (componentType == byte.class)
return ((byte[]) obj).clone();
if (componentType == char.class)
return ((char[]) obj).clone();
if (componentType == short.class)
return ((short[]) obj).clone();
if (componentType == int.class)
return ((int[]) obj).clone();
if (componentType == long.class)
return ((long[]) obj).clone();
if (componentType == float.class)
return ((float[]) obj).clone();
if (componentType == double.class)
return ((double[]) obj).clone();
}
// End d154342.7
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "copy : making a deep copy");
return copySerializable(obj);
} | [
"public",
"Serializable",
"copy",
"(",
"Serializable",
"obj",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"copy : \"",
"+",
"Util",
".",
"identity",
"(",
"obj",
")",
")",
";",
"// -----------------------------------------------------------------------",
"// Optimize copyObject by special casing null, immutable objects,",
"// and primitive arrays. All of these can be handled much more",
"// efficiently than performing a 'deep' copy. d154342.7",
"// -----------------------------------------------------------------------",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"obj",
";",
"}",
"Class",
"<",
"?",
">",
"objType",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"// if the object is a primitive wrapper class, then return it.",
"if",
"(",
"(",
"objType",
"==",
"String",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Integer",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Long",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Boolean",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Byte",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Character",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Float",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Double",
".",
"class",
")",
"||",
"(",
"objType",
"==",
"Short",
".",
"class",
")",
")",
"{",
"// Yes, so do nothing...",
"return",
"obj",
";",
"}",
"Class",
"<",
"?",
">",
"componentType",
"=",
"objType",
".",
"getComponentType",
"(",
")",
";",
"// If this is an array of primitives take a clone instead of deep copy",
"if",
"(",
"componentType",
"!=",
"null",
"&&",
"componentType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if",
"(",
"componentType",
"==",
"boolean",
".",
"class",
")",
"return",
"(",
"(",
"boolean",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"byte",
".",
"class",
")",
"return",
"(",
"(",
"byte",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"char",
".",
"class",
")",
"return",
"(",
"(",
"char",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"short",
".",
"class",
")",
"return",
"(",
"(",
"short",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"int",
".",
"class",
")",
"return",
"(",
"(",
"int",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"long",
".",
"class",
")",
"return",
"(",
"(",
"long",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"float",
".",
"class",
")",
"return",
"(",
"(",
"float",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"double",
".",
"class",
")",
"return",
"(",
"(",
"double",
"[",
"]",
")",
"obj",
")",
".",
"clone",
"(",
")",
";",
"}",
"// End d154342.7",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"copy : making a deep copy\"",
")",
";",
"return",
"copySerializable",
"(",
"obj",
")",
";",
"}"
] | Make a copy of an object by writing it out to stream and reading it
back again. This will make a "deep" copy of the object.
This method is optimized to not copy immutable objects.
@param obj the object to be copied, or null
@return a copy of the object
@throws RuntimeException if the object cannot be serialized | [
"Make",
"a",
"copy",
"of",
"an",
"object",
"by",
"writing",
"it",
"out",
"to",
"stream",
"and",
"reading",
"it",
"back",
"again",
".",
"This",
"will",
"make",
"a",
"deep",
"copy",
"of",
"the",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ObjectCopier.java#L52-L114 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ObjectCopier.java | ObjectCopier.copy | public ScheduleExpression copy(ScheduleExpression schedule)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "copy ScheduleExpression: " + Util.identity(schedule));
// 'schedule' could be a subclass of ScheduleExpression, so only
// use the base class constructor if not a subclass. F743-21028.3
if (schedule.getClass() == ScheduleExpression.class)
{
return copyBase(schedule); // 632906
}
return (ScheduleExpression) copySerializable(schedule);
} | java | public ScheduleExpression copy(ScheduleExpression schedule)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "copy ScheduleExpression: " + Util.identity(schedule));
// 'schedule' could be a subclass of ScheduleExpression, so only
// use the base class constructor if not a subclass. F743-21028.3
if (schedule.getClass() == ScheduleExpression.class)
{
return copyBase(schedule); // 632906
}
return (ScheduleExpression) copySerializable(schedule);
} | [
"public",
"ScheduleExpression",
"copy",
"(",
"ScheduleExpression",
"schedule",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"copy ScheduleExpression: \"",
"+",
"Util",
".",
"identity",
"(",
"schedule",
")",
")",
";",
"// 'schedule' could be a subclass of ScheduleExpression, so only",
"// use the base class constructor if not a subclass. F743-21028.3",
"if",
"(",
"schedule",
".",
"getClass",
"(",
")",
"==",
"ScheduleExpression",
".",
"class",
")",
"{",
"return",
"copyBase",
"(",
"schedule",
")",
";",
"// 632906",
"}",
"return",
"(",
"ScheduleExpression",
")",
"copySerializable",
"(",
"schedule",
")",
";",
"}"
] | Make a copy of a ScheduleExpression object.
@param schedule the object to be copied
@return a copy of the object | [
"Make",
"a",
"copy",
"of",
"a",
"ScheduleExpression",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ObjectCopier.java#L122-L135 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ObjectCopier.java | ObjectCopier.copyBase | public static ScheduleExpression copyBase(ScheduleExpression schedule) // d632906
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "copy copyBase: " + Util.identity(schedule));
// 'schedule' could be a subclass of ScheduleExpression.
// Use only the base class constructor.
return new ScheduleExpression()
.start(schedule.getStart() == null ? null : new Date(schedule.getStart().getTime()))
.end(schedule.getEnd() == null ? null : new Date(schedule.getEnd().getTime()))
.timezone(schedule.getTimezone())
.second(schedule.getSecond())
.minute(schedule.getMinute())
.hour(schedule.getHour())
.dayOfMonth(schedule.getDayOfMonth())
.dayOfWeek(schedule.getDayOfWeek())
.month(schedule.getMonth())
.year(schedule.getYear());
} | java | public static ScheduleExpression copyBase(ScheduleExpression schedule) // d632906
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "copy copyBase: " + Util.identity(schedule));
// 'schedule' could be a subclass of ScheduleExpression.
// Use only the base class constructor.
return new ScheduleExpression()
.start(schedule.getStart() == null ? null : new Date(schedule.getStart().getTime()))
.end(schedule.getEnd() == null ? null : new Date(schedule.getEnd().getTime()))
.timezone(schedule.getTimezone())
.second(schedule.getSecond())
.minute(schedule.getMinute())
.hour(schedule.getHour())
.dayOfMonth(schedule.getDayOfMonth())
.dayOfWeek(schedule.getDayOfWeek())
.month(schedule.getMonth())
.year(schedule.getYear());
} | [
"public",
"static",
"ScheduleExpression",
"copyBase",
"(",
"ScheduleExpression",
"schedule",
")",
"// d632906",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"copy copyBase: \"",
"+",
"Util",
".",
"identity",
"(",
"schedule",
")",
")",
";",
"// 'schedule' could be a subclass of ScheduleExpression.",
"// Use only the base class constructor.",
"return",
"new",
"ScheduleExpression",
"(",
")",
".",
"start",
"(",
"schedule",
".",
"getStart",
"(",
")",
"==",
"null",
"?",
"null",
":",
"new",
"Date",
"(",
"schedule",
".",
"getStart",
"(",
")",
".",
"getTime",
"(",
")",
")",
")",
".",
"end",
"(",
"schedule",
".",
"getEnd",
"(",
")",
"==",
"null",
"?",
"null",
":",
"new",
"Date",
"(",
"schedule",
".",
"getEnd",
"(",
")",
".",
"getTime",
"(",
")",
")",
")",
".",
"timezone",
"(",
"schedule",
".",
"getTimezone",
"(",
")",
")",
".",
"second",
"(",
"schedule",
".",
"getSecond",
"(",
")",
")",
".",
"minute",
"(",
"schedule",
".",
"getMinute",
"(",
")",
")",
".",
"hour",
"(",
"schedule",
".",
"getHour",
"(",
")",
")",
".",
"dayOfMonth",
"(",
"schedule",
".",
"getDayOfMonth",
"(",
")",
")",
".",
"dayOfWeek",
"(",
"schedule",
".",
"getDayOfWeek",
"(",
")",
")",
".",
"month",
"(",
"schedule",
".",
"getMonth",
"(",
")",
")",
".",
"year",
"(",
"schedule",
".",
"getYear",
"(",
")",
")",
";",
"}"
] | Make a copy of a javax.ejb.ScheduleExpression portion of the object.
We do not want to assume anything about how the methods are implemented
in the ScheduleExpression, which can be extended by user code. This
method is used in formatting a ScheduleExpression for the findEJBTimers
command, so it must be in a common, expected format.
@param schedule the object to be copied
@return a copy of the object | [
"Make",
"a",
"copy",
"of",
"a",
"javax",
".",
"ejb",
".",
"ScheduleExpression",
"portion",
"of",
"the",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ObjectCopier.java#L148-L168 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSTuple.java | JSTuple.setMultiChoiceCount | BigInteger setMultiChoiceCount() {
if (fields != null)
for (int i = 0; i < fields.length; i++)
multiChoiceCount = multiChoiceCount.multiply(fields[i].setMultiChoiceCount());
return multiChoiceCount;
} | java | BigInteger setMultiChoiceCount() {
if (fields != null)
for (int i = 0; i < fields.length; i++)
multiChoiceCount = multiChoiceCount.multiply(fields[i].setMultiChoiceCount());
return multiChoiceCount;
} | [
"BigInteger",
"setMultiChoiceCount",
"(",
")",
"{",
"if",
"(",
"fields",
"!=",
"null",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
";",
"i",
"++",
")",
"multiChoiceCount",
"=",
"multiChoiceCount",
".",
"multiply",
"(",
"fields",
"[",
"i",
"]",
".",
"setMultiChoiceCount",
"(",
")",
")",
";",
"return",
"multiChoiceCount",
";",
"}"
] | Set the multiChoiceCount for this tuple | [
"Set",
"the",
"multiChoiceCount",
"for",
"this",
"tuple"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSTuple.java#L93-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSTuple.java | JSTuple.getDominatedVariants | public JSVariant[] getDominatedVariants() {
if (dominated == null) {
List dom = new ArrayList();
getDominatedVariants(dom);
dominated = (JSVariant[])dom.toArray(new JSVariant[0]);
}
return dominated;
} | java | public JSVariant[] getDominatedVariants() {
if (dominated == null) {
List dom = new ArrayList();
getDominatedVariants(dom);
dominated = (JSVariant[])dom.toArray(new JSVariant[0]);
}
return dominated;
} | [
"public",
"JSVariant",
"[",
"]",
"getDominatedVariants",
"(",
")",
"{",
"if",
"(",
"dominated",
"==",
"null",
")",
"{",
"List",
"dom",
"=",
"new",
"ArrayList",
"(",
")",
";",
"getDominatedVariants",
"(",
"dom",
")",
";",
"dominated",
"=",
"(",
"JSVariant",
"[",
"]",
")",
"dom",
".",
"toArray",
"(",
"new",
"JSVariant",
"[",
"0",
"]",
")",
";",
"}",
"return",
"dominated",
";",
"}"
] | Identify any variants that are descendents of this tuple, either directly, or via
other tuples. Used in MessageMap construction. | [
"Identify",
"any",
"variants",
"that",
"are",
"descendents",
"of",
"this",
"tuple",
"either",
"directly",
"or",
"via",
"other",
"tuples",
".",
"Used",
"in",
"MessageMap",
"construction",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSTuple.java#L104-L111 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChainStartMode.java | ChainStartMode.getKey | public static ChainStartMode getKey(int ordinal) {
if (ordinal >= 0 && ordinal < _values.length) {
return _values[ordinal];
}
return null;
} | java | public static ChainStartMode getKey(int ordinal) {
if (ordinal >= 0 && ordinal < _values.length) {
return _values[ordinal];
}
return null;
} | [
"public",
"static",
"ChainStartMode",
"getKey",
"(",
"int",
"ordinal",
")",
"{",
"if",
"(",
"ordinal",
">=",
"0",
"&&",
"ordinal",
"<",
"_values",
".",
"length",
")",
"{",
"return",
"_values",
"[",
"ordinal",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | Get the chain start mode definition for this ordinal.
@param ordinal
@return ChainStartMode, null if it does not match a defined instance | [
"Get",
"the",
"chain",
"start",
"mode",
"definition",
"for",
"this",
"ordinal",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChainStartMode.java#L69-L74 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ClientInjectionBinding.java | ClientInjectionBinding.getInjectionTarget | public static InjectionTarget getInjectionTarget(ComponentNameSpaceConfiguration compNSConfig, ClientInjection injection)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getInjectionTarget: " + injection);
// Create a temporary InjectionBinding in order to resolve the target.
ClientInjectionBinding binding = new ClientInjectionBinding(compNSConfig, injection);
Class<?> injectionType = binding.loadClass(injection.getInjectionTypeName());
String targetName = injection.getTargetName();
String targetClassName = injection.getTargetClassName();
// Add a single injection target and then retrieve it.
binding.addInjectionTarget(injectionType, targetName, targetClassName);
InjectionTarget target = InjectionProcessorContextImpl.getInjectionTargets(binding).get(0);
binding.metadataProcessingComplete(); // d681767
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getInjectionTarget: " + target);
return target;
} | java | public static InjectionTarget getInjectionTarget(ComponentNameSpaceConfiguration compNSConfig, ClientInjection injection)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getInjectionTarget: " + injection);
// Create a temporary InjectionBinding in order to resolve the target.
ClientInjectionBinding binding = new ClientInjectionBinding(compNSConfig, injection);
Class<?> injectionType = binding.loadClass(injection.getInjectionTypeName());
String targetName = injection.getTargetName();
String targetClassName = injection.getTargetClassName();
// Add a single injection target and then retrieve it.
binding.addInjectionTarget(injectionType, targetName, targetClassName);
InjectionTarget target = InjectionProcessorContextImpl.getInjectionTargets(binding).get(0);
binding.metadataProcessingComplete(); // d681767
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getInjectionTarget: " + target);
return target;
} | [
"public",
"static",
"InjectionTarget",
"getInjectionTarget",
"(",
"ComponentNameSpaceConfiguration",
"compNSConfig",
",",
"ClientInjection",
"injection",
")",
"throws",
"InjectionException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getInjectionTarget: \"",
"+",
"injection",
")",
";",
"// Create a temporary InjectionBinding in order to resolve the target.",
"ClientInjectionBinding",
"binding",
"=",
"new",
"ClientInjectionBinding",
"(",
"compNSConfig",
",",
"injection",
")",
";",
"Class",
"<",
"?",
">",
"injectionType",
"=",
"binding",
".",
"loadClass",
"(",
"injection",
".",
"getInjectionTypeName",
"(",
")",
")",
";",
"String",
"targetName",
"=",
"injection",
".",
"getTargetName",
"(",
")",
";",
"String",
"targetClassName",
"=",
"injection",
".",
"getTargetClassName",
"(",
")",
";",
"// Add a single injection target and then retrieve it.",
"binding",
".",
"addInjectionTarget",
"(",
"injectionType",
",",
"targetName",
",",
"targetClassName",
")",
";",
"InjectionTarget",
"target",
"=",
"InjectionProcessorContextImpl",
".",
"getInjectionTargets",
"(",
"binding",
")",
".",
"get",
"(",
"0",
")",
";",
"binding",
".",
"metadataProcessingComplete",
"(",
")",
";",
"// d681767",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getInjectionTarget: \"",
"+",
"target",
")",
";",
"return",
"target",
";",
"}"
] | Acquires an InjectionTarget for the specified ClientInjection.
@param compNSConfig the minimal namespace configuration
@param injection the injection target descriptor
@return the injection target
@throws InjectionException if the target cannot be acquired | [
"Acquires",
"an",
"InjectionTarget",
"for",
"the",
"specified",
"ClientInjection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ClientInjectionBinding.java#L49-L70 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XARecoveryData.java | XARecoveryData.filterXidsByType | protected ArrayList filterXidsByType(Xid[] xidArray) {
if (tc.isEntryEnabled())
Tr.entry(tc, "filterXidsByType", xidArray);
final ArrayList<XidImpl> xidList = new ArrayList<XidImpl>();
if (xidArray != null) {
/*----------------------------------------------------------*/
/* Iterate over the list of returned xids, and insert them */
/* into a new list containing all the xids that have been */
/* recovered thus far. We don't have to worry about */
/* duplicates because every resource is guaranteed to have a */
/* unique bqual + gtrid combination. */
/*----------------------------------------------------------*/
for (int y = 0; y < xidArray.length; y++) {
// PQ56777 - Oracle can return entries with null in them.
// normally(?) it will be the last in the list. It
// appears to happen if an indoubt transaction on the
// database completes during our call to recover.
if (xidArray[y] == null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "RM has returned null inDoubt Xid entry - " + y);
continue;
}
/*------------------------------------------------------*/
/* We only want to add this Xid to our list if it is */
/* one that we generated. */
/*------------------------------------------------------*/
if (XidImpl.isOurFormatId(xidArray[y].getFormatId())) {
/*--------------------------------------------------*/
/* It is possible that the Xid we get back from the */
/* RM is actually an instance of our XidImpl. In */
/* the case that it's not, we have to re-construct */
/* the XidImpl so that we can extract the xid bytes. */
/*--------------------------------------------------*/
XidImpl ourXid = null;
if (xidArray[y] instanceof XidImpl) {
ourXid = (XidImpl) xidArray[y];
} else {
ourXid = new XidImpl(xidArray[y]);
// Check the bqual is one of ours...
// as V5.1 also uses the same formatId but with
// different length encoding
if (ourXid.getBranchQualifier().length != XidImpl.BQUAL_JTA_BQUAL_LENGTH) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Xid is wrong length - " + y);
continue;
}
}
xidList.add(ourXid);
} /* if isOurFormatId() */
} /* for each Xid */
} /* if xidArray != null */
if (tc.isEntryEnabled())
Tr.exit(tc, "filterXidsByType", xidList);
return xidList;
} | java | protected ArrayList filterXidsByType(Xid[] xidArray) {
if (tc.isEntryEnabled())
Tr.entry(tc, "filterXidsByType", xidArray);
final ArrayList<XidImpl> xidList = new ArrayList<XidImpl>();
if (xidArray != null) {
/*----------------------------------------------------------*/
/* Iterate over the list of returned xids, and insert them */
/* into a new list containing all the xids that have been */
/* recovered thus far. We don't have to worry about */
/* duplicates because every resource is guaranteed to have a */
/* unique bqual + gtrid combination. */
/*----------------------------------------------------------*/
for (int y = 0; y < xidArray.length; y++) {
// PQ56777 - Oracle can return entries with null in them.
// normally(?) it will be the last in the list. It
// appears to happen if an indoubt transaction on the
// database completes during our call to recover.
if (xidArray[y] == null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "RM has returned null inDoubt Xid entry - " + y);
continue;
}
/*------------------------------------------------------*/
/* We only want to add this Xid to our list if it is */
/* one that we generated. */
/*------------------------------------------------------*/
if (XidImpl.isOurFormatId(xidArray[y].getFormatId())) {
/*--------------------------------------------------*/
/* It is possible that the Xid we get back from the */
/* RM is actually an instance of our XidImpl. In */
/* the case that it's not, we have to re-construct */
/* the XidImpl so that we can extract the xid bytes. */
/*--------------------------------------------------*/
XidImpl ourXid = null;
if (xidArray[y] instanceof XidImpl) {
ourXid = (XidImpl) xidArray[y];
} else {
ourXid = new XidImpl(xidArray[y]);
// Check the bqual is one of ours...
// as V5.1 also uses the same formatId but with
// different length encoding
if (ourXid.getBranchQualifier().length != XidImpl.BQUAL_JTA_BQUAL_LENGTH) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Xid is wrong length - " + y);
continue;
}
}
xidList.add(ourXid);
} /* if isOurFormatId() */
} /* for each Xid */
} /* if xidArray != null */
if (tc.isEntryEnabled())
Tr.exit(tc, "filterXidsByType", xidList);
return xidList;
} | [
"protected",
"ArrayList",
"filterXidsByType",
"(",
"Xid",
"[",
"]",
"xidArray",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"filterXidsByType\"",
",",
"xidArray",
")",
";",
"final",
"ArrayList",
"<",
"XidImpl",
">",
"xidList",
"=",
"new",
"ArrayList",
"<",
"XidImpl",
">",
"(",
")",
";",
"if",
"(",
"xidArray",
"!=",
"null",
")",
"{",
"/*----------------------------------------------------------*/",
"/* Iterate over the list of returned xids, and insert them */",
"/* into a new list containing all the xids that have been */",
"/* recovered thus far. We don't have to worry about */",
"/* duplicates because every resource is guaranteed to have a */",
"/* unique bqual + gtrid combination. */",
"/*----------------------------------------------------------*/",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"xidArray",
".",
"length",
";",
"y",
"++",
")",
"{",
"// PQ56777 - Oracle can return entries with null in them.",
"// normally(?) it will be the last in the list. It",
"// appears to happen if an indoubt transaction on the",
"// database completes during our call to recover.",
"if",
"(",
"xidArray",
"[",
"y",
"]",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"RM has returned null inDoubt Xid entry - \"",
"+",
"y",
")",
";",
"continue",
";",
"}",
"/*------------------------------------------------------*/",
"/* We only want to add this Xid to our list if it is */",
"/* one that we generated. */",
"/*------------------------------------------------------*/",
"if",
"(",
"XidImpl",
".",
"isOurFormatId",
"(",
"xidArray",
"[",
"y",
"]",
".",
"getFormatId",
"(",
")",
")",
")",
"{",
"/*--------------------------------------------------*/",
"/* It is possible that the Xid we get back from the */",
"/* RM is actually an instance of our XidImpl. In */",
"/* the case that it's not, we have to re-construct */",
"/* the XidImpl so that we can extract the xid bytes. */",
"/*--------------------------------------------------*/",
"XidImpl",
"ourXid",
"=",
"null",
";",
"if",
"(",
"xidArray",
"[",
"y",
"]",
"instanceof",
"XidImpl",
")",
"{",
"ourXid",
"=",
"(",
"XidImpl",
")",
"xidArray",
"[",
"y",
"]",
";",
"}",
"else",
"{",
"ourXid",
"=",
"new",
"XidImpl",
"(",
"xidArray",
"[",
"y",
"]",
")",
";",
"// Check the bqual is one of ours...",
"// as V5.1 also uses the same formatId but with",
"// different length encoding",
"if",
"(",
"ourXid",
".",
"getBranchQualifier",
"(",
")",
".",
"length",
"!=",
"XidImpl",
".",
"BQUAL_JTA_BQUAL_LENGTH",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Xid is wrong length - \"",
"+",
"y",
")",
";",
"continue",
";",
"}",
"}",
"xidList",
".",
"add",
"(",
"ourXid",
")",
";",
"}",
"/* if isOurFormatId() */",
"}",
"/* for each Xid */",
"}",
"/* if xidArray != null */",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"filterXidsByType\"",
",",
"xidList",
")",
";",
"return",
"xidList",
";",
"}"
] | Removes all non-WAS Xids from an array of Xids, and puts them
in an ArrayList structure.
@param xidArray An array of generic Xids.
@return An ArrayList of XidImpl objects. | [
"Removes",
"all",
"non",
"-",
"WAS",
"Xids",
"from",
"an",
"array",
"of",
"Xids",
"and",
"puts",
"them",
"in",
"an",
"ArrayList",
"structure",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XARecoveryData.java#L566-L625 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XARecoveryData.java | XARecoveryData.filterXidsByCruuidAndEpoch | protected ArrayList filterXidsByCruuidAndEpoch(ArrayList xidList,
byte[] cruuid,
int epoch) {
if (tc.isEntryEnabled())
Tr.entry(tc, "filterXidsByCruuidAndEpoch", new Object[] {
xidList,
cruuid,
epoch });
for (int x = xidList.size() - 1; x >= 0; x--) {
final XidImpl ourXid = (XidImpl) xidList.get(x);
final byte[] xidCruuid = ourXid.getCruuid();
final int xidEpoch = ourXid.getEpoch();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Trace other Cruuid: " + xidCruuid + ", or: " + Util.toHexString(xidCruuid));
Tr.debug(tc, "Trace my Cruuid: " + cruuid + ", or: " + Util.toHexString(cruuid));
}
if ((!java.util.Arrays.equals(cruuid, xidCruuid))) {
if (tc.isDebugEnabled())
Tr.debug(tc, "filterXidsByCruuidAndEpoch: cruuid is different: " + ourXid.getCruuid());
xidList.remove(x);
} else if (xidEpoch >= epoch) {
if (tc.isDebugEnabled())
Tr.debug(tc, "filterXidsByCruuidAndEpoch: xid epoch is " + xidEpoch);
xidList.remove(x);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "filterXidsByCruuidAndEpoch", xidList);
return xidList;
} | java | protected ArrayList filterXidsByCruuidAndEpoch(ArrayList xidList,
byte[] cruuid,
int epoch) {
if (tc.isEntryEnabled())
Tr.entry(tc, "filterXidsByCruuidAndEpoch", new Object[] {
xidList,
cruuid,
epoch });
for (int x = xidList.size() - 1; x >= 0; x--) {
final XidImpl ourXid = (XidImpl) xidList.get(x);
final byte[] xidCruuid = ourXid.getCruuid();
final int xidEpoch = ourXid.getEpoch();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Trace other Cruuid: " + xidCruuid + ", or: " + Util.toHexString(xidCruuid));
Tr.debug(tc, "Trace my Cruuid: " + cruuid + ", or: " + Util.toHexString(cruuid));
}
if ((!java.util.Arrays.equals(cruuid, xidCruuid))) {
if (tc.isDebugEnabled())
Tr.debug(tc, "filterXidsByCruuidAndEpoch: cruuid is different: " + ourXid.getCruuid());
xidList.remove(x);
} else if (xidEpoch >= epoch) {
if (tc.isDebugEnabled())
Tr.debug(tc, "filterXidsByCruuidAndEpoch: xid epoch is " + xidEpoch);
xidList.remove(x);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "filterXidsByCruuidAndEpoch", xidList);
return xidList;
} | [
"protected",
"ArrayList",
"filterXidsByCruuidAndEpoch",
"(",
"ArrayList",
"xidList",
",",
"byte",
"[",
"]",
"cruuid",
",",
"int",
"epoch",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"filterXidsByCruuidAndEpoch\"",
",",
"new",
"Object",
"[",
"]",
"{",
"xidList",
",",
"cruuid",
",",
"epoch",
"}",
")",
";",
"for",
"(",
"int",
"x",
"=",
"xidList",
".",
"size",
"(",
")",
"-",
"1",
";",
"x",
">=",
"0",
";",
"x",
"--",
")",
"{",
"final",
"XidImpl",
"ourXid",
"=",
"(",
"XidImpl",
")",
"xidList",
".",
"get",
"(",
"x",
")",
";",
"final",
"byte",
"[",
"]",
"xidCruuid",
"=",
"ourXid",
".",
"getCruuid",
"(",
")",
";",
"final",
"int",
"xidEpoch",
"=",
"ourXid",
".",
"getEpoch",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Trace other Cruuid: \"",
"+",
"xidCruuid",
"+",
"\", or: \"",
"+",
"Util",
".",
"toHexString",
"(",
"xidCruuid",
")",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Trace my Cruuid: \"",
"+",
"cruuid",
"+",
"\", or: \"",
"+",
"Util",
".",
"toHexString",
"(",
"cruuid",
")",
")",
";",
"}",
"if",
"(",
"(",
"!",
"java",
".",
"util",
".",
"Arrays",
".",
"equals",
"(",
"cruuid",
",",
"xidCruuid",
")",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"filterXidsByCruuidAndEpoch: cruuid is different: \"",
"+",
"ourXid",
".",
"getCruuid",
"(",
")",
")",
";",
"xidList",
".",
"remove",
"(",
"x",
")",
";",
"}",
"else",
"if",
"(",
"xidEpoch",
">=",
"epoch",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"filterXidsByCruuidAndEpoch: xid epoch is \"",
"+",
"xidEpoch",
")",
";",
"xidList",
".",
"remove",
"(",
"x",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"filterXidsByCruuidAndEpoch\"",
",",
"xidList",
")",
";",
"return",
"xidList",
";",
"}"
] | Removes all Xids from an ArrayList that don't have our cruuid in
their bqual. Assumes that all Xids are XidImpls.
@param xidList A list of XidImpls.
@param cruuid The cruuid to filter.
@param epoch The epoch number to filter.
@return An ArrayList of XidImpl objects. | [
"Removes",
"all",
"Xids",
"from",
"an",
"ArrayList",
"that",
"don",
"t",
"have",
"our",
"cruuid",
"in",
"their",
"bqual",
".",
"Assumes",
"that",
"all",
"Xids",
"are",
"XidImpls",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XARecoveryData.java#L636-L672 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XARecoveryData.java | XARecoveryData.canWeForgetXid | protected boolean canWeForgetXid(XidImpl ourXid, Xid[] knownXids) {
if (tc.isEntryEnabled())
Tr.entry(tc, "canWeForgetXid", new Object[] {
ourXid,
knownXids });
if (tc.isDebugEnabled()) {
// We are only called if knownXids != null
for (int i = 0; i < knownXids.length; i++) {
Tr.debug(tc, "tx xid[" + i + "] " + knownXids[i]);
}
}
boolean forgetMe = true;
/*----------------------------------------------------------------*/
/* Yank the parts of the JTA xid. The branch qualifier will be */
/* the full JTA branch qualifier, and will need to be shortened */
/* to the same length of the transaction bqual so that the array */
/* compare has a chance to complete successfully. */
/*----------------------------------------------------------------*/
final int jtaFormatId = ourXid.getFormatId();
final byte[] jtaGtrid = ourXid.getGlobalTransactionId();
final byte[] fullJtaBqual = ourXid.getBranchQualifier();
byte[] jtaBqual = null;
/*----------------------------------------------------------------*/
/* We have to separate the transaction gtrid and bqual for the */
/* array compares. These are places to store these items. */
/*----------------------------------------------------------------*/
int txnFormatId;
byte[] txnGtrid;
byte[] txnBqual;
/*----------------------------------------------------------------*/
/* Iterate over all the known XIDs (if there are none, we won't */
/* iterate over anything). */
/*----------------------------------------------------------------*/
int x = 0;
while ((x < knownXids.length) && (forgetMe == true)) {
/*------------------------------------------------------------*/
/* If this is the first XID, shorten the JTA bqual to the */
/* length of the transaction bqual. We are assuming here */
/* that all the transaction bquals are the same length. If */
/* they arent, for some reason, we will need to revisit this. */
/*------------------------------------------------------------*/
if (x == 0) {
final int bqualLength = (knownXids[x].getBranchQualifier()).length;
jtaBqual = new byte[bqualLength];
System.arraycopy(fullJtaBqual, 0,
jtaBqual, 0,
bqualLength);
}
/*------------------------------------------------------------*/
/* Separate the transaction XID into comparable units. */
/*------------------------------------------------------------*/
txnFormatId = knownXids[x].getFormatId();
txnGtrid = knownXids[x].getGlobalTransactionId();
txnBqual = knownXids[x].getBranchQualifier();
/*------------------------------------------------------------*/
/* Compare the individual parts of the XID for equality. If */
/* they are equal, set a boolean value and we can stop */
/* checking. */
/*------------------------------------------------------------*/
if ((jtaFormatId == txnFormatId) &&
(java.util.Arrays.equals(jtaGtrid, txnGtrid)) &&
(java.util.Arrays.equals(jtaBqual, txnBqual))) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Xid has been matched to a transaction:",
ourXid);
}
auditTransactionXid(ourXid, knownXids[x], getXAResourceInfo());
forgetMe = false;
}
x++;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "canWeForgetXid", forgetMe);
return forgetMe;
} | java | protected boolean canWeForgetXid(XidImpl ourXid, Xid[] knownXids) {
if (tc.isEntryEnabled())
Tr.entry(tc, "canWeForgetXid", new Object[] {
ourXid,
knownXids });
if (tc.isDebugEnabled()) {
// We are only called if knownXids != null
for (int i = 0; i < knownXids.length; i++) {
Tr.debug(tc, "tx xid[" + i + "] " + knownXids[i]);
}
}
boolean forgetMe = true;
/*----------------------------------------------------------------*/
/* Yank the parts of the JTA xid. The branch qualifier will be */
/* the full JTA branch qualifier, and will need to be shortened */
/* to the same length of the transaction bqual so that the array */
/* compare has a chance to complete successfully. */
/*----------------------------------------------------------------*/
final int jtaFormatId = ourXid.getFormatId();
final byte[] jtaGtrid = ourXid.getGlobalTransactionId();
final byte[] fullJtaBqual = ourXid.getBranchQualifier();
byte[] jtaBqual = null;
/*----------------------------------------------------------------*/
/* We have to separate the transaction gtrid and bqual for the */
/* array compares. These are places to store these items. */
/*----------------------------------------------------------------*/
int txnFormatId;
byte[] txnGtrid;
byte[] txnBqual;
/*----------------------------------------------------------------*/
/* Iterate over all the known XIDs (if there are none, we won't */
/* iterate over anything). */
/*----------------------------------------------------------------*/
int x = 0;
while ((x < knownXids.length) && (forgetMe == true)) {
/*------------------------------------------------------------*/
/* If this is the first XID, shorten the JTA bqual to the */
/* length of the transaction bqual. We are assuming here */
/* that all the transaction bquals are the same length. If */
/* they arent, for some reason, we will need to revisit this. */
/*------------------------------------------------------------*/
if (x == 0) {
final int bqualLength = (knownXids[x].getBranchQualifier()).length;
jtaBqual = new byte[bqualLength];
System.arraycopy(fullJtaBqual, 0,
jtaBqual, 0,
bqualLength);
}
/*------------------------------------------------------------*/
/* Separate the transaction XID into comparable units. */
/*------------------------------------------------------------*/
txnFormatId = knownXids[x].getFormatId();
txnGtrid = knownXids[x].getGlobalTransactionId();
txnBqual = knownXids[x].getBranchQualifier();
/*------------------------------------------------------------*/
/* Compare the individual parts of the XID for equality. If */
/* they are equal, set a boolean value and we can stop */
/* checking. */
/*------------------------------------------------------------*/
if ((jtaFormatId == txnFormatId) &&
(java.util.Arrays.equals(jtaGtrid, txnGtrid)) &&
(java.util.Arrays.equals(jtaBqual, txnBqual))) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Xid has been matched to a transaction:",
ourXid);
}
auditTransactionXid(ourXid, knownXids[x], getXAResourceInfo());
forgetMe = false;
}
x++;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "canWeForgetXid", forgetMe);
return forgetMe;
} | [
"protected",
"boolean",
"canWeForgetXid",
"(",
"XidImpl",
"ourXid",
",",
"Xid",
"[",
"]",
"knownXids",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"canWeForgetXid\"",
",",
"new",
"Object",
"[",
"]",
"{",
"ourXid",
",",
"knownXids",
"}",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// We are only called if knownXids != null",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"knownXids",
".",
"length",
";",
"i",
"++",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"tx xid[\"",
"+",
"i",
"+",
"\"] \"",
"+",
"knownXids",
"[",
"i",
"]",
")",
";",
"}",
"}",
"boolean",
"forgetMe",
"=",
"true",
";",
"/*----------------------------------------------------------------*/",
"/* Yank the parts of the JTA xid. The branch qualifier will be */",
"/* the full JTA branch qualifier, and will need to be shortened */",
"/* to the same length of the transaction bqual so that the array */",
"/* compare has a chance to complete successfully. */",
"/*----------------------------------------------------------------*/",
"final",
"int",
"jtaFormatId",
"=",
"ourXid",
".",
"getFormatId",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"jtaGtrid",
"=",
"ourXid",
".",
"getGlobalTransactionId",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"fullJtaBqual",
"=",
"ourXid",
".",
"getBranchQualifier",
"(",
")",
";",
"byte",
"[",
"]",
"jtaBqual",
"=",
"null",
";",
"/*----------------------------------------------------------------*/",
"/* We have to separate the transaction gtrid and bqual for the */",
"/* array compares. These are places to store these items. */",
"/*----------------------------------------------------------------*/",
"int",
"txnFormatId",
";",
"byte",
"[",
"]",
"txnGtrid",
";",
"byte",
"[",
"]",
"txnBqual",
";",
"/*----------------------------------------------------------------*/",
"/* Iterate over all the known XIDs (if there are none, we won't */",
"/* iterate over anything). */",
"/*----------------------------------------------------------------*/",
"int",
"x",
"=",
"0",
";",
"while",
"(",
"(",
"x",
"<",
"knownXids",
".",
"length",
")",
"&&",
"(",
"forgetMe",
"==",
"true",
")",
")",
"{",
"/*------------------------------------------------------------*/",
"/* If this is the first XID, shorten the JTA bqual to the */",
"/* length of the transaction bqual. We are assuming here */",
"/* that all the transaction bquals are the same length. If */",
"/* they arent, for some reason, we will need to revisit this. */",
"/*------------------------------------------------------------*/",
"if",
"(",
"x",
"==",
"0",
")",
"{",
"final",
"int",
"bqualLength",
"=",
"(",
"knownXids",
"[",
"x",
"]",
".",
"getBranchQualifier",
"(",
")",
")",
".",
"length",
";",
"jtaBqual",
"=",
"new",
"byte",
"[",
"bqualLength",
"]",
";",
"System",
".",
"arraycopy",
"(",
"fullJtaBqual",
",",
"0",
",",
"jtaBqual",
",",
"0",
",",
"bqualLength",
")",
";",
"}",
"/*------------------------------------------------------------*/",
"/* Separate the transaction XID into comparable units. */",
"/*------------------------------------------------------------*/",
"txnFormatId",
"=",
"knownXids",
"[",
"x",
"]",
".",
"getFormatId",
"(",
")",
";",
"txnGtrid",
"=",
"knownXids",
"[",
"x",
"]",
".",
"getGlobalTransactionId",
"(",
")",
";",
"txnBqual",
"=",
"knownXids",
"[",
"x",
"]",
".",
"getBranchQualifier",
"(",
")",
";",
"/*------------------------------------------------------------*/",
"/* Compare the individual parts of the XID for equality. If */",
"/* they are equal, set a boolean value and we can stop */",
"/* checking. */",
"/*------------------------------------------------------------*/",
"if",
"(",
"(",
"jtaFormatId",
"==",
"txnFormatId",
")",
"&&",
"(",
"java",
".",
"util",
".",
"Arrays",
".",
"equals",
"(",
"jtaGtrid",
",",
"txnGtrid",
")",
")",
"&&",
"(",
"java",
".",
"util",
".",
"Arrays",
".",
"equals",
"(",
"jtaBqual",
",",
"txnBqual",
")",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Xid has been matched to a transaction:\"",
",",
"ourXid",
")",
";",
"}",
"auditTransactionXid",
"(",
"ourXid",
",",
"knownXids",
"[",
"x",
"]",
",",
"getXAResourceInfo",
"(",
")",
")",
";",
"forgetMe",
"=",
"false",
";",
"}",
"x",
"++",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"canWeForgetXid\"",
",",
"forgetMe",
")",
";",
"return",
"forgetMe",
";",
"}"
] | Iterates over the list of known Xids retrieved from transaction
service, and tries to match the given javax.transaction.xa.Xid
with one of them.
@param ourXid The javax.transaction.xa.Xid we are trying to match.
@param knownXids The array of Xids that are possible matches.
@return true if we find a match, false if not. | [
"Iterates",
"over",
"the",
"list",
"of",
"known",
"Xids",
"retrieved",
"from",
"transaction",
"service",
"and",
"tries",
"to",
"match",
"the",
"given",
"javax",
".",
"transaction",
".",
"xa",
".",
"Xid",
"with",
"one",
"of",
"them",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/XARecoveryData.java#L683-L766 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.transports.http.3.2/src/org/apache/cxf/transport/http/AbstractHTTPDestination.java | AbstractHTTPDestination.propogateSecureSession | private static void propogateSecureSession(HttpServletRequest request,
Message message) {
final String cipherSuite =
(String) request.getAttribute(SSL_CIPHER_SUITE_ATTRIBUTE);
if (cipherSuite != null) {
final java.security.cert.Certificate[] certs =
(java.security.cert.Certificate[]) request.getAttribute(SSL_PEER_CERT_CHAIN_ATTRIBUTE);
message.put(TLSSessionInfo.class,
new TLSSessionInfo(cipherSuite,
null,
certs));
}
} | java | private static void propogateSecureSession(HttpServletRequest request,
Message message) {
final String cipherSuite =
(String) request.getAttribute(SSL_CIPHER_SUITE_ATTRIBUTE);
if (cipherSuite != null) {
final java.security.cert.Certificate[] certs =
(java.security.cert.Certificate[]) request.getAttribute(SSL_PEER_CERT_CHAIN_ATTRIBUTE);
message.put(TLSSessionInfo.class,
new TLSSessionInfo(cipherSuite,
null,
certs));
}
} | [
"private",
"static",
"void",
"propogateSecureSession",
"(",
"HttpServletRequest",
"request",
",",
"Message",
"message",
")",
"{",
"final",
"String",
"cipherSuite",
"=",
"(",
"String",
")",
"request",
".",
"getAttribute",
"(",
"SSL_CIPHER_SUITE_ATTRIBUTE",
")",
";",
"if",
"(",
"cipherSuite",
"!=",
"null",
")",
"{",
"final",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
"[",
"]",
"certs",
"=",
"(",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
"[",
"]",
")",
"request",
".",
"getAttribute",
"(",
"SSL_PEER_CERT_CHAIN_ATTRIBUTE",
")",
";",
"message",
".",
"put",
"(",
"TLSSessionInfo",
".",
"class",
",",
"new",
"TLSSessionInfo",
"(",
"cipherSuite",
",",
"null",
",",
"certs",
")",
")",
";",
"}",
"}"
] | Propogate in the message a TLSSessionInfo instance representative
of the TLS-specific information in the HTTP request.
@param request the Jetty request
@param message the Message | [
"Propogate",
"in",
"the",
"message",
"a",
"TLSSessionInfo",
"instance",
"representative",
"of",
"the",
"TLS",
"-",
"specific",
"information",
"in",
"the",
"HTTP",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.transports.http.3.2/src/org/apache/cxf/transport/http/AbstractHTTPDestination.java#L438-L450 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.cxf.cxf.rt.transports.http.3.2/src/org/apache/cxf/transport/http/AbstractHTTPDestination.java | AbstractHTTPDestination.cacheInput | private void cacheInput(Message outMessage) {
if (outMessage.getExchange() == null) {
return;
}
Message inMessage = outMessage.getExchange().getInMessage();
if (inMessage == null) {
return;
}
Object o = inMessage.get("cxf.io.cacheinput");
DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
if (PropertyUtils.isTrue(o)) {
Collection<Attachment> atts = inMessage.getAttachments();
if (atts != null) {
for (Attachment a : atts) {
if (a.getDataHandler().getDataSource() instanceof AttachmentDataSource) {
try {
((AttachmentDataSource) a.getDataHandler().getDataSource()).cache(inMessage);
} catch (IOException e) {
throw new Fault(e);
}
}
}
}
if (in != null) {
in.cacheInput();
}
} else if (in != null) {
//We don't need to cache it, but we may need to consume it in order for the client
// to be able to receive a response. (could be blocked sending)
//However, also don't want to consume indefinitely. We'll limit to 16M.
try {
IOUtils.consume(in, 16 * 1024 * 1024);
} catch (Exception ioe) {
//ignore
}
}
} | java | private void cacheInput(Message outMessage) {
if (outMessage.getExchange() == null) {
return;
}
Message inMessage = outMessage.getExchange().getInMessage();
if (inMessage == null) {
return;
}
Object o = inMessage.get("cxf.io.cacheinput");
DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
if (PropertyUtils.isTrue(o)) {
Collection<Attachment> atts = inMessage.getAttachments();
if (atts != null) {
for (Attachment a : atts) {
if (a.getDataHandler().getDataSource() instanceof AttachmentDataSource) {
try {
((AttachmentDataSource) a.getDataHandler().getDataSource()).cache(inMessage);
} catch (IOException e) {
throw new Fault(e);
}
}
}
}
if (in != null) {
in.cacheInput();
}
} else if (in != null) {
//We don't need to cache it, but we may need to consume it in order for the client
// to be able to receive a response. (could be blocked sending)
//However, also don't want to consume indefinitely. We'll limit to 16M.
try {
IOUtils.consume(in, 16 * 1024 * 1024);
} catch (Exception ioe) {
//ignore
}
}
} | [
"private",
"void",
"cacheInput",
"(",
"Message",
"outMessage",
")",
"{",
"if",
"(",
"outMessage",
".",
"getExchange",
"(",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Message",
"inMessage",
"=",
"outMessage",
".",
"getExchange",
"(",
")",
".",
"getInMessage",
"(",
")",
";",
"if",
"(",
"inMessage",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Object",
"o",
"=",
"inMessage",
".",
"get",
"(",
"\"cxf.io.cacheinput\"",
")",
";",
"DelegatingInputStream",
"in",
"=",
"inMessage",
".",
"getContent",
"(",
"DelegatingInputStream",
".",
"class",
")",
";",
"if",
"(",
"PropertyUtils",
".",
"isTrue",
"(",
"o",
")",
")",
"{",
"Collection",
"<",
"Attachment",
">",
"atts",
"=",
"inMessage",
".",
"getAttachments",
"(",
")",
";",
"if",
"(",
"atts",
"!=",
"null",
")",
"{",
"for",
"(",
"Attachment",
"a",
":",
"atts",
")",
"{",
"if",
"(",
"a",
".",
"getDataHandler",
"(",
")",
".",
"getDataSource",
"(",
")",
"instanceof",
"AttachmentDataSource",
")",
"{",
"try",
"{",
"(",
"(",
"AttachmentDataSource",
")",
"a",
".",
"getDataHandler",
"(",
")",
".",
"getDataSource",
"(",
")",
")",
".",
"cache",
"(",
"inMessage",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"Fault",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"in",
".",
"cacheInput",
"(",
")",
";",
"}",
"}",
"else",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"//We don't need to cache it, but we may need to consume it in order for the client",
"// to be able to receive a response. (could be blocked sending)",
"//However, also don't want to consume indefinitely. We'll limit to 16M.",
"try",
"{",
"IOUtils",
".",
"consume",
"(",
"in",
",",
"16",
"*",
"1024",
"*",
"1024",
")",
";",
"}",
"catch",
"(",
"Exception",
"ioe",
")",
"{",
"//ignore",
"}",
"}",
"}"
] | On first write, we need to make sure any attachments and such that are still on the incoming stream
are read in. Otherwise we can get into a deadlock where the client is still trying to send the
request, but the server is trying to send the response. Neither side is reading and both blocked
on full buffers. Not a good situation.
@param outMessage | [
"On",
"first",
"write",
"we",
"need",
"to",
"make",
"sure",
"any",
"attachments",
"and",
"such",
"that",
"are",
"still",
"on",
"the",
"incoming",
"stream",
"are",
"read",
"in",
".",
"Otherwise",
"we",
"can",
"get",
"into",
"a",
"deadlock",
"where",
"the",
"client",
"is",
"still",
"trying",
"to",
"send",
"the",
"request",
"but",
"the",
"server",
"is",
"trying",
"to",
"send",
"the",
"response",
".",
"Neither",
"side",
"is",
"reading",
"and",
"both",
"blocked",
"on",
"full",
"buffers",
".",
"Not",
"a",
"good",
"situation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.transports.http.3.2/src/org/apache/cxf/transport/http/AbstractHTTPDestination.java#L593-L629 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/FFDC.java | FFDC.processException | public static void processException(Object source
,Class sourceClass
,String methodName
,Throwable throwable
,String probe
,Object[] objects
)
{
if (TraceComponent.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(cclass
,"processException"
,new Object[]{source
,sourceClass
,methodName
,throwable
,probe
,objects
}
);
if (TraceComponent.isAnyTracingEnabled() && trace.isEventEnabled())
trace.event(cclass,
"processException",
throwable);
print(source
,sourceClass
,methodName
,throwable
,probe
,objects);
com.ibm.ws.ffdc.FFDCFilter.processException(throwable
,sourceClass.getName()+":"+methodName
,probe
,source
,objects);
if (TraceComponent.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(cclass,"processException");
} | java | public static void processException(Object source
,Class sourceClass
,String methodName
,Throwable throwable
,String probe
,Object[] objects
)
{
if (TraceComponent.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(cclass
,"processException"
,new Object[]{source
,sourceClass
,methodName
,throwable
,probe
,objects
}
);
if (TraceComponent.isAnyTracingEnabled() && trace.isEventEnabled())
trace.event(cclass,
"processException",
throwable);
print(source
,sourceClass
,methodName
,throwable
,probe
,objects);
com.ibm.ws.ffdc.FFDCFilter.processException(throwable
,sourceClass.getName()+":"+methodName
,probe
,source
,objects);
if (TraceComponent.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(cclass,"processException");
} | [
"public",
"static",
"void",
"processException",
"(",
"Object",
"source",
",",
"Class",
"sourceClass",
",",
"String",
"methodName",
",",
"Throwable",
"throwable",
",",
"String",
"probe",
",",
"Object",
"[",
"]",
"objects",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"entry",
"(",
"cclass",
",",
"\"processException\"",
",",
"new",
"Object",
"[",
"]",
"{",
"source",
",",
"sourceClass",
",",
"methodName",
",",
"throwable",
",",
"probe",
",",
"objects",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEventEnabled",
"(",
")",
")",
"trace",
".",
"event",
"(",
"cclass",
",",
"\"processException\"",
",",
"throwable",
")",
";",
"print",
"(",
"source",
",",
"sourceClass",
",",
"methodName",
",",
"throwable",
",",
"probe",
",",
"objects",
")",
";",
"com",
".",
"ibm",
".",
"ws",
".",
"ffdc",
".",
"FFDCFilter",
".",
"processException",
"(",
"throwable",
",",
"sourceClass",
".",
"getName",
"(",
")",
"+",
"\":\"",
"+",
"methodName",
",",
"probe",
",",
"source",
",",
"objects",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"trace",
".",
"isEntryEnabled",
"(",
")",
")",
"trace",
".",
"exit",
"(",
"cclass",
",",
"\"processException\"",
")",
";",
"}"
] | Process an exception for a non static class.
@param Object the source class requesting the FFDC.
@param Class of the source object.
@param String the method where the FFDC is being requested from.
@param Throwable the cause of the exception.
@param String the probe identifying the source of the exception.
@param Object[] obje cts to be dumped in addition to the source. | [
"Process",
"an",
"exception",
"for",
"a",
"non",
"static",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/FFDC.java#L182-L221 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/FFDC.java | FFDC.print | static void print(Object object,java.io.PrintWriter printWriter) {
if (object instanceof Printable) {
((Printable)object).print(printWriter);
} else {
printWriter.print(object);
} // if (object instanceof Printable).
} | java | static void print(Object object,java.io.PrintWriter printWriter) {
if (object instanceof Printable) {
((Printable)object).print(printWriter);
} else {
printWriter.print(object);
} // if (object instanceof Printable).
} | [
"static",
"void",
"print",
"(",
"Object",
"object",
",",
"java",
".",
"io",
".",
"PrintWriter",
"printWriter",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Printable",
")",
"{",
"(",
"(",
"Printable",
")",
"object",
")",
".",
"print",
"(",
"printWriter",
")",
";",
"}",
"else",
"{",
"printWriter",
".",
"print",
"(",
"object",
")",
";",
"}",
"// if (object instanceof Printable).",
"}"
] | Dump an Object to a java.io.PrintWriter.
@param Object to be dumped to printWriter
@param java.io.PeritWriter to dump the Object to. | [
"Dump",
"an",
"Object",
"to",
"a",
"java",
".",
"io",
".",
"PrintWriter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/matchspace/utils/FFDC.java#L273-L280 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java | LogHandle.getServiceData | byte[] getServiceData() throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "getServiceData", this);
// Check that the file is actually open
if (_activeFile == null)
{
if (tc.isEntryEnabled())
Tr.exit(tc, "getServiceData", "InternalLogException");
throw new InternalLogException(null);
}
final byte[] serviceData = _activeFile.getServiceData();
if (tc.isEntryEnabled())
Tr.exit(tc, "getServiceData", RLSUtils.toHexString(serviceData, RLSUtils.MAX_DISPLAY_BYTES));
return serviceData;
} | java | byte[] getServiceData() throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "getServiceData", this);
// Check that the file is actually open
if (_activeFile == null)
{
if (tc.isEntryEnabled())
Tr.exit(tc, "getServiceData", "InternalLogException");
throw new InternalLogException(null);
}
final byte[] serviceData = _activeFile.getServiceData();
if (tc.isEntryEnabled())
Tr.exit(tc, "getServiceData", RLSUtils.toHexString(serviceData, RLSUtils.MAX_DISPLAY_BYTES));
return serviceData;
} | [
"byte",
"[",
"]",
"getServiceData",
"(",
")",
"throws",
"InternalLogException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getServiceData\"",
",",
"this",
")",
";",
"// Check that the file is actually open",
"if",
"(",
"_activeFile",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getServiceData\"",
",",
"\"InternalLogException\"",
")",
";",
"throw",
"new",
"InternalLogException",
"(",
"null",
")",
";",
"}",
"final",
"byte",
"[",
"]",
"serviceData",
"=",
"_activeFile",
".",
"getServiceData",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getServiceData\"",
",",
"RLSUtils",
".",
"toHexString",
"(",
"serviceData",
",",
"RLSUtils",
".",
"MAX_DISPLAY_BYTES",
")",
")",
";",
"return",
"serviceData",
";",
"}"
] | Package access method to return the current service data.
@return The current service data.
@exception InternalLogException An unexpected error has occured. | [
"Package",
"access",
"method",
"to",
"return",
"the",
"current",
"service",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java#L845-L863 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java | LogHandle.logFileHeader | LogFileHeader logFileHeader() throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logFileHeader", this);
// Check that the file is actually open
if (_activeFile == null)
{
if (tc.isEntryEnabled())
Tr.exit(tc, "logFileHeader", "InternalLogException");
throw new InternalLogException(null);
}
final LogFileHeader logFileHeader = _activeFile.logFileHeader();
if (tc.isEntryEnabled())
Tr.exit(tc, "logFileHeader", logFileHeader);
return logFileHeader;
} | java | LogFileHeader logFileHeader() throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "logFileHeader", this);
// Check that the file is actually open
if (_activeFile == null)
{
if (tc.isEntryEnabled())
Tr.exit(tc, "logFileHeader", "InternalLogException");
throw new InternalLogException(null);
}
final LogFileHeader logFileHeader = _activeFile.logFileHeader();
if (tc.isEntryEnabled())
Tr.exit(tc, "logFileHeader", logFileHeader);
return logFileHeader;
} | [
"LogFileHeader",
"logFileHeader",
"(",
")",
"throws",
"InternalLogException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"logFileHeader\"",
",",
"this",
")",
";",
"// Check that the file is actually open",
"if",
"(",
"_activeFile",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"logFileHeader\"",
",",
"\"InternalLogException\"",
")",
";",
"throw",
"new",
"InternalLogException",
"(",
"null",
")",
";",
"}",
"final",
"LogFileHeader",
"logFileHeader",
"=",
"_activeFile",
".",
"logFileHeader",
"(",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"logFileHeader\"",
",",
"logFileHeader",
")",
";",
"return",
"logFileHeader",
";",
"}"
] | Returns the LogFileHeader for the currently active log file.
@return The LogFileHeader for the currently active log file.
@exception InternalLogException An unexpected error has occured. | [
"Returns",
"the",
"LogFileHeader",
"for",
"the",
"currently",
"active",
"log",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java#L948-L966 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java | LogHandle.recoveredRecords | ArrayList<ReadableLogRecord> recoveredRecords()
{
if (tc.isDebugEnabled())
Tr.debug(tc, "recoveredRecords", _recoveredRecords);
return _recoveredRecords;
} | java | ArrayList<ReadableLogRecord> recoveredRecords()
{
if (tc.isDebugEnabled())
Tr.debug(tc, "recoveredRecords", _recoveredRecords);
return _recoveredRecords;
} | [
"ArrayList",
"<",
"ReadableLogRecord",
">",
"recoveredRecords",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"recoveredRecords\"",
",",
"_recoveredRecords",
")",
";",
"return",
"_recoveredRecords",
";",
"}"
] | Returns an array of ReadableLogRecords retrieved when the recovery log was
opened.
@return ArrayList An array of ReadableLogRecords. | [
"Returns",
"an",
"array",
"of",
"ReadableLogRecords",
"retrieved",
"when",
"the",
"recovery",
"log",
"was",
"opened",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java#L977-L982 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java | LogHandle.setServiceData | void setServiceData(byte[] serviceData) throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "setServiceData", new java.lang.Object[] { RLSUtils.toHexString(serviceData, RLSUtils.MAX_DISPLAY_BYTES), this });
// Check that the files are available
if ((_file1 == null) || (_file2 == null))
{
if (tc.isEntryEnabled())
Tr.exit(tc, "setServiceData", "InternalLogException");
throw new InternalLogException(null);
}
// Cache the service data buffer reference. This class logically 'owns' the buffer.
_serviceData = serviceData;
// Pass the reference to the underlying log file objects.
_file1.setServiceData(serviceData);
_file2.setServiceData(serviceData);
if (tc.isEntryEnabled())
Tr.exit(tc, "setServiceData");
} | java | void setServiceData(byte[] serviceData) throws InternalLogException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "setServiceData", new java.lang.Object[] { RLSUtils.toHexString(serviceData, RLSUtils.MAX_DISPLAY_BYTES), this });
// Check that the files are available
if ((_file1 == null) || (_file2 == null))
{
if (tc.isEntryEnabled())
Tr.exit(tc, "setServiceData", "InternalLogException");
throw new InternalLogException(null);
}
// Cache the service data buffer reference. This class logically 'owns' the buffer.
_serviceData = serviceData;
// Pass the reference to the underlying log file objects.
_file1.setServiceData(serviceData);
_file2.setServiceData(serviceData);
if (tc.isEntryEnabled())
Tr.exit(tc, "setServiceData");
} | [
"void",
"setServiceData",
"(",
"byte",
"[",
"]",
"serviceData",
")",
"throws",
"InternalLogException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"setServiceData\"",
",",
"new",
"java",
".",
"lang",
".",
"Object",
"[",
"]",
"{",
"RLSUtils",
".",
"toHexString",
"(",
"serviceData",
",",
"RLSUtils",
".",
"MAX_DISPLAY_BYTES",
")",
",",
"this",
"}",
")",
";",
"// Check that the files are available",
"if",
"(",
"(",
"_file1",
"==",
"null",
")",
"||",
"(",
"_file2",
"==",
"null",
")",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"setServiceData\"",
",",
"\"InternalLogException\"",
")",
";",
"throw",
"new",
"InternalLogException",
"(",
"null",
")",
";",
"}",
"// Cache the service data buffer reference. This class logically 'owns' the buffer.",
"_serviceData",
"=",
"serviceData",
";",
"// Pass the reference to the underlying log file objects.",
"_file1",
".",
"setServiceData",
"(",
"serviceData",
")",
";",
"_file2",
".",
"setServiceData",
"(",
"serviceData",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"setServiceData\"",
")",
";",
"}"
] | Package access method to replace the existing service data with the new service
data.
@param serviceData The new service data or null for no service data.
@exception InternalLogException An unexpected error has occured. | [
"Package",
"access",
"method",
"to",
"replace",
"the",
"existing",
"service",
"data",
"with",
"the",
"new",
"service",
"data",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java#L995-L1017 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java | LogHandle.writeLogRecord | protected void writeLogRecord(LogRecord logRecord)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "writeLogRecord", logRecord);
_activeFile.writeLogRecord(logRecord);
if (tc.isEntryEnabled())
Tr.exit(tc, "writeLogRecord");
} | java | protected void writeLogRecord(LogRecord logRecord)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "writeLogRecord", logRecord);
_activeFile.writeLogRecord(logRecord);
if (tc.isEntryEnabled())
Tr.exit(tc, "writeLogRecord");
} | [
"protected",
"void",
"writeLogRecord",
"(",
"LogRecord",
"logRecord",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"writeLogRecord\"",
",",
"logRecord",
")",
";",
"_activeFile",
".",
"writeLogRecord",
"(",
"logRecord",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"writeLogRecord\"",
")",
";",
"}"
] | Do any necessary under the covers work to write the LogRecord. | [
"Do",
"any",
"necessary",
"under",
"the",
"covers",
"work",
"to",
"write",
"the",
"LogRecord",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogHandle.java#L1373-L1382 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java | ArchiveUtils.processArchiveManifest | public static Map<String, String> processArchiveManifest(final JarFile jarFile) throws Throwable {
Map<String, String> manifestAttrs = null;
if (jarFile != null) {
try {
manifestAttrs = AccessController.doPrivileged(new PrivilegedExceptionAction<Map<String, String>>() {
@Override
public Map<String, String> run() throws ZipException, IOException {
InputStream is = null;
Map<String, String> attrs = null;
try {
// Read the manifest and access the manifest headers.
is = jarFile.getInputStream(jarFile.getEntry(JarFile.MANIFEST_NAME));
attrs = ManifestProcessor.readManifestIntoMap(ManifestProcessor.parseManifest(is));
} finally {
if (is != null) {
InstallUtils.close(is);
}
}
return attrs;
}
});
} catch (PrivilegedActionException e) {
throw e.getCause();
}
}
return manifestAttrs;
} | java | public static Map<String, String> processArchiveManifest(final JarFile jarFile) throws Throwable {
Map<String, String> manifestAttrs = null;
if (jarFile != null) {
try {
manifestAttrs = AccessController.doPrivileged(new PrivilegedExceptionAction<Map<String, String>>() {
@Override
public Map<String, String> run() throws ZipException, IOException {
InputStream is = null;
Map<String, String> attrs = null;
try {
// Read the manifest and access the manifest headers.
is = jarFile.getInputStream(jarFile.getEntry(JarFile.MANIFEST_NAME));
attrs = ManifestProcessor.readManifestIntoMap(ManifestProcessor.parseManifest(is));
} finally {
if (is != null) {
InstallUtils.close(is);
}
}
return attrs;
}
});
} catch (PrivilegedActionException e) {
throw e.getCause();
}
}
return manifestAttrs;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"processArchiveManifest",
"(",
"final",
"JarFile",
"jarFile",
")",
"throws",
"Throwable",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"manifestAttrs",
"=",
"null",
";",
"if",
"(",
"jarFile",
"!=",
"null",
")",
"{",
"try",
"{",
"manifestAttrs",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"run",
"(",
")",
"throws",
"ZipException",
",",
"IOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"Map",
"<",
"String",
",",
"String",
">",
"attrs",
"=",
"null",
";",
"try",
"{",
"// Read the manifest and access the manifest headers.",
"is",
"=",
"jarFile",
".",
"getInputStream",
"(",
"jarFile",
".",
"getEntry",
"(",
"JarFile",
".",
"MANIFEST_NAME",
")",
")",
";",
"attrs",
"=",
"ManifestProcessor",
".",
"readManifestIntoMap",
"(",
"ManifestProcessor",
".",
"parseManifest",
"(",
"is",
")",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"InstallUtils",
".",
"close",
"(",
"is",
")",
";",
"}",
"}",
"return",
"attrs",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"throw",
"e",
".",
"getCause",
"(",
")",
";",
"}",
"}",
"return",
"manifestAttrs",
";",
"}"
] | Gets the archive file Manifest attributes as a String Map from a jar file.
@param jarFile the Jar File to be processes
@return a Map of attributes and values compiled from the jar file's manifest file
@throws Throwable | [
"Gets",
"the",
"archive",
"file",
"Manifest",
"attributes",
"as",
"a",
"String",
"Map",
"from",
"a",
"jar",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java#L105-L134 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java | ArchiveUtils.processArchiveManifest | public static Map<String, String> processArchiveManifest(final File file) throws Throwable {
Map<String, String> manifestAttrs = null;
if (file != null && file.isFile() && ArchiveFileType.JAR.isType(file.getPath())) {
JarFile jarFile = null;
try {
jarFile = new JarFile(file);
manifestAttrs = processArchiveManifest(jarFile);
} finally {
if (jarFile != null) {
InstallUtils.close(jarFile);
}
}
}
return manifestAttrs;
} | java | public static Map<String, String> processArchiveManifest(final File file) throws Throwable {
Map<String, String> manifestAttrs = null;
if (file != null && file.isFile() && ArchiveFileType.JAR.isType(file.getPath())) {
JarFile jarFile = null;
try {
jarFile = new JarFile(file);
manifestAttrs = processArchiveManifest(jarFile);
} finally {
if (jarFile != null) {
InstallUtils.close(jarFile);
}
}
}
return manifestAttrs;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"processArchiveManifest",
"(",
"final",
"File",
"file",
")",
"throws",
"Throwable",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"manifestAttrs",
"=",
"null",
";",
"if",
"(",
"file",
"!=",
"null",
"&&",
"file",
".",
"isFile",
"(",
")",
"&&",
"ArchiveFileType",
".",
"JAR",
".",
"isType",
"(",
"file",
".",
"getPath",
"(",
")",
")",
")",
"{",
"JarFile",
"jarFile",
"=",
"null",
";",
"try",
"{",
"jarFile",
"=",
"new",
"JarFile",
"(",
"file",
")",
";",
"manifestAttrs",
"=",
"processArchiveManifest",
"(",
"jarFile",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"jarFile",
"!=",
"null",
")",
"{",
"InstallUtils",
".",
"close",
"(",
"jarFile",
")",
";",
"}",
"}",
"}",
"return",
"manifestAttrs",
";",
"}"
] | Gets the archive file Manifest attributes as a String Map from a file.
@param file the file to be processed
@return a Map of attributes and values compiled from the file's manifest file
@throws Throwable | [
"Gets",
"the",
"archive",
"file",
"Manifest",
"attributes",
"as",
"a",
"String",
"Map",
"from",
"a",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java#L143-L159 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java | ArchiveUtils.getLicenseAgreement | public static String getLicenseAgreement(final JarFile jar, final Map<String, String> manifestAttrs) {
String licenseAgreement = null;
if (manifestAttrs.isEmpty()) {
return licenseAgreement;
}
String licenseAgreementPrefix = manifestAttrs.get(ArchiveUtils.LICENSE_AGREEMENT);
LicenseProvider licenseProvider = (licenseAgreementPrefix != null) ? ZipLicenseProvider.createInstance(jar, licenseAgreementPrefix) : null;
if (licenseProvider != null)
licenseAgreement = new InstallLicenseImpl("", LicenseType.UNSPECIFIED, licenseProvider).getAgreement();
return licenseAgreement;
} | java | public static String getLicenseAgreement(final JarFile jar, final Map<String, String> manifestAttrs) {
String licenseAgreement = null;
if (manifestAttrs.isEmpty()) {
return licenseAgreement;
}
String licenseAgreementPrefix = manifestAttrs.get(ArchiveUtils.LICENSE_AGREEMENT);
LicenseProvider licenseProvider = (licenseAgreementPrefix != null) ? ZipLicenseProvider.createInstance(jar, licenseAgreementPrefix) : null;
if (licenseProvider != null)
licenseAgreement = new InstallLicenseImpl("", LicenseType.UNSPECIFIED, licenseProvider).getAgreement();
return licenseAgreement;
} | [
"public",
"static",
"String",
"getLicenseAgreement",
"(",
"final",
"JarFile",
"jar",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"manifestAttrs",
")",
"{",
"String",
"licenseAgreement",
"=",
"null",
";",
"if",
"(",
"manifestAttrs",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"licenseAgreement",
";",
"}",
"String",
"licenseAgreementPrefix",
"=",
"manifestAttrs",
".",
"get",
"(",
"ArchiveUtils",
".",
"LICENSE_AGREEMENT",
")",
";",
"LicenseProvider",
"licenseProvider",
"=",
"(",
"licenseAgreementPrefix",
"!=",
"null",
")",
"?",
"ZipLicenseProvider",
".",
"createInstance",
"(",
"jar",
",",
"licenseAgreementPrefix",
")",
":",
"null",
";",
"if",
"(",
"licenseProvider",
"!=",
"null",
")",
"licenseAgreement",
"=",
"new",
"InstallLicenseImpl",
"(",
"\"\"",
",",
"LicenseType",
".",
"UNSPECIFIED",
",",
"licenseProvider",
")",
".",
"getAgreement",
"(",
")",
";",
"return",
"licenseAgreement",
";",
"}"
] | Gets the license agreement for the jar file.
@param jar the jar file
@param manifestAttrs the manifest file for the jar file
@return the license agreement as a String | [
"Gets",
"the",
"license",
"agreement",
"for",
"the",
"jar",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java#L168-L183 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSetMap.java | ConcurrentServiceReferenceSetMap.deactivate | public void deactivate(ComponentContext context) {
if (contextRef.get() == null) {
// Components are only deactivated if they activate successfully,
// and component instances are discarded after being deactivated.
// This is either DS or programmer error.
throw new IllegalStateException("not activated");
}
this.contextRef.set(null);
} | java | public void deactivate(ComponentContext context) {
if (contextRef.get() == null) {
// Components are only deactivated if they activate successfully,
// and component instances are discarded after being deactivated.
// This is either DS or programmer error.
throw new IllegalStateException("not activated");
}
this.contextRef.set(null);
} | [
"public",
"void",
"deactivate",
"(",
"ComponentContext",
"context",
")",
"{",
"if",
"(",
"contextRef",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"// Components are only deactivated if they activate successfully,",
"// and component instances are discarded after being deactivated.",
"// This is either DS or programmer error.",
"throw",
"new",
"IllegalStateException",
"(",
"\"not activated\"",
")",
";",
"}",
"this",
".",
"contextRef",
".",
"set",
"(",
"null",
")",
";",
"}"
] | Deactivates the map. Will trigger a release of all held services. | [
"Deactivates",
"the",
"map",
".",
"Will",
"trigger",
"a",
"release",
"of",
"all",
"held",
"services",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSetMap.java#L91-L100 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.init | public void init(HttpInboundServiceContext sc) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
} | java | public void init(HttpInboundServiceContext sc) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
} | [
"public",
"void",
"init",
"(",
"HttpInboundServiceContext",
"sc",
")",
"{",
"// for requests, we don't care about the validation",
"setHeaderValidation",
"(",
"false",
")",
";",
"setOwner",
"(",
"sc",
")",
";",
"setBinaryParseState",
"(",
"HttpInternalConstants",
".",
"PARSING_BINARY_VERSION",
")",
";",
"}"
] | Initialize this incoming HTTP request message.
@param sc | [
"Initialize",
"this",
"incoming",
"HTTP",
"request",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L159-L164 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.init | public void init(HttpOutboundServiceContext sc) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
setVersion(getServiceContext().getHttpConfig().getOutgoingVersion());
} | java | public void init(HttpOutboundServiceContext sc) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
setVersion(getServiceContext().getHttpConfig().getOutgoingVersion());
} | [
"public",
"void",
"init",
"(",
"HttpOutboundServiceContext",
"sc",
")",
"{",
"// for requests, we don't care about the validation",
"setHeaderValidation",
"(",
"false",
")",
";",
"setOwner",
"(",
"sc",
")",
";",
"setBinaryParseState",
"(",
"HttpInternalConstants",
".",
"PARSING_BINARY_VERSION",
")",
";",
"setVersion",
"(",
"getServiceContext",
"(",
")",
".",
"getHttpConfig",
"(",
")",
".",
"getOutgoingVersion",
"(",
")",
")",
";",
"}"
] | Initialize this outgoing HTTP request message.
@param sc | [
"Initialize",
"this",
"outgoing",
"HTTP",
"request",
"message",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L171-L177 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.init | public void init(HttpInboundServiceContext sc, BNFHeaders hdrs) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
if (null != hdrs) {
hdrs.duplicate(this);
}
} | java | public void init(HttpInboundServiceContext sc, BNFHeaders hdrs) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
if (null != hdrs) {
hdrs.duplicate(this);
}
} | [
"public",
"void",
"init",
"(",
"HttpInboundServiceContext",
"sc",
",",
"BNFHeaders",
"hdrs",
")",
"{",
"// for requests, we don't care about the validation",
"setHeaderValidation",
"(",
"false",
")",
";",
"setOwner",
"(",
"sc",
")",
";",
"setBinaryParseState",
"(",
"HttpInternalConstants",
".",
"PARSING_BINARY_VERSION",
")",
";",
"if",
"(",
"null",
"!=",
"hdrs",
")",
"{",
"hdrs",
".",
"duplicate",
"(",
"this",
")",
";",
"}",
"}"
] | Initialize this incoming HTTP request message with specific headers,
ie. ones stored in a cache perhaps.
@param sc
@param hdrs | [
"Initialize",
"this",
"incoming",
"HTTP",
"request",
"message",
"with",
"specific",
"headers",
"ie",
".",
"ones",
"stored",
"in",
"a",
"cache",
"perhaps",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L186-L194 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.init | public void init(HttpOutboundServiceContext sc, BNFHeaders hdrs) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
if (null != hdrs) {
hdrs.duplicate(this);
}
setVersion(getServiceContext().getHttpConfig().getOutgoingVersion());
} | java | public void init(HttpOutboundServiceContext sc, BNFHeaders hdrs) {
// for requests, we don't care about the validation
setHeaderValidation(false);
setOwner(sc);
setBinaryParseState(HttpInternalConstants.PARSING_BINARY_VERSION);
if (null != hdrs) {
hdrs.duplicate(this);
}
setVersion(getServiceContext().getHttpConfig().getOutgoingVersion());
} | [
"public",
"void",
"init",
"(",
"HttpOutboundServiceContext",
"sc",
",",
"BNFHeaders",
"hdrs",
")",
"{",
"// for requests, we don't care about the validation",
"setHeaderValidation",
"(",
"false",
")",
";",
"setOwner",
"(",
"sc",
")",
";",
"setBinaryParseState",
"(",
"HttpInternalConstants",
".",
"PARSING_BINARY_VERSION",
")",
";",
"if",
"(",
"null",
"!=",
"hdrs",
")",
"{",
"hdrs",
".",
"duplicate",
"(",
"this",
")",
";",
"}",
"setVersion",
"(",
"getServiceContext",
"(",
")",
".",
"getHttpConfig",
"(",
")",
".",
"getOutgoingVersion",
"(",
")",
")",
";",
"}"
] | Initialize this outgoing HTTP request message with specific headers,
ie. ones stored in a cache perhaps.
@param sc
@param hdrs | [
"Initialize",
"this",
"outgoing",
"HTTP",
"request",
"message",
"with",
"specific",
"headers",
"ie",
".",
"ones",
"stored",
"in",
"a",
"cache",
"perhaps",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L203-L212 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.encodePseudoHeaders | @Override
public WsByteBuffer[] encodePseudoHeaders() {
WsByteBuffer[] firstLine = new WsByteBuffer[1];
firstLine[0] = allocateBuffer(getOutgoingBufferSize());
LiteralIndexType indexType = LiteralIndexType.NOINDEXING;
//For the time being, there will be no indexing on the responses to guarantee
//the write context is concurrent to the remote endpoint's read context. Remote
//intermediaries could index if they so desire, so setting NoIndexing (as
//opposed to NeverIndexing).
//TODO: investigate how streams and priority can work together with indexing on
//responses.
//LiteralIndexType indexType = isPushPromise ? LiteralIndexType.NOINDEXING : LiteralIndexType.INDEX;
//Corresponding dynamic table
H2HeaderTable table = this.getH2HeaderTable();
//Current encoded pseudo-header
byte[] encodedHeader = null;
try {
//Encode the Method
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.METHOD, this.myMethod.toString(), indexType);
firstLine = putBytes(encodedHeader, firstLine);
//Encode Scheme
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.SCHEME, this.myScheme.toString(), indexType);
this.myScheme.toString();
firstLine = putBytes(encodedHeader, firstLine);
//Encode Authority
if (this.sUrlHost != null) {
// TODO: should the iUrlPort be added here?
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.AUTHORITY, this.sUrlHost, indexType);
firstLine = putBytes(encodedHeader, firstLine);
}
//Encode Path
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.PATH, this.myURIString, indexType);
firstLine = putBytes(encodedHeader, firstLine);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.error(tc, e.getMessage());
}
return null;
}
// don't flip the last buffer as headers get tacked on the end
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
String url = GenericUtils.nullOutPasswords(getMarshalledSecondToken(), (byte) '&');
Tr.event(tc, "Encoding first line: " + getMethod() + " " + url + " " + getVersion());
}
return firstLine;
} | java | @Override
public WsByteBuffer[] encodePseudoHeaders() {
WsByteBuffer[] firstLine = new WsByteBuffer[1];
firstLine[0] = allocateBuffer(getOutgoingBufferSize());
LiteralIndexType indexType = LiteralIndexType.NOINDEXING;
//For the time being, there will be no indexing on the responses to guarantee
//the write context is concurrent to the remote endpoint's read context. Remote
//intermediaries could index if they so desire, so setting NoIndexing (as
//opposed to NeverIndexing).
//TODO: investigate how streams and priority can work together with indexing on
//responses.
//LiteralIndexType indexType = isPushPromise ? LiteralIndexType.NOINDEXING : LiteralIndexType.INDEX;
//Corresponding dynamic table
H2HeaderTable table = this.getH2HeaderTable();
//Current encoded pseudo-header
byte[] encodedHeader = null;
try {
//Encode the Method
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.METHOD, this.myMethod.toString(), indexType);
firstLine = putBytes(encodedHeader, firstLine);
//Encode Scheme
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.SCHEME, this.myScheme.toString(), indexType);
this.myScheme.toString();
firstLine = putBytes(encodedHeader, firstLine);
//Encode Authority
if (this.sUrlHost != null) {
// TODO: should the iUrlPort be added here?
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.AUTHORITY, this.sUrlHost, indexType);
firstLine = putBytes(encodedHeader, firstLine);
}
//Encode Path
encodedHeader = H2Headers.encodeHeader(table, HpackConstants.PATH, this.myURIString, indexType);
firstLine = putBytes(encodedHeader, firstLine);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.error(tc, e.getMessage());
}
return null;
}
// don't flip the last buffer as headers get tacked on the end
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
String url = GenericUtils.nullOutPasswords(getMarshalledSecondToken(), (byte) '&');
Tr.event(tc, "Encoding first line: " + getMethod() + " " + url + " " + getVersion());
}
return firstLine;
} | [
"@",
"Override",
"public",
"WsByteBuffer",
"[",
"]",
"encodePseudoHeaders",
"(",
")",
"{",
"WsByteBuffer",
"[",
"]",
"firstLine",
"=",
"new",
"WsByteBuffer",
"[",
"1",
"]",
";",
"firstLine",
"[",
"0",
"]",
"=",
"allocateBuffer",
"(",
"getOutgoingBufferSize",
"(",
")",
")",
";",
"LiteralIndexType",
"indexType",
"=",
"LiteralIndexType",
".",
"NOINDEXING",
";",
"//For the time being, there will be no indexing on the responses to guarantee",
"//the write context is concurrent to the remote endpoint's read context. Remote",
"//intermediaries could index if they so desire, so setting NoIndexing (as",
"//opposed to NeverIndexing).",
"//TODO: investigate how streams and priority can work together with indexing on",
"//responses.",
"//LiteralIndexType indexType = isPushPromise ? LiteralIndexType.NOINDEXING : LiteralIndexType.INDEX;",
"//Corresponding dynamic table",
"H2HeaderTable",
"table",
"=",
"this",
".",
"getH2HeaderTable",
"(",
")",
";",
"//Current encoded pseudo-header",
"byte",
"[",
"]",
"encodedHeader",
"=",
"null",
";",
"try",
"{",
"//Encode the Method",
"encodedHeader",
"=",
"H2Headers",
".",
"encodeHeader",
"(",
"table",
",",
"HpackConstants",
".",
"METHOD",
",",
"this",
".",
"myMethod",
".",
"toString",
"(",
")",
",",
"indexType",
")",
";",
"firstLine",
"=",
"putBytes",
"(",
"encodedHeader",
",",
"firstLine",
")",
";",
"//Encode Scheme",
"encodedHeader",
"=",
"H2Headers",
".",
"encodeHeader",
"(",
"table",
",",
"HpackConstants",
".",
"SCHEME",
",",
"this",
".",
"myScheme",
".",
"toString",
"(",
")",
",",
"indexType",
")",
";",
"this",
".",
"myScheme",
".",
"toString",
"(",
")",
";",
"firstLine",
"=",
"putBytes",
"(",
"encodedHeader",
",",
"firstLine",
")",
";",
"//Encode Authority",
"if",
"(",
"this",
".",
"sUrlHost",
"!=",
"null",
")",
"{",
"// TODO: should the iUrlPort be added here?",
"encodedHeader",
"=",
"H2Headers",
".",
"encodeHeader",
"(",
"table",
",",
"HpackConstants",
".",
"AUTHORITY",
",",
"this",
".",
"sUrlHost",
",",
"indexType",
")",
";",
"firstLine",
"=",
"putBytes",
"(",
"encodedHeader",
",",
"firstLine",
")",
";",
"}",
"//Encode Path",
"encodedHeader",
"=",
"H2Headers",
".",
"encodeHeader",
"(",
"table",
",",
"HpackConstants",
".",
"PATH",
",",
"this",
".",
"myURIString",
",",
"indexType",
")",
";",
"firstLine",
"=",
"putBytes",
"(",
"encodedHeader",
",",
"firstLine",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}",
"// don't flip the last buffer as headers get tacked on the end",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"String",
"url",
"=",
"GenericUtils",
".",
"nullOutPasswords",
"(",
"getMarshalledSecondToken",
"(",
")",
",",
"(",
"byte",
")",
"'",
"'",
")",
";",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Encoding first line: \"",
"+",
"getMethod",
"(",
")",
"+",
"\" \"",
"+",
"url",
"+",
"\" \"",
"+",
"getVersion",
"(",
")",
")",
";",
"}",
"return",
"firstLine",
";",
"}"
] | of the first line. | [
"of",
"the",
"first",
"line",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L557-L606 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.setMethod | @Override
public void setMethod(String method) throws UnsupportedMethodException {
MethodValues val = MethodValues.match(method, 0, method.length());
if (null == val) {
throw new UnsupportedMethodException("Illegal method " + method);
}
setMethod(val);
} | java | @Override
public void setMethod(String method) throws UnsupportedMethodException {
MethodValues val = MethodValues.match(method, 0, method.length());
if (null == val) {
throw new UnsupportedMethodException("Illegal method " + method);
}
setMethod(val);
} | [
"@",
"Override",
"public",
"void",
"setMethod",
"(",
"String",
"method",
")",
"throws",
"UnsupportedMethodException",
"{",
"MethodValues",
"val",
"=",
"MethodValues",
".",
"match",
"(",
"method",
",",
"0",
",",
"method",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"null",
"==",
"val",
")",
"{",
"throw",
"new",
"UnsupportedMethodException",
"(",
"\"Illegal method \"",
"+",
"method",
")",
";",
"}",
"setMethod",
"(",
"val",
")",
";",
"}"
] | Set the method of this request to the given String if it is valid.
@param method
@throws UnsupportedMethodException | [
"Set",
"the",
"method",
"of",
"this",
"request",
"to",
"the",
"given",
"String",
"if",
"it",
"is",
"valid",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L728-L735 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.setMethod | @Override
public void setMethod(MethodValues method) {
this.myMethod = method;
super.setFirstLineChanged();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "setMethod(v): " + (null != method ? method.getName() : null));
}
} | java | @Override
public void setMethod(MethodValues method) {
this.myMethod = method;
super.setFirstLineChanged();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "setMethod(v): " + (null != method ? method.getName() : null));
}
} | [
"@",
"Override",
"public",
"void",
"setMethod",
"(",
"MethodValues",
"method",
")",
"{",
"this",
".",
"myMethod",
"=",
"method",
";",
"super",
".",
"setFirstLineChanged",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"setMethod(v): \"",
"+",
"(",
"null",
"!=",
"method",
"?",
"method",
".",
"getName",
"(",
")",
":",
"null",
")",
")",
";",
"}",
"}"
] | Set the request method to the given value.
@param method | [
"Set",
"the",
"request",
"method",
"to",
"the",
"given",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L757-L764 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.getRequestURI | @Override
final public String getRequestURI() {
if (null == this.myURIString) {
this.myURIString = GenericUtils.getEnglishString(this.myURIBytes);
}
return this.myURIString;
} | java | @Override
final public String getRequestURI() {
if (null == this.myURIString) {
this.myURIString = GenericUtils.getEnglishString(this.myURIBytes);
}
return this.myURIString;
} | [
"@",
"Override",
"final",
"public",
"String",
"getRequestURI",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"myURIString",
")",
"{",
"this",
".",
"myURIString",
"=",
"GenericUtils",
".",
"getEnglishString",
"(",
"this",
".",
"myURIBytes",
")",
";",
"}",
"return",
"this",
".",
"myURIString",
";",
"}"
] | Query the value of the request URI.
@return String | [
"Query",
"the",
"value",
"of",
"the",
"request",
"URI",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L771-L777 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.getTargetHost | private String getTargetHost() {
String host = getVirtualHost();
if (null == host) {
host = (isIncoming()) ? getServiceContext().getLocalAddr().getCanonicalHostName() : getServiceContext().getRemoteAddr().getCanonicalHostName();
}
return host;
} | java | private String getTargetHost() {
String host = getVirtualHost();
if (null == host) {
host = (isIncoming()) ? getServiceContext().getLocalAddr().getCanonicalHostName() : getServiceContext().getRemoteAddr().getCanonicalHostName();
}
return host;
} | [
"private",
"String",
"getTargetHost",
"(",
")",
"{",
"String",
"host",
"=",
"getVirtualHost",
"(",
")",
";",
"if",
"(",
"null",
"==",
"host",
")",
"{",
"host",
"=",
"(",
"isIncoming",
"(",
")",
")",
"?",
"getServiceContext",
"(",
")",
".",
"getLocalAddr",
"(",
")",
".",
"getCanonicalHostName",
"(",
")",
":",
"getServiceContext",
"(",
")",
".",
"getRemoteAddr",
"(",
")",
".",
"getCanonicalHostName",
"(",
")",
";",
"}",
"return",
"host",
";",
"}"
] | Find the target host of the request. This checks the VirtualHost data but
falls back on the socket layer target if need be.
@return String | [
"Find",
"the",
"target",
"host",
"of",
"the",
"request",
".",
"This",
"checks",
"the",
"VirtualHost",
"data",
"but",
"falls",
"back",
"on",
"the",
"socket",
"layer",
"target",
"if",
"need",
"be",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L795-L801 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.getTargetPort | private int getTargetPort() {
int port = getVirtualPort();
if (NOTSET == port) {
port = (isIncoming()) ? getServiceContext().getLocalPort() : getServiceContext().getRemotePort();
}
return port;
} | java | private int getTargetPort() {
int port = getVirtualPort();
if (NOTSET == port) {
port = (isIncoming()) ? getServiceContext().getLocalPort() : getServiceContext().getRemotePort();
}
return port;
} | [
"private",
"int",
"getTargetPort",
"(",
")",
"{",
"int",
"port",
"=",
"getVirtualPort",
"(",
")",
";",
"if",
"(",
"NOTSET",
"==",
"port",
")",
"{",
"port",
"=",
"(",
"isIncoming",
"(",
")",
")",
"?",
"getServiceContext",
"(",
")",
".",
"getLocalPort",
"(",
")",
":",
"getServiceContext",
"(",
")",
".",
"getRemotePort",
"(",
")",
";",
"}",
"return",
"port",
";",
"}"
] | Find the target port of the request. This checks the VirtualPort data and
falls back on the socket port information if need be.
@return int | [
"Find",
"the",
"target",
"port",
"of",
"the",
"request",
".",
"This",
"checks",
"the",
"VirtualPort",
"data",
"and",
"falls",
"back",
"on",
"the",
"socket",
"port",
"information",
"if",
"need",
"be",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L809-L815 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.getVirtualPort | @Override
public int getVirtualPort() {
if (HeaderStorage.NOTSET != this.iUrlPort) {
// use the port from the parsed URL
return this.iUrlPort;
}
if (NOT_PRESENT <= this.iHdrPort) {
// already searched the header value and either found it or not,
// either way, return what we saved
return this.iHdrPort;
}
// need to extract the value from the header
byte[] host = getHeader(HttpHeaderKeys.HDR_HOST).asBytes();
if (null == host || host.length == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: No/empty host header");
}
return -1;
}
// default to not_present now
this.iHdrPort = NOT_PRESENT;
int start = -1;
if (LEFT_BRACKET == host[0]) {
// IPV6 IP address
start = GenericUtils.byteIndexOf(host, RIGHT_BRACKET, 0);
if (-1 == start) {
// invalid IP
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: Invalid IPV6 ip in host header");
}
return -1;
}
start++; // skip past the bracket
} else {
// everything but an IPV6 IP
start = GenericUtils.byteIndexOf(host, BNFHeaders.COLON, 0);
}
if (-1 == start || host.length <= start || BNFHeaders.COLON != host[start]) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: No port in host header");
}
return -1;
}
start++; // skip past the colon
int length = host.length - start;
if (0 >= length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: No port after colon");
}
return -1;
}
try {
// PK14634 - cache the parsed port
this.iHdrPort = GenericUtils.asIntValue(host, start, length);
} catch (NumberFormatException nfe) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: Invalid port value: " + HttpChannelUtils.getEnglishString(host, start, length));
}
return -1;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: returning " + this.iHdrPort);
}
return this.iHdrPort;
} | java | @Override
public int getVirtualPort() {
if (HeaderStorage.NOTSET != this.iUrlPort) {
// use the port from the parsed URL
return this.iUrlPort;
}
if (NOT_PRESENT <= this.iHdrPort) {
// already searched the header value and either found it or not,
// either way, return what we saved
return this.iHdrPort;
}
// need to extract the value from the header
byte[] host = getHeader(HttpHeaderKeys.HDR_HOST).asBytes();
if (null == host || host.length == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: No/empty host header");
}
return -1;
}
// default to not_present now
this.iHdrPort = NOT_PRESENT;
int start = -1;
if (LEFT_BRACKET == host[0]) {
// IPV6 IP address
start = GenericUtils.byteIndexOf(host, RIGHT_BRACKET, 0);
if (-1 == start) {
// invalid IP
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: Invalid IPV6 ip in host header");
}
return -1;
}
start++; // skip past the bracket
} else {
// everything but an IPV6 IP
start = GenericUtils.byteIndexOf(host, BNFHeaders.COLON, 0);
}
if (-1 == start || host.length <= start || BNFHeaders.COLON != host[start]) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: No port in host header");
}
return -1;
}
start++; // skip past the colon
int length = host.length - start;
if (0 >= length) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: No port after colon");
}
return -1;
}
try {
// PK14634 - cache the parsed port
this.iHdrPort = GenericUtils.asIntValue(host, start, length);
} catch (NumberFormatException nfe) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: Invalid port value: " + HttpChannelUtils.getEnglishString(host, start, length));
}
return -1;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getVirtualPort: returning " + this.iHdrPort);
}
return this.iHdrPort;
} | [
"@",
"Override",
"public",
"int",
"getVirtualPort",
"(",
")",
"{",
"if",
"(",
"HeaderStorage",
".",
"NOTSET",
"!=",
"this",
".",
"iUrlPort",
")",
"{",
"// use the port from the parsed URL",
"return",
"this",
".",
"iUrlPort",
";",
"}",
"if",
"(",
"NOT_PRESENT",
"<=",
"this",
".",
"iHdrPort",
")",
"{",
"// already searched the header value and either found it or not,",
"// either way, return what we saved",
"return",
"this",
".",
"iHdrPort",
";",
"}",
"// need to extract the value from the header",
"byte",
"[",
"]",
"host",
"=",
"getHeader",
"(",
"HttpHeaderKeys",
".",
"HDR_HOST",
")",
".",
"asBytes",
"(",
")",
";",
"if",
"(",
"null",
"==",
"host",
"||",
"host",
".",
"length",
"==",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getVirtualPort: No/empty host header\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"// default to not_present now",
"this",
".",
"iHdrPort",
"=",
"NOT_PRESENT",
";",
"int",
"start",
"=",
"-",
"1",
";",
"if",
"(",
"LEFT_BRACKET",
"==",
"host",
"[",
"0",
"]",
")",
"{",
"// IPV6 IP address",
"start",
"=",
"GenericUtils",
".",
"byteIndexOf",
"(",
"host",
",",
"RIGHT_BRACKET",
",",
"0",
")",
";",
"if",
"(",
"-",
"1",
"==",
"start",
")",
"{",
"// invalid IP",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getVirtualPort: Invalid IPV6 ip in host header\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"start",
"++",
";",
"// skip past the bracket",
"}",
"else",
"{",
"// everything but an IPV6 IP",
"start",
"=",
"GenericUtils",
".",
"byteIndexOf",
"(",
"host",
",",
"BNFHeaders",
".",
"COLON",
",",
"0",
")",
";",
"}",
"if",
"(",
"-",
"1",
"==",
"start",
"||",
"host",
".",
"length",
"<=",
"start",
"||",
"BNFHeaders",
".",
"COLON",
"!=",
"host",
"[",
"start",
"]",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getVirtualPort: No port in host header\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"start",
"++",
";",
"// skip past the colon",
"int",
"length",
"=",
"host",
".",
"length",
"-",
"start",
";",
"if",
"(",
"0",
">=",
"length",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getVirtualPort: No port after colon\"",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"try",
"{",
"// PK14634 - cache the parsed port",
"this",
".",
"iHdrPort",
"=",
"GenericUtils",
".",
"asIntValue",
"(",
"host",
",",
"start",
",",
"length",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"// no FFDC required",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getVirtualPort: Invalid port value: \"",
"+",
"HttpChannelUtils",
".",
"getEnglishString",
"(",
"host",
",",
"start",
",",
"length",
")",
")",
";",
"}",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getVirtualPort: returning \"",
"+",
"this",
".",
"iHdrPort",
")",
";",
"}",
"return",
"this",
".",
"iHdrPort",
";",
"}"
] | Query the target port of this request. It will first check for a port
in the URL string and if not found, it will check the Host header. This
will return -1 if it is not found in either spot.
@return int | [
"Query",
"the",
"target",
"port",
"of",
"this",
"request",
".",
"It",
"will",
"first",
"check",
"for",
"a",
"port",
"in",
"the",
"URL",
"string",
"and",
"if",
"not",
"found",
"it",
"will",
"check",
"the",
"Host",
"header",
".",
"This",
"will",
"return",
"-",
"1",
"if",
"it",
"is",
"not",
"found",
"in",
"either",
"spot",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L954-L1021 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.parseURI | private void parseURI(byte[] data, int start) {
// at this point, we're parsing /URI [?querystring]
if (start >= data.length) {
// PK22096 - default to "/" if not found, should have caught empty
// string inputs previously (http://host:port is valid)
this.myURIBytes = SLASH;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Defaulting to slash since no URI data found");
}
return;
}
int uri_end = data.length;
for (int i = start; i < data.length; i++) {
// look for the query string marker
if ('?' == data[i]) {
uri_end = i;
break;
}
}
// save off the URI
if (start == uri_end) {
// no uri found
throw new IllegalArgumentException("Missing URI: " + GenericUtils.getEnglishString(data));
}
if (0 == start && uri_end == data.length) {
this.myURIBytes = data;
} else {
this.myURIBytes = new byte[uri_end - start];
System.arraycopy(data, start, this.myURIBytes, 0, this.myURIBytes.length);
uri_end++; // jump past the '?'
if (uri_end < data.length) {
// save off the query string data
byte[] query = new byte[data.length - uri_end];
System.arraycopy(data, uri_end, query, 0, query.length);
setQueryString(query);
}
}
} | java | private void parseURI(byte[] data, int start) {
// at this point, we're parsing /URI [?querystring]
if (start >= data.length) {
// PK22096 - default to "/" if not found, should have caught empty
// string inputs previously (http://host:port is valid)
this.myURIBytes = SLASH;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Defaulting to slash since no URI data found");
}
return;
}
int uri_end = data.length;
for (int i = start; i < data.length; i++) {
// look for the query string marker
if ('?' == data[i]) {
uri_end = i;
break;
}
}
// save off the URI
if (start == uri_end) {
// no uri found
throw new IllegalArgumentException("Missing URI: " + GenericUtils.getEnglishString(data));
}
if (0 == start && uri_end == data.length) {
this.myURIBytes = data;
} else {
this.myURIBytes = new byte[uri_end - start];
System.arraycopy(data, start, this.myURIBytes, 0, this.myURIBytes.length);
uri_end++; // jump past the '?'
if (uri_end < data.length) {
// save off the query string data
byte[] query = new byte[data.length - uri_end];
System.arraycopy(data, uri_end, query, 0, query.length);
setQueryString(query);
}
}
} | [
"private",
"void",
"parseURI",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
")",
"{",
"// at this point, we're parsing /URI [?querystring]",
"if",
"(",
"start",
">=",
"data",
".",
"length",
")",
"{",
"// PK22096 - default to \"/\" if not found, should have caught empty",
"// string inputs previously (http://host:port is valid)",
"this",
".",
"myURIBytes",
"=",
"SLASH",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Defaulting to slash since no URI data found\"",
")",
";",
"}",
"return",
";",
"}",
"int",
"uri_end",
"=",
"data",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"// look for the query string marker",
"if",
"(",
"'",
"'",
"==",
"data",
"[",
"i",
"]",
")",
"{",
"uri_end",
"=",
"i",
";",
"break",
";",
"}",
"}",
"// save off the URI",
"if",
"(",
"start",
"==",
"uri_end",
")",
"{",
"// no uri found",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Missing URI: \"",
"+",
"GenericUtils",
".",
"getEnglishString",
"(",
"data",
")",
")",
";",
"}",
"if",
"(",
"0",
"==",
"start",
"&&",
"uri_end",
"==",
"data",
".",
"length",
")",
"{",
"this",
".",
"myURIBytes",
"=",
"data",
";",
"}",
"else",
"{",
"this",
".",
"myURIBytes",
"=",
"new",
"byte",
"[",
"uri_end",
"-",
"start",
"]",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"start",
",",
"this",
".",
"myURIBytes",
",",
"0",
",",
"this",
".",
"myURIBytes",
".",
"length",
")",
";",
"uri_end",
"++",
";",
"// jump past the '?'",
"if",
"(",
"uri_end",
"<",
"data",
".",
"length",
")",
"{",
"// save off the query string data",
"byte",
"[",
"]",
"query",
"=",
"new",
"byte",
"[",
"data",
".",
"length",
"-",
"uri_end",
"]",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"uri_end",
",",
"query",
",",
"0",
",",
"query",
".",
"length",
")",
";",
"setQueryString",
"(",
"query",
")",
";",
"}",
"}",
"}"
] | Parse the URI information out of the input data, along with any query
information found afterwards. If format errors are found, then an
exception is thrown.
@param data
@param start
@throws IllegalArgumentException | [
"Parse",
"the",
"URI",
"information",
"out",
"of",
"the",
"input",
"data",
"along",
"with",
"any",
"query",
"information",
"found",
"afterwards",
".",
"If",
"format",
"errors",
"are",
"found",
"then",
"an",
"exception",
"is",
"thrown",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1151-L1188 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.parseScheme | private void parseScheme(byte[] data) {
// we know the first character is correct, find the colon
for (int i = 1; i < data.length; i++) {
if (':' == data[i]) {
SchemeValues val = SchemeValues.match(data, 0, i);
if (null == val) {
throw new IllegalArgumentException("Invalid scheme inside URL: " + GenericUtils.getEnglishString(data));
}
setScheme(val);
// scheme should be followed by "://"
if ((i + 2) >= data.length || ('/' != data[i + 1] || '/' != data[i + 2])) {
throw new IllegalArgumentException("Invalid net_path: " + GenericUtils.getEnglishString(data));
}
parseAuthority(data, i + 3);
return;
}
}
// no colon found
throw new IllegalArgumentException("Invalid scheme in URL: " + GenericUtils.getEnglishString(data));
} | java | private void parseScheme(byte[] data) {
// we know the first character is correct, find the colon
for (int i = 1; i < data.length; i++) {
if (':' == data[i]) {
SchemeValues val = SchemeValues.match(data, 0, i);
if (null == val) {
throw new IllegalArgumentException("Invalid scheme inside URL: " + GenericUtils.getEnglishString(data));
}
setScheme(val);
// scheme should be followed by "://"
if ((i + 2) >= data.length || ('/' != data[i + 1] || '/' != data[i + 2])) {
throw new IllegalArgumentException("Invalid net_path: " + GenericUtils.getEnglishString(data));
}
parseAuthority(data, i + 3);
return;
}
}
// no colon found
throw new IllegalArgumentException("Invalid scheme in URL: " + GenericUtils.getEnglishString(data));
} | [
"private",
"void",
"parseScheme",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"// we know the first character is correct, find the colon",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"'",
"'",
"==",
"data",
"[",
"i",
"]",
")",
"{",
"SchemeValues",
"val",
"=",
"SchemeValues",
".",
"match",
"(",
"data",
",",
"0",
",",
"i",
")",
";",
"if",
"(",
"null",
"==",
"val",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid scheme inside URL: \"",
"+",
"GenericUtils",
".",
"getEnglishString",
"(",
"data",
")",
")",
";",
"}",
"setScheme",
"(",
"val",
")",
";",
"// scheme should be followed by \"://\"",
"if",
"(",
"(",
"i",
"+",
"2",
")",
">=",
"data",
".",
"length",
"||",
"(",
"'",
"'",
"!=",
"data",
"[",
"i",
"+",
"1",
"]",
"||",
"'",
"'",
"!=",
"data",
"[",
"i",
"+",
"2",
"]",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid net_path: \"",
"+",
"GenericUtils",
".",
"getEnglishString",
"(",
"data",
")",
")",
";",
"}",
"parseAuthority",
"(",
"data",
",",
"i",
"+",
"3",
")",
";",
"return",
";",
"}",
"}",
"// no colon found",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid scheme in URL: \"",
"+",
"GenericUtils",
".",
"getEnglishString",
"(",
"data",
")",
")",
";",
"}"
] | Parse the scheme marker out of the input data and then start the parse
for the next section. If any errors are encountered, then an exception
is thrown.
@param data
@throws IllegalArgumentException | [
"Parse",
"the",
"scheme",
"marker",
"out",
"of",
"the",
"input",
"data",
"and",
"then",
"start",
"the",
"parse",
"for",
"the",
"next",
"section",
".",
"If",
"any",
"errors",
"are",
"encountered",
"then",
"an",
"exception",
"is",
"thrown",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1252-L1271 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.setRequestURI | @Override
public void setRequestURI(byte[] uri) {
if (null == uri || 0 == uri.length) {
throw new IllegalArgumentException("setRequestURI: null input");
}
super.setFirstLineChanged();
if ('*' == uri[0]) {
// URI of "*" can only be one character long to be valid
if (1 != uri.length && '?' != uri[1]) {
String value = GenericUtils.getEnglishString(uri);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setRequestURI: invalid uri [" + value + "]");
}
throw new IllegalArgumentException("Invalid uri: " + value);
}
} else if ('/' != uri[0]) {
String value = GenericUtils.getEnglishString(uri);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setRequestURI: invalid uri [" + value + "]");
}
throw new IllegalArgumentException("Invalid uri: " + value);
}
initScheme();
this.myURIString = null;
this.sUrlHost = null;
this.iUrlPort = HeaderStorage.NOTSET;
this.myQueryBytes = null;
this.queryParams = null;
parseURI(uri, 0);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setRequestURI: set URI to " + getRequestURI());
}
} | java | @Override
public void setRequestURI(byte[] uri) {
if (null == uri || 0 == uri.length) {
throw new IllegalArgumentException("setRequestURI: null input");
}
super.setFirstLineChanged();
if ('*' == uri[0]) {
// URI of "*" can only be one character long to be valid
if (1 != uri.length && '?' != uri[1]) {
String value = GenericUtils.getEnglishString(uri);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setRequestURI: invalid uri [" + value + "]");
}
throw new IllegalArgumentException("Invalid uri: " + value);
}
} else if ('/' != uri[0]) {
String value = GenericUtils.getEnglishString(uri);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setRequestURI: invalid uri [" + value + "]");
}
throw new IllegalArgumentException("Invalid uri: " + value);
}
initScheme();
this.myURIString = null;
this.sUrlHost = null;
this.iUrlPort = HeaderStorage.NOTSET;
this.myQueryBytes = null;
this.queryParams = null;
parseURI(uri, 0);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setRequestURI: set URI to " + getRequestURI());
}
} | [
"@",
"Override",
"public",
"void",
"setRequestURI",
"(",
"byte",
"[",
"]",
"uri",
")",
"{",
"if",
"(",
"null",
"==",
"uri",
"||",
"0",
"==",
"uri",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"setRequestURI: null input\"",
")",
";",
"}",
"super",
".",
"setFirstLineChanged",
"(",
")",
";",
"if",
"(",
"'",
"'",
"==",
"uri",
"[",
"0",
"]",
")",
"{",
"// URI of \"*\" can only be one character long to be valid",
"if",
"(",
"1",
"!=",
"uri",
".",
"length",
"&&",
"'",
"'",
"!=",
"uri",
"[",
"1",
"]",
")",
"{",
"String",
"value",
"=",
"GenericUtils",
".",
"getEnglishString",
"(",
"uri",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setRequestURI: invalid uri [\"",
"+",
"value",
"+",
"\"]\"",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid uri: \"",
"+",
"value",
")",
";",
"}",
"}",
"else",
"if",
"(",
"'",
"'",
"!=",
"uri",
"[",
"0",
"]",
")",
"{",
"String",
"value",
"=",
"GenericUtils",
".",
"getEnglishString",
"(",
"uri",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setRequestURI: invalid uri [\"",
"+",
"value",
"+",
"\"]\"",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid uri: \"",
"+",
"value",
")",
";",
"}",
"initScheme",
"(",
")",
";",
"this",
".",
"myURIString",
"=",
"null",
";",
"this",
".",
"sUrlHost",
"=",
"null",
";",
"this",
".",
"iUrlPort",
"=",
"HeaderStorage",
".",
"NOTSET",
";",
"this",
".",
"myQueryBytes",
"=",
"null",
";",
"this",
".",
"queryParams",
"=",
"null",
";",
"parseURI",
"(",
"uri",
",",
"0",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setRequestURI: set URI to \"",
"+",
"getRequestURI",
"(",
")",
")",
";",
"}",
"}"
] | Allow the user to set the URI in the HttpRequest to the given
byte array, prior to sending the request.
@param uri | [
"Allow",
"the",
"user",
"to",
"set",
"the",
"URI",
"in",
"the",
"HttpRequest",
"to",
"the",
"given",
"byte",
"array",
"prior",
"to",
"sending",
"the",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1393-L1429 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.initScheme | public void initScheme() {
// set the scheme based on whether the socket is secure or not
if (null == getServiceContext() || null == getServiceContext().getTSC()) {
// discrimination path, not ready for this yet
return;
}
if (getServiceContext().isSecure()) {
this.myScheme = SchemeValues.HTTPS;
} else {
this.myScheme = SchemeValues.HTTP;
}
} | java | public void initScheme() {
// set the scheme based on whether the socket is secure or not
if (null == getServiceContext() || null == getServiceContext().getTSC()) {
// discrimination path, not ready for this yet
return;
}
if (getServiceContext().isSecure()) {
this.myScheme = SchemeValues.HTTPS;
} else {
this.myScheme = SchemeValues.HTTP;
}
} | [
"public",
"void",
"initScheme",
"(",
")",
"{",
"// set the scheme based on whether the socket is secure or not",
"if",
"(",
"null",
"==",
"getServiceContext",
"(",
")",
"||",
"null",
"==",
"getServiceContext",
"(",
")",
".",
"getTSC",
"(",
")",
")",
"{",
"// discrimination path, not ready for this yet",
"return",
";",
"}",
"if",
"(",
"getServiceContext",
"(",
")",
".",
"isSecure",
"(",
")",
")",
"{",
"this",
".",
"myScheme",
"=",
"SchemeValues",
".",
"HTTPS",
";",
"}",
"else",
"{",
"this",
".",
"myScheme",
"=",
"SchemeValues",
".",
"HTTP",
";",
"}",
"}"
] | Initialize the scheme information based on the socket being secure or not. | [
"Initialize",
"the",
"scheme",
"information",
"based",
"on",
"the",
"socket",
"being",
"secure",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1450-L1461 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.getScheme | @Override
public String getScheme() {
// if it hasn't been set yet, then check whether the SC is secure
// or not and set the value accordingly
if (null == this.myScheme) {
initScheme();
}
if (null == this.myScheme) { // if the request has been already destroyed then it will be still null
return null;
}
return this.myScheme.getName();
} | java | @Override
public String getScheme() {
// if it hasn't been set yet, then check whether the SC is secure
// or not and set the value accordingly
if (null == this.myScheme) {
initScheme();
}
if (null == this.myScheme) { // if the request has been already destroyed then it will be still null
return null;
}
return this.myScheme.getName();
} | [
"@",
"Override",
"public",
"String",
"getScheme",
"(",
")",
"{",
"// if it hasn't been set yet, then check whether the SC is secure",
"// or not and set the value accordingly",
"if",
"(",
"null",
"==",
"this",
".",
"myScheme",
")",
"{",
"initScheme",
"(",
")",
";",
"}",
"if",
"(",
"null",
"==",
"this",
".",
"myScheme",
")",
"{",
"// if the request has been already destroyed then it will be still null",
"return",
"null",
";",
"}",
"return",
"this",
".",
"myScheme",
".",
"getName",
"(",
")",
";",
"}"
] | Query the value of the scheme.
@return String | [
"Query",
"the",
"value",
"of",
"the",
"scheme",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1468-L1479 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.setScheme | @Override
public void setScheme(SchemeValues scheme) {
this.myScheme = scheme;
super.setFirstLineChanged();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setScheme(v): " + (null != scheme ? scheme.getName() : null));
}
} | java | @Override
public void setScheme(SchemeValues scheme) {
this.myScheme = scheme;
super.setFirstLineChanged();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setScheme(v): " + (null != scheme ? scheme.getName() : null));
}
} | [
"@",
"Override",
"public",
"void",
"setScheme",
"(",
"SchemeValues",
"scheme",
")",
"{",
"this",
".",
"myScheme",
"=",
"scheme",
";",
"super",
".",
"setFirstLineChanged",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setScheme(v): \"",
"+",
"(",
"null",
"!=",
"scheme",
"?",
"scheme",
".",
"getName",
"(",
")",
":",
"null",
")",
")",
";",
"}",
"}"
] | Set the value of the scheme in the Request by using the
int identifiers.
@param scheme | [
"Set",
"the",
"value",
"of",
"the",
"scheme",
"in",
"the",
"Request",
"by",
"using",
"the",
"int",
"identifiers",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1487-L1494 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.deserializeMethod | private void deserializeMethod(ObjectInput stream) throws IOException, ClassNotFoundException {
MethodValues method = null;
if (SERIALIZATION_V2 == getDeserializationVersion()) {
method = MethodValues.find(readByteArray(stream));
} else {
method = MethodValues.find((String) stream.readObject());
}
if (null == method) {
throw new IOException("Missing method");
}
setMethod(method);
} | java | private void deserializeMethod(ObjectInput stream) throws IOException, ClassNotFoundException {
MethodValues method = null;
if (SERIALIZATION_V2 == getDeserializationVersion()) {
method = MethodValues.find(readByteArray(stream));
} else {
method = MethodValues.find((String) stream.readObject());
}
if (null == method) {
throw new IOException("Missing method");
}
setMethod(method);
} | [
"private",
"void",
"deserializeMethod",
"(",
"ObjectInput",
"stream",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"MethodValues",
"method",
"=",
"null",
";",
"if",
"(",
"SERIALIZATION_V2",
"==",
"getDeserializationVersion",
"(",
")",
")",
"{",
"method",
"=",
"MethodValues",
".",
"find",
"(",
"readByteArray",
"(",
"stream",
")",
")",
";",
"}",
"else",
"{",
"method",
"=",
"MethodValues",
".",
"find",
"(",
"(",
"String",
")",
"stream",
".",
"readObject",
"(",
")",
")",
";",
"}",
"if",
"(",
"null",
"==",
"method",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Missing method\"",
")",
";",
"}",
"setMethod",
"(",
"method",
")",
";",
"}"
] | Deserialize the method information from the input stream.
@param stream
@throws IOException
@throws ClassNotFoundException | [
"Deserialize",
"the",
"method",
"information",
"from",
"the",
"input",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1712-L1723 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.deserializeScheme | private void deserializeScheme(ObjectInput stream) throws IOException, ClassNotFoundException {
SchemeValues scheme = null;
if (SERIALIZATION_V2 == getDeserializationVersion()) {
byte[] value = readByteArray(stream);
if (null == value) {
throw new IOException("Missing scheme");
}
scheme = SchemeValues.find(value);
} else {
String value = (String) stream.readObject();
scheme = SchemeValues.find(value);
}
setScheme(scheme);
} | java | private void deserializeScheme(ObjectInput stream) throws IOException, ClassNotFoundException {
SchemeValues scheme = null;
if (SERIALIZATION_V2 == getDeserializationVersion()) {
byte[] value = readByteArray(stream);
if (null == value) {
throw new IOException("Missing scheme");
}
scheme = SchemeValues.find(value);
} else {
String value = (String) stream.readObject();
scheme = SchemeValues.find(value);
}
setScheme(scheme);
} | [
"private",
"void",
"deserializeScheme",
"(",
"ObjectInput",
"stream",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"SchemeValues",
"scheme",
"=",
"null",
";",
"if",
"(",
"SERIALIZATION_V2",
"==",
"getDeserializationVersion",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"value",
"=",
"readByteArray",
"(",
"stream",
")",
";",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Missing scheme\"",
")",
";",
"}",
"scheme",
"=",
"SchemeValues",
".",
"find",
"(",
"value",
")",
";",
"}",
"else",
"{",
"String",
"value",
"=",
"(",
"String",
")",
"stream",
".",
"readObject",
"(",
")",
";",
"scheme",
"=",
"SchemeValues",
".",
"find",
"(",
"value",
")",
";",
"}",
"setScheme",
"(",
"scheme",
")",
";",
"}"
] | Deserialize the scheme information from the input stream.
@param stream
@throws IOException
@throws ClassNotFoundException | [
"Deserialize",
"the",
"scheme",
"information",
"from",
"the",
"input",
"stream",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1732-L1745 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java | HttpRequestMessageImpl.parseParameters | private synchronized void parseParameters() {
if (null != this.queryParams) {
// already parsed
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "parseParameters for " + this);
}
String encoding = getCharset().name();
// PQ99481... non-English environments are too complex at the moment due to
// the fact that current clients are not enforcing the proper Content-Type
// header usage therefore figuring out what encoding to use involves system
// properties, WAS config files, etc. So query parameters will only be
// pulled
// from the URI and not POST formdata
// now merge in any possible URL params
String queryString = getQueryString();
if (null != queryString) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Parsing URL query data");
}
this.queryParams = HttpChannelUtils.parseQueryString(queryString, encoding);
} else {
// if we didn't have any data then just create an empty table
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// PQ99481 Tr.debug(tc, "No parameter data found in body or URL");
Tr.debug(tc, "No query data found in URL");
}
this.queryParams = new Hashtable<String, String[]>();
}
} | java | private synchronized void parseParameters() {
if (null != this.queryParams) {
// already parsed
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "parseParameters for " + this);
}
String encoding = getCharset().name();
// PQ99481... non-English environments are too complex at the moment due to
// the fact that current clients are not enforcing the proper Content-Type
// header usage therefore figuring out what encoding to use involves system
// properties, WAS config files, etc. So query parameters will only be
// pulled
// from the URI and not POST formdata
// now merge in any possible URL params
String queryString = getQueryString();
if (null != queryString) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Parsing URL query data");
}
this.queryParams = HttpChannelUtils.parseQueryString(queryString, encoding);
} else {
// if we didn't have any data then just create an empty table
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// PQ99481 Tr.debug(tc, "No parameter data found in body or URL");
Tr.debug(tc, "No query data found in URL");
}
this.queryParams = new Hashtable<String, String[]>();
}
} | [
"private",
"synchronized",
"void",
"parseParameters",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"queryParams",
")",
"{",
"// already parsed",
"return",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"parseParameters for \"",
"+",
"this",
")",
";",
"}",
"String",
"encoding",
"=",
"getCharset",
"(",
")",
".",
"name",
"(",
")",
";",
"// PQ99481... non-English environments are too complex at the moment due to",
"// the fact that current clients are not enforcing the proper Content-Type",
"// header usage therefore figuring out what encoding to use involves system",
"// properties, WAS config files, etc. So query parameters will only be",
"// pulled",
"// from the URI and not POST formdata",
"// now merge in any possible URL params",
"String",
"queryString",
"=",
"getQueryString",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"queryString",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Parsing URL query data\"",
")",
";",
"}",
"this",
".",
"queryParams",
"=",
"HttpChannelUtils",
".",
"parseQueryString",
"(",
"queryString",
",",
"encoding",
")",
";",
"}",
"else",
"{",
"// if we didn't have any data then just create an empty table",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"// PQ99481 Tr.debug(tc, \"No parameter data found in body or URL\");",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No query data found in URL\"",
")",
";",
"}",
"this",
".",
"queryParams",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"String",
"[",
"]",
">",
"(",
")",
";",
"}",
"}"
] | Parse the query parameters out of this message. This will check just the
URL query data of the request. | [
"Parse",
"the",
"query",
"parameters",
"out",
"of",
"this",
"message",
".",
"This",
"will",
"check",
"just",
"the",
"URL",
"query",
"data",
"of",
"the",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpRequestMessageImpl.java#L1870-L1902 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.setDataSourceFactory | protected void setDataSourceFactory(ServiceReference<ResourceFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setDataSourceFactory", "setting " + ref);
}
dataSourceFactoryRef.setReference(ref);
} | java | protected void setDataSourceFactory(ServiceReference<ResourceFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setDataSourceFactory", "setting " + ref);
}
dataSourceFactoryRef.setReference(ref);
} | [
"protected",
"void",
"setDataSourceFactory",
"(",
"ServiceReference",
"<",
"ResourceFactory",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"setDataSourceFactory\"",
",",
"\"setting \"",
"+",
"ref",
")",
";",
"}",
"dataSourceFactoryRef",
".",
"setReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for setting the data source service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"data",
"source",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L204-L209 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.unsetDataSourceFactory | protected void unsetDataSourceFactory(ServiceReference<ResourceFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetDataSourceFactory", "unsetting " + ref);
}
dataSourceFactoryRef.unsetReference(ref);
} | java | protected void unsetDataSourceFactory(ServiceReference<ResourceFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetDataSourceFactory", "unsetting " + ref);
}
dataSourceFactoryRef.unsetReference(ref);
} | [
"protected",
"void",
"unsetDataSourceFactory",
"(",
"ServiceReference",
"<",
"ResourceFactory",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"unsetDataSourceFactory\"",
",",
"\"unsetting \"",
"+",
"ref",
")",
";",
"}",
"dataSourceFactoryRef",
".",
"unsetReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for unsetting the data source service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"data",
"source",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L216-L221 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.setResourceConfigFactory | protected void setResourceConfigFactory(ServiceReference<ResourceConfigFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setResourceConfigFactory", "setting " + ref);
}
resourceConfigFactoryRef.setReference(ref);
} | java | protected void setResourceConfigFactory(ServiceReference<ResourceConfigFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setResourceConfigFactory", "setting " + ref);
}
resourceConfigFactoryRef.setReference(ref);
} | [
"protected",
"void",
"setResourceConfigFactory",
"(",
"ServiceReference",
"<",
"ResourceConfigFactory",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"setResourceConfigFactory\"",
",",
"\"setting \"",
"+",
"ref",
")",
";",
"}",
"resourceConfigFactoryRef",
".",
"setReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for setting the ResourceConfigFactory service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"ResourceConfigFactory",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L228-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.unsetResourceConfigFactory | protected void unsetResourceConfigFactory(ServiceReference<ResourceConfigFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetResourceConfigFactory", "unsetting " + ref);
}
resourceConfigFactoryRef.unsetReference(ref);
} | java | protected void unsetResourceConfigFactory(ServiceReference<ResourceConfigFactory> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetResourceConfigFactory", "unsetting " + ref);
}
resourceConfigFactoryRef.unsetReference(ref);
} | [
"protected",
"void",
"unsetResourceConfigFactory",
"(",
"ServiceReference",
"<",
"ResourceConfigFactory",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"unsetResourceConfigFactory\"",
",",
"\"unsetting \"",
"+",
"ref",
")",
";",
"}",
"resourceConfigFactoryRef",
".",
"unsetReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for unsetting the ResourceConfigFactory service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"ResourceConfigFactory",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L240-L245 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.setLocalTransactionCurrent | protected void setLocalTransactionCurrent(ServiceReference<LocalTransactionCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setLocalTransactionCurrent", "setting " + ref);
}
localTransactionCurrentRef.setReference(ref);
} | java | protected void setLocalTransactionCurrent(ServiceReference<LocalTransactionCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setLocalTransactionCurrent", "setting " + ref);
}
localTransactionCurrentRef.setReference(ref);
} | [
"protected",
"void",
"setLocalTransactionCurrent",
"(",
"ServiceReference",
"<",
"LocalTransactionCurrent",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"setLocalTransactionCurrent\"",
",",
"\"setting \"",
"+",
"ref",
")",
";",
"}",
"localTransactionCurrentRef",
".",
"setReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for setting the LocalTransactionCurrent service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"LocalTransactionCurrent",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L252-L257 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.unsetLocalTransactionCurrent | protected void unsetLocalTransactionCurrent(ServiceReference<LocalTransactionCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetLocalTransactionCurrent", "unsetting " + ref);
}
localTransactionCurrentRef.unsetReference(ref);
} | java | protected void unsetLocalTransactionCurrent(ServiceReference<LocalTransactionCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetLocalTransactionCurrent", "unsetting " + ref);
}
localTransactionCurrentRef.unsetReference(ref);
} | [
"protected",
"void",
"unsetLocalTransactionCurrent",
"(",
"ServiceReference",
"<",
"LocalTransactionCurrent",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"unsetLocalTransactionCurrent\"",
",",
"\"unsetting \"",
"+",
"ref",
")",
";",
"}",
"localTransactionCurrentRef",
".",
"unsetReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for unsetting the LocalTransactionCurrent service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"LocalTransactionCurrent",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L264-L269 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.setEmbeddableWebSphereTransactionManager | protected void setEmbeddableWebSphereTransactionManager(ServiceReference<EmbeddableWebSphereTransactionManager> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setEmbeddableWebSphereTransactionManager", "setting " + ref);
}
embeddableWebSphereTransactionManagerRef.setReference(ref);
} | java | protected void setEmbeddableWebSphereTransactionManager(ServiceReference<EmbeddableWebSphereTransactionManager> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setEmbeddableWebSphereTransactionManager", "setting " + ref);
}
embeddableWebSphereTransactionManagerRef.setReference(ref);
} | [
"protected",
"void",
"setEmbeddableWebSphereTransactionManager",
"(",
"ServiceReference",
"<",
"EmbeddableWebSphereTransactionManager",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"setEmbeddableWebSphereTransactionManager\"",
",",
"\"setting \"",
"+",
"ref",
")",
";",
"}",
"embeddableWebSphereTransactionManagerRef",
".",
"setReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for setting the EmbeddableWebSphereTransactionManager service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"EmbeddableWebSphereTransactionManager",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L276-L281 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.unsetEmbeddableWebSphereTransactionManager | protected void unsetEmbeddableWebSphereTransactionManager(ServiceReference<EmbeddableWebSphereTransactionManager> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetEmbeddableWebSphereTransactionManager", "unsetting " + ref);
}
embeddableWebSphereTransactionManagerRef.unsetReference(ref);
} | java | protected void unsetEmbeddableWebSphereTransactionManager(ServiceReference<EmbeddableWebSphereTransactionManager> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetEmbeddableWebSphereTransactionManager", "unsetting " + ref);
}
embeddableWebSphereTransactionManagerRef.unsetReference(ref);
} | [
"protected",
"void",
"unsetEmbeddableWebSphereTransactionManager",
"(",
"ServiceReference",
"<",
"EmbeddableWebSphereTransactionManager",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"unsetEmbeddableWebSphereTransactionManager\"",
",",
"\"unsetting \"",
"+",
"ref",
")",
";",
"}",
"embeddableWebSphereTransactionManagerRef",
".",
"unsetReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for unsetting the EmbeddableWebSphereTransactionManager service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"EmbeddableWebSphereTransactionManager",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L288-L293 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.setUowCurrent | protected void setUowCurrent(ServiceReference<UOWCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setUowCurrent", "setting " + ref);
}
uowCurrentRef.setReference(ref);
} | java | protected void setUowCurrent(ServiceReference<UOWCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setUowCurrent", "setting " + ref);
}
uowCurrentRef.setReference(ref);
} | [
"protected",
"void",
"setUowCurrent",
"(",
"ServiceReference",
"<",
"UOWCurrent",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"setUowCurrent\"",
",",
"\"setting \"",
"+",
"ref",
")",
";",
"}",
"uowCurrentRef",
".",
"setReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for setting the UOWCurrent service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"UOWCurrent",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L300-L305 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.unsetUowCurrent | protected void unsetUowCurrent(ServiceReference<UOWCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetUowCurrent", "unsetting " + ref);
}
uowCurrentRef.unsetReference(ref);
} | java | protected void unsetUowCurrent(ServiceReference<UOWCurrent> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetUowCurrent", "unsetting " + ref);
}
uowCurrentRef.unsetReference(ref);
} | [
"protected",
"void",
"unsetUowCurrent",
"(",
"ServiceReference",
"<",
"UOWCurrent",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"unsetUowCurrent\"",
",",
"\"unsetting \"",
"+",
"ref",
")",
";",
"}",
"uowCurrentRef",
".",
"unsetReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for unsetting the UOWCurrent service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"UOWCurrent",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L312-L317 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.setUserTransaction | protected void setUserTransaction(ServiceReference<UserTransaction> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setUserTransaction", "setting " + ref);
}
userTransactionRef.setReference(ref);
} | java | protected void setUserTransaction(ServiceReference<UserTransaction> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setUserTransaction", "setting " + ref);
}
userTransactionRef.setReference(ref);
} | [
"protected",
"void",
"setUserTransaction",
"(",
"ServiceReference",
"<",
"UserTransaction",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"setUserTransaction\"",
",",
"\"setting \"",
"+",
"ref",
")",
";",
"}",
"userTransactionRef",
".",
"setReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for setting the UserTransaction service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"UserTransaction",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L324-L329 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.unsetUserTransaction | protected void unsetUserTransaction(ServiceReference<UserTransaction> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetUserTransaction", "unsetting " + ref);
}
userTransactionRef.unsetReference(ref);
} | java | protected void unsetUserTransaction(ServiceReference<UserTransaction> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetUserTransaction", "unsetting " + ref);
}
userTransactionRef.unsetReference(ref);
} | [
"protected",
"void",
"unsetUserTransaction",
"(",
"ServiceReference",
"<",
"UserTransaction",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"unsetUserTransaction\"",
",",
"\"unsetting \"",
"+",
"ref",
")",
";",
"}",
"userTransactionRef",
".",
"unsetReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for unsetting the UserTransaction service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"UserTransaction",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L336-L341 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.setSerializationService | protected void setSerializationService(ServiceReference<SerializationService> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setSerializationService", "setting " + ref);
}
serializationServiceRef.setReference(ref);
} | java | protected void setSerializationService(ServiceReference<SerializationService> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "setSerializationService", "setting " + ref);
}
serializationServiceRef.setReference(ref);
} | [
"protected",
"void",
"setSerializationService",
"(",
"ServiceReference",
"<",
"SerializationService",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"setSerializationService\"",
",",
"\"setting \"",
"+",
"ref",
")",
";",
"}",
"serializationServiceRef",
".",
"setReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for setting the SerializationService service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"setting",
"the",
"SerializationService",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L348-L353 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java | DatabaseStoreService.unsetSerializationService | protected void unsetSerializationService(ServiceReference<SerializationService> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetSerializationService", "unsetting " + ref);
}
serializationServiceRef.unsetReference(ref);
} | java | protected void unsetSerializationService(ServiceReference<SerializationService> ref) {
if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetSerializationService", "unsetting " + ref);
}
serializationServiceRef.unsetReference(ref);
} | [
"protected",
"void",
"unsetSerializationService",
"(",
"ServiceReference",
"<",
"SerializationService",
">",
"ref",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"\"unsetSerializationService\"",
",",
"\"unsetting \"",
"+",
"ref",
")",
";",
"}",
"serializationServiceRef",
".",
"unsetReference",
"(",
"ref",
")",
";",
"}"
] | Declarative Services method for unsetting the SerializationService service reference
@param ref reference to service object; type of service object is verified | [
"Declarative",
"Services",
"method",
"for",
"unsetting",
"the",
"SerializationService",
"service",
"reference"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseStoreService.java#L360-L365 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java | Query.getJdbcConnection | private Connection getJdbcConnection() throws JspCoreException, SQLException {
Connection conn = null;
String url = getConnProperties().getUrl();
String user = getConnProperties().getLoginUser();
String passwd = getConnProperties().getLoginPasswd();
String jndiName = getConnProperties().getJndiName();
//System.out.println("***** Query.getJdbcConnection(): jndiname = " + jndiName);
if (jndiName == null) { // use driver manager
// load driver
String dbDriver = (getConnProperties()).getDbDriver();
try {
Class.forName(dbDriver);
conn = DriverManager.getConnection(url, user, passwd);
} // try load driver
catch (ClassNotFoundException e) {
//com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection", "174", this);
throw new JspCoreException(JspConstants.InvalidDbDriver + dbDriver);
} // catch
} // if jndiname == null
else { // use datasource
DataSource ds;
try {
ds = getSingleton(jndiName);
}
catch (Throwable th) {
//com.ibm.ws.ffdc.FFDCFilter.processException(th, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection", "184", this);
throw new JspCoreException(JspConstants.DatasourceException + th.getMessage());
}
conn = ds.getConnection(user, passwd);
}
return conn;
} | java | private Connection getJdbcConnection() throws JspCoreException, SQLException {
Connection conn = null;
String url = getConnProperties().getUrl();
String user = getConnProperties().getLoginUser();
String passwd = getConnProperties().getLoginPasswd();
String jndiName = getConnProperties().getJndiName();
//System.out.println("***** Query.getJdbcConnection(): jndiname = " + jndiName);
if (jndiName == null) { // use driver manager
// load driver
String dbDriver = (getConnProperties()).getDbDriver();
try {
Class.forName(dbDriver);
conn = DriverManager.getConnection(url, user, passwd);
} // try load driver
catch (ClassNotFoundException e) {
//com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection", "174", this);
throw new JspCoreException(JspConstants.InvalidDbDriver + dbDriver);
} // catch
} // if jndiname == null
else { // use datasource
DataSource ds;
try {
ds = getSingleton(jndiName);
}
catch (Throwable th) {
//com.ibm.ws.ffdc.FFDCFilter.processException(th, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection", "184", this);
throw new JspCoreException(JspConstants.DatasourceException + th.getMessage());
}
conn = ds.getConnection(user, passwd);
}
return conn;
} | [
"private",
"Connection",
"getJdbcConnection",
"(",
")",
"throws",
"JspCoreException",
",",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"String",
"url",
"=",
"getConnProperties",
"(",
")",
".",
"getUrl",
"(",
")",
";",
"String",
"user",
"=",
"getConnProperties",
"(",
")",
".",
"getLoginUser",
"(",
")",
";",
"String",
"passwd",
"=",
"getConnProperties",
"(",
")",
".",
"getLoginPasswd",
"(",
")",
";",
"String",
"jndiName",
"=",
"getConnProperties",
"(",
")",
".",
"getJndiName",
"(",
")",
";",
"//System.out.println(\"***** Query.getJdbcConnection(): jndiname = \" + jndiName);",
"if",
"(",
"jndiName",
"==",
"null",
")",
"{",
"// use driver manager",
"// load driver",
"String",
"dbDriver",
"=",
"(",
"getConnProperties",
"(",
")",
")",
".",
"getDbDriver",
"(",
")",
";",
"try",
"{",
"Class",
".",
"forName",
"(",
"dbDriver",
")",
";",
"conn",
"=",
"DriverManager",
".",
"getConnection",
"(",
"url",
",",
"user",
",",
"passwd",
")",
";",
"}",
"// try load driver",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"//com.ibm.ws.ffdc.FFDCFilter.processException(e, \"com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection\", \"174\", this);",
"throw",
"new",
"JspCoreException",
"(",
"JspConstants",
".",
"InvalidDbDriver",
"+",
"dbDriver",
")",
";",
"}",
"// catch",
"}",
"// if jndiname == null",
"else",
"{",
"// use datasource",
"DataSource",
"ds",
";",
"try",
"{",
"ds",
"=",
"getSingleton",
"(",
"jndiName",
")",
";",
"}",
"catch",
"(",
"Throwable",
"th",
")",
"{",
"//com.ibm.ws.ffdc.FFDCFilter.processException(th, \"com.ibm.ws.webcontainer.jsp.tsx.db.Query.getJdbcConnection\", \"184\", this);",
"throw",
"new",
"JspCoreException",
"(",
"JspConstants",
".",
"DatasourceException",
"+",
"th",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"conn",
"=",
"ds",
".",
"getConnection",
"(",
"user",
",",
"passwd",
")",
";",
"}",
"return",
"conn",
";",
"}"
] | Return a valid jdbc connection.
if jndiName is specified then assume that we need to use a datasource
else use a drivermanager | [
"Return",
"a",
"valid",
"jdbc",
"connection",
".",
"if",
"jndiName",
"is",
"specified",
"then",
"assume",
"that",
"we",
"need",
"to",
"use",
"a",
"datasource",
"else",
"use",
"a",
"drivermanager"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java#L169-L205 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/URLUtils.java | URLUtils.isAbsolutePath | public static boolean isAbsolutePath(String uri) {
boolean absolute = false;
if (uri != null) {
if (uri.indexOf(":/") != -1) {
absolute = true;
} else if (uri.indexOf(":\\") != -1) {
absolute = true;
}
}
return absolute;
} | java | public static boolean isAbsolutePath(String uri) {
boolean absolute = false;
if (uri != null) {
if (uri.indexOf(":/") != -1) {
absolute = true;
} else if (uri.indexOf(":\\") != -1) {
absolute = true;
}
}
return absolute;
} | [
"public",
"static",
"boolean",
"isAbsolutePath",
"(",
"String",
"uri",
")",
"{",
"boolean",
"absolute",
"=",
"false",
";",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"if",
"(",
"uri",
".",
"indexOf",
"(",
"\":/\"",
")",
"!=",
"-",
"1",
")",
"{",
"absolute",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"uri",
".",
"indexOf",
"(",
"\":\\\\\"",
")",
"!=",
"-",
"1",
")",
"{",
"absolute",
"=",
"true",
";",
"}",
"}",
"return",
"absolute",
";",
"}"
] | Checks to see if URI is absolute or relative.
@param uri
@return true it is absolute or false if not | [
"Checks",
"to",
"see",
"if",
"URI",
"is",
"absolute",
"or",
"relative",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/URLUtils.java#L23-L34 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java | IFixUtils.equalsHashes | private static boolean equalsHashes(File fileToHash, String hashToCompare) throws IOException {
boolean result = false;
// Now calculate the new hash and compare the 2. If they are NOT the same the ifix needs to be re-applied.
String fileHash = MD5Utils.getFileMD5String(fileToHash);
if (fileHash.equals(hashToCompare))
result = true;
return result;
} | java | private static boolean equalsHashes(File fileToHash, String hashToCompare) throws IOException {
boolean result = false;
// Now calculate the new hash and compare the 2. If they are NOT the same the ifix needs to be re-applied.
String fileHash = MD5Utils.getFileMD5String(fileToHash);
if (fileHash.equals(hashToCompare))
result = true;
return result;
} | [
"private",
"static",
"boolean",
"equalsHashes",
"(",
"File",
"fileToHash",
",",
"String",
"hashToCompare",
")",
"throws",
"IOException",
"{",
"boolean",
"result",
"=",
"false",
";",
"// Now calculate the new hash and compare the 2. If they are NOT the same the ifix needs to be re-applied.",
"String",
"fileHash",
"=",
"MD5Utils",
".",
"getFileMD5String",
"(",
"fileToHash",
")",
";",
"if",
"(",
"fileHash",
".",
"equals",
"(",
"hashToCompare",
")",
")",
"result",
"=",
"true",
";",
"return",
"result",
";",
"}"
] | This method calculates a hash of the required file and compares it against the supplied hash. It then returns
true if both hashes are equals.
@param fileToHash - The file to calculate the hash for.
@param hashToCompare - The hash to compare.
@return - A boolean indicating whether the hashes are equal. | [
"This",
"method",
"calculates",
"a",
"hash",
"of",
"the",
"required",
"file",
"and",
"compares",
"it",
"against",
"the",
"supplied",
"hash",
".",
"It",
"then",
"returns",
"true",
"if",
"both",
"hashes",
"are",
"equals",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java#L305-L314 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java | IFixUtils.processIFixXmls | private static Map<String, IFixInfo> processIFixXmls(File wlpInstallationDirectory, Map<String, BundleFile> bundleFiles, CommandConsole console) {
// A map of update file names and the IfixInfo objects that contain the latest versions of these files.
Map<String, IFixInfo> filteredIfixInfos = new HashMap<String, IFixInfo>();
// A map of updated file names and the UpdateFile Object that represents the latest version of the file.
// We use this map so that we don't have to find the file in the ifix info object each time.
Map<String, UpdatedFile> latestIfixFiles = new HashMap<String, UpdatedFile>();
// Get the full list of XML files
Set<IFixInfo> ifixInfos = getInstalledIFixes(wlpInstallationDirectory, console);
// Iterate over each one and process each file.
for (IFixInfo chkinfo : ifixInfos) {
// For each ifix, list all of the updated files
for (UpdatedFile updateFile : chkinfo.getUpdates().getFiles()) {
// See if we have an existing entry in the map of existing files. If not, add this one to the map, otherwise
// check to see if this file has a more recent date than the one stored. If it does, then
// replace the existing one with this new entry.
String existingUpdateFileID;
String updateId = updateFile.getId();
// If we have a jar file, then we need to find the existing id which won't be the same as our current one, because the ifix qualifiers are
// different for each ifix jar.
if (bundleFiles.containsKey(updateId)) {
existingUpdateFileID = getExistingMatchingIfixID(bundleFiles.get(updateId), latestIfixFiles.keySet(), bundleFiles);
} else {
// If we're not a jar but a static file, then use the updateID to find the existing values.
existingUpdateFileID = updateId;
}
// If we've got an existing entry and the date of the currently processed updateFile has a greater date,
// then remove the old version and replace it with the new one.
UpdatedFile existingUpdateFile = latestIfixFiles.get(existingUpdateFileID);
if (existingUpdateFile != null) {
int dateComparison = updateFile.getDate().compareTo(existingUpdateFile.getDate());
boolean replaceInMap = false;
if (dateComparison > 0)
replaceInMap = true;
else if (dateComparison == 0) {
//the same file had the same date in two fixes
//check the number of problems being resolved
IFixInfo existingFixInfo = filteredIfixInfos.get(existingUpdateFileID);
List<Problem> existingProblems = existingFixInfo.getResolves().getProblems();
List<Problem> problems = chkinfo.getResolves().getProblems();
//since fixes are cumulative, whichever resolves more problems is newer
if (existingProblems.size() < problems.size())
replaceInMap = true;
}
if (replaceInMap) {
filteredIfixInfos.remove(existingUpdateFileID);
latestIfixFiles.remove(existingUpdateFileID);
filteredIfixInfos.put(updateId, chkinfo);
latestIfixFiles.put(updateId, updateFile);
}
} else {
// If we don't have an existing entry, add this new entry.
filteredIfixInfos.put(updateId, chkinfo);
latestIfixFiles.put(updateId, updateFile);
}
}
}
return filteredIfixInfos;
} | java | private static Map<String, IFixInfo> processIFixXmls(File wlpInstallationDirectory, Map<String, BundleFile> bundleFiles, CommandConsole console) {
// A map of update file names and the IfixInfo objects that contain the latest versions of these files.
Map<String, IFixInfo> filteredIfixInfos = new HashMap<String, IFixInfo>();
// A map of updated file names and the UpdateFile Object that represents the latest version of the file.
// We use this map so that we don't have to find the file in the ifix info object each time.
Map<String, UpdatedFile> latestIfixFiles = new HashMap<String, UpdatedFile>();
// Get the full list of XML files
Set<IFixInfo> ifixInfos = getInstalledIFixes(wlpInstallationDirectory, console);
// Iterate over each one and process each file.
for (IFixInfo chkinfo : ifixInfos) {
// For each ifix, list all of the updated files
for (UpdatedFile updateFile : chkinfo.getUpdates().getFiles()) {
// See if we have an existing entry in the map of existing files. If not, add this one to the map, otherwise
// check to see if this file has a more recent date than the one stored. If it does, then
// replace the existing one with this new entry.
String existingUpdateFileID;
String updateId = updateFile.getId();
// If we have a jar file, then we need to find the existing id which won't be the same as our current one, because the ifix qualifiers are
// different for each ifix jar.
if (bundleFiles.containsKey(updateId)) {
existingUpdateFileID = getExistingMatchingIfixID(bundleFiles.get(updateId), latestIfixFiles.keySet(), bundleFiles);
} else {
// If we're not a jar but a static file, then use the updateID to find the existing values.
existingUpdateFileID = updateId;
}
// If we've got an existing entry and the date of the currently processed updateFile has a greater date,
// then remove the old version and replace it with the new one.
UpdatedFile existingUpdateFile = latestIfixFiles.get(existingUpdateFileID);
if (existingUpdateFile != null) {
int dateComparison = updateFile.getDate().compareTo(existingUpdateFile.getDate());
boolean replaceInMap = false;
if (dateComparison > 0)
replaceInMap = true;
else if (dateComparison == 0) {
//the same file had the same date in two fixes
//check the number of problems being resolved
IFixInfo existingFixInfo = filteredIfixInfos.get(existingUpdateFileID);
List<Problem> existingProblems = existingFixInfo.getResolves().getProblems();
List<Problem> problems = chkinfo.getResolves().getProblems();
//since fixes are cumulative, whichever resolves more problems is newer
if (existingProblems.size() < problems.size())
replaceInMap = true;
}
if (replaceInMap) {
filteredIfixInfos.remove(existingUpdateFileID);
latestIfixFiles.remove(existingUpdateFileID);
filteredIfixInfos.put(updateId, chkinfo);
latestIfixFiles.put(updateId, updateFile);
}
} else {
// If we don't have an existing entry, add this new entry.
filteredIfixInfos.put(updateId, chkinfo);
latestIfixFiles.put(updateId, updateFile);
}
}
}
return filteredIfixInfos;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"IFixInfo",
">",
"processIFixXmls",
"(",
"File",
"wlpInstallationDirectory",
",",
"Map",
"<",
"String",
",",
"BundleFile",
">",
"bundleFiles",
",",
"CommandConsole",
"console",
")",
"{",
"// A map of update file names and the IfixInfo objects that contain the latest versions of these files.",
"Map",
"<",
"String",
",",
"IFixInfo",
">",
"filteredIfixInfos",
"=",
"new",
"HashMap",
"<",
"String",
",",
"IFixInfo",
">",
"(",
")",
";",
"// A map of updated file names and the UpdateFile Object that represents the latest version of the file.",
"// We use this map so that we don't have to find the file in the ifix info object each time.",
"Map",
"<",
"String",
",",
"UpdatedFile",
">",
"latestIfixFiles",
"=",
"new",
"HashMap",
"<",
"String",
",",
"UpdatedFile",
">",
"(",
")",
";",
"// Get the full list of XML files",
"Set",
"<",
"IFixInfo",
">",
"ifixInfos",
"=",
"getInstalledIFixes",
"(",
"wlpInstallationDirectory",
",",
"console",
")",
";",
"// Iterate over each one and process each file.",
"for",
"(",
"IFixInfo",
"chkinfo",
":",
"ifixInfos",
")",
"{",
"// For each ifix, list all of the updated files",
"for",
"(",
"UpdatedFile",
"updateFile",
":",
"chkinfo",
".",
"getUpdates",
"(",
")",
".",
"getFiles",
"(",
")",
")",
"{",
"// See if we have an existing entry in the map of existing files. If not, add this one to the map, otherwise",
"// check to see if this file has a more recent date than the one stored. If it does, then",
"// replace the existing one with this new entry.",
"String",
"existingUpdateFileID",
";",
"String",
"updateId",
"=",
"updateFile",
".",
"getId",
"(",
")",
";",
"// If we have a jar file, then we need to find the existing id which won't be the same as our current one, because the ifix qualifiers are",
"// different for each ifix jar.",
"if",
"(",
"bundleFiles",
".",
"containsKey",
"(",
"updateId",
")",
")",
"{",
"existingUpdateFileID",
"=",
"getExistingMatchingIfixID",
"(",
"bundleFiles",
".",
"get",
"(",
"updateId",
")",
",",
"latestIfixFiles",
".",
"keySet",
"(",
")",
",",
"bundleFiles",
")",
";",
"}",
"else",
"{",
"// If we're not a jar but a static file, then use the updateID to find the existing values.",
"existingUpdateFileID",
"=",
"updateId",
";",
"}",
"// If we've got an existing entry and the date of the currently processed updateFile has a greater date,",
"// then remove the old version and replace it with the new one.",
"UpdatedFile",
"existingUpdateFile",
"=",
"latestIfixFiles",
".",
"get",
"(",
"existingUpdateFileID",
")",
";",
"if",
"(",
"existingUpdateFile",
"!=",
"null",
")",
"{",
"int",
"dateComparison",
"=",
"updateFile",
".",
"getDate",
"(",
")",
".",
"compareTo",
"(",
"existingUpdateFile",
".",
"getDate",
"(",
")",
")",
";",
"boolean",
"replaceInMap",
"=",
"false",
";",
"if",
"(",
"dateComparison",
">",
"0",
")",
"replaceInMap",
"=",
"true",
";",
"else",
"if",
"(",
"dateComparison",
"==",
"0",
")",
"{",
"//the same file had the same date in two fixes",
"//check the number of problems being resolved",
"IFixInfo",
"existingFixInfo",
"=",
"filteredIfixInfos",
".",
"get",
"(",
"existingUpdateFileID",
")",
";",
"List",
"<",
"Problem",
">",
"existingProblems",
"=",
"existingFixInfo",
".",
"getResolves",
"(",
")",
".",
"getProblems",
"(",
")",
";",
"List",
"<",
"Problem",
">",
"problems",
"=",
"chkinfo",
".",
"getResolves",
"(",
")",
".",
"getProblems",
"(",
")",
";",
"//since fixes are cumulative, whichever resolves more problems is newer",
"if",
"(",
"existingProblems",
".",
"size",
"(",
")",
"<",
"problems",
".",
"size",
"(",
")",
")",
"replaceInMap",
"=",
"true",
";",
"}",
"if",
"(",
"replaceInMap",
")",
"{",
"filteredIfixInfos",
".",
"remove",
"(",
"existingUpdateFileID",
")",
";",
"latestIfixFiles",
".",
"remove",
"(",
"existingUpdateFileID",
")",
";",
"filteredIfixInfos",
".",
"put",
"(",
"updateId",
",",
"chkinfo",
")",
";",
"latestIfixFiles",
".",
"put",
"(",
"updateId",
",",
"updateFile",
")",
";",
"}",
"}",
"else",
"{",
"// If we don't have an existing entry, add this new entry.",
"filteredIfixInfos",
".",
"put",
"(",
"updateId",
",",
"chkinfo",
")",
";",
"latestIfixFiles",
".",
"put",
"(",
"updateId",
",",
"updateFile",
")",
";",
"}",
"}",
"}",
"return",
"filteredIfixInfos",
";",
"}"
] | This method processes all of the ifix xml's and stores the latest version of each file found in a map. The
comparisons on each file are based on the date associated with the file. The latest date means the latest update.
@param wlpInstallationDirectory - The Liberty install dir.
@param bundleFiles - A Map of all bundle file Ids and the BundleFiles from all lpmf xmls.
@param console - The CommandConsole to write messages to.
@return - A Map of all files in all ifix xmls, and the IfixInfos that contain the latest versions of the file. | [
"This",
"method",
"processes",
"all",
"of",
"the",
"ifix",
"xml",
"s",
"and",
"stores",
"the",
"latest",
"version",
"of",
"each",
"file",
"found",
"in",
"a",
"map",
".",
"The",
"comparisons",
"on",
"each",
"file",
"are",
"based",
"on",
"the",
"date",
"associated",
"with",
"the",
"file",
".",
"The",
"latest",
"date",
"means",
"the",
"latest",
"update",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java#L414-L474 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java | IFixUtils.getExistingMatchingIfixID | private static String getExistingMatchingIfixID(BundleFile bundleFile, Set<String> existingIDs, Map<String, BundleFile> bundleFiles) {
String existingIfixKey = null;
// Iterate over the known ids.
for (String existingID : existingIDs) {
// If we have a corresponding BundleFile for the existing ID, we need to check it matches the currently processed file.
if (bundleFiles.containsKey(existingID)) {
BundleFile existingBundleFile = bundleFiles.get(existingID);
// If our symbolic name match the supplied BundleFile then move on to the version checking.
if (bundleFile.getSymbolicName().equals(existingBundleFile.getSymbolicName())) {
//Get the versions of both the checking bundle and the existing bundle. Check that the version, excluding the qualifier match
// and if they do, we have a match.
Version existingBundleVersion = new Version(existingBundleFile.getVersion());
Version bundleVersion = new Version(bundleFile.getVersion());
if (bundleVersion.getMajor() == existingBundleVersion.getMajor() &&
bundleVersion.getMinor() == existingBundleVersion.getMinor() &&
bundleVersion.getMicro() == existingBundleVersion.getMicro())
existingIfixKey = existingID;
}
}
}
return existingIfixKey;
} | java | private static String getExistingMatchingIfixID(BundleFile bundleFile, Set<String> existingIDs, Map<String, BundleFile> bundleFiles) {
String existingIfixKey = null;
// Iterate over the known ids.
for (String existingID : existingIDs) {
// If we have a corresponding BundleFile for the existing ID, we need to check it matches the currently processed file.
if (bundleFiles.containsKey(existingID)) {
BundleFile existingBundleFile = bundleFiles.get(existingID);
// If our symbolic name match the supplied BundleFile then move on to the version checking.
if (bundleFile.getSymbolicName().equals(existingBundleFile.getSymbolicName())) {
//Get the versions of both the checking bundle and the existing bundle. Check that the version, excluding the qualifier match
// and if they do, we have a match.
Version existingBundleVersion = new Version(existingBundleFile.getVersion());
Version bundleVersion = new Version(bundleFile.getVersion());
if (bundleVersion.getMajor() == existingBundleVersion.getMajor() &&
bundleVersion.getMinor() == existingBundleVersion.getMinor() &&
bundleVersion.getMicro() == existingBundleVersion.getMicro())
existingIfixKey = existingID;
}
}
}
return existingIfixKey;
} | [
"private",
"static",
"String",
"getExistingMatchingIfixID",
"(",
"BundleFile",
"bundleFile",
",",
"Set",
"<",
"String",
">",
"existingIDs",
",",
"Map",
"<",
"String",
",",
"BundleFile",
">",
"bundleFiles",
")",
"{",
"String",
"existingIfixKey",
"=",
"null",
";",
"// Iterate over the known ids.",
"for",
"(",
"String",
"existingID",
":",
"existingIDs",
")",
"{",
"// If we have a corresponding BundleFile for the existing ID, we need to check it matches the currently processed file.",
"if",
"(",
"bundleFiles",
".",
"containsKey",
"(",
"existingID",
")",
")",
"{",
"BundleFile",
"existingBundleFile",
"=",
"bundleFiles",
".",
"get",
"(",
"existingID",
")",
";",
"// If our symbolic name match the supplied BundleFile then move on to the version checking.",
"if",
"(",
"bundleFile",
".",
"getSymbolicName",
"(",
")",
".",
"equals",
"(",
"existingBundleFile",
".",
"getSymbolicName",
"(",
")",
")",
")",
"{",
"//Get the versions of both the checking bundle and the existing bundle. Check that the version, excluding the qualifier match",
"// and if they do, we have a match.",
"Version",
"existingBundleVersion",
"=",
"new",
"Version",
"(",
"existingBundleFile",
".",
"getVersion",
"(",
")",
")",
";",
"Version",
"bundleVersion",
"=",
"new",
"Version",
"(",
"bundleFile",
".",
"getVersion",
"(",
")",
")",
";",
"if",
"(",
"bundleVersion",
".",
"getMajor",
"(",
")",
"==",
"existingBundleVersion",
".",
"getMajor",
"(",
")",
"&&",
"bundleVersion",
".",
"getMinor",
"(",
")",
"==",
"existingBundleVersion",
".",
"getMinor",
"(",
")",
"&&",
"bundleVersion",
".",
"getMicro",
"(",
")",
"==",
"existingBundleVersion",
".",
"getMicro",
"(",
")",
")",
"existingIfixKey",
"=",
"existingID",
";",
"}",
"}",
"}",
"return",
"existingIfixKey",
";",
"}"
] | This method takes a ifix ID finds any existing IFix IDs that refer to the same base bundle. Because the ifix jars will have
different qualifiers, we need to be able to work out which ids are related.
@param bundleFile - The bundleFile that maps to the current jar file we're processing.
@param existingIDs - A Set of Strings that represent the existing updateIds.
@param bundleFiles - All the known bundleFile objects.
@return - The existing key that maps to the same base bundle. | [
"This",
"method",
"takes",
"a",
"ifix",
"ID",
"finds",
"any",
"existing",
"IFix",
"IDs",
"that",
"refer",
"to",
"the",
"same",
"base",
"bundle",
".",
"Because",
"the",
"ifix",
"jars",
"will",
"have",
"different",
"qualifiers",
"we",
"need",
"to",
"be",
"able",
"to",
"work",
"out",
"which",
"ids",
"are",
"related",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java#L489-L510 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java | IFixUtils.processLPMFXmls | private static Map<String, BundleFile> processLPMFXmls(File wlpInstallationDirectory, CommandConsole console) {
// A map of update file names and the IfixInfo objects that contain the latest versions of these files.
Map<String, BundleFile> bundleFiles = new HashMap<String, BundleFile>();
// Iterate over each Liberty Profile Metadata file and process each bundle.
for (LibertyProfileMetadataFile chklpmf : getInstalledLibertyProfileMetadataFiles(wlpInstallationDirectory, console)) {
// For each metadata file, list all of the bundle files
Bundles bundles = chklpmf.getBundles();
if (bundles != null) {
List<BundleFile> bundleEntries = bundles.getBundleFiles();
if (bundleEntries != null) {
for (BundleFile bundleFile : bundleEntries) {
// See if we have an existing entry in the map of existing files. If not, add this one to the map, otherwise
// check to see if this file has a more recent date than the one stored. If it does, then
// replace the existing one with this new entry.
bundleFiles.put(bundleFile.getId(), bundleFile);
}
}
}
}
return bundleFiles;
} | java | private static Map<String, BundleFile> processLPMFXmls(File wlpInstallationDirectory, CommandConsole console) {
// A map of update file names and the IfixInfo objects that contain the latest versions of these files.
Map<String, BundleFile> bundleFiles = new HashMap<String, BundleFile>();
// Iterate over each Liberty Profile Metadata file and process each bundle.
for (LibertyProfileMetadataFile chklpmf : getInstalledLibertyProfileMetadataFiles(wlpInstallationDirectory, console)) {
// For each metadata file, list all of the bundle files
Bundles bundles = chklpmf.getBundles();
if (bundles != null) {
List<BundleFile> bundleEntries = bundles.getBundleFiles();
if (bundleEntries != null) {
for (BundleFile bundleFile : bundleEntries) {
// See if we have an existing entry in the map of existing files. If not, add this one to the map, otherwise
// check to see if this file has a more recent date than the one stored. If it does, then
// replace the existing one with this new entry.
bundleFiles.put(bundleFile.getId(), bundleFile);
}
}
}
}
return bundleFiles;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"BundleFile",
">",
"processLPMFXmls",
"(",
"File",
"wlpInstallationDirectory",
",",
"CommandConsole",
"console",
")",
"{",
"// A map of update file names and the IfixInfo objects that contain the latest versions of these files.",
"Map",
"<",
"String",
",",
"BundleFile",
">",
"bundleFiles",
"=",
"new",
"HashMap",
"<",
"String",
",",
"BundleFile",
">",
"(",
")",
";",
"// Iterate over each Liberty Profile Metadata file and process each bundle.",
"for",
"(",
"LibertyProfileMetadataFile",
"chklpmf",
":",
"getInstalledLibertyProfileMetadataFiles",
"(",
"wlpInstallationDirectory",
",",
"console",
")",
")",
"{",
"// For each metadata file, list all of the bundle files",
"Bundles",
"bundles",
"=",
"chklpmf",
".",
"getBundles",
"(",
")",
";",
"if",
"(",
"bundles",
"!=",
"null",
")",
"{",
"List",
"<",
"BundleFile",
">",
"bundleEntries",
"=",
"bundles",
".",
"getBundleFiles",
"(",
")",
";",
"if",
"(",
"bundleEntries",
"!=",
"null",
")",
"{",
"for",
"(",
"BundleFile",
"bundleFile",
":",
"bundleEntries",
")",
"{",
"// See if we have an existing entry in the map of existing files. If not, add this one to the map, otherwise",
"// check to see if this file has a more recent date than the one stored. If it does, then",
"// replace the existing one with this new entry.",
"bundleFiles",
".",
"put",
"(",
"bundleFile",
".",
"getId",
"(",
")",
",",
"bundleFile",
")",
";",
"}",
"}",
"}",
"}",
"return",
"bundleFiles",
";",
"}"
] | This method processes all of the Liberty profile Metadata files stores the BundleFile objects containing the BundleSymbolic
name and version of each bundle against the id of the file that matches the corresponding entry in the ifix.xml.
@param wlpInstallationDirectory - The Liberty install dir.
@param console - The CommandConsole to write messages to.
@return - A Map of all bundle file Ids and the BundleFiles from all lpmf xmls. | [
"This",
"method",
"processes",
"all",
"of",
"the",
"Liberty",
"profile",
"Metadata",
"files",
"stores",
"the",
"BundleFile",
"objects",
"containing",
"the",
"BundleSymbolic",
"name",
"and",
"version",
"of",
"each",
"bundle",
"against",
"the",
"id",
"of",
"the",
"file",
"that",
"matches",
"the",
"corresponding",
"entry",
"in",
"the",
"ifix",
".",
"xml",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java#L520-L542 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java | AccessIdUtil.getEntityType | public static String getEntityType(String accessId) {
Matcher m = matcher(accessId);
if (m != null) {
return m.group(1);
}
return null;
} | java | public static String getEntityType(String accessId) {
Matcher m = matcher(accessId);
if (m != null) {
return m.group(1);
}
return null;
} | [
"public",
"static",
"String",
"getEntityType",
"(",
"String",
"accessId",
")",
"{",
"Matcher",
"m",
"=",
"matcher",
"(",
"accessId",
")",
";",
"if",
"(",
"m",
"!=",
"null",
")",
"{",
"return",
"m",
".",
"group",
"(",
"1",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Given an accessId, extract the entity type.
@param accessId
@return The type for the accessId, or {@code null} if the accessId is invalid | [
"Given",
"an",
"accessId",
"extract",
"the",
"entity",
"type",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java#L147-L153 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java | AccessIdUtil.getRealm | public static String getRealm(String accessId) {
Matcher m = matcher(accessId);
if (m != null) {
return m.group(2);
}
return null;
} | java | public static String getRealm(String accessId) {
Matcher m = matcher(accessId);
if (m != null) {
return m.group(2);
}
return null;
} | [
"public",
"static",
"String",
"getRealm",
"(",
"String",
"accessId",
")",
"{",
"Matcher",
"m",
"=",
"matcher",
"(",
"accessId",
")",
";",
"if",
"(",
"m",
"!=",
"null",
")",
"{",
"return",
"m",
".",
"group",
"(",
"2",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Given an accessId, extract the realm.
@param accessId
@return The realm for the accessId, or {@code null} if the accessId is invalid | [
"Given",
"an",
"accessId",
"extract",
"the",
"realm",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java#L161-L167 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java | AccessIdUtil.getUniqueId | public static String getUniqueId(String accessId) {
Matcher m = matcher(accessId);
if (m != null) {
return m.group(3);
}
return null;
} | java | public static String getUniqueId(String accessId) {
Matcher m = matcher(accessId);
if (m != null) {
return m.group(3);
}
return null;
} | [
"public",
"static",
"String",
"getUniqueId",
"(",
"String",
"accessId",
")",
"{",
"Matcher",
"m",
"=",
"matcher",
"(",
"accessId",
")",
";",
"if",
"(",
"m",
"!=",
"null",
")",
"{",
"return",
"m",
".",
"group",
"(",
"3",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Given an accessId, extract the uniqueId.
@param accessId
@return The uniqueId for the accessId, or {@code null} if the accessId is invalid | [
"Given",
"an",
"accessId",
"extract",
"the",
"uniqueId",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java#L175-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java | AccessIdUtil.getUniqueId | public static String getUniqueId(String accessId, String realm) {
if (realm != null) {
Pattern pattern = Pattern.compile("([^:]+):(" + Pattern.quote(realm) + ")/(.*)");
Matcher m = pattern.matcher(accessId);
if (m.matches()) {
if (m.group(3).length() > 0) {
return m.group(3);
}
}
}
// if there is no match, fall back.
return getUniqueId(accessId);
} | java | public static String getUniqueId(String accessId, String realm) {
if (realm != null) {
Pattern pattern = Pattern.compile("([^:]+):(" + Pattern.quote(realm) + ")/(.*)");
Matcher m = pattern.matcher(accessId);
if (m.matches()) {
if (m.group(3).length() > 0) {
return m.group(3);
}
}
}
// if there is no match, fall back.
return getUniqueId(accessId);
} | [
"public",
"static",
"String",
"getUniqueId",
"(",
"String",
"accessId",
",",
"String",
"realm",
")",
"{",
"if",
"(",
"realm",
"!=",
"null",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"([^:]+):(\"",
"+",
"Pattern",
".",
"quote",
"(",
"realm",
")",
"+",
"\")/(.*)\"",
")",
";",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"accessId",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"if",
"(",
"m",
".",
"group",
"(",
"3",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"return",
"m",
".",
"group",
"(",
"3",
")",
";",
"}",
"}",
"}",
"// if there is no match, fall back.",
"return",
"getUniqueId",
"(",
"accessId",
")",
";",
"}"
] | Given an accessId and realm name, extract the uniqueId.
@param accessId
@param realm
@return The uniqueId for the accessId, or {@code null} if the accessId is invalid | [
"Given",
"an",
"accessId",
"and",
"realm",
"name",
"extract",
"the",
"uniqueId",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java#L190-L203 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/EnvConfig13Source.java | EnvConfig13Source.replaceNonAlpha | private String replaceNonAlpha(String name) {
String modifiedName = null;
if (p != null)
modifiedName = p.matcher(name).replaceAll("_");
return modifiedName;
} | java | private String replaceNonAlpha(String name) {
String modifiedName = null;
if (p != null)
modifiedName = p.matcher(name).replaceAll("_");
return modifiedName;
} | [
"private",
"String",
"replaceNonAlpha",
"(",
"String",
"name",
")",
"{",
"String",
"modifiedName",
"=",
"null",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"modifiedName",
"=",
"p",
".",
"matcher",
"(",
"name",
")",
".",
"replaceAll",
"(",
"\"_\"",
")",
";",
"return",
"modifiedName",
";",
"}"
] | Replace non-alphanumeric characters in a string with underscores.
@param name
@return modified name | [
"Replace",
"non",
"-",
"alphanumeric",
"characters",
"in",
"a",
"string",
"with",
"underscores",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/EnvConfig13Source.java#L64-L69 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java | SubscriptionItemStream.setConsumerDispatcher | public void setConsumerDispatcher(ConsumerDispatcher consumerDispatcher)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setConsumerDispatcher", consumerDispatcher);
this.consumerDispatcher = consumerDispatcher;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setConsumerDispatcher");
} | java | public void setConsumerDispatcher(ConsumerDispatcher consumerDispatcher)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setConsumerDispatcher", consumerDispatcher);
this.consumerDispatcher = consumerDispatcher;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setConsumerDispatcher");
} | [
"public",
"void",
"setConsumerDispatcher",
"(",
"ConsumerDispatcher",
"consumerDispatcher",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setConsumerDispatcher\"",
",",
"consumerDispatcher",
")",
";",
"this",
".",
"consumerDispatcher",
"=",
"consumerDispatcher",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setConsumerDispatcher\"",
")",
";",
"}"
] | Set the consumerDispatcher object to which this itemstream belongs
@param the consumerDispatcher object | [
"Set",
"the",
"consumerDispatcher",
"object",
"to",
"which",
"this",
"itemstream",
"belongs"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java#L126-L135 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java | SubscriptionItemStream.xmlWriteOn | @Override
public void xmlWriteOn(FormattedWriter writer) throws IOException
{
if (consumerDispatcher != null)
{
writer.newLine();
writer.taggedValue("consumerDispatcher", consumerDispatcher.toString());
}
} | java | @Override
public void xmlWriteOn(FormattedWriter writer) throws IOException
{
if (consumerDispatcher != null)
{
writer.newLine();
writer.taggedValue("consumerDispatcher", consumerDispatcher.toString());
}
} | [
"@",
"Override",
"public",
"void",
"xmlWriteOn",
"(",
"FormattedWriter",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"consumerDispatcher",
"!=",
"null",
")",
"{",
"writer",
".",
"newLine",
"(",
")",
";",
"writer",
".",
"taggedValue",
"(",
"\"consumerDispatcher\"",
",",
"consumerDispatcher",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | Prints debug information to the XML writer | [
"Prints",
"debug",
"information",
"to",
"the",
"XML",
"writer"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java#L153-L161 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java | SubscriptionItemStream.deleteIfPossible | public void deleteIfPossible(boolean startAsynchThread)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "deleteIfPossible", new Boolean(startAsynchThread));
// Lock exclusively to stop any further messages from being added.
_subscriptionLockManager.lockExclusive();
try
{
if (destinationHandler == null)
{
// Get the transaction manager for the message processor
PubSubMessageItemStream mis = (PubSubMessageItemStream) getItemStream();
destinationHandler = (DestinationHandler) mis.getItemStream();
}
if (toBeDeleted ||
destinationHandler.isToBeDeleted())
{
SIMPTransactionManager txManager = destinationHandler.getTxManager();
boolean complete = false;
try
{
Statistics statistics = null;
try
{
statistics = getStatistics();
} catch (NotInMessageStore e)
{
// No FFDC Code needed
// This exception can be thrown if a Durable subscription was on a destination that
// was deleted and it was a durable subscription which was already marked for deletion
complete = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteIfPossible", "Subscription already deleted");
return;
}
long countOfAvailableItems = statistics.getAvailableItemCount();
/*
* There may be itemreference which is locked for
* delivery delay.Those messages must also be deleted.
* Hence get the locked message count.Its imp to note that
* all the messages will not be deleted only the messages which
* are available or messages which are locked for delivery delay
* will be deleted.That check is done in removeAllAvailableReferences()
* where a DeliveryDelay filter is used.
*/
long countOfLockedMessages = statistics.getLockedItemCount();
if (countOfAvailableItems > 0 || countOfLockedMessages > 0)
{
//Remove any available references from the subscription.
try
{
removeAllAvailableReferences();
} catch (SIResourceException e1)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteIfPossible", e1);
// Exit so finally block run
return;
}
}
statistics = getStatistics();
long countOfTotalItems = statistics.getTotalItemCount();
if (countOfTotalItems == 0)
{
//All references are gone. The subscription can be removed.
if (destinationHandler.isToBeDeleted())
{
//It may now be possible to clean up the destination. Have a go!
destinationHandler.getDestinationManager().markDestinationAsCleanUpPending(destinationHandler);
}
try
{
PubSubMessageItemStream parentItemStream = (PubSubMessageItemStream) getItemStream();
remove(txManager.createAutoCommitTransaction(), NO_LOCK_ID);
parentItemStream.decrementReferenceStreamCount();
complete = true;
} catch (MessageStoreException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.deleteIfPossible",
"1:364:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:371:1.54",
e });
}
}
} catch (Exception e)
{
// No FFDC code needed
// Log that this exception occured
SibTr.exception(tc, e);
} finally
{
if (!complete)
{
destinationHandler.getDestinationManager().addSubscriptionToDelete(this);
if (startAsynchThread)
destinationHandler.getDestinationManager().startAsynchDeletion();
}
}
}
} catch (MessageStoreException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.deleteIfPossible",
"1:400:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:407:1.54",
e });
} finally
{
// Finally unlock the lock manager
_subscriptionLockManager.unlockExclusive();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteIfPossible");
return;
} | java | public void deleteIfPossible(boolean startAsynchThread)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "deleteIfPossible", new Boolean(startAsynchThread));
// Lock exclusively to stop any further messages from being added.
_subscriptionLockManager.lockExclusive();
try
{
if (destinationHandler == null)
{
// Get the transaction manager for the message processor
PubSubMessageItemStream mis = (PubSubMessageItemStream) getItemStream();
destinationHandler = (DestinationHandler) mis.getItemStream();
}
if (toBeDeleted ||
destinationHandler.isToBeDeleted())
{
SIMPTransactionManager txManager = destinationHandler.getTxManager();
boolean complete = false;
try
{
Statistics statistics = null;
try
{
statistics = getStatistics();
} catch (NotInMessageStore e)
{
// No FFDC Code needed
// This exception can be thrown if a Durable subscription was on a destination that
// was deleted and it was a durable subscription which was already marked for deletion
complete = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteIfPossible", "Subscription already deleted");
return;
}
long countOfAvailableItems = statistics.getAvailableItemCount();
/*
* There may be itemreference which is locked for
* delivery delay.Those messages must also be deleted.
* Hence get the locked message count.Its imp to note that
* all the messages will not be deleted only the messages which
* are available or messages which are locked for delivery delay
* will be deleted.That check is done in removeAllAvailableReferences()
* where a DeliveryDelay filter is used.
*/
long countOfLockedMessages = statistics.getLockedItemCount();
if (countOfAvailableItems > 0 || countOfLockedMessages > 0)
{
//Remove any available references from the subscription.
try
{
removeAllAvailableReferences();
} catch (SIResourceException e1)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteIfPossible", e1);
// Exit so finally block run
return;
}
}
statistics = getStatistics();
long countOfTotalItems = statistics.getTotalItemCount();
if (countOfTotalItems == 0)
{
//All references are gone. The subscription can be removed.
if (destinationHandler.isToBeDeleted())
{
//It may now be possible to clean up the destination. Have a go!
destinationHandler.getDestinationManager().markDestinationAsCleanUpPending(destinationHandler);
}
try
{
PubSubMessageItemStream parentItemStream = (PubSubMessageItemStream) getItemStream();
remove(txManager.createAutoCommitTransaction(), NO_LOCK_ID);
parentItemStream.decrementReferenceStreamCount();
complete = true;
} catch (MessageStoreException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.deleteIfPossible",
"1:364:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:371:1.54",
e });
}
}
} catch (Exception e)
{
// No FFDC code needed
// Log that this exception occured
SibTr.exception(tc, e);
} finally
{
if (!complete)
{
destinationHandler.getDestinationManager().addSubscriptionToDelete(this);
if (startAsynchThread)
destinationHandler.getDestinationManager().startAsynchDeletion();
}
}
}
} catch (MessageStoreException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.deleteIfPossible",
"1:400:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:407:1.54",
e });
} finally
{
// Finally unlock the lock manager
_subscriptionLockManager.unlockExclusive();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteIfPossible");
return;
} | [
"public",
"void",
"deleteIfPossible",
"(",
"boolean",
"startAsynchThread",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"deleteIfPossible\"",
",",
"new",
"Boolean",
"(",
"startAsynchThread",
")",
")",
";",
"// Lock exclusively to stop any further messages from being added.",
"_subscriptionLockManager",
".",
"lockExclusive",
"(",
")",
";",
"try",
"{",
"if",
"(",
"destinationHandler",
"==",
"null",
")",
"{",
"// Get the transaction manager for the message processor",
"PubSubMessageItemStream",
"mis",
"=",
"(",
"PubSubMessageItemStream",
")",
"getItemStream",
"(",
")",
";",
"destinationHandler",
"=",
"(",
"DestinationHandler",
")",
"mis",
".",
"getItemStream",
"(",
")",
";",
"}",
"if",
"(",
"toBeDeleted",
"||",
"destinationHandler",
".",
"isToBeDeleted",
"(",
")",
")",
"{",
"SIMPTransactionManager",
"txManager",
"=",
"destinationHandler",
".",
"getTxManager",
"(",
")",
";",
"boolean",
"complete",
"=",
"false",
";",
"try",
"{",
"Statistics",
"statistics",
"=",
"null",
";",
"try",
"{",
"statistics",
"=",
"getStatistics",
"(",
")",
";",
"}",
"catch",
"(",
"NotInMessageStore",
"e",
")",
"{",
"// No FFDC Code needed",
"// This exception can be thrown if a Durable subscription was on a destination that ",
"// was deleted and it was a durable subscription which was already marked for deletion",
"complete",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"deleteIfPossible\"",
",",
"\"Subscription already deleted\"",
")",
";",
"return",
";",
"}",
"long",
"countOfAvailableItems",
"=",
"statistics",
".",
"getAvailableItemCount",
"(",
")",
";",
"/*\n * There may be itemreference which is locked for\n * delivery delay.Those messages must also be deleted.\n * Hence get the locked message count.Its imp to note that\n * all the messages will not be deleted only the messages which\n * are available or messages which are locked for delivery delay\n * will be deleted.That check is done in removeAllAvailableReferences()\n * where a DeliveryDelay filter is used.\n */",
"long",
"countOfLockedMessages",
"=",
"statistics",
".",
"getLockedItemCount",
"(",
")",
";",
"if",
"(",
"countOfAvailableItems",
">",
"0",
"||",
"countOfLockedMessages",
">",
"0",
")",
"{",
"//Remove any available references from the subscription.",
"try",
"{",
"removeAllAvailableReferences",
"(",
")",
";",
"}",
"catch",
"(",
"SIResourceException",
"e1",
")",
"{",
"// No FFDC code needed",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"deleteIfPossible\"",
",",
"e1",
")",
";",
"// Exit so finally block run",
"return",
";",
"}",
"}",
"statistics",
"=",
"getStatistics",
"(",
")",
";",
"long",
"countOfTotalItems",
"=",
"statistics",
".",
"getTotalItemCount",
"(",
")",
";",
"if",
"(",
"countOfTotalItems",
"==",
"0",
")",
"{",
"//All references are gone. The subscription can be removed.",
"if",
"(",
"destinationHandler",
".",
"isToBeDeleted",
"(",
")",
")",
"{",
"//It may now be possible to clean up the destination. Have a go!",
"destinationHandler",
".",
"getDestinationManager",
"(",
")",
".",
"markDestinationAsCleanUpPending",
"(",
"destinationHandler",
")",
";",
"}",
"try",
"{",
"PubSubMessageItemStream",
"parentItemStream",
"=",
"(",
"PubSubMessageItemStream",
")",
"getItemStream",
"(",
")",
";",
"remove",
"(",
"txManager",
".",
"createAutoCommitTransaction",
"(",
")",
",",
"NO_LOCK_ID",
")",
";",
"parentItemStream",
".",
"decrementReferenceStreamCount",
"(",
")",
";",
"complete",
"=",
"true",
";",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.deleteIfPossible\"",
",",
"\"1:364:1.54\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream\"",
",",
"\"1:371:1.54\"",
",",
"e",
"}",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed",
"// Log that this exception occured",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"!",
"complete",
")",
"{",
"destinationHandler",
".",
"getDestinationManager",
"(",
")",
".",
"addSubscriptionToDelete",
"(",
"this",
")",
";",
"if",
"(",
"startAsynchThread",
")",
"destinationHandler",
".",
"getDestinationManager",
"(",
")",
".",
"startAsynchDeletion",
"(",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.deleteIfPossible\"",
",",
"\"1:400:1.54\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream\"",
",",
"\"1:407:1.54\"",
",",
"e",
"}",
")",
";",
"}",
"finally",
"{",
"// Finally unlock the lock manager",
"_subscriptionLockManager",
".",
"unlockExclusive",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"deleteIfPossible\"",
")",
";",
"return",
";",
"}"
] | Method deleteIfPossible.
<p>Test whether the item stream is marked as awaiting deletion
and if so, check if there are still items on the itemstream that
will block its removal.</p>
Any failures to delete the subscription will queue the request to the
Asynch deletion thread. | [
"Method",
"deleteIfPossible",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java#L255-L400 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java | SubscriptionItemStream.markAsToBeDeleted | public void markAsToBeDeleted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "markAsToBeDeleted");
toBeDeleted = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "markAsToBeDeleted");
} | java | public void markAsToBeDeleted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "markAsToBeDeleted");
toBeDeleted = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "markAsToBeDeleted");
} | [
"public",
"void",
"markAsToBeDeleted",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"markAsToBeDeleted\"",
")",
";",
"toBeDeleted",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"markAsToBeDeleted\"",
")",
";",
"}"
] | Mark this itemstream as awaiting deletion | [
"Mark",
"this",
"itemstream",
"as",
"awaiting",
"deletion"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java#L421-L430 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java | SubscriptionItemStream.removeAllAvailableReferences | public void removeAllAvailableReferences() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeAllAvailableReferences");
LocalTransaction transaction = null;
ItemReference itemReference = null;
try
{
// Get the transaction manager for the message processor
PubSubMessageItemStream mis = (PubSubMessageItemStream) getItemStream();
DestinationHandler dh = (DestinationHandler) mis.getItemStream();
SIMPTransactionManager txManager = dh.getTxManager();
removingAvailableReferences = true;
if (txManager != null)
{
/* Create new transaction */
transaction = txManager.createLocalTransaction(true);
int countOfItems = 0;
//Remove all the references in batches to avoid large UOWs in the msgstore
do
{
do
{
/*
* Introduce a new DeliveryDelayDeleteFilter which basically retrieves
* the messages which are either available or which are locked
* for delivery delay It is just a marker class.Earlier to
* delivery delay feature null was being passed
*/
itemReference = this.removeFirstMatching(new DeliveryDelayDeleteFilter(), (Transaction) transaction);
if (itemReference != null)
countOfItems++;
} while ((itemReference != null) && (countOfItems < BATCH_DELETE_SIZE));
//Commit the batch
if (countOfItems > 0)
{
transaction.commit();
/* Create new transaction */
if (itemReference != null)
{
transaction = txManager.createLocalTransaction(true);
}
countOfItems = 0;
}
} while (itemReference != null);
}
} catch (MessageStoreException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.removeAllAvailableReferences",
"1:509:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:516:1.54",
e });
if (transaction != null)
handleRollback(transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAllAvailableReferences");
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:530:1.54",
e },
null),
e);
} catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.removeAllAvailableReferences",
"1:540:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:547:1.54",
e });
if (transaction != null)
handleRollback(transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAllAvailableReferences");
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:561:1.54",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAllAvailableReferences");
} | java | public void removeAllAvailableReferences() throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeAllAvailableReferences");
LocalTransaction transaction = null;
ItemReference itemReference = null;
try
{
// Get the transaction manager for the message processor
PubSubMessageItemStream mis = (PubSubMessageItemStream) getItemStream();
DestinationHandler dh = (DestinationHandler) mis.getItemStream();
SIMPTransactionManager txManager = dh.getTxManager();
removingAvailableReferences = true;
if (txManager != null)
{
/* Create new transaction */
transaction = txManager.createLocalTransaction(true);
int countOfItems = 0;
//Remove all the references in batches to avoid large UOWs in the msgstore
do
{
do
{
/*
* Introduce a new DeliveryDelayDeleteFilter which basically retrieves
* the messages which are either available or which are locked
* for delivery delay It is just a marker class.Earlier to
* delivery delay feature null was being passed
*/
itemReference = this.removeFirstMatching(new DeliveryDelayDeleteFilter(), (Transaction) transaction);
if (itemReference != null)
countOfItems++;
} while ((itemReference != null) && (countOfItems < BATCH_DELETE_SIZE));
//Commit the batch
if (countOfItems > 0)
{
transaction.commit();
/* Create new transaction */
if (itemReference != null)
{
transaction = txManager.createLocalTransaction(true);
}
countOfItems = 0;
}
} while (itemReference != null);
}
} catch (MessageStoreException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.removeAllAvailableReferences",
"1:509:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:516:1.54",
e });
if (transaction != null)
handleRollback(transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAllAvailableReferences");
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:530:1.54",
e },
null),
e);
} catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.removeAllAvailableReferences",
"1:540:1.54",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:547:1.54",
e });
if (transaction != null)
handleRollback(transaction);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAllAvailableReferences");
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream",
"1:561:1.54",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeAllAvailableReferences");
} | [
"public",
"void",
"removeAllAvailableReferences",
"(",
")",
"throws",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"removeAllAvailableReferences\"",
")",
";",
"LocalTransaction",
"transaction",
"=",
"null",
";",
"ItemReference",
"itemReference",
"=",
"null",
";",
"try",
"{",
"// Get the transaction manager for the message processor",
"PubSubMessageItemStream",
"mis",
"=",
"(",
"PubSubMessageItemStream",
")",
"getItemStream",
"(",
")",
";",
"DestinationHandler",
"dh",
"=",
"(",
"DestinationHandler",
")",
"mis",
".",
"getItemStream",
"(",
")",
";",
"SIMPTransactionManager",
"txManager",
"=",
"dh",
".",
"getTxManager",
"(",
")",
";",
"removingAvailableReferences",
"=",
"true",
";",
"if",
"(",
"txManager",
"!=",
"null",
")",
"{",
"/* Create new transaction */",
"transaction",
"=",
"txManager",
".",
"createLocalTransaction",
"(",
"true",
")",
";",
"int",
"countOfItems",
"=",
"0",
";",
"//Remove all the references in batches to avoid large UOWs in the msgstore",
"do",
"{",
"do",
"{",
"/*\n * Introduce a new DeliveryDelayDeleteFilter which basically retrieves\n * the messages which are either available or which are locked\n * for delivery delay It is just a marker class.Earlier to\n * delivery delay feature null was being passed\n */",
"itemReference",
"=",
"this",
".",
"removeFirstMatching",
"(",
"new",
"DeliveryDelayDeleteFilter",
"(",
")",
",",
"(",
"Transaction",
")",
"transaction",
")",
";",
"if",
"(",
"itemReference",
"!=",
"null",
")",
"countOfItems",
"++",
";",
"}",
"while",
"(",
"(",
"itemReference",
"!=",
"null",
")",
"&&",
"(",
"countOfItems",
"<",
"BATCH_DELETE_SIZE",
")",
")",
";",
"//Commit the batch",
"if",
"(",
"countOfItems",
">",
"0",
")",
"{",
"transaction",
".",
"commit",
"(",
")",
";",
"/* Create new transaction */",
"if",
"(",
"itemReference",
"!=",
"null",
")",
"{",
"transaction",
"=",
"txManager",
".",
"createLocalTransaction",
"(",
"true",
")",
";",
"}",
"countOfItems",
"=",
"0",
";",
"}",
"}",
"while",
"(",
"itemReference",
"!=",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"MessageStoreException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.removeAllAvailableReferences\"",
",",
"\"1:509:1.54\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream\"",
",",
"\"1:516:1.54\"",
",",
"e",
"}",
")",
";",
"if",
"(",
"transaction",
"!=",
"null",
")",
"handleRollback",
"(",
"transaction",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeAllAvailableReferences\"",
")",
";",
"throw",
"new",
"SIResourceException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream\"",
",",
"\"1:530:1.54\"",
",",
"e",
"}",
",",
"null",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream.removeAllAvailableReferences\"",
",",
"\"1:540:1.54\"",
",",
"this",
")",
";",
"SibTr",
".",
"exception",
"(",
"tc",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream\"",
",",
"\"1:547:1.54\"",
",",
"e",
"}",
")",
";",
"if",
"(",
"transaction",
"!=",
"null",
")",
"handleRollback",
"(",
"transaction",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeAllAvailableReferences\"",
")",
";",
"throw",
"new",
"SIResourceException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.store.itemstreams.SubscriptionItemStream\"",
",",
"\"1:561:1.54\"",
",",
"e",
"}",
",",
"null",
")",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"removeAllAvailableReferences\"",
")",
";",
"}"
] | Removes all available reference items from the reference stream in batches
@throws MessageStoreException | [
"Removes",
"all",
"available",
"reference",
"items",
"from",
"the",
"reference",
"stream",
"in",
"batches"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java#L438-L557 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java | SubscriptionItemStream.getSubscriptionLockManager | public LockManager getSubscriptionLockManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getSubscriptionLockManager");
SibTr.exit(tc, "getSubscriptionLockManager", _subscriptionLockManager);
}
return _subscriptionLockManager;
} | java | public LockManager getSubscriptionLockManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getSubscriptionLockManager");
SibTr.exit(tc, "getSubscriptionLockManager", _subscriptionLockManager);
}
return _subscriptionLockManager;
} | [
"public",
"LockManager",
"getSubscriptionLockManager",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getSubscriptionLockManager\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getSubscriptionLockManager\"",
",",
"_subscriptionLockManager",
")",
";",
"}",
"return",
"_subscriptionLockManager",
";",
"}"
] | Returns the lock manager associated with this subscription | [
"Returns",
"the",
"lock",
"manager",
"associated",
"with",
"this",
"subscription"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/store/itemstreams/SubscriptionItemStream.java#L626-L634 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/serializable/TaskSkipped.java | TaskSkipped.readObject | @Trivial
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
GetField fields = in.readFields();
failure = (Throwable) fields.get(FAILURE, null);
previousResult = (byte[]) fields.get(PREVIOUS_RESULT, null);
} | java | @Trivial
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
GetField fields = in.readFields();
failure = (Throwable) fields.get(FAILURE, null);
previousResult = (byte[]) fields.get(PREVIOUS_RESULT, null);
} | [
"@",
"Trivial",
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"GetField",
"fields",
"=",
"in",
".",
"readFields",
"(",
")",
";",
"failure",
"=",
"(",
"Throwable",
")",
"fields",
".",
"get",
"(",
"FAILURE",
",",
"null",
")",
";",
"previousResult",
"=",
"(",
"byte",
"[",
"]",
")",
"fields",
".",
"get",
"(",
"PREVIOUS_RESULT",
",",
"null",
")",
";",
"}"
] | Deserialize information about the skipped execution.
@param in The stream from which this object is read.
@throws IOException
@throws ClassNotFoundException | [
"Deserialize",
"information",
"about",
"the",
"skipped",
"execution",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/serializable/TaskSkipped.java#L122-L127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/serializable/TaskSkipped.java | TaskSkipped.writeObject | @Trivial
private void writeObject(ObjectOutputStream out) throws IOException {
PutField fields = out.putFields();
fields.put(FAILURE, failure);
fields.put(PREVIOUS_RESULT, previousResult);
out.writeFields();
} | java | @Trivial
private void writeObject(ObjectOutputStream out) throws IOException {
PutField fields = out.putFields();
fields.put(FAILURE, failure);
fields.put(PREVIOUS_RESULT, previousResult);
out.writeFields();
} | [
"@",
"Trivial",
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"PutField",
"fields",
"=",
"out",
".",
"putFields",
"(",
")",
";",
"fields",
".",
"put",
"(",
"FAILURE",
",",
"failure",
")",
";",
"fields",
".",
"put",
"(",
"PREVIOUS_RESULT",
",",
"previousResult",
")",
";",
"out",
".",
"writeFields",
"(",
")",
";",
"}"
] | Serialize information about the skipped execution.
@param out The stream to which this object is serialized.
@throws IOException | [
"Serialize",
"information",
"about",
"the",
"skipped",
"execution",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/serializable/TaskSkipped.java#L135-L141 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ws/staticvalue/StaticValue.java | StaticValue.mutateStaticValue | public static <T> StaticValue<T> mutateStaticValue(StaticValue<T> staticValue, Callable<T> initializer) {
if (multiplex) {
// Multiplexing case; must check for existing StaticValue
if (staticValue == null) {
// no existing value; create new one with no constructor initializer
staticValue = StaticValue.createStaticValue(null);
}
// initialize this thread only with the initializer
staticValue.initialize(getThreadGroup(), initializer);
return staticValue;
}
// Final singleton case; just create a new StaticValue
return StaticValue.createStaticValue(initializer);
} | java | public static <T> StaticValue<T> mutateStaticValue(StaticValue<T> staticValue, Callable<T> initializer) {
if (multiplex) {
// Multiplexing case; must check for existing StaticValue
if (staticValue == null) {
// no existing value; create new one with no constructor initializer
staticValue = StaticValue.createStaticValue(null);
}
// initialize this thread only with the initializer
staticValue.initialize(getThreadGroup(), initializer);
return staticValue;
}
// Final singleton case; just create a new StaticValue
return StaticValue.createStaticValue(initializer);
} | [
"public",
"static",
"<",
"T",
">",
"StaticValue",
"<",
"T",
">",
"mutateStaticValue",
"(",
"StaticValue",
"<",
"T",
">",
"staticValue",
",",
"Callable",
"<",
"T",
">",
"initializer",
")",
"{",
"if",
"(",
"multiplex",
")",
"{",
"// Multiplexing case; must check for existing StaticValue",
"if",
"(",
"staticValue",
"==",
"null",
")",
"{",
"// no existing value; create new one with no constructor initializer",
"staticValue",
"=",
"StaticValue",
".",
"createStaticValue",
"(",
"null",
")",
";",
"}",
"// initialize this thread only with the initializer",
"staticValue",
".",
"initialize",
"(",
"getThreadGroup",
"(",
")",
",",
"initializer",
")",
";",
"return",
"staticValue",
";",
"}",
"// Final singleton case; just create a new StaticValue",
"return",
"StaticValue",
".",
"createStaticValue",
"(",
"initializer",
")",
";",
"}"
] | Mutates a static value. Note that if not multiplexing then this method returns a
new StaticValue object with the value as obtained by the initializer.
@param staticValue the mutated static value using the specified initializer
@param initializer the initializer to use to get the new value for the static value
@return the static value. This may be a new static value or the one passed in depending on
if the static value can be mutated. | [
"Mutates",
"a",
"static",
"value",
".",
"Note",
"that",
"if",
"not",
"multiplexing",
"then",
"this",
"method",
"returns",
"a",
"new",
"StaticValue",
"object",
"with",
"the",
"value",
"as",
"obtained",
"by",
"the",
"initializer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/staticvalue/StaticValue.java#L76-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ArrayUtils.java | ArrayUtils.concat | public static Object concat(Object[] arrs)
{
int totalLen = 0;
Class commonComponentType = null;
for (int i = 0, len = arrs.length; i < len; i++)
{
// skip all null arrays
if (arrs[i] == null)
{
continue;
}
int arrayLen = Array.getLength(arrs[i]);
// skip all empty arrays
if (arrayLen == 0)
{
continue;
}
totalLen += arrayLen;
Class componentType = arrs[i].getClass().getComponentType();
commonComponentType =
(commonComponentType == null) ? componentType
: commonClass(commonComponentType, componentType);
}
if (commonComponentType == null)
{
return null;
}
return concat(Array.newInstance(commonComponentType, totalLen), totalLen, arrs);
} | java | public static Object concat(Object[] arrs)
{
int totalLen = 0;
Class commonComponentType = null;
for (int i = 0, len = arrs.length; i < len; i++)
{
// skip all null arrays
if (arrs[i] == null)
{
continue;
}
int arrayLen = Array.getLength(arrs[i]);
// skip all empty arrays
if (arrayLen == 0)
{
continue;
}
totalLen += arrayLen;
Class componentType = arrs[i].getClass().getComponentType();
commonComponentType =
(commonComponentType == null) ? componentType
: commonClass(commonComponentType, componentType);
}
if (commonComponentType == null)
{
return null;
}
return concat(Array.newInstance(commonComponentType, totalLen), totalLen, arrs);
} | [
"public",
"static",
"Object",
"concat",
"(",
"Object",
"[",
"]",
"arrs",
")",
"{",
"int",
"totalLen",
"=",
"0",
";",
"Class",
"commonComponentType",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"len",
"=",
"arrs",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"// skip all null arrays",
"if",
"(",
"arrs",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"int",
"arrayLen",
"=",
"Array",
".",
"getLength",
"(",
"arrs",
"[",
"i",
"]",
")",
";",
"// skip all empty arrays",
"if",
"(",
"arrayLen",
"==",
"0",
")",
"{",
"continue",
";",
"}",
"totalLen",
"+=",
"arrayLen",
";",
"Class",
"componentType",
"=",
"arrs",
"[",
"i",
"]",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
";",
"commonComponentType",
"=",
"(",
"commonComponentType",
"==",
"null",
")",
"?",
"componentType",
":",
"commonClass",
"(",
"commonComponentType",
",",
"componentType",
")",
";",
"}",
"if",
"(",
"commonComponentType",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"concat",
"(",
"Array",
".",
"newInstance",
"(",
"commonComponentType",
",",
"totalLen",
")",
",",
"totalLen",
",",
"arrs",
")",
";",
"}"
] | Concatenates arrays into one. Any null or empty arrays are ignored.
If all arrays are null or empty, returns null.
Elements will be ordered in the order in which the arrays are supplied.
@param arrs array of arrays
@return the concatenated array | [
"Concatenates",
"arrays",
"into",
"one",
".",
"Any",
"null",
"or",
"empty",
"arrays",
"are",
"ignored",
".",
"If",
"all",
"arrays",
"are",
"null",
"or",
"empty",
"returns",
"null",
".",
"Elements",
"will",
"be",
"ordered",
"in",
"the",
"order",
"in",
"which",
"the",
"arrays",
"are",
"supplied",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ArrayUtils.java#L114-L148 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/util/WIMSortCompare.java | WIMSortCompare.compare | @Override
public int compare(T entity1, T entity2) {
SortHandler shandler = new SortHandler(sortControl);
return shandler.compareEntitysWithRespectToProperties((Entity) entity1, (Entity) entity2);
} | java | @Override
public int compare(T entity1, T entity2) {
SortHandler shandler = new SortHandler(sortControl);
return shandler.compareEntitysWithRespectToProperties((Entity) entity1, (Entity) entity2);
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"T",
"entity1",
",",
"T",
"entity2",
")",
"{",
"SortHandler",
"shandler",
"=",
"new",
"SortHandler",
"(",
"sortControl",
")",
";",
"return",
"shandler",
".",
"compareEntitysWithRespectToProperties",
"(",
"(",
"Entity",
")",
"entity1",
",",
"(",
"Entity",
")",
"entity2",
")",
";",
"}"
] | Compares its two objects for order. Returns a negative integer, zero, or
a positive integer as the first argument is less than, equal to, or greater than the second.
@param obj1 the first object
@param obj2 the second object
@return a negative integer, zero, or a positive integer as the first argument is less than,
equal to, or greater than the second. | [
"Compares",
"its",
"two",
"objects",
"for",
"order",
".",
"Returns",
"a",
"negative",
"integer",
"zero",
"or",
"a",
"positive",
"integer",
"as",
"the",
"first",
"argument",
"is",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"the",
"second",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/util/WIMSortCompare.java#L43-L48 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/LockManager.java | LockManager.dump | public void dump() {
if (!tc.isDumpEnabled()) {
return;
}
Enumeration vEnum = lockTable.keys();
Tr.dump(tc, "-- Lock Manager Dump --");
while (vEnum.hasMoreElements()) {
Object key = vEnum.nextElement();
Tr.dump(tc, "lock table entry",
new Object[] { key, lockTable.get(key) });
}
} | java | public void dump() {
if (!tc.isDumpEnabled()) {
return;
}
Enumeration vEnum = lockTable.keys();
Tr.dump(tc, "-- Lock Manager Dump --");
while (vEnum.hasMoreElements()) {
Object key = vEnum.nextElement();
Tr.dump(tc, "lock table entry",
new Object[] { key, lockTable.get(key) });
}
} | [
"public",
"void",
"dump",
"(",
")",
"{",
"if",
"(",
"!",
"tc",
".",
"isDumpEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"Enumeration",
"vEnum",
"=",
"lockTable",
".",
"keys",
"(",
")",
";",
"Tr",
".",
"dump",
"(",
"tc",
",",
"\"-- Lock Manager Dump --\"",
")",
";",
"while",
"(",
"vEnum",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Object",
"key",
"=",
"vEnum",
".",
"nextElement",
"(",
")",
";",
"Tr",
".",
"dump",
"(",
"tc",
",",
"\"lock table entry\"",
",",
"new",
"Object",
"[",
"]",
"{",
"key",
",",
"lockTable",
".",
"get",
"(",
"key",
")",
"}",
")",
";",
"}",
"}"
] | Dump internal state of lock manager. | [
"Dump",
"internal",
"state",
"of",
"lock",
"manager",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/LockManager.java#L451-L466 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/buildtasks/AbstractInstrumentationTask.java | AbstractInstrumentationTask.getCommandline | protected Commandline getCommandline() {
Commandline cmdl = new Commandline();
if (configFile != null) {
cmdl.createArgument().setValue("--config");
cmdl.createArgument().setFile(configFile);
}
if (debug) {
cmdl.createArgument().setValue("--debug");
}
return cmdl;
} | java | protected Commandline getCommandline() {
Commandline cmdl = new Commandline();
if (configFile != null) {
cmdl.createArgument().setValue("--config");
cmdl.createArgument().setFile(configFile);
}
if (debug) {
cmdl.createArgument().setValue("--debug");
}
return cmdl;
} | [
"protected",
"Commandline",
"getCommandline",
"(",
")",
"{",
"Commandline",
"cmdl",
"=",
"new",
"Commandline",
"(",
")",
";",
"if",
"(",
"configFile",
"!=",
"null",
")",
"{",
"cmdl",
".",
"createArgument",
"(",
")",
".",
"setValue",
"(",
"\"--config\"",
")",
";",
"cmdl",
".",
"createArgument",
"(",
")",
".",
"setFile",
"(",
"configFile",
")",
";",
"}",
"if",
"(",
"debug",
")",
"{",
"cmdl",
".",
"createArgument",
"(",
")",
".",
"setValue",
"(",
"\"--debug\"",
")",
";",
"}",
"return",
"cmdl",
";",
"}"
] | Get the command line configuration arguments for the
StaticTraceInstrumentation invocations.
@return the ant Commandline that holds the command line arguments | [
"Get",
"the",
"command",
"line",
"configuration",
"arguments",
"for",
"the",
"StaticTraceInstrumentation",
"invocations",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/buildtasks/AbstractInstrumentationTask.java#L98-L108 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/buildtasks/AbstractInstrumentationTask.java | AbstractInstrumentationTask.execute | @Override
public void execute() {
List<File> flist = new ArrayList<File>();
if (file != null) {
flist.add(file);
}
for (int i = 0; i < filesets.size(); i++) {
FileSet fs = filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File dir = fs.getDir(getProject());
String[] includedFiles = ds.getIncludedFiles();
for (String s : Arrays.asList(includedFiles)) {
flist.add(new File(dir, s));
}
}
Commandline cmdl = getCommandline();
for (File f : flist) {
cmdl.createArgument().setFile(f);
}
AbstractInstrumentation inst;
try {
inst = createInstrumentation();
if (cmdl.size() == 0) {
return;
}
inst.processArguments(cmdl.getArguments());
inst.processPackageInfo();
} catch (Exception t) {
getProject().log(this, "Invalid class files or jars specified " + t, Project.MSG_ERR);
if (failOnError) {
getProject().log("Instrumentation Failed", t, Project.MSG_ERR);
throw new BuildException("InstrumentationFailed", t);
} else {
return;
}
}
List<File> classFiles = inst.getClassFiles();
List<File> jarFiles = inst.getJarFiles();
// I don't remember why I did this
// inst.setClassFiles(null);
// inst.setJarFiles(null);
boolean instrumentationErrors = false;
for (File f : classFiles) {
try {
log("Instrumenting class " + f, verbosity);
inst.instrumentClassFile(f);
} catch (Throwable t) {
boolean instrumentationError = t instanceof InstrumentationException;
if (failOnError && !instrumentationError) {
throw new BuildException("Instrumentation of class " + f + " failed", t);
} else {
String reason = "";
if (instrumentationError) {
reason = ": " + t.getMessage();
instrumentationErrors = true;
}
getProject().log(this, "Unable to instrument class " + f + reason, Project.MSG_WARN);
}
}
}
for (File f : jarFiles) {
try {
log("Instrumenting archive file " + f, verbosity);
inst.instrumentZipFile(f);
} catch (Throwable t) {
if (failOnError) {
throw new BuildException("InstrumentationFailed", t);
} else {
getProject().log(this, "Unable to instrument archive " + f, Project.MSG_WARN);
}
}
}
if (instrumentationErrors) {
throw new BuildException("Instrumentation of classes failed");
}
} | java | @Override
public void execute() {
List<File> flist = new ArrayList<File>();
if (file != null) {
flist.add(file);
}
for (int i = 0; i < filesets.size(); i++) {
FileSet fs = filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File dir = fs.getDir(getProject());
String[] includedFiles = ds.getIncludedFiles();
for (String s : Arrays.asList(includedFiles)) {
flist.add(new File(dir, s));
}
}
Commandline cmdl = getCommandline();
for (File f : flist) {
cmdl.createArgument().setFile(f);
}
AbstractInstrumentation inst;
try {
inst = createInstrumentation();
if (cmdl.size() == 0) {
return;
}
inst.processArguments(cmdl.getArguments());
inst.processPackageInfo();
} catch (Exception t) {
getProject().log(this, "Invalid class files or jars specified " + t, Project.MSG_ERR);
if (failOnError) {
getProject().log("Instrumentation Failed", t, Project.MSG_ERR);
throw new BuildException("InstrumentationFailed", t);
} else {
return;
}
}
List<File> classFiles = inst.getClassFiles();
List<File> jarFiles = inst.getJarFiles();
// I don't remember why I did this
// inst.setClassFiles(null);
// inst.setJarFiles(null);
boolean instrumentationErrors = false;
for (File f : classFiles) {
try {
log("Instrumenting class " + f, verbosity);
inst.instrumentClassFile(f);
} catch (Throwable t) {
boolean instrumentationError = t instanceof InstrumentationException;
if (failOnError && !instrumentationError) {
throw new BuildException("Instrumentation of class " + f + " failed", t);
} else {
String reason = "";
if (instrumentationError) {
reason = ": " + t.getMessage();
instrumentationErrors = true;
}
getProject().log(this, "Unable to instrument class " + f + reason, Project.MSG_WARN);
}
}
}
for (File f : jarFiles) {
try {
log("Instrumenting archive file " + f, verbosity);
inst.instrumentZipFile(f);
} catch (Throwable t) {
if (failOnError) {
throw new BuildException("InstrumentationFailed", t);
} else {
getProject().log(this, "Unable to instrument archive " + f, Project.MSG_WARN);
}
}
}
if (instrumentationErrors) {
throw new BuildException("Instrumentation of classes failed");
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"List",
"<",
"File",
">",
"flist",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"flist",
".",
"add",
"(",
"file",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"filesets",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"FileSet",
"fs",
"=",
"filesets",
".",
"elementAt",
"(",
"i",
")",
";",
"DirectoryScanner",
"ds",
"=",
"fs",
".",
"getDirectoryScanner",
"(",
"getProject",
"(",
")",
")",
";",
"File",
"dir",
"=",
"fs",
".",
"getDir",
"(",
"getProject",
"(",
")",
")",
";",
"String",
"[",
"]",
"includedFiles",
"=",
"ds",
".",
"getIncludedFiles",
"(",
")",
";",
"for",
"(",
"String",
"s",
":",
"Arrays",
".",
"asList",
"(",
"includedFiles",
")",
")",
"{",
"flist",
".",
"add",
"(",
"new",
"File",
"(",
"dir",
",",
"s",
")",
")",
";",
"}",
"}",
"Commandline",
"cmdl",
"=",
"getCommandline",
"(",
")",
";",
"for",
"(",
"File",
"f",
":",
"flist",
")",
"{",
"cmdl",
".",
"createArgument",
"(",
")",
".",
"setFile",
"(",
"f",
")",
";",
"}",
"AbstractInstrumentation",
"inst",
";",
"try",
"{",
"inst",
"=",
"createInstrumentation",
"(",
")",
";",
"if",
"(",
"cmdl",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"inst",
".",
"processArguments",
"(",
"cmdl",
".",
"getArguments",
"(",
")",
")",
";",
"inst",
".",
"processPackageInfo",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"t",
")",
"{",
"getProject",
"(",
")",
".",
"log",
"(",
"this",
",",
"\"Invalid class files or jars specified \"",
"+",
"t",
",",
"Project",
".",
"MSG_ERR",
")",
";",
"if",
"(",
"failOnError",
")",
"{",
"getProject",
"(",
")",
".",
"log",
"(",
"\"Instrumentation Failed\"",
",",
"t",
",",
"Project",
".",
"MSG_ERR",
")",
";",
"throw",
"new",
"BuildException",
"(",
"\"InstrumentationFailed\"",
",",
"t",
")",
";",
"}",
"else",
"{",
"return",
";",
"}",
"}",
"List",
"<",
"File",
">",
"classFiles",
"=",
"inst",
".",
"getClassFiles",
"(",
")",
";",
"List",
"<",
"File",
">",
"jarFiles",
"=",
"inst",
".",
"getJarFiles",
"(",
")",
";",
"// I don't remember why I did this",
"// inst.setClassFiles(null);",
"// inst.setJarFiles(null);",
"boolean",
"instrumentationErrors",
"=",
"false",
";",
"for",
"(",
"File",
"f",
":",
"classFiles",
")",
"{",
"try",
"{",
"log",
"(",
"\"Instrumenting class \"",
"+",
"f",
",",
"verbosity",
")",
";",
"inst",
".",
"instrumentClassFile",
"(",
"f",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"boolean",
"instrumentationError",
"=",
"t",
"instanceof",
"InstrumentationException",
";",
"if",
"(",
"failOnError",
"&&",
"!",
"instrumentationError",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Instrumentation of class \"",
"+",
"f",
"+",
"\" failed\"",
",",
"t",
")",
";",
"}",
"else",
"{",
"String",
"reason",
"=",
"\"\"",
";",
"if",
"(",
"instrumentationError",
")",
"{",
"reason",
"=",
"\": \"",
"+",
"t",
".",
"getMessage",
"(",
")",
";",
"instrumentationErrors",
"=",
"true",
";",
"}",
"getProject",
"(",
")",
".",
"log",
"(",
"this",
",",
"\"Unable to instrument class \"",
"+",
"f",
"+",
"reason",
",",
"Project",
".",
"MSG_WARN",
")",
";",
"}",
"}",
"}",
"for",
"(",
"File",
"f",
":",
"jarFiles",
")",
"{",
"try",
"{",
"log",
"(",
"\"Instrumenting archive file \"",
"+",
"f",
",",
"verbosity",
")",
";",
"inst",
".",
"instrumentZipFile",
"(",
"f",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"failOnError",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"InstrumentationFailed\"",
",",
"t",
")",
";",
"}",
"else",
"{",
"getProject",
"(",
")",
".",
"log",
"(",
"this",
",",
"\"Unable to instrument archive \"",
"+",
"f",
",",
"Project",
".",
"MSG_WARN",
")",
";",
"}",
"}",
"}",
"if",
"(",
"instrumentationErrors",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"\"Instrumentation of classes failed\"",
")",
";",
"}",
"}"
] | Execute the build task. | [
"Execute",
"the",
"build",
"task",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/buildtasks/AbstractInstrumentationTask.java#L115-L203 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.write | private ReturnCode write(String command, ReturnCode notStartedRC, ReturnCode errorRC) {
SocketChannel channel = null;
try {
ServerCommandID commandID = createServerCommand(command);
if (commandID.getPort() > 0) {
channel = SelectorProvider.provider().openSocketChannel();
channel.connect(new InetSocketAddress(InetAddress.getByName(null), commandID.getPort()));
// Write command.
write(channel, commandID.getCommandString());
// Receive authorization challenge.
String authID = read(channel);
// Respond to authorization challenge.
File authFile = new File(commandAuthDir, authID);
// Delete a file created by the server (check for write access)
authFile.delete();
// respond to the server to indicate the delete has happened.
write(channel, authID);
// Read command response.
String cmdResponse = read(channel), targetServerUUID = null, responseCode = null;
if (cmdResponse.isEmpty()) {
throw new IOException("connection closed by server without a reply");
}
if (cmdResponse.indexOf(DELIM) != -1) {
targetServerUUID = cmdResponse.substring(0, cmdResponse.indexOf(DELIM));
responseCode = cmdResponse.substring(cmdResponse.indexOf(DELIM) + 1);
} else {
targetServerUUID = cmdResponse;
}
if (!commandID.validateTarget(targetServerUUID)) {
throw new IOException("command file mismatch");
}
ReturnCode result = ReturnCode.OK;
if (responseCode != null) {
try {
int returnCode = Integer.parseInt(responseCode.trim());
result = ReturnCode.getEnum(returnCode);
} catch (NumberFormatException nfe) {
throw new IOException("invalid return code");
}
}
if (result == ReturnCode.INVALID) {
throw new IOException("invalid return code");
}
return result;
}
if (commandID.getPort() == -1) {
return ReturnCode.SERVER_COMMAND_PORT_DISABLED_STATUS;
}
return notStartedRC;
} catch (ConnectException e) {
Debug.printStackTrace(e);
return notStartedRC;
} catch (IOException e) {
Debug.printStackTrace(e);
return errorRC;
} finally {
Utils.tryToClose(channel);
}
} | java | private ReturnCode write(String command, ReturnCode notStartedRC, ReturnCode errorRC) {
SocketChannel channel = null;
try {
ServerCommandID commandID = createServerCommand(command);
if (commandID.getPort() > 0) {
channel = SelectorProvider.provider().openSocketChannel();
channel.connect(new InetSocketAddress(InetAddress.getByName(null), commandID.getPort()));
// Write command.
write(channel, commandID.getCommandString());
// Receive authorization challenge.
String authID = read(channel);
// Respond to authorization challenge.
File authFile = new File(commandAuthDir, authID);
// Delete a file created by the server (check for write access)
authFile.delete();
// respond to the server to indicate the delete has happened.
write(channel, authID);
// Read command response.
String cmdResponse = read(channel), targetServerUUID = null, responseCode = null;
if (cmdResponse.isEmpty()) {
throw new IOException("connection closed by server without a reply");
}
if (cmdResponse.indexOf(DELIM) != -1) {
targetServerUUID = cmdResponse.substring(0, cmdResponse.indexOf(DELIM));
responseCode = cmdResponse.substring(cmdResponse.indexOf(DELIM) + 1);
} else {
targetServerUUID = cmdResponse;
}
if (!commandID.validateTarget(targetServerUUID)) {
throw new IOException("command file mismatch");
}
ReturnCode result = ReturnCode.OK;
if (responseCode != null) {
try {
int returnCode = Integer.parseInt(responseCode.trim());
result = ReturnCode.getEnum(returnCode);
} catch (NumberFormatException nfe) {
throw new IOException("invalid return code");
}
}
if (result == ReturnCode.INVALID) {
throw new IOException("invalid return code");
}
return result;
}
if (commandID.getPort() == -1) {
return ReturnCode.SERVER_COMMAND_PORT_DISABLED_STATUS;
}
return notStartedRC;
} catch (ConnectException e) {
Debug.printStackTrace(e);
return notStartedRC;
} catch (IOException e) {
Debug.printStackTrace(e);
return errorRC;
} finally {
Utils.tryToClose(channel);
}
} | [
"private",
"ReturnCode",
"write",
"(",
"String",
"command",
",",
"ReturnCode",
"notStartedRC",
",",
"ReturnCode",
"errorRC",
")",
"{",
"SocketChannel",
"channel",
"=",
"null",
";",
"try",
"{",
"ServerCommandID",
"commandID",
"=",
"createServerCommand",
"(",
"command",
")",
";",
"if",
"(",
"commandID",
".",
"getPort",
"(",
")",
">",
"0",
")",
"{",
"channel",
"=",
"SelectorProvider",
".",
"provider",
"(",
")",
".",
"openSocketChannel",
"(",
")",
";",
"channel",
".",
"connect",
"(",
"new",
"InetSocketAddress",
"(",
"InetAddress",
".",
"getByName",
"(",
"null",
")",
",",
"commandID",
".",
"getPort",
"(",
")",
")",
")",
";",
"// Write command.",
"write",
"(",
"channel",
",",
"commandID",
".",
"getCommandString",
"(",
")",
")",
";",
"// Receive authorization challenge.",
"String",
"authID",
"=",
"read",
"(",
"channel",
")",
";",
"// Respond to authorization challenge.",
"File",
"authFile",
"=",
"new",
"File",
"(",
"commandAuthDir",
",",
"authID",
")",
";",
"// Delete a file created by the server (check for write access)",
"authFile",
".",
"delete",
"(",
")",
";",
"// respond to the server to indicate the delete has happened.",
"write",
"(",
"channel",
",",
"authID",
")",
";",
"// Read command response.",
"String",
"cmdResponse",
"=",
"read",
"(",
"channel",
")",
",",
"targetServerUUID",
"=",
"null",
",",
"responseCode",
"=",
"null",
";",
"if",
"(",
"cmdResponse",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"connection closed by server without a reply\"",
")",
";",
"}",
"if",
"(",
"cmdResponse",
".",
"indexOf",
"(",
"DELIM",
")",
"!=",
"-",
"1",
")",
"{",
"targetServerUUID",
"=",
"cmdResponse",
".",
"substring",
"(",
"0",
",",
"cmdResponse",
".",
"indexOf",
"(",
"DELIM",
")",
")",
";",
"responseCode",
"=",
"cmdResponse",
".",
"substring",
"(",
"cmdResponse",
".",
"indexOf",
"(",
"DELIM",
")",
"+",
"1",
")",
";",
"}",
"else",
"{",
"targetServerUUID",
"=",
"cmdResponse",
";",
"}",
"if",
"(",
"!",
"commandID",
".",
"validateTarget",
"(",
"targetServerUUID",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"command file mismatch\"",
")",
";",
"}",
"ReturnCode",
"result",
"=",
"ReturnCode",
".",
"OK",
";",
"if",
"(",
"responseCode",
"!=",
"null",
")",
"{",
"try",
"{",
"int",
"returnCode",
"=",
"Integer",
".",
"parseInt",
"(",
"responseCode",
".",
"trim",
"(",
")",
")",
";",
"result",
"=",
"ReturnCode",
".",
"getEnum",
"(",
"returnCode",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"invalid return code\"",
")",
";",
"}",
"}",
"if",
"(",
"result",
"==",
"ReturnCode",
".",
"INVALID",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"invalid return code\"",
")",
";",
"}",
"return",
"result",
";",
"}",
"if",
"(",
"commandID",
".",
"getPort",
"(",
")",
"==",
"-",
"1",
")",
"{",
"return",
"ReturnCode",
".",
"SERVER_COMMAND_PORT_DISABLED_STATUS",
";",
"}",
"return",
"notStartedRC",
";",
"}",
"catch",
"(",
"ConnectException",
"e",
")",
"{",
"Debug",
".",
"printStackTrace",
"(",
"e",
")",
";",
"return",
"notStartedRC",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Debug",
".",
"printStackTrace",
"(",
"e",
")",
";",
"return",
"errorRC",
";",
"}",
"finally",
"{",
"Utils",
".",
"tryToClose",
"(",
"channel",
")",
";",
"}",
"}"
] | Write a command to the server process.
@param command the command to write
@param notStartedRC the return code if the server could not be reached
@param errorRC the return code if an error occurred while communicating
with the server
@return {@link ReturnCode#OK} if the command was sent, notStartedRC if
the server could not be reached, timeoutRC if the client timed
out reading a response from the server, {@link ReturnCode#SERVER_COMMAND_PORT_DISABLED_STATUS} if the
server's command port listener is disabled, or errorRC if any
other communication error occurred | [
"Write",
"a",
"command",
"to",
"the",
"server",
"process",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L100-L166 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.startStatus | public ReturnCode startStatus(ServerLock lock) {
// The server process might not have created the command file yet.
// Wait for it to appear.
while (!isValid()) {
ReturnCode rc = startStatusWait(lock);
if (rc != ReturnCode.START_STATUS_ACTION) {
return rc;
}
}
for (int i = 0; i < BootstrapConstants.MAX_POLL_ATTEMPTS && isValid(); i++) {
// Try to connect to the server's command file. This might fail if
// the command file is written but the server hasn't opened the
// socket yet.
ReturnCode rc = write(STATUS_START_COMMAND,
ReturnCode.START_STATUS_ACTION,
ReturnCode.ERROR_SERVER_START);
if (rc != ReturnCode.START_STATUS_ACTION) {
return rc;
}
// Wait a bit, ensuring that the server process is still running.
rc = startStatusWait(lock);
if (rc != ReturnCode.START_STATUS_ACTION) {
return rc;
}
}
return write(STATUS_START_COMMAND,
ReturnCode.ERROR_SERVER_START,
ReturnCode.ERROR_SERVER_START);
} | java | public ReturnCode startStatus(ServerLock lock) {
// The server process might not have created the command file yet.
// Wait for it to appear.
while (!isValid()) {
ReturnCode rc = startStatusWait(lock);
if (rc != ReturnCode.START_STATUS_ACTION) {
return rc;
}
}
for (int i = 0; i < BootstrapConstants.MAX_POLL_ATTEMPTS && isValid(); i++) {
// Try to connect to the server's command file. This might fail if
// the command file is written but the server hasn't opened the
// socket yet.
ReturnCode rc = write(STATUS_START_COMMAND,
ReturnCode.START_STATUS_ACTION,
ReturnCode.ERROR_SERVER_START);
if (rc != ReturnCode.START_STATUS_ACTION) {
return rc;
}
// Wait a bit, ensuring that the server process is still running.
rc = startStatusWait(lock);
if (rc != ReturnCode.START_STATUS_ACTION) {
return rc;
}
}
return write(STATUS_START_COMMAND,
ReturnCode.ERROR_SERVER_START,
ReturnCode.ERROR_SERVER_START);
} | [
"public",
"ReturnCode",
"startStatus",
"(",
"ServerLock",
"lock",
")",
"{",
"// The server process might not have created the command file yet.",
"// Wait for it to appear.",
"while",
"(",
"!",
"isValid",
"(",
")",
")",
"{",
"ReturnCode",
"rc",
"=",
"startStatusWait",
"(",
"lock",
")",
";",
"if",
"(",
"rc",
"!=",
"ReturnCode",
".",
"START_STATUS_ACTION",
")",
"{",
"return",
"rc",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"BootstrapConstants",
".",
"MAX_POLL_ATTEMPTS",
"&&",
"isValid",
"(",
")",
";",
"i",
"++",
")",
"{",
"// Try to connect to the server's command file. This might fail if",
"// the command file is written but the server hasn't opened the",
"// socket yet.",
"ReturnCode",
"rc",
"=",
"write",
"(",
"STATUS_START_COMMAND",
",",
"ReturnCode",
".",
"START_STATUS_ACTION",
",",
"ReturnCode",
".",
"ERROR_SERVER_START",
")",
";",
"if",
"(",
"rc",
"!=",
"ReturnCode",
".",
"START_STATUS_ACTION",
")",
"{",
"return",
"rc",
";",
"}",
"// Wait a bit, ensuring that the server process is still running.",
"rc",
"=",
"startStatusWait",
"(",
"lock",
")",
";",
"if",
"(",
"rc",
"!=",
"ReturnCode",
".",
"START_STATUS_ACTION",
")",
"{",
"return",
"rc",
";",
"}",
"}",
"return",
"write",
"(",
"STATUS_START_COMMAND",
",",
"ReturnCode",
".",
"ERROR_SERVER_START",
",",
"ReturnCode",
".",
"ERROR_SERVER_START",
")",
";",
"}"
] | Waits for the server to be fully started.
@param lock the server lock, which must be held by the server process
before this method is called | [
"Waits",
"for",
"the",
"server",
"to",
"be",
"fully",
"started",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L174-L205 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.startStatusWait | private ReturnCode startStatusWait(ServerLock lock) {
try {
Thread.sleep(BootstrapConstants.POLL_INTERVAL_MS);
} catch (InterruptedException ex) {
Debug.printStackTrace(ex);
return ReturnCode.ERROR_SERVER_START;
}
// This method is only called if the server process was holding
// the server lock. If this process is suddenly able to obtain the
// lock, then the server process didn't finish starting.
if (!lock.testServerRunning()) {
return ReturnCode.ERROR_SERVER_START;
}
return ReturnCode.START_STATUS_ACTION;
} | java | private ReturnCode startStatusWait(ServerLock lock) {
try {
Thread.sleep(BootstrapConstants.POLL_INTERVAL_MS);
} catch (InterruptedException ex) {
Debug.printStackTrace(ex);
return ReturnCode.ERROR_SERVER_START;
}
// This method is only called if the server process was holding
// the server lock. If this process is suddenly able to obtain the
// lock, then the server process didn't finish starting.
if (!lock.testServerRunning()) {
return ReturnCode.ERROR_SERVER_START;
}
return ReturnCode.START_STATUS_ACTION;
} | [
"private",
"ReturnCode",
"startStatusWait",
"(",
"ServerLock",
"lock",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"BootstrapConstants",
".",
"POLL_INTERVAL_MS",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"Debug",
".",
"printStackTrace",
"(",
"ex",
")",
";",
"return",
"ReturnCode",
".",
"ERROR_SERVER_START",
";",
"}",
"// This method is only called if the server process was holding",
"// the server lock. If this process is suddenly able to obtain the",
"// lock, then the server process didn't finish starting.",
"if",
"(",
"!",
"lock",
".",
"testServerRunning",
"(",
")",
")",
"{",
"return",
"ReturnCode",
".",
"ERROR_SERVER_START",
";",
"}",
"return",
"ReturnCode",
".",
"START_STATUS_ACTION",
";",
"}"
] | Wait a bit because the server process could not be contacted, and then
verify that the server process is still running.
@param lock
@return {@link ReturnCode#START_STATUS_ACTION} to try contacting the
server process again, or another return code to give up | [
"Wait",
"a",
"bit",
"because",
"the",
"server",
"process",
"could",
"not",
"be",
"contacted",
"and",
"then",
"verify",
"that",
"the",
"server",
"process",
"is",
"still",
"running",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L215-L231 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.stopServer | public ReturnCode stopServer(boolean force) {
return write(force ? FORCE_STOP_COMMAND : STOP_COMMAND,
ReturnCode.REDUNDANT_ACTION_STATUS,
ReturnCode.ERROR_SERVER_STOP);
} | java | public ReturnCode stopServer(boolean force) {
return write(force ? FORCE_STOP_COMMAND : STOP_COMMAND,
ReturnCode.REDUNDANT_ACTION_STATUS,
ReturnCode.ERROR_SERVER_STOP);
} | [
"public",
"ReturnCode",
"stopServer",
"(",
"boolean",
"force",
")",
"{",
"return",
"write",
"(",
"force",
"?",
"FORCE_STOP_COMMAND",
":",
"STOP_COMMAND",
",",
"ReturnCode",
".",
"REDUNDANT_ACTION_STATUS",
",",
"ReturnCode",
".",
"ERROR_SERVER_STOP",
")",
";",
"}"
] | Stop the server by issuing a "stop" instruction to the server listener | [
"Stop",
"the",
"server",
"by",
"issuing",
"a",
"stop",
"instruction",
"to",
"the",
"server",
"listener"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L236-L240 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.introspectServer | public ReturnCode introspectServer(String dumpTimestamp, Set<JavaDumpAction> javaDumpActions) {
// Since "server dump" is used for diagnostics, we go out of our way to
// not send an unrecognized command to the server even if the user has
// broken their environment such that the client process supports java
// dumps but the server doesn't.
String command;
if (javaDumpActions.isEmpty()) {
command = INTROSPECT_COMMAND + DELIM + dumpTimestamp;
} else {
StringBuilder commandBuilder = new StringBuilder().append(INTROSPECT_JAVADUMP_COMMAND).append(DELIM).append(dumpTimestamp);
for (JavaDumpAction javaDumpAction : javaDumpActions) {
commandBuilder.append(',').append(javaDumpAction.name());
}
command = commandBuilder.toString();
}
return write(command,
ReturnCode.DUMP_ACTION,
ReturnCode.ERROR_SERVER_DUMP);
} | java | public ReturnCode introspectServer(String dumpTimestamp, Set<JavaDumpAction> javaDumpActions) {
// Since "server dump" is used for diagnostics, we go out of our way to
// not send an unrecognized command to the server even if the user has
// broken their environment such that the client process supports java
// dumps but the server doesn't.
String command;
if (javaDumpActions.isEmpty()) {
command = INTROSPECT_COMMAND + DELIM + dumpTimestamp;
} else {
StringBuilder commandBuilder = new StringBuilder().append(INTROSPECT_JAVADUMP_COMMAND).append(DELIM).append(dumpTimestamp);
for (JavaDumpAction javaDumpAction : javaDumpActions) {
commandBuilder.append(',').append(javaDumpAction.name());
}
command = commandBuilder.toString();
}
return write(command,
ReturnCode.DUMP_ACTION,
ReturnCode.ERROR_SERVER_DUMP);
} | [
"public",
"ReturnCode",
"introspectServer",
"(",
"String",
"dumpTimestamp",
",",
"Set",
"<",
"JavaDumpAction",
">",
"javaDumpActions",
")",
"{",
"// Since \"server dump\" is used for diagnostics, we go out of our way to",
"// not send an unrecognized command to the server even if the user has",
"// broken their environment such that the client process supports java",
"// dumps but the server doesn't.",
"String",
"command",
";",
"if",
"(",
"javaDumpActions",
".",
"isEmpty",
"(",
")",
")",
"{",
"command",
"=",
"INTROSPECT_COMMAND",
"+",
"DELIM",
"+",
"dumpTimestamp",
";",
"}",
"else",
"{",
"StringBuilder",
"commandBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"INTROSPECT_JAVADUMP_COMMAND",
")",
".",
"append",
"(",
"DELIM",
")",
".",
"append",
"(",
"dumpTimestamp",
")",
";",
"for",
"(",
"JavaDumpAction",
"javaDumpAction",
":",
"javaDumpActions",
")",
"{",
"commandBuilder",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"javaDumpAction",
".",
"name",
"(",
")",
")",
";",
"}",
"command",
"=",
"commandBuilder",
".",
"toString",
"(",
")",
";",
"}",
"return",
"write",
"(",
"command",
",",
"ReturnCode",
".",
"DUMP_ACTION",
",",
"ReturnCode",
".",
"ERROR_SERVER_DUMP",
")",
";",
"}"
] | Dump the server by issuing a "introspect" instruction to the server listener | [
"Dump",
"the",
"server",
"by",
"issuing",
"a",
"introspect",
"instruction",
"to",
"the",
"server",
"listener"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L245-L264 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.javaDump | public ReturnCode javaDump(Set<JavaDumpAction> javaDumpActions) {
StringBuilder commandBuilder = new StringBuilder(JAVADUMP_COMMAND);
char sep = DELIM;
for (JavaDumpAction javaDumpAction : javaDumpActions) {
commandBuilder.append(sep).append(javaDumpAction.toString());
sep = ',';
}
return write(commandBuilder.toString(),
ReturnCode.SERVER_INACTIVE_STATUS,
ReturnCode.ERROR_SERVER_DUMP);
} | java | public ReturnCode javaDump(Set<JavaDumpAction> javaDumpActions) {
StringBuilder commandBuilder = new StringBuilder(JAVADUMP_COMMAND);
char sep = DELIM;
for (JavaDumpAction javaDumpAction : javaDumpActions) {
commandBuilder.append(sep).append(javaDumpAction.toString());
sep = ',';
}
return write(commandBuilder.toString(),
ReturnCode.SERVER_INACTIVE_STATUS,
ReturnCode.ERROR_SERVER_DUMP);
} | [
"public",
"ReturnCode",
"javaDump",
"(",
"Set",
"<",
"JavaDumpAction",
">",
"javaDumpActions",
")",
"{",
"StringBuilder",
"commandBuilder",
"=",
"new",
"StringBuilder",
"(",
"JAVADUMP_COMMAND",
")",
";",
"char",
"sep",
"=",
"DELIM",
";",
"for",
"(",
"JavaDumpAction",
"javaDumpAction",
":",
"javaDumpActions",
")",
"{",
"commandBuilder",
".",
"append",
"(",
"sep",
")",
".",
"append",
"(",
"javaDumpAction",
".",
"toString",
"(",
")",
")",
";",
"sep",
"=",
"'",
"'",
";",
"}",
"return",
"write",
"(",
"commandBuilder",
".",
"toString",
"(",
")",
",",
"ReturnCode",
".",
"SERVER_INACTIVE_STATUS",
",",
"ReturnCode",
".",
"ERROR_SERVER_DUMP",
")",
";",
"}"
] | Create a java dump of the server JVM by issuing a "javadump" instruction
to the server listener | [
"Create",
"a",
"java",
"dump",
"of",
"the",
"server",
"JVM",
"by",
"issuing",
"a",
"javadump",
"instruction",
"to",
"the",
"server",
"listener"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L270-L281 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.pause | public ReturnCode pause(String targetArg) {
StringBuilder commandBuilder = new StringBuilder(PAUSE_COMMAND);
char sep = DELIM;
if (targetArg != null) {
commandBuilder.append(sep).append(targetArg);
}
return write(commandBuilder.toString(),
ReturnCode.SERVER_INACTIVE_STATUS,
ReturnCode.ERROR_SERVER_PAUSE);
} | java | public ReturnCode pause(String targetArg) {
StringBuilder commandBuilder = new StringBuilder(PAUSE_COMMAND);
char sep = DELIM;
if (targetArg != null) {
commandBuilder.append(sep).append(targetArg);
}
return write(commandBuilder.toString(),
ReturnCode.SERVER_INACTIVE_STATUS,
ReturnCode.ERROR_SERVER_PAUSE);
} | [
"public",
"ReturnCode",
"pause",
"(",
"String",
"targetArg",
")",
"{",
"StringBuilder",
"commandBuilder",
"=",
"new",
"StringBuilder",
"(",
"PAUSE_COMMAND",
")",
";",
"char",
"sep",
"=",
"DELIM",
";",
"if",
"(",
"targetArg",
"!=",
"null",
")",
"{",
"commandBuilder",
".",
"append",
"(",
"sep",
")",
".",
"append",
"(",
"targetArg",
")",
";",
"}",
"return",
"write",
"(",
"commandBuilder",
".",
"toString",
"(",
")",
",",
"ReturnCode",
".",
"SERVER_INACTIVE_STATUS",
",",
"ReturnCode",
".",
"ERROR_SERVER_PAUSE",
")",
";",
"}"
] | Attempt to Stop the inbound work to a server by issuing a "pause" request
to the server. | [
"Attempt",
"to",
"Stop",
"the",
"inbound",
"work",
"to",
"a",
"server",
"by",
"issuing",
"a",
"pause",
"request",
"to",
"the",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L287-L298 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java | ServerCommandClient.resume | public ReturnCode resume(String targetArg) {
StringBuilder commandBuilder = new StringBuilder(RESUME_COMMAND);
char sep = DELIM;
if (targetArg != null) {
commandBuilder.append(sep).append(targetArg);
}
return write(commandBuilder.toString(),
ReturnCode.SERVER_INACTIVE_STATUS,
ReturnCode.ERROR_SERVER_RESUME);
} | java | public ReturnCode resume(String targetArg) {
StringBuilder commandBuilder = new StringBuilder(RESUME_COMMAND);
char sep = DELIM;
if (targetArg != null) {
commandBuilder.append(sep).append(targetArg);
}
return write(commandBuilder.toString(),
ReturnCode.SERVER_INACTIVE_STATUS,
ReturnCode.ERROR_SERVER_RESUME);
} | [
"public",
"ReturnCode",
"resume",
"(",
"String",
"targetArg",
")",
"{",
"StringBuilder",
"commandBuilder",
"=",
"new",
"StringBuilder",
"(",
"RESUME_COMMAND",
")",
";",
"char",
"sep",
"=",
"DELIM",
";",
"if",
"(",
"targetArg",
"!=",
"null",
")",
"{",
"commandBuilder",
".",
"append",
"(",
"sep",
")",
".",
"append",
"(",
"targetArg",
")",
";",
"}",
"return",
"write",
"(",
"commandBuilder",
".",
"toString",
"(",
")",
",",
"ReturnCode",
".",
"SERVER_INACTIVE_STATUS",
",",
"ReturnCode",
".",
"ERROR_SERVER_RESUME",
")",
";",
"}"
] | Resume Inbound work to a server by issuing a "resume" request
to the server. | [
"Resume",
"Inbound",
"work",
"to",
"a",
"server",
"by",
"issuing",
"a",
"resume",
"request",
"to",
"the",
"server",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerCommandClient.java#L304-L315 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/JtiNonceCache.java | JtiNonceCache.contain | public boolean contain(OidcTokenImplBase token) { //(IdToken token) {
String key = token.getJwtId();
if (key == null) {
return false;
}
key = getCacheKey(token);
long currentTimeMilliseconds = (new Date()).getTime();
synchronized (primaryTable) {
Long exp = (Long) primaryTable.get(key); // milliseconds
if (exp != null) {
if (exp.longValue() > currentTimeMilliseconds) { // not expired yet // milliseconds
return true;
} else {
primaryTable.remove(key);
}
}
// cache the jwt
long tokenExp = token.getExpirationTimeSeconds() * 1000; // milliseconds
if (tokenExp == 0) { // in case it's not set, let's give it one hour
tokenExp = currentTimeMilliseconds + 60 * 60 * 1000; // 1 hour
}
primaryTable.put(key, Long.valueOf(tokenExp));
}
return false;
} | java | public boolean contain(OidcTokenImplBase token) { //(IdToken token) {
String key = token.getJwtId();
if (key == null) {
return false;
}
key = getCacheKey(token);
long currentTimeMilliseconds = (new Date()).getTime();
synchronized (primaryTable) {
Long exp = (Long) primaryTable.get(key); // milliseconds
if (exp != null) {
if (exp.longValue() > currentTimeMilliseconds) { // not expired yet // milliseconds
return true;
} else {
primaryTable.remove(key);
}
}
// cache the jwt
long tokenExp = token.getExpirationTimeSeconds() * 1000; // milliseconds
if (tokenExp == 0) { // in case it's not set, let's give it one hour
tokenExp = currentTimeMilliseconds + 60 * 60 * 1000; // 1 hour
}
primaryTable.put(key, Long.valueOf(tokenExp));
}
return false;
} | [
"public",
"boolean",
"contain",
"(",
"OidcTokenImplBase",
"token",
")",
"{",
"//(IdToken token) {",
"String",
"key",
"=",
"token",
".",
"getJwtId",
"(",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"key",
"=",
"getCacheKey",
"(",
"token",
")",
";",
"long",
"currentTimeMilliseconds",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
";",
"synchronized",
"(",
"primaryTable",
")",
"{",
"Long",
"exp",
"=",
"(",
"Long",
")",
"primaryTable",
".",
"get",
"(",
"key",
")",
";",
"// milliseconds",
"if",
"(",
"exp",
"!=",
"null",
")",
"{",
"if",
"(",
"exp",
".",
"longValue",
"(",
")",
">",
"currentTimeMilliseconds",
")",
"{",
"// not expired yet // milliseconds",
"return",
"true",
";",
"}",
"else",
"{",
"primaryTable",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}",
"// cache the jwt",
"long",
"tokenExp",
"=",
"token",
".",
"getExpirationTimeSeconds",
"(",
")",
"*",
"1000",
";",
"// milliseconds",
"if",
"(",
"tokenExp",
"==",
"0",
")",
"{",
"// in case it's not set, let's give it one hour",
"tokenExp",
"=",
"currentTimeMilliseconds",
"+",
"60",
"*",
"60",
"*",
"1000",
";",
"// 1 hour",
"}",
"primaryTable",
".",
"put",
"(",
"key",
",",
"Long",
".",
"valueOf",
"(",
"tokenExp",
")",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Find and return the object associated with the specified key. Add it if not already present. | [
"Find",
"and",
"return",
"the",
"object",
"associated",
"with",
"the",
"specified",
"key",
".",
"Add",
"it",
"if",
"not",
"already",
"present",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/JtiNonceCache.java#L101-L127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSStateManager.java | WSStateManager.isValid | public final ResourceException isValid(int newAction) {
try {
setState(newAction, true);
} catch (TransactionException exp) {
FFDCFilter.processException(exp, "com.ibm.ws.rsadapter.spi.WSStateManager.isValid", "385", this);
return exp;
}
return null;
} | java | public final ResourceException isValid(int newAction) {
try {
setState(newAction, true);
} catch (TransactionException exp) {
FFDCFilter.processException(exp, "com.ibm.ws.rsadapter.spi.WSStateManager.isValid", "385", this);
return exp;
}
return null;
} | [
"public",
"final",
"ResourceException",
"isValid",
"(",
"int",
"newAction",
")",
"{",
"try",
"{",
"setState",
"(",
"newAction",
",",
"true",
")",
";",
"}",
"catch",
"(",
"TransactionException",
"exp",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exp",
",",
"\"com.ibm.ws.rsadapter.spi.WSStateManager.isValid\"",
",",
"\"385\"",
",",
"this",
")",
";",
"return",
"exp",
";",
"}",
"return",
"null",
";",
"}"
] | If the action is valid return null. Otherwise return a
TransactionException with the cause.
@param newAction
int
@return TransactionException | [
"If",
"the",
"action",
"is",
"valid",
"return",
"null",
".",
"Otherwise",
"return",
"a",
"TransactionException",
"with",
"the",
"cause",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSStateManager.java#L388-L397 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.