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
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java | SSLConnectionLink.ready | @Override
public void ready(VirtualConnection inVC) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "ready, vc=" + getVCHash());
}
// Double check for error condition where close already happened. Protective measure.
if (!closed && FrameworkState.isValid()) {
try {
// Outbound connections took care of sslContext and sslEngine creation already.
// If inbound, discrimination may have already created the engine and context
if (isInbound) {
// See if discrimination ran already. Get the state map from the VC.
Map<Object, Object> stateMap = inVC.getStateMap();
// Extract and remove result of discrimination, if it happened.
discState = (SSLDiscriminatorState) stateMap.remove(SSLChannel.SSL_DISCRIMINATOR_STATE);
if (discState != null) {
// Discrimination has happened. Save already existing sslEngine.
sslEngine = discState.getEngine();
sslContext = discState.getSSLContext();
setLinkConfig((SSLLinkConfig) stateMap.get(SSLConnectionLink.LINKCONFIG));
} else if (sslContext == null || getSSLEngine() == null) {
// Create a new SSL context based on the current properties in the ssl config.
sslContext = getChannel().getSSLContextForInboundLink(this, inVC);
// Discrimination has not happened yet. Create new SSL engine.
sslEngine = SSLUtils.getSSLEngine(sslContext,
sslChannel.getConfig().getFlowType(),
getLinkConfig(),
this);
}
} else {
// Outbound connect is ready. Ensure we have an sslContext and sslEngine.
if (sslContext == null || getSSLEngine() == null) {
// Create a new SSL context based on the current properties in the ssl config.
sslContext = getChannel().getSSLContextForOutboundLink(this, inVC, targetAddress);
// PK46069 - use engine that allows session id re-use
sslEngine = SSLUtils.getOutboundSSLEngine(
sslContext, getLinkConfig(),
targetAddress.getRemoteAddress().getHostName(),
targetAddress.getRemoteAddress().getPort(),
this);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "SSL engine hc=" + getSSLEngine().hashCode() + " associated with vc=" + getVCHash());
}
// Flag that connection has been established.
// Need to set this to true for inbound and outbound so close will work right.
connected = true;
// Determine if this is an inbound or outbound connection.
if (isInbound) {
readyInbound(inVC);
} else {
readyOutbound(inVC, true);
}
} catch (Exception e) {
if (FrameworkState.isStopping()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Ignoring exception during server shutdown: " + e);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught exception during ready, " + e, e);
}
FFDCFilter.processException(e, getClass().getName(), "238", this);
}
close(inVC, e);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ready called after close so do nothing");
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "ready");
}
} | java | @Override
public void ready(VirtualConnection inVC) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "ready, vc=" + getVCHash());
}
// Double check for error condition where close already happened. Protective measure.
if (!closed && FrameworkState.isValid()) {
try {
// Outbound connections took care of sslContext and sslEngine creation already.
// If inbound, discrimination may have already created the engine and context
if (isInbound) {
// See if discrimination ran already. Get the state map from the VC.
Map<Object, Object> stateMap = inVC.getStateMap();
// Extract and remove result of discrimination, if it happened.
discState = (SSLDiscriminatorState) stateMap.remove(SSLChannel.SSL_DISCRIMINATOR_STATE);
if (discState != null) {
// Discrimination has happened. Save already existing sslEngine.
sslEngine = discState.getEngine();
sslContext = discState.getSSLContext();
setLinkConfig((SSLLinkConfig) stateMap.get(SSLConnectionLink.LINKCONFIG));
} else if (sslContext == null || getSSLEngine() == null) {
// Create a new SSL context based on the current properties in the ssl config.
sslContext = getChannel().getSSLContextForInboundLink(this, inVC);
// Discrimination has not happened yet. Create new SSL engine.
sslEngine = SSLUtils.getSSLEngine(sslContext,
sslChannel.getConfig().getFlowType(),
getLinkConfig(),
this);
}
} else {
// Outbound connect is ready. Ensure we have an sslContext and sslEngine.
if (sslContext == null || getSSLEngine() == null) {
// Create a new SSL context based on the current properties in the ssl config.
sslContext = getChannel().getSSLContextForOutboundLink(this, inVC, targetAddress);
// PK46069 - use engine that allows session id re-use
sslEngine = SSLUtils.getOutboundSSLEngine(
sslContext, getLinkConfig(),
targetAddress.getRemoteAddress().getHostName(),
targetAddress.getRemoteAddress().getPort(),
this);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "SSL engine hc=" + getSSLEngine().hashCode() + " associated with vc=" + getVCHash());
}
// Flag that connection has been established.
// Need to set this to true for inbound and outbound so close will work right.
connected = true;
// Determine if this is an inbound or outbound connection.
if (isInbound) {
readyInbound(inVC);
} else {
readyOutbound(inVC, true);
}
} catch (Exception e) {
if (FrameworkState.isStopping()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Ignoring exception during server shutdown: " + e);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught exception during ready, " + e, e);
}
FFDCFilter.processException(e, getClass().getName(), "238", this);
}
close(inVC, e);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ready called after close so do nothing");
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "ready");
}
} | [
"@",
"Override",
"public",
"void",
"ready",
"(",
"VirtualConnection",
"inVC",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"ready, vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"// Double check for error condition where close already happened. Protective measure.",
"if",
"(",
"!",
"closed",
"&&",
"FrameworkState",
".",
"isValid",
"(",
")",
")",
"{",
"try",
"{",
"// Outbound connections took care of sslContext and sslEngine creation already.",
"// If inbound, discrimination may have already created the engine and context",
"if",
"(",
"isInbound",
")",
"{",
"// See if discrimination ran already. Get the state map from the VC.",
"Map",
"<",
"Object",
",",
"Object",
">",
"stateMap",
"=",
"inVC",
".",
"getStateMap",
"(",
")",
";",
"// Extract and remove result of discrimination, if it happened.",
"discState",
"=",
"(",
"SSLDiscriminatorState",
")",
"stateMap",
".",
"remove",
"(",
"SSLChannel",
".",
"SSL_DISCRIMINATOR_STATE",
")",
";",
"if",
"(",
"discState",
"!=",
"null",
")",
"{",
"// Discrimination has happened. Save already existing sslEngine.",
"sslEngine",
"=",
"discState",
".",
"getEngine",
"(",
")",
";",
"sslContext",
"=",
"discState",
".",
"getSSLContext",
"(",
")",
";",
"setLinkConfig",
"(",
"(",
"SSLLinkConfig",
")",
"stateMap",
".",
"get",
"(",
"SSLConnectionLink",
".",
"LINKCONFIG",
")",
")",
";",
"}",
"else",
"if",
"(",
"sslContext",
"==",
"null",
"||",
"getSSLEngine",
"(",
")",
"==",
"null",
")",
"{",
"// Create a new SSL context based on the current properties in the ssl config.",
"sslContext",
"=",
"getChannel",
"(",
")",
".",
"getSSLContextForInboundLink",
"(",
"this",
",",
"inVC",
")",
";",
"// Discrimination has not happened yet. Create new SSL engine.",
"sslEngine",
"=",
"SSLUtils",
".",
"getSSLEngine",
"(",
"sslContext",
",",
"sslChannel",
".",
"getConfig",
"(",
")",
".",
"getFlowType",
"(",
")",
",",
"getLinkConfig",
"(",
")",
",",
"this",
")",
";",
"}",
"}",
"else",
"{",
"// Outbound connect is ready. Ensure we have an sslContext and sslEngine.",
"if",
"(",
"sslContext",
"==",
"null",
"||",
"getSSLEngine",
"(",
")",
"==",
"null",
")",
"{",
"// Create a new SSL context based on the current properties in the ssl config.",
"sslContext",
"=",
"getChannel",
"(",
")",
".",
"getSSLContextForOutboundLink",
"(",
"this",
",",
"inVC",
",",
"targetAddress",
")",
";",
"// PK46069 - use engine that allows session id re-use",
"sslEngine",
"=",
"SSLUtils",
".",
"getOutboundSSLEngine",
"(",
"sslContext",
",",
"getLinkConfig",
"(",
")",
",",
"targetAddress",
".",
"getRemoteAddress",
"(",
")",
".",
"getHostName",
"(",
")",
",",
"targetAddress",
".",
"getRemoteAddress",
"(",
")",
".",
"getPort",
"(",
")",
",",
"this",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"SSL engine hc=\"",
"+",
"getSSLEngine",
"(",
")",
".",
"hashCode",
"(",
")",
"+",
"\" associated with vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"// Flag that connection has been established.",
"// Need to set this to true for inbound and outbound so close will work right.",
"connected",
"=",
"true",
";",
"// Determine if this is an inbound or outbound connection.",
"if",
"(",
"isInbound",
")",
"{",
"readyInbound",
"(",
"inVC",
")",
";",
"}",
"else",
"{",
"readyOutbound",
"(",
"inVC",
",",
"true",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"FrameworkState",
".",
"isStopping",
"(",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Ignoring exception during server shutdown: \"",
"+",
"e",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Caught exception during ready, \"",
"+",
"e",
",",
"e",
")",
";",
"}",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"238\"",
",",
"this",
")",
";",
"}",
"close",
"(",
"inVC",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"ready called after close so do nothing\"",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"ready\"",
")",
";",
"}",
"}"
] | This method will be called at one of two times. If this connection link
is part of an inbound chain, then this will be called when the device side
channel has accepted a new connection and determined that this is the next
channel in the chain. Note, that the Discriminator may have already been
run. The second case where this method may be called is if this connection
link is part of an outbound chain. In that case, this method will be called
when the initial outbound connect reports back success.
@see com.ibm.wsspi.channelfw.ConnectionReadyCallback#ready(VirtualConnection) | [
"This",
"method",
"will",
"be",
"called",
"at",
"one",
"of",
"two",
"times",
".",
"If",
"this",
"connection",
"link",
"is",
"part",
"of",
"an",
"inbound",
"chain",
"then",
"this",
"will",
"be",
"called",
"when",
"the",
"device",
"side",
"channel",
"has",
"accepted",
"a",
"new",
"connection",
"and",
"determined",
"that",
"this",
"is",
"the",
"next",
"channel",
"in",
"the",
"chain",
".",
"Note",
"that",
"the",
"Discriminator",
"may",
"have",
"already",
"been",
"run",
".",
"The",
"second",
"case",
"where",
"this",
"method",
"may",
"be",
"called",
"is",
"if",
"this",
"connection",
"link",
"is",
"part",
"of",
"an",
"outbound",
"chain",
".",
"In",
"that",
"case",
"this",
"method",
"will",
"be",
"called",
"when",
"the",
"initial",
"outbound",
"connect",
"reports",
"back",
"success",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java#L282-L359 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java | SSLConnectionLink.readyInboundPostHandshake | protected void readyInboundPostHandshake(
WsByteBuffer netBuffer,
WsByteBuffer decryptedNetBuffer,
WsByteBuffer encryptedAppBuffer,
HandshakeStatus hsStatus) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyInboundPostHandshake, vc=" + getVCHash());
}
// Release the no longer needed buffers.
encryptedAppBuffer.release();
if (hsStatus == HandshakeStatus.FINISHED) {
AlpnSupportUtils.getAlpnResult(getSSLEngine(), this);
// PK16095 - take certain actions when the handshake completes
getChannel().onHandshakeFinish(getSSLEngine());
// Handshake complete. Now get the request. Use our read interface so unwrap already done.
// Check if data exists in the network buffer still. This would be app data beyond handshake.
if (netBuffer.remaining() == 0 || netBuffer.position() == 0) {
// No app data. Release the netBuffer as it will no longer be used.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing netBuffer: " + netBuffer.hashCode());
}
netBuffer.release();
getDeviceReadInterface().setBuffers(null);
} else {
// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "App data exists in netBuffer after handshake: " + netBuffer.remaining());
}
}
readInterface.setBuffer(decryptedNetBuffer);
// No need to save number of bytes read.
MyReadCompletedCallback readCallback = new MyReadCompletedCallback(decryptedNetBuffer);
if (null != readInterface.read(1, readCallback, false, TCPRequestContext.USE_CHANNEL_TIMEOUT)) {
// Read was handled synchronously.
determineNextChannel();
}
} else {
// Unknown result from handshake. All other results should have thrown exceptions.
// Clean up buffers used during read.
netBuffer.release();
getDeviceReadInterface().setBuffers(null);
decryptedNetBuffer.release();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unhandled result from SSL engine: " + hsStatus);
}
SSLException ssle = new SSLException("Unhandled result from SSL engine: " + hsStatus);
FFDCFilter.processException(ssle, getClass().getName(), "401", this);
close(getVirtualConnection(), ssle);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyInboundPostHandshake");
}
} | java | protected void readyInboundPostHandshake(
WsByteBuffer netBuffer,
WsByteBuffer decryptedNetBuffer,
WsByteBuffer encryptedAppBuffer,
HandshakeStatus hsStatus) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyInboundPostHandshake, vc=" + getVCHash());
}
// Release the no longer needed buffers.
encryptedAppBuffer.release();
if (hsStatus == HandshakeStatus.FINISHED) {
AlpnSupportUtils.getAlpnResult(getSSLEngine(), this);
// PK16095 - take certain actions when the handshake completes
getChannel().onHandshakeFinish(getSSLEngine());
// Handshake complete. Now get the request. Use our read interface so unwrap already done.
// Check if data exists in the network buffer still. This would be app data beyond handshake.
if (netBuffer.remaining() == 0 || netBuffer.position() == 0) {
// No app data. Release the netBuffer as it will no longer be used.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing netBuffer: " + netBuffer.hashCode());
}
netBuffer.release();
getDeviceReadInterface().setBuffers(null);
} else {
// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "App data exists in netBuffer after handshake: " + netBuffer.remaining());
}
}
readInterface.setBuffer(decryptedNetBuffer);
// No need to save number of bytes read.
MyReadCompletedCallback readCallback = new MyReadCompletedCallback(decryptedNetBuffer);
if (null != readInterface.read(1, readCallback, false, TCPRequestContext.USE_CHANNEL_TIMEOUT)) {
// Read was handled synchronously.
determineNextChannel();
}
} else {
// Unknown result from handshake. All other results should have thrown exceptions.
// Clean up buffers used during read.
netBuffer.release();
getDeviceReadInterface().setBuffers(null);
decryptedNetBuffer.release();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unhandled result from SSL engine: " + hsStatus);
}
SSLException ssle = new SSLException("Unhandled result from SSL engine: " + hsStatus);
FFDCFilter.processException(ssle, getClass().getName(), "401", this);
close(getVirtualConnection(), ssle);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyInboundPostHandshake");
}
} | [
"protected",
"void",
"readyInboundPostHandshake",
"(",
"WsByteBuffer",
"netBuffer",
",",
"WsByteBuffer",
"decryptedNetBuffer",
",",
"WsByteBuffer",
"encryptedAppBuffer",
",",
"HandshakeStatus",
"hsStatus",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"readyInboundPostHandshake, vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"// Release the no longer needed buffers.",
"encryptedAppBuffer",
".",
"release",
"(",
")",
";",
"if",
"(",
"hsStatus",
"==",
"HandshakeStatus",
".",
"FINISHED",
")",
"{",
"AlpnSupportUtils",
".",
"getAlpnResult",
"(",
"getSSLEngine",
"(",
")",
",",
"this",
")",
";",
"// PK16095 - take certain actions when the handshake completes",
"getChannel",
"(",
")",
".",
"onHandshakeFinish",
"(",
"getSSLEngine",
"(",
")",
")",
";",
"// Handshake complete. Now get the request. Use our read interface so unwrap already done.",
"// Check if data exists in the network buffer still. This would be app data beyond handshake.",
"if",
"(",
"netBuffer",
".",
"remaining",
"(",
")",
"==",
"0",
"||",
"netBuffer",
".",
"position",
"(",
")",
"==",
"0",
")",
"{",
"// No app data. Release the netBuffer as it will no longer be used.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Releasing netBuffer: \"",
"+",
"netBuffer",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"netBuffer",
".",
"release",
"(",
")",
";",
"getDeviceReadInterface",
"(",
")",
".",
"setBuffers",
"(",
"null",
")",
";",
"}",
"else",
"{",
"// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"App data exists in netBuffer after handshake: \"",
"+",
"netBuffer",
".",
"remaining",
"(",
")",
")",
";",
"}",
"}",
"readInterface",
".",
"setBuffer",
"(",
"decryptedNetBuffer",
")",
";",
"// No need to save number of bytes read.",
"MyReadCompletedCallback",
"readCallback",
"=",
"new",
"MyReadCompletedCallback",
"(",
"decryptedNetBuffer",
")",
";",
"if",
"(",
"null",
"!=",
"readInterface",
".",
"read",
"(",
"1",
",",
"readCallback",
",",
"false",
",",
"TCPRequestContext",
".",
"USE_CHANNEL_TIMEOUT",
")",
")",
"{",
"// Read was handled synchronously.",
"determineNextChannel",
"(",
")",
";",
"}",
"}",
"else",
"{",
"// Unknown result from handshake. All other results should have thrown exceptions.",
"// Clean up buffers used during read.",
"netBuffer",
".",
"release",
"(",
")",
";",
"getDeviceReadInterface",
"(",
")",
".",
"setBuffers",
"(",
"null",
")",
";",
"decryptedNetBuffer",
".",
"release",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Unhandled result from SSL engine: \"",
"+",
"hsStatus",
")",
";",
"}",
"SSLException",
"ssle",
"=",
"new",
"SSLException",
"(",
"\"Unhandled result from SSL engine: \"",
"+",
"hsStatus",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"ssle",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"401\"",
",",
"this",
")",
";",
"close",
"(",
"getVirtualConnection",
"(",
")",
",",
"ssle",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"readyInboundPostHandshake\"",
")",
";",
"}",
"}"
] | This method is called after the SSL handshake has taken place.
@param netBuffer
@param decryptedNetBuffer
@param encryptedAppBuffer
@param hsStatus | [
"This",
"method",
"is",
"called",
"after",
"the",
"SSL",
"handshake",
"has",
"taken",
"place",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java#L683-L742 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java | SSLConnectionLink.readyOutbound | private void readyOutbound(VirtualConnection inVC, boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyOutbound, vc=" + getVCHash());
}
final SSLChannelData config = this.sslChannel.getConfig();
// Encrypted buffer from the network.
WsByteBuffer netBuffer = SSLUtils.allocateByteBuffer(getPacketBufferSize(), config.getEncryptBuffersDirect());
// Unencrypted buffer from the ssl engine output to be handed up to the application.
WsByteBuffer decryptedNetBuffer = SSLUtils.allocateByteBuffer(getAppBufferSize(), config.getDecryptBuffersDirect());
// Encrypted buffer from the ssl engine to be sent sent out on the network.
WsByteBuffer encryptedAppBuffer = SSLUtils.allocateByteBuffer(getPacketBufferSize(), true);
// Result from the SSL engine.
SSLEngineResult sslResult = null;
// Build the required callback.
MyHandshakeCompletedCallback callback = null;
// Flag if an error took place
IOException exception = null;
// Only create the callback if this is for an async request.
if (async) {
callback = new MyHandshakeCompletedCallback(this, netBuffer, decryptedNetBuffer, encryptedAppBuffer, FlowType.OUTBOUND);
}
try {
// Start the aynchronous SSL handshake.
sslResult = SSLUtils.handleHandshake(this, netBuffer, decryptedNetBuffer,
encryptedAppBuffer, sslResult, callback, false);
// Check to see if the work was able to be done synchronously.
if (sslResult != null) {
// Handshake was done synchronously.
readyOutboundPostHandshake(netBuffer, decryptedNetBuffer,
encryptedAppBuffer, sslResult.getHandshakeStatus(), async);
}
} catch (IOException e) {
exception = e;
} catch (ReadOnlyBufferException e) {
exception = new IOException("Caught exception: " + e);
}
if (exception != null) {
FFDCFilter.processException(exception, getClass().getName(), "540", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught exception during handshake after connect, " + exception);
}
// Release the buffers.
if (netBuffer != null) {
netBuffer.release();
netBuffer = null;
getDeviceReadInterface().setBuffers(null);
}
if (decryptedNetBuffer != null) {
decryptedNetBuffer.release();
decryptedNetBuffer = null;
}
if (encryptedAppBuffer != null) {
encryptedAppBuffer.release();
encryptedAppBuffer = null;
}
if (async) {
close(inVC, exception);
} else {
this.syncConnectFailure = true;
close(inVC, exception);
throw exception;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyOutbound");
}
return;
} | java | private void readyOutbound(VirtualConnection inVC, boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyOutbound, vc=" + getVCHash());
}
final SSLChannelData config = this.sslChannel.getConfig();
// Encrypted buffer from the network.
WsByteBuffer netBuffer = SSLUtils.allocateByteBuffer(getPacketBufferSize(), config.getEncryptBuffersDirect());
// Unencrypted buffer from the ssl engine output to be handed up to the application.
WsByteBuffer decryptedNetBuffer = SSLUtils.allocateByteBuffer(getAppBufferSize(), config.getDecryptBuffersDirect());
// Encrypted buffer from the ssl engine to be sent sent out on the network.
WsByteBuffer encryptedAppBuffer = SSLUtils.allocateByteBuffer(getPacketBufferSize(), true);
// Result from the SSL engine.
SSLEngineResult sslResult = null;
// Build the required callback.
MyHandshakeCompletedCallback callback = null;
// Flag if an error took place
IOException exception = null;
// Only create the callback if this is for an async request.
if (async) {
callback = new MyHandshakeCompletedCallback(this, netBuffer, decryptedNetBuffer, encryptedAppBuffer, FlowType.OUTBOUND);
}
try {
// Start the aynchronous SSL handshake.
sslResult = SSLUtils.handleHandshake(this, netBuffer, decryptedNetBuffer,
encryptedAppBuffer, sslResult, callback, false);
// Check to see if the work was able to be done synchronously.
if (sslResult != null) {
// Handshake was done synchronously.
readyOutboundPostHandshake(netBuffer, decryptedNetBuffer,
encryptedAppBuffer, sslResult.getHandshakeStatus(), async);
}
} catch (IOException e) {
exception = e;
} catch (ReadOnlyBufferException e) {
exception = new IOException("Caught exception: " + e);
}
if (exception != null) {
FFDCFilter.processException(exception, getClass().getName(), "540", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught exception during handshake after connect, " + exception);
}
// Release the buffers.
if (netBuffer != null) {
netBuffer.release();
netBuffer = null;
getDeviceReadInterface().setBuffers(null);
}
if (decryptedNetBuffer != null) {
decryptedNetBuffer.release();
decryptedNetBuffer = null;
}
if (encryptedAppBuffer != null) {
encryptedAppBuffer.release();
encryptedAppBuffer = null;
}
if (async) {
close(inVC, exception);
} else {
this.syncConnectFailure = true;
close(inVC, exception);
throw exception;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyOutbound");
}
return;
} | [
"private",
"void",
"readyOutbound",
"(",
"VirtualConnection",
"inVC",
",",
"boolean",
"async",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"readyOutbound, vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"final",
"SSLChannelData",
"config",
"=",
"this",
".",
"sslChannel",
".",
"getConfig",
"(",
")",
";",
"// Encrypted buffer from the network.",
"WsByteBuffer",
"netBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"getPacketBufferSize",
"(",
")",
",",
"config",
".",
"getEncryptBuffersDirect",
"(",
")",
")",
";",
"// Unencrypted buffer from the ssl engine output to be handed up to the application.",
"WsByteBuffer",
"decryptedNetBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"getAppBufferSize",
"(",
")",
",",
"config",
".",
"getDecryptBuffersDirect",
"(",
")",
")",
";",
"// Encrypted buffer from the ssl engine to be sent sent out on the network.",
"WsByteBuffer",
"encryptedAppBuffer",
"=",
"SSLUtils",
".",
"allocateByteBuffer",
"(",
"getPacketBufferSize",
"(",
")",
",",
"true",
")",
";",
"// Result from the SSL engine.",
"SSLEngineResult",
"sslResult",
"=",
"null",
";",
"// Build the required callback.",
"MyHandshakeCompletedCallback",
"callback",
"=",
"null",
";",
"// Flag if an error took place",
"IOException",
"exception",
"=",
"null",
";",
"// Only create the callback if this is for an async request.",
"if",
"(",
"async",
")",
"{",
"callback",
"=",
"new",
"MyHandshakeCompletedCallback",
"(",
"this",
",",
"netBuffer",
",",
"decryptedNetBuffer",
",",
"encryptedAppBuffer",
",",
"FlowType",
".",
"OUTBOUND",
")",
";",
"}",
"try",
"{",
"// Start the aynchronous SSL handshake.",
"sslResult",
"=",
"SSLUtils",
".",
"handleHandshake",
"(",
"this",
",",
"netBuffer",
",",
"decryptedNetBuffer",
",",
"encryptedAppBuffer",
",",
"sslResult",
",",
"callback",
",",
"false",
")",
";",
"// Check to see if the work was able to be done synchronously.",
"if",
"(",
"sslResult",
"!=",
"null",
")",
"{",
"// Handshake was done synchronously.",
"readyOutboundPostHandshake",
"(",
"netBuffer",
",",
"decryptedNetBuffer",
",",
"encryptedAppBuffer",
",",
"sslResult",
".",
"getHandshakeStatus",
"(",
")",
",",
"async",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"exception",
"=",
"e",
";",
"}",
"catch",
"(",
"ReadOnlyBufferException",
"e",
")",
"{",
"exception",
"=",
"new",
"IOException",
"(",
"\"Caught exception: \"",
"+",
"e",
")",
";",
"}",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"exception",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"\"540\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Caught exception during handshake after connect, \"",
"+",
"exception",
")",
";",
"}",
"// Release the buffers.",
"if",
"(",
"netBuffer",
"!=",
"null",
")",
"{",
"netBuffer",
".",
"release",
"(",
")",
";",
"netBuffer",
"=",
"null",
";",
"getDeviceReadInterface",
"(",
")",
".",
"setBuffers",
"(",
"null",
")",
";",
"}",
"if",
"(",
"decryptedNetBuffer",
"!=",
"null",
")",
"{",
"decryptedNetBuffer",
".",
"release",
"(",
")",
";",
"decryptedNetBuffer",
"=",
"null",
";",
"}",
"if",
"(",
"encryptedAppBuffer",
"!=",
"null",
")",
"{",
"encryptedAppBuffer",
".",
"release",
"(",
")",
";",
"encryptedAppBuffer",
"=",
"null",
";",
"}",
"if",
"(",
"async",
")",
"{",
"close",
"(",
"inVC",
",",
"exception",
")",
";",
"}",
"else",
"{",
"this",
".",
"syncConnectFailure",
"=",
"true",
";",
"close",
"(",
"inVC",
",",
"exception",
")",
";",
"throw",
"exception",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"readyOutbound\"",
")",
";",
"}",
"return",
";",
"}"
] | Handle work required by the ready method for outbound connections. When called, the
outbound socket has been established. Establish the SSL connection before reporting
to the next channel. Note, this method is called in both sync and async flows.
@param inVC virtual connection associated with this request
@param async flag for asynchronous (true) or synchronous (false)
@throws IOException | [
"Handle",
"work",
"required",
"by",
"the",
"ready",
"method",
"for",
"outbound",
"connections",
".",
"When",
"called",
"the",
"outbound",
"socket",
"has",
"been",
"established",
".",
"Establish",
"the",
"SSL",
"connection",
"before",
"reporting",
"to",
"the",
"next",
"channel",
".",
"Note",
"this",
"method",
"is",
"called",
"in",
"both",
"sync",
"and",
"async",
"flows",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java#L753-L825 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java | SSLConnectionLink.readyOutboundPostHandshake | protected void readyOutboundPostHandshake(
WsByteBuffer netBuffer,
WsByteBuffer decryptedNetBuffer,
WsByteBuffer encryptedAppBuffer,
HandshakeStatus hsStatus,
boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyOutboundPostHandshake, vc=" + getVCHash());
}
// Exception to call destroy with in case of bad return code from SSL engine.
IOException exception = null;
if (hsStatus != HandshakeStatus.FINISHED) {
// Handshake failed.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unexpected results of handshake after connect, " + hsStatus);
}
exception = new IOException("Unexpected results of handshake after connect, " + hsStatus);
}
// PK16095 - take certain actions when the handshake completes
getChannel().onHandshakeFinish(getSSLEngine());
// Null out the buffer references on the device side so they don't wrongly reused later.
getDeviceReadInterface().setBuffers(null);
// Clean up the buffers.
// PI48725 Start
// Handshake complete. Now get the request. Use our read interface so unwrap already done.
// Check if data exists in the network buffer still. This would be app data beyond handshake.
if (netBuffer.remaining() == 0 || netBuffer.position() == 0) {
// No app data. Release the netBuffer as it will no longer be used.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing netBuffer: " + netBuffer.hashCode());
}
// Null out the buffer references on the device side so they don't wrongly reused later.
netBuffer.release();
} else {
// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "App data exists in netBuffer after handshake: " + netBuffer.remaining());
}
this.readInterface.setNetBuffer(netBuffer);
}
// PI48725 Finish
// Clean up the buffers.
decryptedNetBuffer.release();
encryptedAppBuffer.release();
// Call appropriate callback if async
if (async) {
if (exception != null) {
close(getVirtualConnection(), exception);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling ready method.");
}
super.ready(getVirtualConnection());
}
} else {
if (exception != null) {
throw exception;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyOutboundPostHandshake");
}
} | java | protected void readyOutboundPostHandshake(
WsByteBuffer netBuffer,
WsByteBuffer decryptedNetBuffer,
WsByteBuffer encryptedAppBuffer,
HandshakeStatus hsStatus,
boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyOutboundPostHandshake, vc=" + getVCHash());
}
// Exception to call destroy with in case of bad return code from SSL engine.
IOException exception = null;
if (hsStatus != HandshakeStatus.FINISHED) {
// Handshake failed.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unexpected results of handshake after connect, " + hsStatus);
}
exception = new IOException("Unexpected results of handshake after connect, " + hsStatus);
}
// PK16095 - take certain actions when the handshake completes
getChannel().onHandshakeFinish(getSSLEngine());
// Null out the buffer references on the device side so they don't wrongly reused later.
getDeviceReadInterface().setBuffers(null);
// Clean up the buffers.
// PI48725 Start
// Handshake complete. Now get the request. Use our read interface so unwrap already done.
// Check if data exists in the network buffer still. This would be app data beyond handshake.
if (netBuffer.remaining() == 0 || netBuffer.position() == 0) {
// No app data. Release the netBuffer as it will no longer be used.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing netBuffer: " + netBuffer.hashCode());
}
// Null out the buffer references on the device side so they don't wrongly reused later.
netBuffer.release();
} else {
// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "App data exists in netBuffer after handshake: " + netBuffer.remaining());
}
this.readInterface.setNetBuffer(netBuffer);
}
// PI48725 Finish
// Clean up the buffers.
decryptedNetBuffer.release();
encryptedAppBuffer.release();
// Call appropriate callback if async
if (async) {
if (exception != null) {
close(getVirtualConnection(), exception);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling ready method.");
}
super.ready(getVirtualConnection());
}
} else {
if (exception != null) {
throw exception;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyOutboundPostHandshake");
}
} | [
"protected",
"void",
"readyOutboundPostHandshake",
"(",
"WsByteBuffer",
"netBuffer",
",",
"WsByteBuffer",
"decryptedNetBuffer",
",",
"WsByteBuffer",
"encryptedAppBuffer",
",",
"HandshakeStatus",
"hsStatus",
",",
"boolean",
"async",
")",
"throws",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"readyOutboundPostHandshake, vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"// Exception to call destroy with in case of bad return code from SSL engine.",
"IOException",
"exception",
"=",
"null",
";",
"if",
"(",
"hsStatus",
"!=",
"HandshakeStatus",
".",
"FINISHED",
")",
"{",
"// Handshake failed.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Unexpected results of handshake after connect, \"",
"+",
"hsStatus",
")",
";",
"}",
"exception",
"=",
"new",
"IOException",
"(",
"\"Unexpected results of handshake after connect, \"",
"+",
"hsStatus",
")",
";",
"}",
"// PK16095 - take certain actions when the handshake completes",
"getChannel",
"(",
")",
".",
"onHandshakeFinish",
"(",
"getSSLEngine",
"(",
")",
")",
";",
"// Null out the buffer references on the device side so they don't wrongly reused later.",
"getDeviceReadInterface",
"(",
")",
".",
"setBuffers",
"(",
"null",
")",
";",
"// Clean up the buffers.",
"// PI48725 Start",
"// Handshake complete. Now get the request. Use our read interface so unwrap already done.",
"// Check if data exists in the network buffer still. This would be app data beyond handshake.",
"if",
"(",
"netBuffer",
".",
"remaining",
"(",
")",
"==",
"0",
"||",
"netBuffer",
".",
"position",
"(",
")",
"==",
"0",
")",
"{",
"// No app data. Release the netBuffer as it will no longer be used.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Releasing netBuffer: \"",
"+",
"netBuffer",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"// Null out the buffer references on the device side so they don't wrongly reused later.",
"netBuffer",
".",
"release",
"(",
")",
";",
"}",
"else",
"{",
"// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"App data exists in netBuffer after handshake: \"",
"+",
"netBuffer",
".",
"remaining",
"(",
")",
")",
";",
"}",
"this",
".",
"readInterface",
".",
"setNetBuffer",
"(",
"netBuffer",
")",
";",
"}",
"// PI48725 Finish",
"// Clean up the buffers.",
"decryptedNetBuffer",
".",
"release",
"(",
")",
";",
"encryptedAppBuffer",
".",
"release",
"(",
")",
";",
"// Call appropriate callback if async",
"if",
"(",
"async",
")",
"{",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"close",
"(",
"getVirtualConnection",
"(",
")",
",",
"exception",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Calling ready method.\"",
")",
";",
"}",
"super",
".",
"ready",
"(",
"getVirtualConnection",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"exception",
"!=",
"null",
")",
"{",
"throw",
"exception",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"readyOutboundPostHandshake\"",
")",
";",
"}",
"}"
] | This method is called to handle the results of an SSL handshake. This may be called
by a callback or in the same thread as the connect request.
@param netBuffer buffer for data flowing in fron the net
@param decryptedNetBuffer buffer for decrypted data from the net
@param encryptedAppBuffer buffer for encrypted data flowing from the app
@param hsStatus output from the last call to the SSL engine
@param async whether this is for an async (true) or sync (false) request
@throws IOException | [
"This",
"method",
"is",
"called",
"to",
"handle",
"the",
"results",
"of",
"an",
"SSL",
"handshake",
".",
"This",
"may",
"be",
"called",
"by",
"a",
"callback",
"or",
"in",
"the",
"same",
"thread",
"as",
"the",
"connect",
"request",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java#L838-L910 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java | SSLConnectionLink.handleRedundantConnect | private void handleRedundantConnect() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "handleRedundantConnect, vc=" + getVCHash());
}
// This conn link has already been connected.
// Need to shut get a new SSL engine.
cleanup();
// PK46069 - use engine that allows session id re-use
sslEngine = SSLUtils.getOutboundSSLEngine(
sslContext, getLinkConfig(),
targetAddress.getRemoteAddress().getHostName(),
targetAddress.getRemoteAddress().getPort(),
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "New SSL engine=" + getSSLEngine().hashCode() + " for vc=" + getVCHash());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "handleRedundantConnect");
}
} | java | private void handleRedundantConnect() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "handleRedundantConnect, vc=" + getVCHash());
}
// This conn link has already been connected.
// Need to shut get a new SSL engine.
cleanup();
// PK46069 - use engine that allows session id re-use
sslEngine = SSLUtils.getOutboundSSLEngine(
sslContext, getLinkConfig(),
targetAddress.getRemoteAddress().getHostName(),
targetAddress.getRemoteAddress().getPort(),
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "New SSL engine=" + getSSLEngine().hashCode() + " for vc=" + getVCHash());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "handleRedundantConnect");
}
} | [
"private",
"void",
"handleRedundantConnect",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"handleRedundantConnect, vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"// This conn link has already been connected.",
"// Need to shut get a new SSL engine.",
"cleanup",
"(",
")",
";",
"// PK46069 - use engine that allows session id re-use",
"sslEngine",
"=",
"SSLUtils",
".",
"getOutboundSSLEngine",
"(",
"sslContext",
",",
"getLinkConfig",
"(",
")",
",",
"targetAddress",
".",
"getRemoteAddress",
"(",
")",
".",
"getHostName",
"(",
")",
",",
"targetAddress",
".",
"getRemoteAddress",
"(",
")",
".",
"getPort",
"(",
")",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"New SSL engine=\"",
"+",
"getSSLEngine",
"(",
")",
".",
"hashCode",
"(",
")",
"+",
"\" for vc=\"",
"+",
"getVCHash",
"(",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"handleRedundantConnect\"",
")",
";",
"}",
"}"
] | This method is called if connect or connectAsync are called redundantly, after
the connection is already established. It cleans up the SSL engine. The connect
methods will then pass the connect on down the chain where, eventually, a new
socket will be established with this virtual connection. | [
"This",
"method",
"is",
"called",
"if",
"connect",
"or",
"connectAsync",
"are",
"called",
"redundantly",
"after",
"the",
"connection",
"is",
"already",
"established",
".",
"It",
"cleans",
"up",
"the",
"SSL",
"engine",
".",
"The",
"connect",
"methods",
"will",
"then",
"pass",
"the",
"connect",
"on",
"down",
"the",
"chain",
"where",
"eventually",
"a",
"new",
"socket",
"will",
"be",
"established",
"with",
"this",
"virtual",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java#L918-L937 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java | SSLConnectionLink.setAlpnProtocol | public void setAlpnProtocol(String protocol) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setAlpnProtocol: " + protocol + " " + this);
}
this.alpnProtocol = protocol;
this.sslConnectionContext.setAlpnProtocol(protocol);
} | java | public void setAlpnProtocol(String protocol) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setAlpnProtocol: " + protocol + " " + this);
}
this.alpnProtocol = protocol;
this.sslConnectionContext.setAlpnProtocol(protocol);
} | [
"public",
"void",
"setAlpnProtocol",
"(",
"String",
"protocol",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setAlpnProtocol: \"",
"+",
"protocol",
"+",
"\" \"",
"+",
"this",
")",
";",
"}",
"this",
".",
"alpnProtocol",
"=",
"protocol",
";",
"this",
".",
"sslConnectionContext",
".",
"setAlpnProtocol",
"(",
"protocol",
")",
";",
"}"
] | Set the ALPN protocol negotiated for this link
@param String protocol | [
"Set",
"the",
"ALPN",
"protocol",
"negotiated",
"for",
"this",
"link"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLConnectionLink.java#L1255-L1261 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannel.java | UDPChannel.destroyConnLinks | private void destroyConnLinks() {
synchronized (inUse) {
int numlinks = inUse.size();
for (int i = 0; i < numlinks; i++) {
inUse.removeFirst().destroy(null);
}
}
} | java | private void destroyConnLinks() {
synchronized (inUse) {
int numlinks = inUse.size();
for (int i = 0; i < numlinks; i++) {
inUse.removeFirst().destroy(null);
}
}
} | [
"private",
"void",
"destroyConnLinks",
"(",
")",
"{",
"synchronized",
"(",
"inUse",
")",
"{",
"int",
"numlinks",
"=",
"inUse",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numlinks",
";",
"i",
"++",
")",
"{",
"inUse",
".",
"removeFirst",
"(",
")",
".",
"destroy",
"(",
"null",
")",
";",
"}",
"}",
"}"
] | call the destroy on all the UDPConnLink objects related to this
UDPChannel which are currently "in use". | [
"call",
"the",
"destroy",
"on",
"all",
"the",
"UDPConnLink",
"objects",
"related",
"to",
"this",
"UDPChannel",
"which",
"are",
"currently",
"in",
"use",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannel.java#L304-L311 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannel.java | UDPChannel.verifySender | public boolean verifySender(InetAddress remoteAddr) {
boolean returnValue = true;
if (alists != null) {
returnValue = !alists.accessDenied(remoteAddr);
}
return returnValue;
} | java | public boolean verifySender(InetAddress remoteAddr) {
boolean returnValue = true;
if (alists != null) {
returnValue = !alists.accessDenied(remoteAddr);
}
return returnValue;
} | [
"public",
"boolean",
"verifySender",
"(",
"InetAddress",
"remoteAddr",
")",
"{",
"boolean",
"returnValue",
"=",
"true",
";",
"if",
"(",
"alists",
"!=",
"null",
")",
"{",
"returnValue",
"=",
"!",
"alists",
".",
"accessDenied",
"(",
"remoteAddr",
")",
";",
"}",
"return",
"returnValue",
";",
"}"
] | Verify whether the remote address is allowed to communicated with the
channel.
@param remoteAddr
@return boolean - false means it is denied | [
"Verify",
"whether",
"the",
"remote",
"address",
"is",
"allowed",
"to",
"communicated",
"with",
"the",
"channel",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/UDPChannel.java#L324-L331 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java | IPAddressRange.aboveRange | public boolean aboveRange(InetAddress ip) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "aboveRange, ip is " + ip);
Tr.debug(tc, "aboveRange, ip is " + ip);
}
return greaterThan(ip, ipHigher);
} | java | public boolean aboveRange(InetAddress ip) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "aboveRange, ip is " + ip);
Tr.debug(tc, "aboveRange, ip is " + ip);
}
return greaterThan(ip, ipHigher);
} | [
"public",
"boolean",
"aboveRange",
"(",
"InetAddress",
"ip",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"aboveRange, ip is \"",
"+",
"ip",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"aboveRange, ip is \"",
"+",
"ip",
")",
";",
"}",
"return",
"greaterThan",
"(",
"ip",
",",
"ipHigher",
")",
";",
"}"
] | Is the given ip address numericaly above the address range?
Is it above ipHigher? | [
"Is",
"the",
"given",
"ip",
"address",
"numericaly",
"above",
"the",
"address",
"range?",
"Is",
"it",
"above",
"ipHigher?"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java#L233-L239 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java | IPAddressRange.belowRange | public boolean belowRange(InetAddress ip) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "belowRange, ip is " + ip);
Tr.debug(tc, "belowRange, ipLower is " + ipLower);
}
return lessThan(ip, ipLower);
} | java | public boolean belowRange(InetAddress ip) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "belowRange, ip is " + ip);
Tr.debug(tc, "belowRange, ipLower is " + ipLower);
}
return lessThan(ip, ipLower);
} | [
"public",
"boolean",
"belowRange",
"(",
"InetAddress",
"ip",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"belowRange, ip is \"",
"+",
"ip",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"belowRange, ipLower is \"",
"+",
"ipLower",
")",
";",
"}",
"return",
"lessThan",
"(",
"ip",
",",
"ipLower",
")",
";",
"}"
] | Is the given ip address numerically below the address range?
Is it below ipLower?
@param ip
@return | [
"Is",
"the",
"given",
"ip",
"address",
"numerically",
"below",
"the",
"address",
"range?",
"Is",
"it",
"below",
"ipLower?"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java#L248-L254 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.metrics.cdi/src/io/astefanutti/metrics/cdi/SeMetricName.java | SeMetricName.metadataValueOf | private String metadataValueOf(String value) {
if (value == null || value.trim().isEmpty())
return null;
return value;
} | java | private String metadataValueOf(String value) {
if (value == null || value.trim().isEmpty())
return null;
return value;
} | [
"private",
"String",
"metadataValueOf",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"return",
"null",
";",
"return",
"value",
";",
"}"
] | Since annotations have the default value of "", convert it to null.
@param value
@return The value of the metadata field if present, null otherwise | [
"Since",
"annotations",
"have",
"the",
"default",
"value",
"of",
"convert",
"it",
"to",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics.cdi/src/io/astefanutti/metrics/cdi/SeMetricName.java#L167-L171 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolImplThreadSafe.java | PoolImplThreadSafe.get | @Override
public final Object get() {
Object o = buffer.pop();
if (beanPerf != null) { // Update PMI data
beanPerf.objectRetrieve(buffer.size(), (o != null));
}
return o;
} | java | @Override
public final Object get() {
Object o = buffer.pop();
if (beanPerf != null) { // Update PMI data
beanPerf.objectRetrieve(buffer.size(), (o != null));
}
return o;
} | [
"@",
"Override",
"public",
"final",
"Object",
"get",
"(",
")",
"{",
"Object",
"o",
"=",
"buffer",
".",
"pop",
"(",
")",
";",
"if",
"(",
"beanPerf",
"!=",
"null",
")",
"{",
"// Update PMI data",
"beanPerf",
".",
"objectRetrieve",
"(",
"buffer",
".",
"size",
"(",
")",
",",
"(",
"o",
"!=",
"null",
")",
")",
";",
"}",
"return",
"o",
";",
"}"
] | Retrieve an object from this pool.
@return This method will return null if this pool is empty. | [
"Retrieve",
"an",
"object",
"from",
"this",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolImplThreadSafe.java#L149-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolImplThreadSafe.java | PoolImplThreadSafe.put | @Override
public final void put(Object o) {
boolean discarded = false;
if (inactive) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setting active: " + this);
// If the pool was marked inactive by the pool manager alarm, then
// switch it back to active. Hopefully this happens before too
// many other threads notice and cause contention with the
// following sync block.
inactive = false;
// If this pool has been inactive long enough to be marked
// unmanaged, then add it back as managed again.
synchronized (this) {
if (!ivManaged) {
poolMgr.add(this);
ivManaged = true;
}
}
}
discarded = !buffer.pushWithLimit(o, poolSize.maxSize);
if (discarded) {
if (discardStrategy != null) {
discardStrategy.discard(o);
}
}
if (beanPerf != null) { // Update PMI data
beanPerf.objectReturn(buffer.size(), discarded);
}
} | java | @Override
public final void put(Object o) {
boolean discarded = false;
if (inactive) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setting active: " + this);
// If the pool was marked inactive by the pool manager alarm, then
// switch it back to active. Hopefully this happens before too
// many other threads notice and cause contention with the
// following sync block.
inactive = false;
// If this pool has been inactive long enough to be marked
// unmanaged, then add it back as managed again.
synchronized (this) {
if (!ivManaged) {
poolMgr.add(this);
ivManaged = true;
}
}
}
discarded = !buffer.pushWithLimit(o, poolSize.maxSize);
if (discarded) {
if (discardStrategy != null) {
discardStrategy.discard(o);
}
}
if (beanPerf != null) { // Update PMI data
beanPerf.objectReturn(buffer.size(), discarded);
}
} | [
"@",
"Override",
"public",
"final",
"void",
"put",
"(",
"Object",
"o",
")",
"{",
"boolean",
"discarded",
"=",
"false",
";",
"if",
"(",
"inactive",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setting active: \"",
"+",
"this",
")",
";",
"// If the pool was marked inactive by the pool manager alarm, then",
"// switch it back to active. Hopefully this happens before too",
"// many other threads notice and cause contention with the",
"// following sync block.",
"inactive",
"=",
"false",
";",
"// If this pool has been inactive long enough to be marked",
"// unmanaged, then add it back as managed again.",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"ivManaged",
")",
"{",
"poolMgr",
".",
"add",
"(",
"this",
")",
";",
"ivManaged",
"=",
"true",
";",
"}",
"}",
"}",
"discarded",
"=",
"!",
"buffer",
".",
"pushWithLimit",
"(",
"o",
",",
"poolSize",
".",
"maxSize",
")",
";",
"if",
"(",
"discarded",
")",
"{",
"if",
"(",
"discardStrategy",
"!=",
"null",
")",
"{",
"discardStrategy",
".",
"discard",
"(",
"o",
")",
";",
"}",
"}",
"if",
"(",
"beanPerf",
"!=",
"null",
")",
"{",
"// Update PMI data",
"beanPerf",
".",
"objectReturn",
"(",
"buffer",
".",
"size",
"(",
")",
",",
"discarded",
")",
";",
"}",
"}"
] | Return an object instance to this pool.
<p>
If there is no room left in the pool the instance will be discarded; in
that case if the PooledObject or DiscardStrategy interfaces are being
used, the appropriate callback method will be called. | [
"Return",
"an",
"object",
"instance",
"to",
"this",
"pool",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolImplThreadSafe.java#L169-L204 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolImplThreadSafe.java | PoolImplThreadSafe.periodicDrain | @Override
final void periodicDrain() {
// Drain to the minimum size but only by the maxDrainAmount.
// This slows the drain process, allowing for the pool to become
// active before becoming fully drained (to minimum level).
SizeData size = poolSize;
int numDiscarded = drainToSize(size.minSize, size.maxDrainAmount);
// When a pool becomes inactive, and is drained to the minimum level
// then there is really no point to continue calling periodicDrain.
// To avoid this, the pool is removed from the list of managed pools,
// and since the pool has a reference to the pool manager, it can
// easily add itself back to the list if it becomes active again.
// Note that this has the side effect of allowing orphaned pools
// to be garbage collected... since the PoolManager will also drop
// its reference. d376426
if (numDiscarded == 0) {
// Do not remove immediately, but keep a count and only
// remove after a few iterations of no drain... to avoid
// some of the churn of add/remove for pools that are
// used regularly, but lightly.
++ivInactiveNoDrainCount;
if (ivInactiveNoDrainCount > 4) {
synchronized (this) {
poolMgr.remove(this);
ivManaged = false;
}
// Reset the count for the next time it becomes active.
ivInactiveNoDrainCount = 0;
}
} else
ivInactiveNoDrainCount = 0;
} | java | @Override
final void periodicDrain() {
// Drain to the minimum size but only by the maxDrainAmount.
// This slows the drain process, allowing for the pool to become
// active before becoming fully drained (to minimum level).
SizeData size = poolSize;
int numDiscarded = drainToSize(size.minSize, size.maxDrainAmount);
// When a pool becomes inactive, and is drained to the minimum level
// then there is really no point to continue calling periodicDrain.
// To avoid this, the pool is removed from the list of managed pools,
// and since the pool has a reference to the pool manager, it can
// easily add itself back to the list if it becomes active again.
// Note that this has the side effect of allowing orphaned pools
// to be garbage collected... since the PoolManager will also drop
// its reference. d376426
if (numDiscarded == 0) {
// Do not remove immediately, but keep a count and only
// remove after a few iterations of no drain... to avoid
// some of the churn of add/remove for pools that are
// used regularly, but lightly.
++ivInactiveNoDrainCount;
if (ivInactiveNoDrainCount > 4) {
synchronized (this) {
poolMgr.remove(this);
ivManaged = false;
}
// Reset the count for the next time it becomes active.
ivInactiveNoDrainCount = 0;
}
} else
ivInactiveNoDrainCount = 0;
} | [
"@",
"Override",
"final",
"void",
"periodicDrain",
"(",
")",
"{",
"// Drain to the minimum size but only by the maxDrainAmount.",
"// This slows the drain process, allowing for the pool to become",
"// active before becoming fully drained (to minimum level).",
"SizeData",
"size",
"=",
"poolSize",
";",
"int",
"numDiscarded",
"=",
"drainToSize",
"(",
"size",
".",
"minSize",
",",
"size",
".",
"maxDrainAmount",
")",
";",
"// When a pool becomes inactive, and is drained to the minimum level",
"// then there is really no point to continue calling periodicDrain.",
"// To avoid this, the pool is removed from the list of managed pools,",
"// and since the pool has a reference to the pool manager, it can",
"// easily add itself back to the list if it becomes active again.",
"// Note that this has the side effect of allowing orphaned pools",
"// to be garbage collected... since the PoolManager will also drop",
"// its reference. d376426",
"if",
"(",
"numDiscarded",
"==",
"0",
")",
"{",
"// Do not remove immediately, but keep a count and only",
"// remove after a few iterations of no drain... to avoid",
"// some of the churn of add/remove for pools that are",
"// used regularly, but lightly.",
"++",
"ivInactiveNoDrainCount",
";",
"if",
"(",
"ivInactiveNoDrainCount",
">",
"4",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"poolMgr",
".",
"remove",
"(",
"this",
")",
";",
"ivManaged",
"=",
"false",
";",
"}",
"// Reset the count for the next time it becomes active.",
"ivInactiveNoDrainCount",
"=",
"0",
";",
"}",
"}",
"else",
"ivInactiveNoDrainCount",
"=",
"0",
";",
"}"
] | Remove a percentage of the elements from this pool down to its minimum
value. If the pool becomes active while draining discontinue. | [
"Remove",
"a",
"percentage",
"of",
"the",
"elements",
"from",
"this",
"pool",
"down",
"to",
"its",
"minimum",
"value",
".",
"If",
"the",
"pool",
"becomes",
"active",
"while",
"draining",
"discontinue",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/PoolImplThreadSafe.java#L210-L243 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java | ResponseMessage.init | public void init(HttpInboundConnection conn, RequestMessage req) {
this.request = req;
this.response = conn.getResponse();
this.connection = conn;
this.outStream = new ResponseBody(this.response.getBody());
this.locale = Locale.getDefault();
} | java | public void init(HttpInboundConnection conn, RequestMessage req) {
this.request = req;
this.response = conn.getResponse();
this.connection = conn;
this.outStream = new ResponseBody(this.response.getBody());
this.locale = Locale.getDefault();
} | [
"public",
"void",
"init",
"(",
"HttpInboundConnection",
"conn",
",",
"RequestMessage",
"req",
")",
"{",
"this",
".",
"request",
"=",
"req",
";",
"this",
".",
"response",
"=",
"conn",
".",
"getResponse",
"(",
")",
";",
"this",
".",
"connection",
"=",
"conn",
";",
"this",
".",
"outStream",
"=",
"new",
"ResponseBody",
"(",
"this",
".",
"response",
".",
"getBody",
"(",
")",
")",
";",
"this",
".",
"locale",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"}"
] | Initialize this response message with the input connection.
@param conn
@param req | [
"Initialize",
"this",
"response",
"message",
"with",
"the",
"input",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java#L76-L82 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java | ResponseMessage.clear | public void clear() {
this.contentType = null;
this.encoding = null;
this.locale = null;
this.outStream = null;
this.outWriter = null;
this.streamActive = false;
} | java | public void clear() {
this.contentType = null;
this.encoding = null;
this.locale = null;
this.outStream = null;
this.outWriter = null;
this.streamActive = false;
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"this",
".",
"contentType",
"=",
"null",
";",
"this",
".",
"encoding",
"=",
"null",
";",
"this",
".",
"locale",
"=",
"null",
";",
"this",
".",
"outStream",
"=",
"null",
";",
"this",
".",
"outWriter",
"=",
"null",
";",
"this",
".",
"streamActive",
"=",
"false",
";",
"}"
] | Clear all the temporary variables of this response. | [
"Clear",
"all",
"the",
"temporary",
"variables",
"of",
"this",
"response",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java#L87-L94 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java | ResponseMessage.convertURItoURL | private String convertURItoURL(String uri) {
int indexScheme = uri.indexOf("://");
if (-1 != indexScheme) {
int indexQuery = uri.indexOf('?');
if (-1 == indexQuery || indexScheme < indexQuery) {
// already a full url
return uri;
}
}
StringBuilder sb = new StringBuilder();
String scheme = this.request.getScheme();
sb.append(scheme).append("://");
sb.append(this.request.getServerName());
int port = this.request.getServerPort();
if ("http".equalsIgnoreCase(scheme) && 80 != port) {
sb.append(':').append(port);
} else if ("https".equalsIgnoreCase(scheme) && 443 != port) {
sb.append(':').append(port);
}
String data = this.request.getContextPath();
if (!"".equals(data)) {
sb.append(data);
}
if (0 == uri.length()) {
sb.append('/');
} else if (uri.charAt(0) == '/') {
// relative to servlet container root...
sb.append(uri);
} else {
// relative to current URI,
data = this.request.getServletPath();
if (!"".equals(data)) {
sb.append(data);
}
data = this.request.getPathInfo();
if (null != data) {
sb.append(data);
}
sb.append('/');
sb.append(uri);
// TODO: webcontainer converted "/./" and "/../" info too
}
return sb.toString();
} | java | private String convertURItoURL(String uri) {
int indexScheme = uri.indexOf("://");
if (-1 != indexScheme) {
int indexQuery = uri.indexOf('?');
if (-1 == indexQuery || indexScheme < indexQuery) {
// already a full url
return uri;
}
}
StringBuilder sb = new StringBuilder();
String scheme = this.request.getScheme();
sb.append(scheme).append("://");
sb.append(this.request.getServerName());
int port = this.request.getServerPort();
if ("http".equalsIgnoreCase(scheme) && 80 != port) {
sb.append(':').append(port);
} else if ("https".equalsIgnoreCase(scheme) && 443 != port) {
sb.append(':').append(port);
}
String data = this.request.getContextPath();
if (!"".equals(data)) {
sb.append(data);
}
if (0 == uri.length()) {
sb.append('/');
} else if (uri.charAt(0) == '/') {
// relative to servlet container root...
sb.append(uri);
} else {
// relative to current URI,
data = this.request.getServletPath();
if (!"".equals(data)) {
sb.append(data);
}
data = this.request.getPathInfo();
if (null != data) {
sb.append(data);
}
sb.append('/');
sb.append(uri);
// TODO: webcontainer converted "/./" and "/../" info too
}
return sb.toString();
} | [
"private",
"String",
"convertURItoURL",
"(",
"String",
"uri",
")",
"{",
"int",
"indexScheme",
"=",
"uri",
".",
"indexOf",
"(",
"\"://\"",
")",
";",
"if",
"(",
"-",
"1",
"!=",
"indexScheme",
")",
"{",
"int",
"indexQuery",
"=",
"uri",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"-",
"1",
"==",
"indexQuery",
"||",
"indexScheme",
"<",
"indexQuery",
")",
"{",
"// already a full url",
"return",
"uri",
";",
"}",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"scheme",
"=",
"this",
".",
"request",
".",
"getScheme",
"(",
")",
";",
"sb",
".",
"append",
"(",
"scheme",
")",
".",
"append",
"(",
"\"://\"",
")",
";",
"sb",
".",
"append",
"(",
"this",
".",
"request",
".",
"getServerName",
"(",
")",
")",
";",
"int",
"port",
"=",
"this",
".",
"request",
".",
"getServerPort",
"(",
")",
";",
"if",
"(",
"\"http\"",
".",
"equalsIgnoreCase",
"(",
"scheme",
")",
"&&",
"80",
"!=",
"port",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"port",
")",
";",
"}",
"else",
"if",
"(",
"\"https\"",
".",
"equalsIgnoreCase",
"(",
"scheme",
")",
"&&",
"443",
"!=",
"port",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"port",
")",
";",
"}",
"String",
"data",
"=",
"this",
".",
"request",
".",
"getContextPath",
"(",
")",
";",
"if",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"data",
")",
")",
"{",
"sb",
".",
"append",
"(",
"data",
")",
";",
"}",
"if",
"(",
"0",
"==",
"uri",
".",
"length",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"if",
"(",
"uri",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"{",
"// relative to servlet container root...",
"sb",
".",
"append",
"(",
"uri",
")",
";",
"}",
"else",
"{",
"// relative to current URI,",
"data",
"=",
"this",
".",
"request",
".",
"getServletPath",
"(",
")",
";",
"if",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"data",
")",
")",
"{",
"sb",
".",
"append",
"(",
"data",
")",
";",
"}",
"data",
"=",
"this",
".",
"request",
".",
"getPathInfo",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"data",
")",
"{",
"sb",
".",
"append",
"(",
"data",
")",
";",
"}",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"sb",
".",
"append",
"(",
"uri",
")",
";",
"// TODO: webcontainer converted \"/./\" and \"/../\" info too",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Convert a possible URI to a full URL.
@param uri
@return String | [
"Convert",
"a",
"possible",
"URI",
"to",
"a",
"full",
"URL",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java#L240-L284 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java | ResponseMessage.commit | public void commit() {
if (isCommitted()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Committing: " + this);
}
if (null == this.response.getHeader("Content-Language")) {
// content-language not yet set, add now
this.response.setHeader(
"Content-Language",
getLocale().toString().replace('_', '-'));
}
if (null != this.response.getHeader("Content-Encoding")) {
this.response.removeHeader("Content-Length");
}
// if a session exists, store the set-cookie in the response now
SessionInfo info = this.request.getSessionInfo();
if (null != info) {
SessionConfig config = info.getSessionConfig();
if (config.usingCookies() && null != info.getSession()) {
// create a session cookie now
boolean add = true;
HttpCookie existing = this.response.getCookie(config.getIDName());
if (null != existing) {
if (!info.getSession().getId().equals(existing.getValue())) {
// some other session cookie existed but doesn't match
// the current session, remove it
this.response.removeCookie(existing);
} else {
// this session already exists
add = false;
}
}
if (add) {
this.response.addCookie(
convertCookie(SessionInfo.encodeCookie(info)));
}
}
} // end-if-request-session-exists
} | java | public void commit() {
if (isCommitted()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Committing: " + this);
}
if (null == this.response.getHeader("Content-Language")) {
// content-language not yet set, add now
this.response.setHeader(
"Content-Language",
getLocale().toString().replace('_', '-'));
}
if (null != this.response.getHeader("Content-Encoding")) {
this.response.removeHeader("Content-Length");
}
// if a session exists, store the set-cookie in the response now
SessionInfo info = this.request.getSessionInfo();
if (null != info) {
SessionConfig config = info.getSessionConfig();
if (config.usingCookies() && null != info.getSession()) {
// create a session cookie now
boolean add = true;
HttpCookie existing = this.response.getCookie(config.getIDName());
if (null != existing) {
if (!info.getSession().getId().equals(existing.getValue())) {
// some other session cookie existed but doesn't match
// the current session, remove it
this.response.removeCookie(existing);
} else {
// this session already exists
add = false;
}
}
if (add) {
this.response.addCookie(
convertCookie(SessionInfo.encodeCookie(info)));
}
}
} // end-if-request-session-exists
} | [
"public",
"void",
"commit",
"(",
")",
"{",
"if",
"(",
"isCommitted",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Committing: \"",
"+",
"this",
")",
";",
"}",
"if",
"(",
"null",
"==",
"this",
".",
"response",
".",
"getHeader",
"(",
"\"Content-Language\"",
")",
")",
"{",
"// content-language not yet set, add now",
"this",
".",
"response",
".",
"setHeader",
"(",
"\"Content-Language\"",
",",
"getLocale",
"(",
")",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"this",
".",
"response",
".",
"getHeader",
"(",
"\"Content-Encoding\"",
")",
")",
"{",
"this",
".",
"response",
".",
"removeHeader",
"(",
"\"Content-Length\"",
")",
";",
"}",
"// if a session exists, store the set-cookie in the response now",
"SessionInfo",
"info",
"=",
"this",
".",
"request",
".",
"getSessionInfo",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"info",
")",
"{",
"SessionConfig",
"config",
"=",
"info",
".",
"getSessionConfig",
"(",
")",
";",
"if",
"(",
"config",
".",
"usingCookies",
"(",
")",
"&&",
"null",
"!=",
"info",
".",
"getSession",
"(",
")",
")",
"{",
"// create a session cookie now",
"boolean",
"add",
"=",
"true",
";",
"HttpCookie",
"existing",
"=",
"this",
".",
"response",
".",
"getCookie",
"(",
"config",
".",
"getIDName",
"(",
")",
")",
";",
"if",
"(",
"null",
"!=",
"existing",
")",
"{",
"if",
"(",
"!",
"info",
".",
"getSession",
"(",
")",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"existing",
".",
"getValue",
"(",
")",
")",
")",
"{",
"// some other session cookie existed but doesn't match",
"// the current session, remove it",
"this",
".",
"response",
".",
"removeCookie",
"(",
"existing",
")",
";",
"}",
"else",
"{",
"// this session already exists",
"add",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"add",
")",
"{",
"this",
".",
"response",
".",
"addCookie",
"(",
"convertCookie",
"(",
"SessionInfo",
".",
"encodeCookie",
"(",
"info",
")",
")",
")",
";",
"}",
"}",
"}",
"// end-if-request-session-exists",
"}"
] | When headers are being marshalled out, this message moves to committed
state which will disallow most further changes. | [
"When",
"headers",
"are",
"being",
"marshalled",
"out",
"this",
"message",
"moves",
"to",
"committed",
"state",
"which",
"will",
"disallow",
"most",
"further",
"changes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/servlet/internal/ResponseMessage.java#L452-L492 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/buildtasks/InstrumentForTrace.java | InstrumentForTrace.setApi | public void setApi(String api) {
api = api.trim();
if ("liberty".equalsIgnoreCase(api)) {
this.api = "liberty";
} else if ("websphere".equalsIgnoreCase(api)) {
this.api = "tr";
} else if ("tr".equalsIgnoreCase(api)) {
this.api = "tr";
} else if ("jsr47".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else if ("java".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else if ("java.logging".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else if ("java-logging".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else {
log("Invalid trace type " + api, Project.MSG_ERR);
}
} | java | public void setApi(String api) {
api = api.trim();
if ("liberty".equalsIgnoreCase(api)) {
this.api = "liberty";
} else if ("websphere".equalsIgnoreCase(api)) {
this.api = "tr";
} else if ("tr".equalsIgnoreCase(api)) {
this.api = "tr";
} else if ("jsr47".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else if ("java".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else if ("java.logging".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else if ("java-logging".equalsIgnoreCase(api)) {
this.api = "java-logging";
} else {
log("Invalid trace type " + api, Project.MSG_ERR);
}
} | [
"public",
"void",
"setApi",
"(",
"String",
"api",
")",
"{",
"api",
"=",
"api",
".",
"trim",
"(",
")",
";",
"if",
"(",
"\"liberty\"",
".",
"equalsIgnoreCase",
"(",
"api",
")",
")",
"{",
"this",
".",
"api",
"=",
"\"liberty\"",
";",
"}",
"else",
"if",
"(",
"\"websphere\"",
".",
"equalsIgnoreCase",
"(",
"api",
")",
")",
"{",
"this",
".",
"api",
"=",
"\"tr\"",
";",
"}",
"else",
"if",
"(",
"\"tr\"",
".",
"equalsIgnoreCase",
"(",
"api",
")",
")",
"{",
"this",
".",
"api",
"=",
"\"tr\"",
";",
"}",
"else",
"if",
"(",
"\"jsr47\"",
".",
"equalsIgnoreCase",
"(",
"api",
")",
")",
"{",
"this",
".",
"api",
"=",
"\"java-logging\"",
";",
"}",
"else",
"if",
"(",
"\"java\"",
".",
"equalsIgnoreCase",
"(",
"api",
")",
")",
"{",
"this",
".",
"api",
"=",
"\"java-logging\"",
";",
"}",
"else",
"if",
"(",
"\"java.logging\"",
".",
"equalsIgnoreCase",
"(",
"api",
")",
")",
"{",
"this",
".",
"api",
"=",
"\"java-logging\"",
";",
"}",
"else",
"if",
"(",
"\"java-logging\"",
".",
"equalsIgnoreCase",
"(",
"api",
")",
")",
"{",
"this",
".",
"api",
"=",
"\"java-logging\"",
";",
"}",
"else",
"{",
"log",
"(",
"\"Invalid trace type \"",
"+",
"api",
",",
"Project",
".",
"MSG_ERR",
")",
";",
"}",
"}"
] | Set the type of trace API to use.
@param api
the type of trace interface to use | [
"Set",
"the",
"type",
"of",
"trace",
"API",
"to",
"use",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/buildtasks/InstrumentForTrace.java#L59-L78 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.web/src/com/ibm/ws/jaxws/web/WebJaxWsModuleInfoBuilder.java | WebJaxWsModuleInfoBuilder.getServletNameClassPairsInWebXML | private Map<String, String> getServletNameClassPairsInWebXML(Container containerToAdapt) throws UnableToAdaptException {
Map<String, String> nameClassPairs = new HashMap<String, String>();
WebAppConfig webAppConfig = containerToAdapt.adapt(WebAppConfig.class);
Iterator<IServletConfig> cfgIter = webAppConfig.getServletInfos();
while (cfgIter.hasNext()) {
IServletConfig servletCfg = cfgIter.next();
if (servletCfg.getClassName() == null) {
continue;
}
nameClassPairs.put(servletCfg.getServletName(), servletCfg.getClassName());
}
return nameClassPairs;
} | java | private Map<String, String> getServletNameClassPairsInWebXML(Container containerToAdapt) throws UnableToAdaptException {
Map<String, String> nameClassPairs = new HashMap<String, String>();
WebAppConfig webAppConfig = containerToAdapt.adapt(WebAppConfig.class);
Iterator<IServletConfig> cfgIter = webAppConfig.getServletInfos();
while (cfgIter.hasNext()) {
IServletConfig servletCfg = cfgIter.next();
if (servletCfg.getClassName() == null) {
continue;
}
nameClassPairs.put(servletCfg.getServletName(), servletCfg.getClassName());
}
return nameClassPairs;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"getServletNameClassPairsInWebXML",
"(",
"Container",
"containerToAdapt",
")",
"throws",
"UnableToAdaptException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"nameClassPairs",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"WebAppConfig",
"webAppConfig",
"=",
"containerToAdapt",
".",
"adapt",
"(",
"WebAppConfig",
".",
"class",
")",
";",
"Iterator",
"<",
"IServletConfig",
">",
"cfgIter",
"=",
"webAppConfig",
".",
"getServletInfos",
"(",
")",
";",
"while",
"(",
"cfgIter",
".",
"hasNext",
"(",
")",
")",
"{",
"IServletConfig",
"servletCfg",
"=",
"cfgIter",
".",
"next",
"(",
")",
";",
"if",
"(",
"servletCfg",
".",
"getClassName",
"(",
")",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"nameClassPairs",
".",
"put",
"(",
"servletCfg",
".",
"getServletName",
"(",
")",
",",
"servletCfg",
".",
"getClassName",
"(",
")",
")",
";",
"}",
"return",
"nameClassPairs",
";",
"}"
] | Get all the Servlet name and className pairs from web.xml
@param webAppConfig
@return
@throws UnableToAdaptException | [
"Get",
"all",
"the",
"Servlet",
"name",
"and",
"className",
"pairs",
"from",
"web",
".",
"xml"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.web/src/com/ibm/ws/jaxws/web/WebJaxWsModuleInfoBuilder.java#L204-L217 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.web/src/com/ibm/ws/jaxws/web/WebJaxWsModuleInfoBuilder.java | WebJaxWsModuleInfoBuilder.processClassesInWebXML | private void processClassesInWebXML(EndpointInfoBuilder endpointInfoBuilder, EndpointInfoBuilderContext ctx, WebAppConfig webAppConfig,
JaxWsModuleInfo jaxWsModuleInfo, Set<String> presentedServices) throws UnableToAdaptException {
Iterator<IServletConfig> cfgIter = webAppConfig.getServletInfos();
while (cfgIter.hasNext()) {
IServletConfig servletCfg = cfgIter.next();
String servletClassName = servletCfg.getClassName();
if (servletClassName == null
|| presentedServices.contains(servletClassName)
|| !JaxWsUtils.isWebService(ctx.getInfoStore().getDelayableClassInfo(servletClassName))) {
continue;
}
String servletName = servletCfg.getServletName();
// add the servletName into EndpointInfoContext env
ctx.addContextEnv(JaxWsConstants.ENV_ATTRIBUTE_ENDPOINT_SERVLET_NAME, servletName);
jaxWsModuleInfo.addEndpointInfo(servletName, endpointInfoBuilder.build(ctx, servletClassName, EndpointType.SERVLET));
}
} | java | private void processClassesInWebXML(EndpointInfoBuilder endpointInfoBuilder, EndpointInfoBuilderContext ctx, WebAppConfig webAppConfig,
JaxWsModuleInfo jaxWsModuleInfo, Set<String> presentedServices) throws UnableToAdaptException {
Iterator<IServletConfig> cfgIter = webAppConfig.getServletInfos();
while (cfgIter.hasNext()) {
IServletConfig servletCfg = cfgIter.next();
String servletClassName = servletCfg.getClassName();
if (servletClassName == null
|| presentedServices.contains(servletClassName)
|| !JaxWsUtils.isWebService(ctx.getInfoStore().getDelayableClassInfo(servletClassName))) {
continue;
}
String servletName = servletCfg.getServletName();
// add the servletName into EndpointInfoContext env
ctx.addContextEnv(JaxWsConstants.ENV_ATTRIBUTE_ENDPOINT_SERVLET_NAME, servletName);
jaxWsModuleInfo.addEndpointInfo(servletName, endpointInfoBuilder.build(ctx, servletClassName, EndpointType.SERVLET));
}
} | [
"private",
"void",
"processClassesInWebXML",
"(",
"EndpointInfoBuilder",
"endpointInfoBuilder",
",",
"EndpointInfoBuilderContext",
"ctx",
",",
"WebAppConfig",
"webAppConfig",
",",
"JaxWsModuleInfo",
"jaxWsModuleInfo",
",",
"Set",
"<",
"String",
">",
"presentedServices",
")",
"throws",
"UnableToAdaptException",
"{",
"Iterator",
"<",
"IServletConfig",
">",
"cfgIter",
"=",
"webAppConfig",
".",
"getServletInfos",
"(",
")",
";",
"while",
"(",
"cfgIter",
".",
"hasNext",
"(",
")",
")",
"{",
"IServletConfig",
"servletCfg",
"=",
"cfgIter",
".",
"next",
"(",
")",
";",
"String",
"servletClassName",
"=",
"servletCfg",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"servletClassName",
"==",
"null",
"||",
"presentedServices",
".",
"contains",
"(",
"servletClassName",
")",
"||",
"!",
"JaxWsUtils",
".",
"isWebService",
"(",
"ctx",
".",
"getInfoStore",
"(",
")",
".",
"getDelayableClassInfo",
"(",
"servletClassName",
")",
")",
")",
"{",
"continue",
";",
"}",
"String",
"servletName",
"=",
"servletCfg",
".",
"getServletName",
"(",
")",
";",
"// add the servletName into EndpointInfoContext env",
"ctx",
".",
"addContextEnv",
"(",
"JaxWsConstants",
".",
"ENV_ATTRIBUTE_ENDPOINT_SERVLET_NAME",
",",
"servletName",
")",
";",
"jaxWsModuleInfo",
".",
"addEndpointInfo",
"(",
"servletName",
",",
"endpointInfoBuilder",
".",
"build",
"(",
"ctx",
",",
"servletClassName",
",",
"EndpointType",
".",
"SERVLET",
")",
")",
";",
"}",
"}"
] | Process the serviceImplBean classes in web.xml file.
@param ctx
@param webAppConfig
@param jaxWsModuleInfo
@throws Exception | [
"Process",
"the",
"serviceImplBean",
"classes",
"in",
"web",
".",
"xml",
"file",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.web/src/com/ibm/ws/jaxws/web/WebJaxWsModuleInfoBuilder.java#L227-L248 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/trm/TrmMessageFactory.java | TrmMessageFactory.getInstance | public static TrmMessageFactory getInstance() {
if (_instance == null) {
synchronized(TrmMessageFactory.class) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance");
try {
Class cls = Class.forName(TRM_MESSAGE_FACTORY_CLASS);
_instance = (TrmMessageFactory) cls.newInstance();
}
catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.TrmMessageFactory.createFactoryInstance", "112");
SibTr.error(tc,"UNABLE_TO_CREATE_TRMFACTORY_CWSIF0021",e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance",_instance);
}
}
return _instance;
} | java | public static TrmMessageFactory getInstance() {
if (_instance == null) {
synchronized(TrmMessageFactory.class) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance");
try {
Class cls = Class.forName(TRM_MESSAGE_FACTORY_CLASS);
_instance = (TrmMessageFactory) cls.newInstance();
}
catch (Exception e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.TrmMessageFactory.createFactoryInstance", "112");
SibTr.error(tc,"UNABLE_TO_CREATE_TRMFACTORY_CWSIF0021",e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance",_instance);
}
}
return _instance;
} | [
"public",
"static",
"TrmMessageFactory",
"getInstance",
"(",
")",
"{",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"synchronized",
"(",
"TrmMessageFactory",
".",
"class",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"createFactoryInstance\"",
")",
";",
"try",
"{",
"Class",
"cls",
"=",
"Class",
".",
"forName",
"(",
"TRM_MESSAGE_FACTORY_CLASS",
")",
";",
"_instance",
"=",
"(",
"TrmMessageFactory",
")",
"cls",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.mfp.TrmMessageFactory.createFactoryInstance\"",
",",
"\"112\"",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"UNABLE_TO_CREATE_TRMFACTORY_CWSIF0021\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"createFactoryInstance\"",
",",
"_instance",
")",
";",
"}",
"}",
"return",
"_instance",
";",
"}"
] | Get the singleton TrmMessageFactory which is to be used for
creating TRM Message instances.
@return The TrmMessageFactory | [
"Get",
"the",
"singleton",
"TrmMessageFactory",
"which",
"is",
"to",
"be",
"used",
"for",
"creating",
"TRM",
"Message",
"instances",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/trm/TrmMessageFactory.java#L44-L61 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/NamedEventManager.java | NamedEventManager.addNamedEvent | public void addNamedEvent (String shortName, Class<? extends ComponentSystemEvent> cls)
{
String key = shortName;
Collection<Class<? extends ComponentSystemEvent>> eventList;
// Per the spec, if the short name is missing, generate one.
if (shortName == null)
{
key = getFixedName (cls);
}
eventList = events.get (key);
if (eventList == null)
{
// First event registered to this short name.
eventList = new LinkedList<Class<? extends ComponentSystemEvent>>();
events.put (key, eventList);
}
eventList.add (cls);
} | java | public void addNamedEvent (String shortName, Class<? extends ComponentSystemEvent> cls)
{
String key = shortName;
Collection<Class<? extends ComponentSystemEvent>> eventList;
// Per the spec, if the short name is missing, generate one.
if (shortName == null)
{
key = getFixedName (cls);
}
eventList = events.get (key);
if (eventList == null)
{
// First event registered to this short name.
eventList = new LinkedList<Class<? extends ComponentSystemEvent>>();
events.put (key, eventList);
}
eventList.add (cls);
} | [
"public",
"void",
"addNamedEvent",
"(",
"String",
"shortName",
",",
"Class",
"<",
"?",
"extends",
"ComponentSystemEvent",
">",
"cls",
")",
"{",
"String",
"key",
"=",
"shortName",
";",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"ComponentSystemEvent",
">",
">",
"eventList",
";",
"// Per the spec, if the short name is missing, generate one.",
"if",
"(",
"shortName",
"==",
"null",
")",
"{",
"key",
"=",
"getFixedName",
"(",
"cls",
")",
";",
"}",
"eventList",
"=",
"events",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"eventList",
"==",
"null",
")",
"{",
"// First event registered to this short name.",
"eventList",
"=",
"new",
"LinkedList",
"<",
"Class",
"<",
"?",
"extends",
"ComponentSystemEvent",
">",
">",
"(",
")",
";",
"events",
".",
"put",
"(",
"key",
",",
"eventList",
")",
";",
"}",
"eventList",
".",
"add",
"(",
"cls",
")",
";",
"}"
] | Registers a named event.
@param shortName a String containing the short name for the event, from the @NamedEvent.shortName()
attribute.
@param cls the event class to register. | [
"Registers",
"a",
"named",
"event",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/NamedEventManager.java#L69-L93 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/NamedEventManager.java | NamedEventManager.getFixedName | private String getFixedName (Class<? extends ComponentSystemEvent> cls)
{
StringBuilder result = new StringBuilder();
String className;
// Get the unqualified class name.
className = cls.getSimpleName();
// Strip the trailing "event" off the class name if present.
if (className.toLowerCase().endsWith ("event"))
{
className = className.substring (0, result.length() - 5);
}
// Prepend the package name.
if (cls.getPackage() != null)
{
result.append (cls.getPackage().getName());
result.append ('.');
}
result.append (className);
return result.toString();
} | java | private String getFixedName (Class<? extends ComponentSystemEvent> cls)
{
StringBuilder result = new StringBuilder();
String className;
// Get the unqualified class name.
className = cls.getSimpleName();
// Strip the trailing "event" off the class name if present.
if (className.toLowerCase().endsWith ("event"))
{
className = className.substring (0, result.length() - 5);
}
// Prepend the package name.
if (cls.getPackage() != null)
{
result.append (cls.getPackage().getName());
result.append ('.');
}
result.append (className);
return result.toString();
} | [
"private",
"String",
"getFixedName",
"(",
"Class",
"<",
"?",
"extends",
"ComponentSystemEvent",
">",
"cls",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"className",
";",
"// Get the unqualified class name.",
"className",
"=",
"cls",
".",
"getSimpleName",
"(",
")",
";",
"// Strip the trailing \"event\" off the class name if present.",
"if",
"(",
"className",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\"event\"",
")",
")",
"{",
"className",
"=",
"className",
".",
"substring",
"(",
"0",
",",
"result",
".",
"length",
"(",
")",
"-",
"5",
")",
";",
"}",
"// Prepend the package name.",
"if",
"(",
"cls",
".",
"getPackage",
"(",
")",
"!=",
"null",
")",
"{",
"result",
".",
"append",
"(",
"cls",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"result",
".",
"append",
"(",
"className",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] | Retrieves the short name for an event class, according to spec rules.
@param cls the class to find the short name for.
@return a String containing the short name for the given class. | [
"Retrieves",
"the",
"short",
"name",
"for",
"an",
"event",
"class",
"according",
"to",
"spec",
"rules",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/config/NamedEventManager.java#L115-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/collector/CollectorJsonUtils1_1.java | CollectorJsonUtils1_1.jsonifyEvent | public static String jsonifyEvent(Object event, String eventType, String serverName, String wlpUserDir, String serverHostName, String[] tags,
int maxFieldLength) {
if (eventType.equals(CollectorConstants.GC_EVENT_TYPE)) {
if (event instanceof GCData) {
return jsonifyGCEvent(wlpUserDir, serverName, serverHostName, event, tags);
} else {
return jsonifyGCEvent(-1, wlpUserDir, serverName, serverHostName, CollectorConstants.GC_EVENT_TYPE, event, tags);
}
} else if (eventType.equals(CollectorConstants.MESSAGES_LOG_EVENT_TYPE)) {
return jsonifyTraceAndMessage(maxFieldLength, wlpUserDir, serverName, serverHostName, CollectorConstants.MESSAGES_LOG_EVENT_TYPE, event, tags);
} else if (eventType.equals(CollectorConstants.TRACE_LOG_EVENT_TYPE)) {
return jsonifyTraceAndMessage(maxFieldLength, wlpUserDir, serverName, serverHostName, CollectorConstants.TRACE_LOG_EVENT_TYPE, event, tags);
} else if (eventType.equals(CollectorConstants.FFDC_EVENT_TYPE)) {
return jsonifyFFDC(maxFieldLength, wlpUserDir, serverName, serverHostName, event, tags);
} else if (eventType.equals(CollectorConstants.ACCESS_LOG_EVENT_TYPE)) {
return jsonifyAccess(wlpUserDir, serverName, serverHostName, event, tags);
} else if (eventType.equals(CollectorConstants.AUDIT_LOG_EVENT_TYPE)) {
return jsonifyAudit(wlpUserDir, serverName, serverHostName, event, tags);
}
return "";
} | java | public static String jsonifyEvent(Object event, String eventType, String serverName, String wlpUserDir, String serverHostName, String[] tags,
int maxFieldLength) {
if (eventType.equals(CollectorConstants.GC_EVENT_TYPE)) {
if (event instanceof GCData) {
return jsonifyGCEvent(wlpUserDir, serverName, serverHostName, event, tags);
} else {
return jsonifyGCEvent(-1, wlpUserDir, serverName, serverHostName, CollectorConstants.GC_EVENT_TYPE, event, tags);
}
} else if (eventType.equals(CollectorConstants.MESSAGES_LOG_EVENT_TYPE)) {
return jsonifyTraceAndMessage(maxFieldLength, wlpUserDir, serverName, serverHostName, CollectorConstants.MESSAGES_LOG_EVENT_TYPE, event, tags);
} else if (eventType.equals(CollectorConstants.TRACE_LOG_EVENT_TYPE)) {
return jsonifyTraceAndMessage(maxFieldLength, wlpUserDir, serverName, serverHostName, CollectorConstants.TRACE_LOG_EVENT_TYPE, event, tags);
} else if (eventType.equals(CollectorConstants.FFDC_EVENT_TYPE)) {
return jsonifyFFDC(maxFieldLength, wlpUserDir, serverName, serverHostName, event, tags);
} else if (eventType.equals(CollectorConstants.ACCESS_LOG_EVENT_TYPE)) {
return jsonifyAccess(wlpUserDir, serverName, serverHostName, event, tags);
} else if (eventType.equals(CollectorConstants.AUDIT_LOG_EVENT_TYPE)) {
return jsonifyAudit(wlpUserDir, serverName, serverHostName, event, tags);
}
return "";
} | [
"public",
"static",
"String",
"jsonifyEvent",
"(",
"Object",
"event",
",",
"String",
"eventType",
",",
"String",
"serverName",
",",
"String",
"wlpUserDir",
",",
"String",
"serverHostName",
",",
"String",
"[",
"]",
"tags",
",",
"int",
"maxFieldLength",
")",
"{",
"if",
"(",
"eventType",
".",
"equals",
"(",
"CollectorConstants",
".",
"GC_EVENT_TYPE",
")",
")",
"{",
"if",
"(",
"event",
"instanceof",
"GCData",
")",
"{",
"return",
"jsonifyGCEvent",
"(",
"wlpUserDir",
",",
"serverName",
",",
"serverHostName",
",",
"event",
",",
"tags",
")",
";",
"}",
"else",
"{",
"return",
"jsonifyGCEvent",
"(",
"-",
"1",
",",
"wlpUserDir",
",",
"serverName",
",",
"serverHostName",
",",
"CollectorConstants",
".",
"GC_EVENT_TYPE",
",",
"event",
",",
"tags",
")",
";",
"}",
"}",
"else",
"if",
"(",
"eventType",
".",
"equals",
"(",
"CollectorConstants",
".",
"MESSAGES_LOG_EVENT_TYPE",
")",
")",
"{",
"return",
"jsonifyTraceAndMessage",
"(",
"maxFieldLength",
",",
"wlpUserDir",
",",
"serverName",
",",
"serverHostName",
",",
"CollectorConstants",
".",
"MESSAGES_LOG_EVENT_TYPE",
",",
"event",
",",
"tags",
")",
";",
"}",
"else",
"if",
"(",
"eventType",
".",
"equals",
"(",
"CollectorConstants",
".",
"TRACE_LOG_EVENT_TYPE",
")",
")",
"{",
"return",
"jsonifyTraceAndMessage",
"(",
"maxFieldLength",
",",
"wlpUserDir",
",",
"serverName",
",",
"serverHostName",
",",
"CollectorConstants",
".",
"TRACE_LOG_EVENT_TYPE",
",",
"event",
",",
"tags",
")",
";",
"}",
"else",
"if",
"(",
"eventType",
".",
"equals",
"(",
"CollectorConstants",
".",
"FFDC_EVENT_TYPE",
")",
")",
"{",
"return",
"jsonifyFFDC",
"(",
"maxFieldLength",
",",
"wlpUserDir",
",",
"serverName",
",",
"serverHostName",
",",
"event",
",",
"tags",
")",
";",
"}",
"else",
"if",
"(",
"eventType",
".",
"equals",
"(",
"CollectorConstants",
".",
"ACCESS_LOG_EVENT_TYPE",
")",
")",
"{",
"return",
"jsonifyAccess",
"(",
"wlpUserDir",
",",
"serverName",
",",
"serverHostName",
",",
"event",
",",
"tags",
")",
";",
"}",
"else",
"if",
"(",
"eventType",
".",
"equals",
"(",
"CollectorConstants",
".",
"AUDIT_LOG_EVENT_TYPE",
")",
")",
"{",
"return",
"jsonifyAudit",
"(",
"wlpUserDir",
",",
"serverName",
",",
"serverHostName",
",",
"event",
",",
"tags",
")",
";",
"}",
"return",
"\"\"",
";",
"}"
] | Method to return log event data in json format. This method is for collector version greater than 1.0
@param event The object originating from logging source which contains necessary fields
@param eventType The type of event
@param servername The name of the server
@param wlpUserDir The name of wlp user directory
@param serverHostName The name of server host
@param collectorVersion The version number
@param tags An array of tags
@param maxFieldLength The max character length of strings | [
"Method",
"to",
"return",
"log",
"event",
"data",
"in",
"json",
"format",
".",
"This",
"method",
"is",
"for",
"collector",
"version",
"greater",
"than",
"1",
".",
"0"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/collector/CollectorJsonUtils1_1.java#L49-L87 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java | TimeLimitDaemon.valueHasChanged | public void valueHasChanged(DCache cache, Object id, long expirationTime, int inactivity) { // CPF-Inactivity
//final String methodName = "valueHasChanged()";
if (expirationTime <= 0 && inactivity <=0 ) { // CPF-Inactivity
throw new IllegalArgumentException("expirationTime or inactivity must be positive");
}
if ( UNIT_TEST_INACTIVITY ) {
System.out.println(" valueHasChanged() - entry");
System.out.println(" expirationTime="+expirationTime);
System.out.println(" inactivity="+inactivity);
}
// CPF-Inactivity
//-----------------------------------------------------------
// Force an expriationTime if we have an inactivity timer
//-----------------------------------------------------------
boolean isInactivityTimeOut = false;
if ( inactivity > 0 ) {
// For 7.0, use QuickApproxTime.getRef.getApproxTime()
long adjustedExpirationTime = System.currentTimeMillis() + ( inactivity * 1000 );
if ( adjustedExpirationTime < expirationTime ||
expirationTime <= 0 ) {
expirationTime = adjustedExpirationTime;
isInactivityTimeOut = true;
}
}
ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache);
// Just make sure expirationMetaData is NOT NULL in case of an internal-error condition
if (expirationMetaData == null) {
return;
}
synchronized (expirationMetaData) {
InvalidationTask it = (InvalidationTask) expirationMetaData.expirationTable.get(id);
if (it == null) {
it = (InvalidationTask) taskPool.remove();
it.id = id;
expirationMetaData.expirationTable.put(id, it);
} else {
expirationMetaData.timeLimitHeap.delete(it);
}
it.expirationTime = expirationTime;
it.isInactivityTimeOut = isInactivityTimeOut;
expirationMetaData.timeLimitHeap.insert(it);
//ccount++;
//traceDebug(methodName, "cacheName=" + cache.getCacheName() + " id=" + id + " expirationTableSize=" + expirationMetaData.expirationTable.size() + " timeLimitHeapSize=" + expirationMetaData.timeLimitHeap.size() + " count=" + ccount);
}
} | java | public void valueHasChanged(DCache cache, Object id, long expirationTime, int inactivity) { // CPF-Inactivity
//final String methodName = "valueHasChanged()";
if (expirationTime <= 0 && inactivity <=0 ) { // CPF-Inactivity
throw new IllegalArgumentException("expirationTime or inactivity must be positive");
}
if ( UNIT_TEST_INACTIVITY ) {
System.out.println(" valueHasChanged() - entry");
System.out.println(" expirationTime="+expirationTime);
System.out.println(" inactivity="+inactivity);
}
// CPF-Inactivity
//-----------------------------------------------------------
// Force an expriationTime if we have an inactivity timer
//-----------------------------------------------------------
boolean isInactivityTimeOut = false;
if ( inactivity > 0 ) {
// For 7.0, use QuickApproxTime.getRef.getApproxTime()
long adjustedExpirationTime = System.currentTimeMillis() + ( inactivity * 1000 );
if ( adjustedExpirationTime < expirationTime ||
expirationTime <= 0 ) {
expirationTime = adjustedExpirationTime;
isInactivityTimeOut = true;
}
}
ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache);
// Just make sure expirationMetaData is NOT NULL in case of an internal-error condition
if (expirationMetaData == null) {
return;
}
synchronized (expirationMetaData) {
InvalidationTask it = (InvalidationTask) expirationMetaData.expirationTable.get(id);
if (it == null) {
it = (InvalidationTask) taskPool.remove();
it.id = id;
expirationMetaData.expirationTable.put(id, it);
} else {
expirationMetaData.timeLimitHeap.delete(it);
}
it.expirationTime = expirationTime;
it.isInactivityTimeOut = isInactivityTimeOut;
expirationMetaData.timeLimitHeap.insert(it);
//ccount++;
//traceDebug(methodName, "cacheName=" + cache.getCacheName() + " id=" + id + " expirationTableSize=" + expirationMetaData.expirationTable.size() + " timeLimitHeapSize=" + expirationMetaData.timeLimitHeap.size() + " count=" + ccount);
}
} | [
"public",
"void",
"valueHasChanged",
"(",
"DCache",
"cache",
",",
"Object",
"id",
",",
"long",
"expirationTime",
",",
"int",
"inactivity",
")",
"{",
"// CPF-Inactivity",
"//final String methodName = \"valueHasChanged()\";",
"if",
"(",
"expirationTime",
"<=",
"0",
"&&",
"inactivity",
"<=",
"0",
")",
"{",
"// CPF-Inactivity",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expirationTime or inactivity must be positive\"",
")",
";",
"}",
"if",
"(",
"UNIT_TEST_INACTIVITY",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\" valueHasChanged() - entry\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" expirationTime=\"",
"+",
"expirationTime",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\" inactivity=\"",
"+",
"inactivity",
")",
";",
"}",
"// CPF-Inactivity",
"//-----------------------------------------------------------",
"// Force an expriationTime if we have an inactivity timer",
"//-----------------------------------------------------------",
"boolean",
"isInactivityTimeOut",
"=",
"false",
";",
"if",
"(",
"inactivity",
">",
"0",
")",
"{",
"// For 7.0, use QuickApproxTime.getRef.getApproxTime()",
"long",
"adjustedExpirationTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"(",
"inactivity",
"*",
"1000",
")",
";",
"if",
"(",
"adjustedExpirationTime",
"<",
"expirationTime",
"||",
"expirationTime",
"<=",
"0",
")",
"{",
"expirationTime",
"=",
"adjustedExpirationTime",
";",
"isInactivityTimeOut",
"=",
"true",
";",
"}",
"}",
"ExpirationMetaData",
"expirationMetaData",
"=",
"(",
"ExpirationMetaData",
")",
"cacheInstancesTable",
".",
"get",
"(",
"cache",
")",
";",
"// Just make sure expirationMetaData is NOT NULL in case of an internal-error condition",
"if",
"(",
"expirationMetaData",
"==",
"null",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"expirationMetaData",
")",
"{",
"InvalidationTask",
"it",
"=",
"(",
"InvalidationTask",
")",
"expirationMetaData",
".",
"expirationTable",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"it",
"==",
"null",
")",
"{",
"it",
"=",
"(",
"InvalidationTask",
")",
"taskPool",
".",
"remove",
"(",
")",
";",
"it",
".",
"id",
"=",
"id",
";",
"expirationMetaData",
".",
"expirationTable",
".",
"put",
"(",
"id",
",",
"it",
")",
";",
"}",
"else",
"{",
"expirationMetaData",
".",
"timeLimitHeap",
".",
"delete",
"(",
"it",
")",
";",
"}",
"it",
".",
"expirationTime",
"=",
"expirationTime",
";",
"it",
".",
"isInactivityTimeOut",
"=",
"isInactivityTimeOut",
";",
"expirationMetaData",
".",
"timeLimitHeap",
".",
"insert",
"(",
"it",
")",
";",
"//ccount++;",
"//traceDebug(methodName, \"cacheName=\" + cache.getCacheName() + \" id=\" + id + \" expirationTableSize=\" + expirationMetaData.expirationTable.size() + \" timeLimitHeapSize=\" + expirationMetaData.timeLimitHeap.size() + \" count=\" + ccount);",
"}",
"}"
] | This notifies this daemon that a value has changed,
so the expiration time should be updated.
It updates internal tables and indexes accordingly.
@param cache The cache instance.
@param id The cache id.
@param expirationTime The new expiration time. | [
"This",
"notifies",
"this",
"daemon",
"that",
"a",
"value",
"has",
"changed",
"so",
"the",
"expiration",
"time",
"should",
"be",
"updated",
".",
"It",
"updates",
"internal",
"tables",
"and",
"indexes",
"accordingly",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java#L224-L268 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java | TimeLimitDaemon.valueWasRemoved | public void valueWasRemoved(DCache cache, Object id) {
//final String methodName = "valueWasRemoved()";
if ( UNIT_TEST_INACTIVITY ) {
System.out.println("valueWasRemoved() - entry");
}
ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache);
if (expirationMetaData == null) {
return;
}
synchronized (expirationMetaData) {
InvalidationTask it = (InvalidationTask) expirationMetaData.expirationTable.remove(id);
if (it != null) {
expirationMetaData.timeLimitHeap.delete(it);
it.reset();
taskPool.add(it);
//traceDebug(methodName, "cacheName=" + cache.cacheName + " id=" + id + " expirationTableSize=" + expirationMetaData.expirationTable.size() + " timeLimitHeapSize=" + expirationMetaData.timeLimitHeap.size());
}
}
} | java | public void valueWasRemoved(DCache cache, Object id) {
//final String methodName = "valueWasRemoved()";
if ( UNIT_TEST_INACTIVITY ) {
System.out.println("valueWasRemoved() - entry");
}
ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache);
if (expirationMetaData == null) {
return;
}
synchronized (expirationMetaData) {
InvalidationTask it = (InvalidationTask) expirationMetaData.expirationTable.remove(id);
if (it != null) {
expirationMetaData.timeLimitHeap.delete(it);
it.reset();
taskPool.add(it);
//traceDebug(methodName, "cacheName=" + cache.cacheName + " id=" + id + " expirationTableSize=" + expirationMetaData.expirationTable.size() + " timeLimitHeapSize=" + expirationMetaData.timeLimitHeap.size());
}
}
} | [
"public",
"void",
"valueWasRemoved",
"(",
"DCache",
"cache",
",",
"Object",
"id",
")",
"{",
"//final String methodName = \"valueWasRemoved()\";",
"if",
"(",
"UNIT_TEST_INACTIVITY",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"valueWasRemoved() - entry\"",
")",
";",
"}",
"ExpirationMetaData",
"expirationMetaData",
"=",
"(",
"ExpirationMetaData",
")",
"cacheInstancesTable",
".",
"get",
"(",
"cache",
")",
";",
"if",
"(",
"expirationMetaData",
"==",
"null",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"expirationMetaData",
")",
"{",
"InvalidationTask",
"it",
"=",
"(",
"InvalidationTask",
")",
"expirationMetaData",
".",
"expirationTable",
".",
"remove",
"(",
"id",
")",
";",
"if",
"(",
"it",
"!=",
"null",
")",
"{",
"expirationMetaData",
".",
"timeLimitHeap",
".",
"delete",
"(",
"it",
")",
";",
"it",
".",
"reset",
"(",
")",
";",
"taskPool",
".",
"add",
"(",
"it",
")",
";",
"//traceDebug(methodName, \"cacheName=\" + cache.cacheName + \" id=\" + id + \" expirationTableSize=\" + expirationMetaData.expirationTable.size() + \" timeLimitHeapSize=\" + expirationMetaData.timeLimitHeap.size());",
"}",
"}",
"}"
] | This notifies this daemon that an entry has removed,
It removes the entry from the internal tables.
@param cache The cache instance.
@param id The cache id. | [
"This",
"notifies",
"this",
"daemon",
"that",
"an",
"entry",
"has",
"removed",
"It",
"removes",
"the",
"entry",
"from",
"the",
"internal",
"tables",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java#L277-L295 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java | TimeLimitDaemon.valueWasAccessed | public void valueWasAccessed(DCache cache, Object id, long expirationTime, int inactivity) {
valueHasChanged(cache, id, expirationTime, inactivity);
} | java | public void valueWasAccessed(DCache cache, Object id, long expirationTime, int inactivity) {
valueHasChanged(cache, id, expirationTime, inactivity);
} | [
"public",
"void",
"valueWasAccessed",
"(",
"DCache",
"cache",
",",
"Object",
"id",
",",
"long",
"expirationTime",
",",
"int",
"inactivity",
")",
"{",
"valueHasChanged",
"(",
"cache",
",",
"id",
",",
"expirationTime",
",",
"inactivity",
")",
";",
"}"
] | CPF-Inactivity - cache check inactivity > 0 before calling this method. | [
"CPF",
"-",
"Inactivity",
"-",
"cache",
"check",
"inactivity",
">",
"0",
"before",
"calling",
"this",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java#L298-L300 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java | TimeLimitDaemon.createExpirationMetaData | public void createExpirationMetaData(DCache cache) {
//final String methodName = "createExpirationMetaData()";
ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache);
if (expirationMetaData == null) {
int initialTableSize = DEFAULT_SIZE_FOR_MEM;
if (cache.getSwapToDisk() && cache.getCacheConfig().getDiskCachePerformanceLevel() == CacheConfig.HIGH) {
initialTableSize = DEFAULT_SIZE_FOR_MEM_DISK;
}
expirationMetaData = new ExpirationMetaData(initialTableSize);
cacheInstancesTable.put(cache, expirationMetaData);
}
} | java | public void createExpirationMetaData(DCache cache) {
//final String methodName = "createExpirationMetaData()";
ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache);
if (expirationMetaData == null) {
int initialTableSize = DEFAULT_SIZE_FOR_MEM;
if (cache.getSwapToDisk() && cache.getCacheConfig().getDiskCachePerformanceLevel() == CacheConfig.HIGH) {
initialTableSize = DEFAULT_SIZE_FOR_MEM_DISK;
}
expirationMetaData = new ExpirationMetaData(initialTableSize);
cacheInstancesTable.put(cache, expirationMetaData);
}
} | [
"public",
"void",
"createExpirationMetaData",
"(",
"DCache",
"cache",
")",
"{",
"//final String methodName = \"createExpirationMetaData()\";",
"ExpirationMetaData",
"expirationMetaData",
"=",
"(",
"ExpirationMetaData",
")",
"cacheInstancesTable",
".",
"get",
"(",
"cache",
")",
";",
"if",
"(",
"expirationMetaData",
"==",
"null",
")",
"{",
"int",
"initialTableSize",
"=",
"DEFAULT_SIZE_FOR_MEM",
";",
"if",
"(",
"cache",
".",
"getSwapToDisk",
"(",
")",
"&&",
"cache",
".",
"getCacheConfig",
"(",
")",
".",
"getDiskCachePerformanceLevel",
"(",
")",
"==",
"CacheConfig",
".",
"HIGH",
")",
"{",
"initialTableSize",
"=",
"DEFAULT_SIZE_FOR_MEM_DISK",
";",
"}",
"expirationMetaData",
"=",
"new",
"ExpirationMetaData",
"(",
"initialTableSize",
")",
";",
"cacheInstancesTable",
".",
"put",
"(",
"cache",
",",
"expirationMetaData",
")",
";",
"}",
"}"
] | This method is called when the cache is created. This will initialize ExpirationMetaData for specified cache
@param cache The cache instance. | [
"This",
"method",
"is",
"called",
"when",
"the",
"cache",
"is",
"created",
".",
"This",
"will",
"initialize",
"ExpirationMetaData",
"for",
"specified",
"cache"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java#L307-L318 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/MatchingApplicationSignature.java | MatchingApplicationSignature.getApplicationSignature | public ApplicationSignature getApplicationSignature()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getApplicationSignature");
SibTr.exit(tc, "getApplicationSignature", applicationSig);
}
return applicationSig;
} | java | public ApplicationSignature getApplicationSignature()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getApplicationSignature");
SibTr.exit(tc, "getApplicationSignature", applicationSig);
}
return applicationSig;
} | [
"public",
"ApplicationSignature",
"getApplicationSignature",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getApplicationSignature\"",
")",
";",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"getApplicationSignature\"",
",",
"applicationSig",
")",
";",
"}",
"return",
"applicationSig",
";",
"}"
] | Returns the ApplicationSignature.
@return ApplicationSignature | [
"Returns",
"the",
"ApplicationSignature",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/MatchingApplicationSignature.java#L68-L76 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/OidcUtil.java | OidcUtil.getUserNameFromSubject | public static String getUserNameFromSubject(Subject subject) {
Iterator<Principal> it = subject.getPrincipals().iterator();
String username = it.next().getName();
return username;
} | java | public static String getUserNameFromSubject(Subject subject) {
Iterator<Principal> it = subject.getPrincipals().iterator();
String username = it.next().getName();
return username;
} | [
"public",
"static",
"String",
"getUserNameFromSubject",
"(",
"Subject",
"subject",
")",
"{",
"Iterator",
"<",
"Principal",
">",
"it",
"=",
"subject",
".",
"getPrincipals",
"(",
")",
".",
"iterator",
"(",
")",
";",
"String",
"username",
"=",
"it",
".",
"next",
"(",
")",
".",
"getName",
"(",
")",
";",
"return",
"username",
";",
"}"
] | The sujbect has to be non-null | [
"The",
"sujbect",
"has",
"to",
"be",
"non",
"-",
"null"
] | 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/OidcUtil.java#L136-L140 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/OidcUtil.java | OidcUtil.encode | public static String encode(String value) {
if (value == null) {
return value;
}
try {
value = URLEncoder.encode(value, Constants.UTF_8);
} catch (UnsupportedEncodingException e) {
// Do nothing - UTF-8 should always be supported
}
return value;
} | java | public static String encode(String value) {
if (value == null) {
return value;
}
try {
value = URLEncoder.encode(value, Constants.UTF_8);
} catch (UnsupportedEncodingException e) {
// Do nothing - UTF-8 should always be supported
}
return value;
} | [
"public",
"static",
"String",
"encode",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"value",
";",
"}",
"try",
"{",
"value",
"=",
"URLEncoder",
".",
"encode",
"(",
"value",
",",
"Constants",
".",
"UTF_8",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"// Do nothing - UTF-8 should always be supported",
"}",
"return",
"value",
";",
"}"
] | Encodes the given string using URLEncoder and UTF-8 encoding.
@param value
@return | [
"Encodes",
"the",
"given",
"string",
"using",
"URLEncoder",
"and",
"UTF",
"-",
"8",
"encoding",
"."
] | 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/OidcUtil.java#L148-L158 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/OidcUtil.java | OidcUtil.getTimeStamp | public static String getTimeStamp(long lNumber) {
String timeStamp = "" + lNumber;
int iIndex = TIMESTAMP_LENGTH - timeStamp.length(); // this is enough for 3000 years
return zeroFillers[iIndex] + timeStamp;
} | java | public static String getTimeStamp(long lNumber) {
String timeStamp = "" + lNumber;
int iIndex = TIMESTAMP_LENGTH - timeStamp.length(); // this is enough for 3000 years
return zeroFillers[iIndex] + timeStamp;
} | [
"public",
"static",
"String",
"getTimeStamp",
"(",
"long",
"lNumber",
")",
"{",
"String",
"timeStamp",
"=",
"\"\"",
"+",
"lNumber",
";",
"int",
"iIndex",
"=",
"TIMESTAMP_LENGTH",
"-",
"timeStamp",
".",
"length",
"(",
")",
";",
"// this is enough for 3000 years",
"return",
"zeroFillers",
"[",
"iIndex",
"]",
"+",
"timeStamp",
";",
"}"
] | for unit test | [
"for",
"unit",
"test"
] | 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/OidcUtil.java#L223-L227 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/OidcUtil.java | OidcUtil.createNonceCookieValue | public static String createNonceCookieValue(String nonceValue, String state, ConvergedClientConfig clientConfig) {
return HashUtils.digest(nonceValue + state + clientConfig.getClientSecret());
} | java | public static String createNonceCookieValue(String nonceValue, String state, ConvergedClientConfig clientConfig) {
return HashUtils.digest(nonceValue + state + clientConfig.getClientSecret());
} | [
"public",
"static",
"String",
"createNonceCookieValue",
"(",
"String",
"nonceValue",
",",
"String",
"state",
",",
"ConvergedClientConfig",
"clientConfig",
")",
"{",
"return",
"HashUtils",
".",
"digest",
"(",
"nonceValue",
"+",
"state",
"+",
"clientConfig",
".",
"getClientSecret",
"(",
")",
")",
";",
"}"
] | calculate the cookie value of Nonce | [
"calculate",
"the",
"cookie",
"value",
"of",
"Nonce"
] | 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/OidcUtil.java#L265-L267 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/InternTable.java | InternTable.compress | private void compress()
{
counter = 1;
for (Iterator e = values().iterator(); e.hasNext(); )
{
Selector s = (Selector) e.next();
s.setUniqueId(counter++);
}
} | java | private void compress()
{
counter = 1;
for (Iterator e = values().iterator(); e.hasNext(); )
{
Selector s = (Selector) e.next();
s.setUniqueId(counter++);
}
} | [
"private",
"void",
"compress",
"(",
")",
"{",
"counter",
"=",
"1",
";",
"for",
"(",
"Iterator",
"e",
"=",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"e",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Selector",
"s",
"=",
"(",
"Selector",
")",
"e",
".",
"next",
"(",
")",
";",
"s",
".",
"setUniqueId",
"(",
"counter",
"++",
")",
";",
"}",
"}"
] | Compress the uniqueId assignments for Selectors currently in the intern table | [
"Compress",
"the",
"uniqueId",
"assignments",
"for",
"Selectors",
"currently",
"in",
"the",
"intern",
"table"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/InternTable.java#L61-L69 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodeTextBody | private static JsJmsMessage decodeTextBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeTextBody");
JsJmsTextMessage result = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null) {
result.setText(URLDecode(body));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeTextBody");
return result;
} | java | private static JsJmsMessage decodeTextBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeTextBody");
JsJmsTextMessage result = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null) {
result.setText(URLDecode(body));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeTextBody");
return result;
} | [
"private",
"static",
"JsJmsMessage",
"decodeTextBody",
"(",
"String",
"body",
")",
"throws",
"MessageDecodeFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"decodeTextBody\"",
")",
";",
"JsJmsTextMessage",
"result",
"=",
"new",
"JsJmsTextMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"if",
"(",
"body",
"!=",
"null",
")",
"{",
"result",
".",
"setText",
"(",
"URLDecode",
"(",
"body",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"decodeTextBody\"",
")",
";",
"return",
"result",
";",
"}"
] | Decode a text message | [
"Decode",
"a",
"text",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L129-L139 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodeBytesBody | private static JsJmsMessage decodeBytesBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeBytesBody");
JsJmsBytesMessage result = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null)
result.setBytes(HexString.hexToBin(body, 0));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeBytesBody");
return result;
} | java | private static JsJmsMessage decodeBytesBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeBytesBody");
JsJmsBytesMessage result = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null)
result.setBytes(HexString.hexToBin(body, 0));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeBytesBody");
return result;
} | [
"private",
"static",
"JsJmsMessage",
"decodeBytesBody",
"(",
"String",
"body",
")",
"throws",
"MessageDecodeFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"decodeBytesBody\"",
")",
";",
"JsJmsBytesMessage",
"result",
"=",
"new",
"JsJmsBytesMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"if",
"(",
"body",
"!=",
"null",
")",
"result",
".",
"setBytes",
"(",
"HexString",
".",
"hexToBin",
"(",
"body",
",",
"0",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"decodeBytesBody\"",
")",
";",
"return",
"result",
";",
"}"
] | Decode a bytes message | [
"Decode",
"a",
"bytes",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L142-L151 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodeObjectBody | private static JsJmsMessage decodeObjectBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeObjectBody");
JsJmsObjectMessage result = new JsJmsObjectMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null)
result.setSerializedObject(HexString.hexToBin(body, 0));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeObjectBody");
return result;
} | java | private static JsJmsMessage decodeObjectBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeObjectBody");
JsJmsObjectMessage result = new JsJmsObjectMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null)
result.setSerializedObject(HexString.hexToBin(body, 0));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeObjectBody");
return result;
} | [
"private",
"static",
"JsJmsMessage",
"decodeObjectBody",
"(",
"String",
"body",
")",
"throws",
"MessageDecodeFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"decodeObjectBody\"",
")",
";",
"JsJmsObjectMessage",
"result",
"=",
"new",
"JsJmsObjectMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"if",
"(",
"body",
"!=",
"null",
")",
"result",
".",
"setSerializedObject",
"(",
"HexString",
".",
"hexToBin",
"(",
"body",
",",
"0",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"decodeObjectBody\"",
")",
";",
"return",
"result",
";",
"}"
] | Decode an object message | [
"Decode",
"an",
"object",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L154-L163 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodeStreamBody | private static JsJmsMessage decodeStreamBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeStreamBody");
JsJmsStreamMessage result = new JsJmsStreamMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null) {
try {
StringTokenizer st = new StringTokenizer(body, "&");
while (st.hasMoreTokens())
result.writeObject(decodeObject(st.nextToken()));
} catch (UnsupportedEncodingException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageFactoryImpl.decodeStreamBody", "196");
// This can't happen, as the Exception can only be thrown for an MQ message
// which isn't what we have.
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeStreamBody");
return result;
} | java | private static JsJmsMessage decodeStreamBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeStreamBody");
JsJmsStreamMessage result = new JsJmsStreamMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null) {
try {
StringTokenizer st = new StringTokenizer(body, "&");
while (st.hasMoreTokens())
result.writeObject(decodeObject(st.nextToken()));
} catch (UnsupportedEncodingException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageFactoryImpl.decodeStreamBody", "196");
// This can't happen, as the Exception can only be thrown for an MQ message
// which isn't what we have.
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeStreamBody");
return result;
} | [
"private",
"static",
"JsJmsMessage",
"decodeStreamBody",
"(",
"String",
"body",
")",
"throws",
"MessageDecodeFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"decodeStreamBody\"",
")",
";",
"JsJmsStreamMessage",
"result",
"=",
"new",
"JsJmsStreamMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"if",
"(",
"body",
"!=",
"null",
")",
"{",
"try",
"{",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"body",
",",
"\"&\"",
")",
";",
"while",
"(",
"st",
".",
"hasMoreTokens",
"(",
")",
")",
"result",
".",
"writeObject",
"(",
"decodeObject",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.mfp.impl.WebJsJmsMessageFactoryImpl.decodeStreamBody\"",
",",
"\"196\"",
")",
";",
"// This can't happen, as the Exception can only be thrown for an MQ message",
"// which isn't what we have.",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"decodeStreamBody\"",
")",
";",
"return",
"result",
";",
"}"
] | Decode a stream message | [
"Decode",
"a",
"stream",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L166-L184 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodeMapBody | private static JsJmsMessage decodeMapBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeMapBody");
JsJmsMapMessage result = new JsJmsMapMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null) {
try {
StringTokenizer st = new StringTokenizer(body, "&");
while (st.hasMoreTokens()) {
Object[] pair = decodePair(st.nextToken());
result.setObject((String) pair[0], pair[1]);
}
} catch (UnsupportedEncodingException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageFactoryImpl.decodeMapBody", "218");
// This can't happen, as the Exception can only be thrown for an MQ message
// which isn't what we have.
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeMapBody");
return result;
} | java | private static JsJmsMessage decodeMapBody(String body) throws MessageDecodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "decodeMapBody");
JsJmsMapMessage result = new JsJmsMapMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
if (body != null) {
try {
StringTokenizer st = new StringTokenizer(body, "&");
while (st.hasMoreTokens()) {
Object[] pair = decodePair(st.nextToken());
result.setObject((String) pair[0], pair[1]);
}
} catch (UnsupportedEncodingException e) {
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageFactoryImpl.decodeMapBody", "218");
// This can't happen, as the Exception can only be thrown for an MQ message
// which isn't what we have.
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "decodeMapBody");
return result;
} | [
"private",
"static",
"JsJmsMessage",
"decodeMapBody",
"(",
"String",
"body",
")",
"throws",
"MessageDecodeFailedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"decodeMapBody\"",
")",
";",
"JsJmsMapMessage",
"result",
"=",
"new",
"JsJmsMapMessageImpl",
"(",
"MfpConstants",
".",
"CONSTRUCTOR_NO_OP",
")",
";",
"if",
"(",
"body",
"!=",
"null",
")",
"{",
"try",
"{",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"body",
",",
"\"&\"",
")",
";",
"while",
"(",
"st",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"Object",
"[",
"]",
"pair",
"=",
"decodePair",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
";",
"result",
".",
"setObject",
"(",
"(",
"String",
")",
"pair",
"[",
"0",
"]",
",",
"pair",
"[",
"1",
"]",
")",
";",
"}",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.mfp.impl.WebJsJmsMessageFactoryImpl.decodeMapBody\"",
",",
"\"218\"",
")",
";",
"// This can't happen, as the Exception can only be thrown for an MQ message",
"// which isn't what we have.",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"decodeMapBody\"",
")",
";",
"return",
"result",
";",
"}"
] | Decode a map message | [
"Decode",
"a",
"map",
"message"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L187-L207 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodeHeader | private static void decodeHeader(JsJmsMessage msg, String id, String type, String topic, String props) {
// id should be hexEncoded byte array but if it looks too short we prepend a '0' to
// allow clients to simply use an integer if they want.
if (id != null) {
if (id.length() % 2 != 0)
id = "0" + id;
msg.setCorrelationIdAsBytes(HexString.hexToBin(id, 0));
}
// type goes in the JMSXAppId property. A type of 'SIB' means the special case
// compact form.
if (type != null) {
if (type.equals("SIB"))
msg.setJmsxAppId(MfpConstants.WPM_JMSXAPPID);
else
msg.setJmsxAppId(URLDecode(type));
}
// Topic goes to discriminator
if (topic != null)
msg.setDiscriminator(URLDecode(topic));
// And the properties
if (props != null) {
StringTokenizer st = new StringTokenizer(props, "&");
while (st.hasMoreTokens()) {
Object[] pair = decodePair(st.nextToken());
// JMSXAppID has already been set from the header field
if (!((String) pair[0]).equals(SIProperties.JMSXAppID)) {
try {
msg.setObjectProperty((String) pair[0], pair[1]);
} catch (Exception e) {
// No FFDC code needed
// No FFDC needed as setObjectProperty() can only throw a JMSException
// for a JMS_IBM_Report or JMS_IBM_Feedback property & we don't call
// it for any of those.
}
}
}
}
} | java | private static void decodeHeader(JsJmsMessage msg, String id, String type, String topic, String props) {
// id should be hexEncoded byte array but if it looks too short we prepend a '0' to
// allow clients to simply use an integer if they want.
if (id != null) {
if (id.length() % 2 != 0)
id = "0" + id;
msg.setCorrelationIdAsBytes(HexString.hexToBin(id, 0));
}
// type goes in the JMSXAppId property. A type of 'SIB' means the special case
// compact form.
if (type != null) {
if (type.equals("SIB"))
msg.setJmsxAppId(MfpConstants.WPM_JMSXAPPID);
else
msg.setJmsxAppId(URLDecode(type));
}
// Topic goes to discriminator
if (topic != null)
msg.setDiscriminator(URLDecode(topic));
// And the properties
if (props != null) {
StringTokenizer st = new StringTokenizer(props, "&");
while (st.hasMoreTokens()) {
Object[] pair = decodePair(st.nextToken());
// JMSXAppID has already been set from the header field
if (!((String) pair[0]).equals(SIProperties.JMSXAppID)) {
try {
msg.setObjectProperty((String) pair[0], pair[1]);
} catch (Exception e) {
// No FFDC code needed
// No FFDC needed as setObjectProperty() can only throw a JMSException
// for a JMS_IBM_Report or JMS_IBM_Feedback property & we don't call
// it for any of those.
}
}
}
}
} | [
"private",
"static",
"void",
"decodeHeader",
"(",
"JsJmsMessage",
"msg",
",",
"String",
"id",
",",
"String",
"type",
",",
"String",
"topic",
",",
"String",
"props",
")",
"{",
"// id should be hexEncoded byte array but if it looks too short we prepend a '0' to",
"// allow clients to simply use an integer if they want.",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"if",
"(",
"id",
".",
"length",
"(",
")",
"%",
"2",
"!=",
"0",
")",
"id",
"=",
"\"0\"",
"+",
"id",
";",
"msg",
".",
"setCorrelationIdAsBytes",
"(",
"HexString",
".",
"hexToBin",
"(",
"id",
",",
"0",
")",
")",
";",
"}",
"// type goes in the JMSXAppId property. A type of 'SIB' means the special case",
"// compact form.",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"\"SIB\"",
")",
")",
"msg",
".",
"setJmsxAppId",
"(",
"MfpConstants",
".",
"WPM_JMSXAPPID",
")",
";",
"else",
"msg",
".",
"setJmsxAppId",
"(",
"URLDecode",
"(",
"type",
")",
")",
";",
"}",
"// Topic goes to discriminator",
"if",
"(",
"topic",
"!=",
"null",
")",
"msg",
".",
"setDiscriminator",
"(",
"URLDecode",
"(",
"topic",
")",
")",
";",
"// And the properties",
"if",
"(",
"props",
"!=",
"null",
")",
"{",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"props",
",",
"\"&\"",
")",
";",
"while",
"(",
"st",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"Object",
"[",
"]",
"pair",
"=",
"decodePair",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
";",
"// JMSXAppID has already been set from the header field",
"if",
"(",
"!",
"(",
"(",
"String",
")",
"pair",
"[",
"0",
"]",
")",
".",
"equals",
"(",
"SIProperties",
".",
"JMSXAppID",
")",
")",
"{",
"try",
"{",
"msg",
".",
"setObjectProperty",
"(",
"(",
"String",
")",
"pair",
"[",
"0",
"]",
",",
"pair",
"[",
"1",
"]",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// No FFDC code needed",
"// No FFDC needed as setObjectProperty() can only throw a JMSException",
"// for a JMS_IBM_Report or JMS_IBM_Feedback property & we don't call",
"// it for any of those.",
"}",
"}",
"}",
"}",
"}"
] | Decode and set the header fields | [
"Decode",
"and",
"set",
"the",
"header",
"fields"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L210-L250 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodePair | private static Object[] decodePair(String text) {
Object[] result = new Object[2];
int i = text.indexOf('=');
result[0] = URLDecode(text.substring(0, i));
result[1] = decodeObject(text.substring(i + 1));
return result;
} | java | private static Object[] decodePair(String text) {
Object[] result = new Object[2];
int i = text.indexOf('=');
result[0] = URLDecode(text.substring(0, i));
result[1] = decodeObject(text.substring(i + 1));
return result;
} | [
"private",
"static",
"Object",
"[",
"]",
"decodePair",
"(",
"String",
"text",
")",
"{",
"Object",
"[",
"]",
"result",
"=",
"new",
"Object",
"[",
"2",
"]",
";",
"int",
"i",
"=",
"text",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"result",
"[",
"0",
"]",
"=",
"URLDecode",
"(",
"text",
".",
"substring",
"(",
"0",
",",
"i",
")",
")",
";",
"result",
"[",
"1",
"]",
"=",
"decodeObject",
"(",
"text",
".",
"substring",
"(",
"i",
"+",
"1",
")",
")",
";",
"return",
"result",
";",
"}"
] | Decode a name=value pair | [
"Decode",
"a",
"name",
"=",
"value",
"pair"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L253-L259 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.decodeObject | private static Object decodeObject(String text) {
Object result = null;
if (text.startsWith("[]"))
result = HexString.hexToBin(text, 2);
else
result = URLDecode(text);
return result;
} | java | private static Object decodeObject(String text) {
Object result = null;
if (text.startsWith("[]"))
result = HexString.hexToBin(text, 2);
else
result = URLDecode(text);
return result;
} | [
"private",
"static",
"Object",
"decodeObject",
"(",
"String",
"text",
")",
"{",
"Object",
"result",
"=",
"null",
";",
"if",
"(",
"text",
".",
"startsWith",
"(",
"\"[]\"",
")",
")",
"result",
"=",
"HexString",
".",
"hexToBin",
"(",
"text",
",",
"2",
")",
";",
"else",
"result",
"=",
"URLDecode",
"(",
"text",
")",
";",
"return",
"result",
";",
"}"
] | Decode an object as a string or byte array | [
"Decode",
"an",
"object",
"as",
"a",
"string",
"or",
"byte",
"array"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L262-L269 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java | WebJsMessageFactoryImpl.URLDecode | private static String URLDecode(String text) {
String result = null;
try {
result = URLDecoder.decode(text, "UTF8");
} catch (UnsupportedEncodingException e) {
// Should never happen - all JDKs must support UTF8
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsMessageFactoryImpl.URLDecode", "293");
}
return result;
} | java | private static String URLDecode(String text) {
String result = null;
try {
result = URLDecoder.decode(text, "UTF8");
} catch (UnsupportedEncodingException e) {
// Should never happen - all JDKs must support UTF8
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsMessageFactoryImpl.URLDecode", "293");
}
return result;
} | [
"private",
"static",
"String",
"URLDecode",
"(",
"String",
"text",
")",
"{",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"URLDecoder",
".",
"decode",
"(",
"text",
",",
"\"UTF8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"// Should never happen - all JDKs must support UTF8",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.mfp.impl.WebJsMessageFactoryImpl.URLDecode\"",
",",
"\"293\"",
")",
";",
"}",
"return",
"result",
";",
"}"
] | URL decode a string | [
"URL",
"decode",
"a",
"string"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/WebJsMessageFactoryImpl.java#L272-L281 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/CustomMatchingStrategy.java | CustomMatchingStrategy.getMatchResponse | @Override
public MatchResponse getMatchResponse(SecurityConstraint securityConstraint, String resourceName, String method) {
CollectionMatch collectionMatch = getCollectionMatch(securityConstraint.getWebResourceCollections(), resourceName, method);
if (CollectionMatch.RESPONSE_NO_MATCH.equals(collectionMatch) ||
(collectionMatch == null && securityConstraint.getRoles().isEmpty() && securityConstraint.isAccessPrecluded() == false)) {
return MatchResponse.NO_MATCH_RESPONSE;
} else if (collectionMatch == null) {
return MatchResponse.CUSTOM_NO_MATCH_RESPONSE;
}
return new MatchResponse(securityConstraint.getRoles(), securityConstraint.isSSLRequired(),
securityConstraint.isAccessPrecluded(), collectionMatch);
} | java | @Override
public MatchResponse getMatchResponse(SecurityConstraint securityConstraint, String resourceName, String method) {
CollectionMatch collectionMatch = getCollectionMatch(securityConstraint.getWebResourceCollections(), resourceName, method);
if (CollectionMatch.RESPONSE_NO_MATCH.equals(collectionMatch) ||
(collectionMatch == null && securityConstraint.getRoles().isEmpty() && securityConstraint.isAccessPrecluded() == false)) {
return MatchResponse.NO_MATCH_RESPONSE;
} else if (collectionMatch == null) {
return MatchResponse.CUSTOM_NO_MATCH_RESPONSE;
}
return new MatchResponse(securityConstraint.getRoles(), securityConstraint.isSSLRequired(),
securityConstraint.isAccessPrecluded(), collectionMatch);
} | [
"@",
"Override",
"public",
"MatchResponse",
"getMatchResponse",
"(",
"SecurityConstraint",
"securityConstraint",
",",
"String",
"resourceName",
",",
"String",
"method",
")",
"{",
"CollectionMatch",
"collectionMatch",
"=",
"getCollectionMatch",
"(",
"securityConstraint",
".",
"getWebResourceCollections",
"(",
")",
",",
"resourceName",
",",
"method",
")",
";",
"if",
"(",
"CollectionMatch",
".",
"RESPONSE_NO_MATCH",
".",
"equals",
"(",
"collectionMatch",
")",
"||",
"(",
"collectionMatch",
"==",
"null",
"&&",
"securityConstraint",
".",
"getRoles",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"securityConstraint",
".",
"isAccessPrecluded",
"(",
")",
"==",
"false",
")",
")",
"{",
"return",
"MatchResponse",
".",
"NO_MATCH_RESPONSE",
";",
"}",
"else",
"if",
"(",
"collectionMatch",
"==",
"null",
")",
"{",
"return",
"MatchResponse",
".",
"CUSTOM_NO_MATCH_RESPONSE",
";",
"}",
"return",
"new",
"MatchResponse",
"(",
"securityConstraint",
".",
"getRoles",
"(",
")",
",",
"securityConstraint",
".",
"isSSLRequired",
"(",
")",
",",
"securityConstraint",
".",
"isAccessPrecluded",
"(",
")",
",",
"collectionMatch",
")",
";",
"}"
] | Gets the response object that contains the roles, the SSL required
and access precluded indicators. Gets the response using the custom method algorithm.
If the collection match returned from the collection is null,
then response must be CUSTOM_NO_MATCH_RESPONSE.
@param resourceName The resource name.
@param method The HTTP method.
@return | [
"Gets",
"the",
"response",
"object",
"that",
"contains",
"the",
"roles",
"the",
"SSL",
"required",
"and",
"access",
"precluded",
"indicators",
".",
"Gets",
"the",
"response",
"using",
"the",
"custom",
"method",
"algorithm",
".",
"If",
"the",
"collection",
"match",
"returned",
"from",
"the",
"collection",
"is",
"null",
"then",
"response",
"must",
"be",
"CUSTOM_NO_MATCH_RESPONSE",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/CustomMatchingStrategy.java#L50-L61 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/internal/RegisteredHttpServiceImpl.java | RegisteredHttpServiceImpl.deactivate | protected void deactivate(ComponentContext ctxt, int reason) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Deactivating, reason=" + reason);
}
unregisterAll();
} | java | protected void deactivate(ComponentContext ctxt, int reason) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Deactivating, reason=" + reason);
}
unregisterAll();
} | [
"protected",
"void",
"deactivate",
"(",
"ComponentContext",
"ctxt",
",",
"int",
"reason",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"this",
",",
"tc",
",",
"\"Deactivating, reason=\"",
"+",
"reason",
")",
";",
"}",
"unregisterAll",
"(",
")",
";",
"}"
] | Deactivate this component.
@param ctxt | [
"Deactivate",
"this",
"component",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.httpservice/src/com/ibm/ws/httpsvc/internal/RegisteredHttpServiceImpl.java#L98-L103 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java | SessionContext.addHttpSessionListener | public void addHttpSessionListener(HttpSessionListener listener, String J2EEName) {
synchronized (mHttpSessionListeners) {
mHttpSessionListeners.add(listener);
mHttpSessionListenersJ2eeNames.add(J2EEName);
sessionListener = true;
_coreHttpSessionManager.getIStore().setHttpSessionListener(true);
// PM03375: Set app listeners
if (mHttpAppSessionListeners != null)
mHttpAppSessionListeners.add(listener);
// PM03375: Set listener for app session manager
if (_coreHttpAppSessionManager != null)
_coreHttpAppSessionManager.getIStore().setHttpSessionListener(true);
if (listener instanceof IBMSessionListener) {
wasHttpSessionObserver.setDoesContainIBMSessionListener(true);
// PM03375: Mark app observer
// Begin: PM03375: Use separate observer for app sessions
if (wasHttpAppSessionObserver != null) {
wasHttpAppSessionObserver.setDoesContainIBMSessionListener(true);
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "Marked " +
" app IBM session listener for app observer "
+ mHttpAppSessionListeners);
}
// End: PM03375
}
}
} | java | public void addHttpSessionListener(HttpSessionListener listener, String J2EEName) {
synchronized (mHttpSessionListeners) {
mHttpSessionListeners.add(listener);
mHttpSessionListenersJ2eeNames.add(J2EEName);
sessionListener = true;
_coreHttpSessionManager.getIStore().setHttpSessionListener(true);
// PM03375: Set app listeners
if (mHttpAppSessionListeners != null)
mHttpAppSessionListeners.add(listener);
// PM03375: Set listener for app session manager
if (_coreHttpAppSessionManager != null)
_coreHttpAppSessionManager.getIStore().setHttpSessionListener(true);
if (listener instanceof IBMSessionListener) {
wasHttpSessionObserver.setDoesContainIBMSessionListener(true);
// PM03375: Mark app observer
// Begin: PM03375: Use separate observer for app sessions
if (wasHttpAppSessionObserver != null) {
wasHttpAppSessionObserver.setDoesContainIBMSessionListener(true);
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "Marked " +
" app IBM session listener for app observer "
+ mHttpAppSessionListeners);
}
// End: PM03375
}
}
} | [
"public",
"void",
"addHttpSessionListener",
"(",
"HttpSessionListener",
"listener",
",",
"String",
"J2EEName",
")",
"{",
"synchronized",
"(",
"mHttpSessionListeners",
")",
"{",
"mHttpSessionListeners",
".",
"add",
"(",
"listener",
")",
";",
"mHttpSessionListenersJ2eeNames",
".",
"add",
"(",
"J2EEName",
")",
";",
"sessionListener",
"=",
"true",
";",
"_coreHttpSessionManager",
".",
"getIStore",
"(",
")",
".",
"setHttpSessionListener",
"(",
"true",
")",
";",
"// PM03375: Set app listeners",
"if",
"(",
"mHttpAppSessionListeners",
"!=",
"null",
")",
"mHttpAppSessionListeners",
".",
"add",
"(",
"listener",
")",
";",
"// PM03375: Set listener for app session manager ",
"if",
"(",
"_coreHttpAppSessionManager",
"!=",
"null",
")",
"_coreHttpAppSessionManager",
".",
"getIStore",
"(",
")",
".",
"setHttpSessionListener",
"(",
"true",
")",
";",
"if",
"(",
"listener",
"instanceof",
"IBMSessionListener",
")",
"{",
"wasHttpSessionObserver",
".",
"setDoesContainIBMSessionListener",
"(",
"true",
")",
";",
"// PM03375: Mark app observer",
"// Begin: PM03375: Use separate observer for app sessions",
"if",
"(",
"wasHttpAppSessionObserver",
"!=",
"null",
")",
"{",
"wasHttpAppSessionObserver",
".",
"setDoesContainIBMSessionListener",
"(",
"true",
")",
";",
"LoggingUtil",
".",
"SESSION_LOGGER_CORE",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"methodClassName",
",",
"methodNames",
"[",
"ADD_HTTP_SESSION_LISTENER",
"]",
",",
"\"Marked \"",
"+",
"\" app IBM session listener for app observer \"",
"+",
"mHttpAppSessionListeners",
")",
";",
"}",
"// End: PM03375",
"}",
"}",
"}"
] | Akaimai requested function - overridden in WsSessionContext | [
"Akaimai",
"requested",
"function",
"-",
"overridden",
"in",
"WsSessionContext"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java#L1075-L1102 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.springboot.utility/src/com/ibm/ws/springboot/utility/tasks/BaseCommandTask.java | BaseCommandTask.getArgumentValue | protected String getArgumentValue(String arg, String[] args, ConsoleWrapper stdin, PrintStream stdout) {
for (int i = 1; i < args.length; i++) {
String key = args[i].split("=")[0];
if (key.equals(arg)) {
return getValue(args[i]);
}
}
return null;
} | java | protected String getArgumentValue(String arg, String[] args, ConsoleWrapper stdin, PrintStream stdout) {
for (int i = 1; i < args.length; i++) {
String key = args[i].split("=")[0];
if (key.equals(arg)) {
return getValue(args[i]);
}
}
return null;
} | [
"protected",
"String",
"getArgumentValue",
"(",
"String",
"arg",
",",
"String",
"[",
"]",
"args",
",",
"ConsoleWrapper",
"stdin",
",",
"PrintStream",
"stdout",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"key",
"=",
"args",
"[",
"i",
"]",
".",
"split",
"(",
"\"=\"",
")",
"[",
"0",
"]",
";",
"if",
"(",
"key",
".",
"equals",
"(",
"arg",
")",
")",
"{",
"return",
"getValue",
"(",
"args",
"[",
"i",
"]",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the value for the specified argument String.
No validation is done in the format of args as it is assumed to
have been done previously.
@param arg Argument name to resolve a value for
@param args List of arguments. Assumes the script name is included and therefore minimum length is 2.
@param stdin Standard in interface
@param stdout Standard out interface
@return Value of the argument
@throws IllegalArgumentException if the argument is defined but no value is given. | [
"Gets",
"the",
"value",
"for",
"the",
"specified",
"argument",
"String",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.springboot.utility/src/com/ibm/ws/springboot/utility/tasks/BaseCommandTask.java#L163-L171 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CATHandshakeProperties.java | CATHandshakeProperties.setHeartbeatInterval | public void setHeartbeatInterval(short heartbeatInterval)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setHeartbeatInterval");
properties.put(HEARTBEAT_INTERVAL, heartbeatInterval);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setHeartbeatInterval", ""+heartbeatInterval);
} | java | public void setHeartbeatInterval(short heartbeatInterval)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setHeartbeatInterval");
properties.put(HEARTBEAT_INTERVAL, heartbeatInterval);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setHeartbeatInterval", ""+heartbeatInterval);
} | [
"public",
"void",
"setHeartbeatInterval",
"(",
"short",
"heartbeatInterval",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setHeartbeatInterval\"",
")",
";",
"properties",
".",
"put",
"(",
"HEARTBEAT_INTERVAL",
",",
"heartbeatInterval",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setHeartbeatInterval\"",
",",
"\"\"",
"+",
"heartbeatInterval",
")",
";",
"}"
] | Sets the heartbeat interval.
@param heartbeatInterval | [
"Sets",
"the",
"heartbeat",
"interval",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CATHandshakeProperties.java#L176-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/util/SpringBootThinUtil.java | SpringBootThinUtil.isZip | private boolean isZip(JarEntry entry) throws IOException {
try (InputStream entryInputStream = sourceFatJar.getInputStream(entry)) {
try (ZipInputStream zipInputStream = new ZipInputStream(entryInputStream)) {
ZipEntry ze = zipInputStream.getNextEntry();
if (ze == null) {
return false;
}
return true;
}
}
} | java | private boolean isZip(JarEntry entry) throws IOException {
try (InputStream entryInputStream = sourceFatJar.getInputStream(entry)) {
try (ZipInputStream zipInputStream = new ZipInputStream(entryInputStream)) {
ZipEntry ze = zipInputStream.getNextEntry();
if (ze == null) {
return false;
}
return true;
}
}
} | [
"private",
"boolean",
"isZip",
"(",
"JarEntry",
"entry",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"entryInputStream",
"=",
"sourceFatJar",
".",
"getInputStream",
"(",
"entry",
")",
")",
"{",
"try",
"(",
"ZipInputStream",
"zipInputStream",
"=",
"new",
"ZipInputStream",
"(",
"entryInputStream",
")",
")",
"{",
"ZipEntry",
"ze",
"=",
"zipInputStream",
".",
"getNextEntry",
"(",
")",
";",
"if",
"(",
"ze",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"}",
"}"
] | Check whether the jar entry is a zip, regardless of the extension.
@param entry
@return true or false telling if the jar entry is a valid zip
@throws IOException | [
"Check",
"whether",
"the",
"jar",
"entry",
"is",
"a",
"zip",
"regardless",
"of",
"the",
"extension",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/util/SpringBootThinUtil.java#L225-L235 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/Utils.java | Utils.getLogDir | public static File getLogDir() {
String logDirLoc = null;
// 1st check in environment variable is set. This is the normal case
// when the server is started from the command line.
if (logDir.get() == null) {
File resultDir = null;
try {
logDirLoc = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
return System.getenv(BootstrapConstants.ENV_LOG_DIR);
}
});
} catch (Exception ex) {
}
//outputDirLoc = System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
if (logDirLoc != null) {
resultDir = new File(logDirLoc);
} else {
// PI20344: Check if the Java property is set, which is the normal case when
// the server is embedded; i.e. they didn't launch it from the command line.
logDirLoc = System.getProperty(BootstrapConstants.ENV_LOG_DIR);
if (logDirLoc != null) {
resultDir = new File(logDirLoc);
}
}
logDir = StaticValue.mutateStaticValue(logDir, new FileInitializer(resultDir));
}
return logDir.get();
} | java | public static File getLogDir() {
String logDirLoc = null;
// 1st check in environment variable is set. This is the normal case
// when the server is started from the command line.
if (logDir.get() == null) {
File resultDir = null;
try {
logDirLoc = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
return System.getenv(BootstrapConstants.ENV_LOG_DIR);
}
});
} catch (Exception ex) {
}
//outputDirLoc = System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
if (logDirLoc != null) {
resultDir = new File(logDirLoc);
} else {
// PI20344: Check if the Java property is set, which is the normal case when
// the server is embedded; i.e. they didn't launch it from the command line.
logDirLoc = System.getProperty(BootstrapConstants.ENV_LOG_DIR);
if (logDirLoc != null) {
resultDir = new File(logDirLoc);
}
}
logDir = StaticValue.mutateStaticValue(logDir, new FileInitializer(resultDir));
}
return logDir.get();
} | [
"public",
"static",
"File",
"getLogDir",
"(",
")",
"{",
"String",
"logDirLoc",
"=",
"null",
";",
"// 1st check in environment variable is set. This is the normal case",
"// when the server is started from the command line.",
"if",
"(",
"logDir",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"File",
"resultDir",
"=",
"null",
";",
"try",
"{",
"logDirLoc",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"java",
".",
"security",
".",
"PrivilegedExceptionAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"throws",
"Exception",
"{",
"return",
"System",
".",
"getenv",
"(",
"BootstrapConstants",
".",
"ENV_LOG_DIR",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"}",
"//outputDirLoc = System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);",
"if",
"(",
"logDirLoc",
"!=",
"null",
")",
"{",
"resultDir",
"=",
"new",
"File",
"(",
"logDirLoc",
")",
";",
"}",
"else",
"{",
"// PI20344: Check if the Java property is set, which is the normal case when",
"// the server is embedded; i.e. they didn't launch it from the command line.",
"logDirLoc",
"=",
"System",
".",
"getProperty",
"(",
"BootstrapConstants",
".",
"ENV_LOG_DIR",
")",
";",
"if",
"(",
"logDirLoc",
"!=",
"null",
")",
"{",
"resultDir",
"=",
"new",
"File",
"(",
"logDirLoc",
")",
";",
"}",
"}",
"logDir",
"=",
"StaticValue",
".",
"mutateStaticValue",
"(",
"logDir",
",",
"new",
"FileInitializer",
"(",
"resultDir",
")",
")",
";",
"}",
"return",
"logDir",
".",
"get",
"(",
")",
";",
"}"
] | Returns directory containing server log directories.
@return instance of the log directory or 'null' if LOG_DIR is not defined | [
"Returns",
"directory",
"containing",
"server",
"log",
"directories",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/Utils.java#L103-L136 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/Utils.java | Utils.getOutputDir | public static File getOutputDir(boolean isClient) {
String outputDirLoc = null;
// 1st check in environment variable is set. This is the normal case
// when the server is started from the command line.
if (outputDir.get() == null) {
try {
outputDirLoc = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
return System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
}
});
} catch (Exception ex) {
}
//outputDirLoc = System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
File resultDir = null;
if (outputDirLoc != null) {
resultDir = new File(outputDirLoc);
} else {
// PI20344: Check if the Java property is set, which is the normal case when
// the server is embedded; i.e. they didn't launch it from the command line.
outputDirLoc = System.getProperty(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
if (outputDirLoc != null) {
resultDir = new File(outputDirLoc);
} else {
File userDir = Utils.getUserDir();
if (userDir != null) {
if (isClient) {
resultDir = new File(userDir, "clients");
} else {
resultDir = new File(userDir, "servers");
}
}
}
}
outputDir = StaticValue.mutateStaticValue(outputDir, new FileInitializer(resultDir));
}
return outputDir.get();
} | java | public static File getOutputDir(boolean isClient) {
String outputDirLoc = null;
// 1st check in environment variable is set. This is the normal case
// when the server is started from the command line.
if (outputDir.get() == null) {
try {
outputDirLoc = AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<String>() {
@Override
public String run() throws Exception {
return System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
}
});
} catch (Exception ex) {
}
//outputDirLoc = System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
File resultDir = null;
if (outputDirLoc != null) {
resultDir = new File(outputDirLoc);
} else {
// PI20344: Check if the Java property is set, which is the normal case when
// the server is embedded; i.e. they didn't launch it from the command line.
outputDirLoc = System.getProperty(BootstrapConstants.ENV_WLP_OUTPUT_DIR);
if (outputDirLoc != null) {
resultDir = new File(outputDirLoc);
} else {
File userDir = Utils.getUserDir();
if (userDir != null) {
if (isClient) {
resultDir = new File(userDir, "clients");
} else {
resultDir = new File(userDir, "servers");
}
}
}
}
outputDir = StaticValue.mutateStaticValue(outputDir, new FileInitializer(resultDir));
}
return outputDir.get();
} | [
"public",
"static",
"File",
"getOutputDir",
"(",
"boolean",
"isClient",
")",
"{",
"String",
"outputDirLoc",
"=",
"null",
";",
"// 1st check in environment variable is set. This is the normal case",
"// when the server is started from the command line.",
"if",
"(",
"outputDir",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"try",
"{",
"outputDirLoc",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"java",
".",
"security",
".",
"PrivilegedExceptionAction",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"run",
"(",
")",
"throws",
"Exception",
"{",
"return",
"System",
".",
"getenv",
"(",
"BootstrapConstants",
".",
"ENV_WLP_OUTPUT_DIR",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"}",
"//outputDirLoc = System.getenv(BootstrapConstants.ENV_WLP_OUTPUT_DIR);",
"File",
"resultDir",
"=",
"null",
";",
"if",
"(",
"outputDirLoc",
"!=",
"null",
")",
"{",
"resultDir",
"=",
"new",
"File",
"(",
"outputDirLoc",
")",
";",
"}",
"else",
"{",
"// PI20344: Check if the Java property is set, which is the normal case when",
"// the server is embedded; i.e. they didn't launch it from the command line.",
"outputDirLoc",
"=",
"System",
".",
"getProperty",
"(",
"BootstrapConstants",
".",
"ENV_WLP_OUTPUT_DIR",
")",
";",
"if",
"(",
"outputDirLoc",
"!=",
"null",
")",
"{",
"resultDir",
"=",
"new",
"File",
"(",
"outputDirLoc",
")",
";",
"}",
"else",
"{",
"File",
"userDir",
"=",
"Utils",
".",
"getUserDir",
"(",
")",
";",
"if",
"(",
"userDir",
"!=",
"null",
")",
"{",
"if",
"(",
"isClient",
")",
"{",
"resultDir",
"=",
"new",
"File",
"(",
"userDir",
",",
"\"clients\"",
")",
";",
"}",
"else",
"{",
"resultDir",
"=",
"new",
"File",
"(",
"userDir",
",",
"\"servers\"",
")",
";",
"}",
"}",
"}",
"}",
"outputDir",
"=",
"StaticValue",
".",
"mutateStaticValue",
"(",
"outputDir",
",",
"new",
"FileInitializer",
"(",
"resultDir",
")",
")",
";",
"}",
"return",
"outputDir",
".",
"get",
"(",
")",
";",
"}"
] | Returns directory containing server output directories. A server output
directory has server's name as a name and located under this directory.
@return instance of the output directory or 'null' if installation directory
can't be determined. | [
"Returns",
"directory",
"containing",
"server",
"output",
"directories",
".",
"A",
"server",
"output",
"directory",
"has",
"server",
"s",
"name",
"as",
"a",
"name",
"and",
"located",
"under",
"this",
"directory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/Utils.java#L145-L187 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/Utils.java | Utils.tryToClose | public static boolean tryToClose(ZipFile zipFile) {
if (zipFile != null) {
try {
zipFile.close();
return true;
} catch (IOException e) {
// ignore
}
}
return false;
} | java | public static boolean tryToClose(ZipFile zipFile) {
if (zipFile != null) {
try {
zipFile.close();
return true;
} catch (IOException e) {
// ignore
}
}
return false;
} | [
"public",
"static",
"boolean",
"tryToClose",
"(",
"ZipFile",
"zipFile",
")",
"{",
"if",
"(",
"zipFile",
"!=",
"null",
")",
"{",
"try",
"{",
"zipFile",
".",
"close",
"(",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// ignore",
"}",
"}",
"return",
"false",
";",
"}"
] | Close the zip file
@param zipFile
@return | [
"Close",
"the",
"zip",
"file"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/Utils.java#L321-L331 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/FTUtils.java | FTUtils.getRealClass | public static Class<?> getRealClass(Class<?> clazz) {
Class<?> realClazz = clazz;
if (isWeldProxy(clazz)) {
realClazz = clazz.getSuperclass();
}
return realClazz;
} | java | public static Class<?> getRealClass(Class<?> clazz) {
Class<?> realClazz = clazz;
if (isWeldProxy(clazz)) {
realClazz = clazz.getSuperclass();
}
return realClazz;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getRealClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Class",
"<",
"?",
">",
"realClazz",
"=",
"clazz",
";",
"if",
"(",
"isWeldProxy",
"(",
"clazz",
")",
")",
"{",
"realClazz",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
";",
"}",
"return",
"realClazz",
";",
"}"
] | Get the real class. If it is proxy, get its superclass, which will be the real class.
@param clazz
@return the real class. | [
"Get",
"the",
"real",
"class",
".",
"If",
"it",
"is",
"proxy",
"get",
"its",
"superclass",
"which",
"will",
"be",
"the",
"real",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/FTUtils.java#L42-L48 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/OutboundVirtualConnectionImpl.java | OutboundVirtualConnectionImpl.destroy | public void destroy(Exception e) {
if (this.appCallback != null) {
this.appCallback.destroy(e);
this.appCallback = null;
}
} | java | public void destroy(Exception e) {
if (this.appCallback != null) {
this.appCallback.destroy(e);
this.appCallback = null;
}
} | [
"public",
"void",
"destroy",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"this",
".",
"appCallback",
"!=",
"null",
")",
"{",
"this",
".",
"appCallback",
".",
"destroy",
"(",
"e",
")",
";",
"this",
".",
"appCallback",
"=",
"null",
";",
"}",
"}"
] | This method is called when there is a problem with the
connectAsync call further down the stack. This will just
be used as a pass through.
@param e | [
"This",
"method",
"is",
"called",
"when",
"there",
"is",
"a",
"problem",
"with",
"the",
"connectAsync",
"call",
"further",
"down",
"the",
"stack",
".",
"This",
"will",
"just",
"be",
"used",
"as",
"a",
"pass",
"through",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/OutboundVirtualConnectionImpl.java#L133-L138 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/SmapGenerator.java | SmapGenerator.addSmap | public synchronized void addSmap(String smap, String stratumName) {
embedded.add("*O " + stratumName + "\n" + smap + "*C " + stratumName + "\n");
} | java | public synchronized void addSmap(String smap, String stratumName) {
embedded.add("*O " + stratumName + "\n" + smap + "*C " + stratumName + "\n");
} | [
"public",
"synchronized",
"void",
"addSmap",
"(",
"String",
"smap",
",",
"String",
"stratumName",
")",
"{",
"embedded",
".",
"add",
"(",
"\"*O \"",
"+",
"stratumName",
"+",
"\"\\n\"",
"+",
"smap",
"+",
"\"*C \"",
"+",
"stratumName",
"+",
"\"\\n\"",
")",
";",
"}"
] | Adds the given string as an embedded SMAP with the given stratum name.
@param smap the SMAP to embed
@param stratumName the name of the stratum output by the compilation
that produced the <tt>smap</tt> to be embedded | [
"Adds",
"the",
"given",
"string",
"as",
"an",
"embedded",
"SMAP",
"with",
"the",
"given",
"stratum",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/SmapGenerator.java#L82-L84 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterCBuffImpl.java | LogRepositoryWriterCBuffImpl.dumpItems | public void dumpItems() {
LinkedList<CBuffRecord> copy = new LinkedList<CBuffRecord>();
synchronized(this) {
copy.addAll(buffer);
buffer.clear();
currentSize = 0L;
if (headerBytes == null) {
return;
}
}
dumpWriter.setHeader(headerBytes);
for(CBuffRecord record: copy) {
dumpWriter.logRecord(record.timestamp, record.bytes);
}
} | java | public void dumpItems() {
LinkedList<CBuffRecord> copy = new LinkedList<CBuffRecord>();
synchronized(this) {
copy.addAll(buffer);
buffer.clear();
currentSize = 0L;
if (headerBytes == null) {
return;
}
}
dumpWriter.setHeader(headerBytes);
for(CBuffRecord record: copy) {
dumpWriter.logRecord(record.timestamp, record.bytes);
}
} | [
"public",
"void",
"dumpItems",
"(",
")",
"{",
"LinkedList",
"<",
"CBuffRecord",
">",
"copy",
"=",
"new",
"LinkedList",
"<",
"CBuffRecord",
">",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"copy",
".",
"addAll",
"(",
"buffer",
")",
";",
"buffer",
".",
"clear",
"(",
")",
";",
"currentSize",
"=",
"0L",
";",
"if",
"(",
"headerBytes",
"==",
"null",
")",
"{",
"return",
";",
"}",
"}",
"dumpWriter",
".",
"setHeader",
"(",
"headerBytes",
")",
";",
"for",
"(",
"CBuffRecord",
"record",
":",
"copy",
")",
"{",
"dumpWriter",
".",
"logRecord",
"(",
"record",
".",
"timestamp",
",",
"record",
".",
"bytes",
")",
";",
"}",
"}"
] | Dumps records stored in buffer to disk using configured LogRepositoryWriter. | [
"Dumps",
"records",
"stored",
"in",
"buffer",
"to",
"disk",
"using",
"configured",
"LogRepositoryWriter",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositoryWriterCBuffImpl.java#L130-L145 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.anno/src/com/ibm/ws/anno/classsource/internal/ClassSourceImpl.java | ClassSourceImpl.getJandexIndex | protected Index getJandexIndex() {
String methodName = "getJandexIndex";
boolean doLog = tc.isDebugEnabled();
boolean doJandexLog = JandexLogger.doLog();
boolean useJandex = getUseJandex();
if ( !useJandex ) {
// Figuring out if there is a Jandex index is mildly expensive,
// and is to be avoided when logging is disabled.
if ( doLog || doJandexLog ) {
boolean haveJandex = basicHasJandexIndex();
String msg;
if ( haveJandex ) {
msg = MessageFormat.format(
"[ {0} ] Jandex disabled; Jandex index [ {1} ] found",
getHashText(), getJandexIndexPath());
} else {
msg = MessageFormat.format(
"[ {0} ] Jandex disabled; Jandex index [ {1} ] not found",
getHashText(), getJandexIndexPath());
}
if ( doLog ) {
Tr.debug(tc, msg);
}
if ( doJandexLog ) {
JandexLogger.log(CLASS_NAME, methodName, msg);
}
}
return null;
} else {
Index jandexIndex = basicGetJandexIndex();
if ( doLog || doJandexLog ) {
String msg;
if ( jandexIndex != null ) {
msg = MessageFormat.format(
"[ {0} ] Jandex enabled; Jandex index [ {1} ] found",
getHashText(), getJandexIndexPath());
} else {
msg = MessageFormat.format(
"[ {0} ] Jandex enabled; Jandex index [ {1} ] not found",
getHashText(), getJandexIndexPath());
}
if ( doLog ) {
Tr.debug(tc, msg);
}
if ( doJandexLog ) {
JandexLogger.log(CLASS_NAME, methodName, msg);
}
}
return jandexIndex;
}
} | java | protected Index getJandexIndex() {
String methodName = "getJandexIndex";
boolean doLog = tc.isDebugEnabled();
boolean doJandexLog = JandexLogger.doLog();
boolean useJandex = getUseJandex();
if ( !useJandex ) {
// Figuring out if there is a Jandex index is mildly expensive,
// and is to be avoided when logging is disabled.
if ( doLog || doJandexLog ) {
boolean haveJandex = basicHasJandexIndex();
String msg;
if ( haveJandex ) {
msg = MessageFormat.format(
"[ {0} ] Jandex disabled; Jandex index [ {1} ] found",
getHashText(), getJandexIndexPath());
} else {
msg = MessageFormat.format(
"[ {0} ] Jandex disabled; Jandex index [ {1} ] not found",
getHashText(), getJandexIndexPath());
}
if ( doLog ) {
Tr.debug(tc, msg);
}
if ( doJandexLog ) {
JandexLogger.log(CLASS_NAME, methodName, msg);
}
}
return null;
} else {
Index jandexIndex = basicGetJandexIndex();
if ( doLog || doJandexLog ) {
String msg;
if ( jandexIndex != null ) {
msg = MessageFormat.format(
"[ {0} ] Jandex enabled; Jandex index [ {1} ] found",
getHashText(), getJandexIndexPath());
} else {
msg = MessageFormat.format(
"[ {0} ] Jandex enabled; Jandex index [ {1} ] not found",
getHashText(), getJandexIndexPath());
}
if ( doLog ) {
Tr.debug(tc, msg);
}
if ( doJandexLog ) {
JandexLogger.log(CLASS_NAME, methodName, msg);
}
}
return jandexIndex;
}
} | [
"protected",
"Index",
"getJandexIndex",
"(",
")",
"{",
"String",
"methodName",
"=",
"\"getJandexIndex\"",
";",
"boolean",
"doLog",
"=",
"tc",
".",
"isDebugEnabled",
"(",
")",
";",
"boolean",
"doJandexLog",
"=",
"JandexLogger",
".",
"doLog",
"(",
")",
";",
"boolean",
"useJandex",
"=",
"getUseJandex",
"(",
")",
";",
"if",
"(",
"!",
"useJandex",
")",
"{",
"// Figuring out if there is a Jandex index is mildly expensive,",
"// and is to be avoided when logging is disabled.",
"if",
"(",
"doLog",
"||",
"doJandexLog",
")",
"{",
"boolean",
"haveJandex",
"=",
"basicHasJandexIndex",
"(",
")",
";",
"String",
"msg",
";",
"if",
"(",
"haveJandex",
")",
"{",
"msg",
"=",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Jandex disabled; Jandex index [ {1} ] found\"",
",",
"getHashText",
"(",
")",
",",
"getJandexIndexPath",
"(",
")",
")",
";",
"}",
"else",
"{",
"msg",
"=",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Jandex disabled; Jandex index [ {1} ] not found\"",
",",
"getHashText",
"(",
")",
",",
"getJandexIndexPath",
"(",
")",
")",
";",
"}",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"msg",
")",
";",
"}",
"if",
"(",
"doJandexLog",
")",
"{",
"JandexLogger",
".",
"log",
"(",
"CLASS_NAME",
",",
"methodName",
",",
"msg",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"else",
"{",
"Index",
"jandexIndex",
"=",
"basicGetJandexIndex",
"(",
")",
";",
"if",
"(",
"doLog",
"||",
"doJandexLog",
")",
"{",
"String",
"msg",
";",
"if",
"(",
"jandexIndex",
"!=",
"null",
")",
"{",
"msg",
"=",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Jandex enabled; Jandex index [ {1} ] found\"",
",",
"getHashText",
"(",
")",
",",
"getJandexIndexPath",
"(",
")",
")",
";",
"}",
"else",
"{",
"msg",
"=",
"MessageFormat",
".",
"format",
"(",
"\"[ {0} ] Jandex enabled; Jandex index [ {1} ] not found\"",
",",
"getHashText",
"(",
")",
",",
"getJandexIndexPath",
"(",
")",
")",
";",
"}",
"if",
"(",
"doLog",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"msg",
")",
";",
"}",
"if",
"(",
"doJandexLog",
")",
"{",
"JandexLogger",
".",
"log",
"(",
"CLASS_NAME",
",",
"methodName",
",",
"msg",
")",
";",
"}",
"}",
"return",
"jandexIndex",
";",
"}",
"}"
] | Attempt to read the Jandex index.
If Jandex is not enabled, immediately answer null.
If no Jandex index is available, or if it cannot be read, answer null.
@return The read Jandex index. | [
"Attempt",
"to",
"read",
"the",
"Jandex",
"index",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.anno/src/com/ibm/ws/anno/classsource/internal/ClassSourceImpl.java#L569-L629 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java | ConjunctionImpl.and | public boolean and(SimpleTest newTest) {
for (int i = 0; i < tmpSimpleTests.size(); i++) {
SimpleTest cand = (SimpleTest) tmpSimpleTests.get(i);
if (cand.getIdentifier().getName().equals(newTest.getIdentifier().getName()))
{
// Careful, may be operating in XPath selector domain, in which
// case we need more stringent tests
if(cand.getIdentifier().isExtended())
{
if(cand.getIdentifier().getStep() == newTest.getIdentifier().getStep())
{
// Identifiers have same name and same location step
return cand.combine(newTest);
}
}
else
return cand.combine(newTest);
}
}
tmpSimpleTests.add(newTest);
alwaysTrue = false;
return true;
} | java | public boolean and(SimpleTest newTest) {
for (int i = 0; i < tmpSimpleTests.size(); i++) {
SimpleTest cand = (SimpleTest) tmpSimpleTests.get(i);
if (cand.getIdentifier().getName().equals(newTest.getIdentifier().getName()))
{
// Careful, may be operating in XPath selector domain, in which
// case we need more stringent tests
if(cand.getIdentifier().isExtended())
{
if(cand.getIdentifier().getStep() == newTest.getIdentifier().getStep())
{
// Identifiers have same name and same location step
return cand.combine(newTest);
}
}
else
return cand.combine(newTest);
}
}
tmpSimpleTests.add(newTest);
alwaysTrue = false;
return true;
} | [
"public",
"boolean",
"and",
"(",
"SimpleTest",
"newTest",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tmpSimpleTests",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"SimpleTest",
"cand",
"=",
"(",
"SimpleTest",
")",
"tmpSimpleTests",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"cand",
".",
"getIdentifier",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"newTest",
".",
"getIdentifier",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"// Careful, may be operating in XPath selector domain, in which",
"// case we need more stringent tests",
"if",
"(",
"cand",
".",
"getIdentifier",
"(",
")",
".",
"isExtended",
"(",
")",
")",
"{",
"if",
"(",
"cand",
".",
"getIdentifier",
"(",
")",
".",
"getStep",
"(",
")",
"==",
"newTest",
".",
"getIdentifier",
"(",
")",
".",
"getStep",
"(",
")",
")",
"{",
"// Identifiers have same name and same location step",
"return",
"cand",
".",
"combine",
"(",
"newTest",
")",
";",
"}",
"}",
"else",
"return",
"cand",
".",
"combine",
"(",
"newTest",
")",
";",
"}",
"}",
"tmpSimpleTests",
".",
"add",
"(",
"newTest",
")",
";",
"alwaysTrue",
"=",
"false",
";",
"return",
"true",
";",
"}"
] | Add a SimpleTest to the Conjunction, searching for contradictions.
@param newTest the new SimpleTest to be added
@return true if the new test is compatible with the old (a false return means the
conjunction will always be false because the test is always false) | [
"Add",
"a",
"SimpleTest",
"to",
"the",
"Conjunction",
"searching",
"for",
"contradictions",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java#L104-L126 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java | ConjunctionImpl.organize | public boolean organize() {
// First, find any simple tests that can be used to reduce residual components to
// simple tests or pure truth values, either because the simple test is a NULL test or
// because it is effectively an equality test.
if (tmpResidual.size() > 0) {
List[] equatedIds = findEquatedIdentifiers();
while (equatedIds != null && tmpResidual.size() > 0) {
equatedIds = reduceResidual(equatedIds);
if (equatedIds != null && equatedIds.length == 0)
// Special indicator for contradiction
return false;
}
}
// We now have a reduced form Conjunction that is still capable of being true. We
// call shedSubtests on each SimpleTest so that STRINGOTH tests can move their
// "difficult" parts to the residual. We didn't do this earlier because we wanted to
// give the STRINGOTH test an opportunity to be trumped by a EQ test on the
// same identifier (or to be contradicted by a NULL test). A false return from
// shedSubtests causes the entire SimpleTest to be removed.
for (int i = 0; i < tmpSimpleTests.size(); )
if (((SimpleTestImpl) tmpSimpleTests.get(i)).shedSubtests(tmpResidual))
i++;
else
tmpSimpleTests.remove(i);
// Sort the simple tests by ordinal position, looking for illegal position
// assignments.
for (int i = 0; i < tmpSimpleTests.size()-1; i++)
for (int j = i+1; j < tmpSimpleTests.size(); j++) {
SimpleTest iTest = (SimpleTest) tmpSimpleTests.get(i);
SimpleTest jTest = (SimpleTest) tmpSimpleTests.get(j);
OrdinalPosition iPos = (OrdinalPosition) iTest.getIdentifier().getOrdinalPosition();
OrdinalPosition jPos = (OrdinalPosition) jTest.getIdentifier().getOrdinalPosition();
if(jPos.compareTo(iPos) < 0)
{
tmpSimpleTests.set(j, iTest);
tmpSimpleTests.set(i, jTest);
}
else if (jTest.getIdentifier().getOrdinalPosition() ==
iTest.getIdentifier().getOrdinalPosition())
throw new IllegalStateException();
}
// We can now convert the Conjunction to its final form
simpleTests = (SimpleTest[]) tmpSimpleTests.toArray(new SimpleTest[0]);
tmpSimpleTests = null;
for (int i = 0; i < tmpResidual.size(); i++)
if (residual == null)
residual = (Selector) tmpResidual.get(i);
else
residual = new OperatorImpl(Operator.AND, residual, (Selector) tmpResidual.get(i));
tmpResidual = null;
alwaysTrue = simpleTests.length == 0 && residual == null;
return true;
} | java | public boolean organize() {
// First, find any simple tests that can be used to reduce residual components to
// simple tests or pure truth values, either because the simple test is a NULL test or
// because it is effectively an equality test.
if (tmpResidual.size() > 0) {
List[] equatedIds = findEquatedIdentifiers();
while (equatedIds != null && tmpResidual.size() > 0) {
equatedIds = reduceResidual(equatedIds);
if (equatedIds != null && equatedIds.length == 0)
// Special indicator for contradiction
return false;
}
}
// We now have a reduced form Conjunction that is still capable of being true. We
// call shedSubtests on each SimpleTest so that STRINGOTH tests can move their
// "difficult" parts to the residual. We didn't do this earlier because we wanted to
// give the STRINGOTH test an opportunity to be trumped by a EQ test on the
// same identifier (or to be contradicted by a NULL test). A false return from
// shedSubtests causes the entire SimpleTest to be removed.
for (int i = 0; i < tmpSimpleTests.size(); )
if (((SimpleTestImpl) tmpSimpleTests.get(i)).shedSubtests(tmpResidual))
i++;
else
tmpSimpleTests.remove(i);
// Sort the simple tests by ordinal position, looking for illegal position
// assignments.
for (int i = 0; i < tmpSimpleTests.size()-1; i++)
for (int j = i+1; j < tmpSimpleTests.size(); j++) {
SimpleTest iTest = (SimpleTest) tmpSimpleTests.get(i);
SimpleTest jTest = (SimpleTest) tmpSimpleTests.get(j);
OrdinalPosition iPos = (OrdinalPosition) iTest.getIdentifier().getOrdinalPosition();
OrdinalPosition jPos = (OrdinalPosition) jTest.getIdentifier().getOrdinalPosition();
if(jPos.compareTo(iPos) < 0)
{
tmpSimpleTests.set(j, iTest);
tmpSimpleTests.set(i, jTest);
}
else if (jTest.getIdentifier().getOrdinalPosition() ==
iTest.getIdentifier().getOrdinalPosition())
throw new IllegalStateException();
}
// We can now convert the Conjunction to its final form
simpleTests = (SimpleTest[]) tmpSimpleTests.toArray(new SimpleTest[0]);
tmpSimpleTests = null;
for (int i = 0; i < tmpResidual.size(); i++)
if (residual == null)
residual = (Selector) tmpResidual.get(i);
else
residual = new OperatorImpl(Operator.AND, residual, (Selector) tmpResidual.get(i));
tmpResidual = null;
alwaysTrue = simpleTests.length == 0 && residual == null;
return true;
} | [
"public",
"boolean",
"organize",
"(",
")",
"{",
"// First, find any simple tests that can be used to reduce residual components to",
"// simple tests or pure truth values, either because the simple test is a NULL test or",
"// because it is effectively an equality test.",
"if",
"(",
"tmpResidual",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"List",
"[",
"]",
"equatedIds",
"=",
"findEquatedIdentifiers",
"(",
")",
";",
"while",
"(",
"equatedIds",
"!=",
"null",
"&&",
"tmpResidual",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"equatedIds",
"=",
"reduceResidual",
"(",
"equatedIds",
")",
";",
"if",
"(",
"equatedIds",
"!=",
"null",
"&&",
"equatedIds",
".",
"length",
"==",
"0",
")",
"// Special indicator for contradiction",
"return",
"false",
";",
"}",
"}",
"// We now have a reduced form Conjunction that is still capable of being true. We",
"// call shedSubtests on each SimpleTest so that STRINGOTH tests can move their",
"// \"difficult\" parts to the residual. We didn't do this earlier because we wanted to ",
"// give the STRINGOTH test an opportunity to be trumped by a EQ test on the ",
"// same identifier (or to be contradicted by a NULL test). A false return from",
"// shedSubtests causes the entire SimpleTest to be removed. ",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tmpSimpleTests",
".",
"size",
"(",
")",
";",
")",
"if",
"(",
"(",
"(",
"SimpleTestImpl",
")",
"tmpSimpleTests",
".",
"get",
"(",
"i",
")",
")",
".",
"shedSubtests",
"(",
"tmpResidual",
")",
")",
"i",
"++",
";",
"else",
"tmpSimpleTests",
".",
"remove",
"(",
"i",
")",
";",
"// Sort the simple tests by ordinal position, looking for illegal position",
"// assignments.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tmpSimpleTests",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
"++",
")",
"for",
"(",
"int",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<",
"tmpSimpleTests",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"SimpleTest",
"iTest",
"=",
"(",
"SimpleTest",
")",
"tmpSimpleTests",
".",
"get",
"(",
"i",
")",
";",
"SimpleTest",
"jTest",
"=",
"(",
"SimpleTest",
")",
"tmpSimpleTests",
".",
"get",
"(",
"j",
")",
";",
"OrdinalPosition",
"iPos",
"=",
"(",
"OrdinalPosition",
")",
"iTest",
".",
"getIdentifier",
"(",
")",
".",
"getOrdinalPosition",
"(",
")",
";",
"OrdinalPosition",
"jPos",
"=",
"(",
"OrdinalPosition",
")",
"jTest",
".",
"getIdentifier",
"(",
")",
".",
"getOrdinalPosition",
"(",
")",
";",
"if",
"(",
"jPos",
".",
"compareTo",
"(",
"iPos",
")",
"<",
"0",
")",
"{",
"tmpSimpleTests",
".",
"set",
"(",
"j",
",",
"iTest",
")",
";",
"tmpSimpleTests",
".",
"set",
"(",
"i",
",",
"jTest",
")",
";",
"}",
"else",
"if",
"(",
"jTest",
".",
"getIdentifier",
"(",
")",
".",
"getOrdinalPosition",
"(",
")",
"==",
"iTest",
".",
"getIdentifier",
"(",
")",
".",
"getOrdinalPosition",
"(",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"// We can now convert the Conjunction to its final form",
"simpleTests",
"=",
"(",
"SimpleTest",
"[",
"]",
")",
"tmpSimpleTests",
".",
"toArray",
"(",
"new",
"SimpleTest",
"[",
"0",
"]",
")",
";",
"tmpSimpleTests",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tmpResidual",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"if",
"(",
"residual",
"==",
"null",
")",
"residual",
"=",
"(",
"Selector",
")",
"tmpResidual",
".",
"get",
"(",
"i",
")",
";",
"else",
"residual",
"=",
"new",
"OperatorImpl",
"(",
"Operator",
".",
"AND",
",",
"residual",
",",
"(",
"Selector",
")",
"tmpResidual",
".",
"get",
"(",
"i",
")",
")",
";",
"tmpResidual",
"=",
"null",
";",
"alwaysTrue",
"=",
"simpleTests",
".",
"length",
"==",
"0",
"&&",
"residual",
"==",
"null",
";",
"return",
"true",
";",
"}"
] | Organize the Conjunction into its final useful form for MatchSpace.
@return true if the Conjunction is still capable of being true, false if a
contradiction was detected during the organize step.
@exception IllegalStateException if the Resolver assigned ordinalPosition information
incorrectly so that the simple tests cannot be ordered. | [
"Organize",
"the",
"Conjunction",
"into",
"its",
"final",
"useful",
"form",
"for",
"MatchSpace",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java#L149-L202 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java | ConjunctionImpl.findEquatedIdentifiers | private List[] findEquatedIdentifiers() {
List[] ans = null;
for (int i = 0; i < tmpSimpleTests.size(); i++) {
SimpleTest cand = (SimpleTest) tmpSimpleTests.get(i);
if (cand.getKind() == SimpleTest.NULL) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName());
ans[1].add(null);
}
else {
Object candValue = cand.getValue();
if (candValue != null) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName());
ans[1].add(candValue);
}
}
}
return ans;
} | java | private List[] findEquatedIdentifiers() {
List[] ans = null;
for (int i = 0; i < tmpSimpleTests.size(); i++) {
SimpleTest cand = (SimpleTest) tmpSimpleTests.get(i);
if (cand.getKind() == SimpleTest.NULL) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName());
ans[1].add(null);
}
else {
Object candValue = cand.getValue();
if (candValue != null) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName());
ans[1].add(candValue);
}
}
}
return ans;
} | [
"private",
"List",
"[",
"]",
"findEquatedIdentifiers",
"(",
")",
"{",
"List",
"[",
"]",
"ans",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tmpSimpleTests",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"SimpleTest",
"cand",
"=",
"(",
"SimpleTest",
")",
"tmpSimpleTests",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"cand",
".",
"getKind",
"(",
")",
"==",
"SimpleTest",
".",
"NULL",
")",
"{",
"if",
"(",
"ans",
"==",
"null",
")",
"ans",
"=",
"new",
"List",
"[",
"]",
"{",
"new",
"ArrayList",
"(",
")",
",",
"new",
"ArrayList",
"(",
")",
"}",
";",
"ans",
"[",
"0",
"]",
".",
"add",
"(",
"cand",
".",
"getIdentifier",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"ans",
"[",
"1",
"]",
".",
"add",
"(",
"null",
")",
";",
"}",
"else",
"{",
"Object",
"candValue",
"=",
"cand",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"candValue",
"!=",
"null",
")",
"{",
"if",
"(",
"ans",
"==",
"null",
")",
"ans",
"=",
"new",
"List",
"[",
"]",
"{",
"new",
"ArrayList",
"(",
")",
",",
"new",
"ArrayList",
"(",
")",
"}",
";",
"ans",
"[",
"0",
"]",
".",
"add",
"(",
"cand",
".",
"getIdentifier",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"ans",
"[",
"1",
"]",
".",
"add",
"(",
"candValue",
")",
";",
"}",
"}",
"}",
"return",
"ans",
";",
"}"
] | that these can be removed from tmpResidual. Return null if there are none. | [
"that",
"these",
"can",
"be",
"removed",
"from",
"tmpResidual",
".",
"Return",
"null",
"if",
"there",
"are",
"none",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java#L208-L229 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java | ConjunctionImpl.reduceResidual | private List[] reduceResidual(List[] equatedIds) {
List[] ans = null;
for (int i = 0; i < tmpResidual.size(); ) {
Operator oper = substitute((Operator) tmpResidual.get(i), equatedIds);
if (oper.getNumIds() > 0 && !Matching.isSimple(oper))
// Even after substitution, must remain as a residual
tmpResidual.set(i++, oper);
else if (oper.getNumIds() == 1) {
// Eligible as a simple test. DNF transform the test first to exploit new type
// information that may have been introduced by the substitution.
Selector trans = Matching.getTransformer().DNF(oper);
if (trans instanceof Operator && ((Operator) trans).getOp() == Selector.OR)
// DNF transformation of the result has revealed a new OR connector. This can
// happen iff the process of substitution changed a <> operator of type
// UNKNOWN into type NUMERIC, which in turn became a disjunction of
// inequalities. If this happens we choose to punt since otherwise we would
// have to redo the entire division of the selector into Conjunctions. We
// don't have logic for the case where the transformation reveals a new AND
// because there is no substitution into a DNF-normalized conjunct that can
// produce a naked AND.
tmpResidual.set(i++, oper);
else {
// Otherwise, remove the residual and make a new SimpleTest and enter it. If
// the new SimpleTest is non-conflicting, proceed, otherwise abandon the
// Conjunction.
SimpleTest newTest = new SimpleTestImpl(trans);
if (!and(newTest))
return new List[0];
tmpResidual.remove(i);
// See if the new test is capable of further reducing the residual
if (newTest.getKind() == SimpleTest.NULL) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(newTest.getIdentifier().getName());
ans[1].add(null);
}
else {
Object newTestValue = newTest.getValue();
if (newTestValue != null) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(newTest.getIdentifier().getName());
ans[1].add(newTestValue);
}
}
}
}
else { // oper.numIds == 0
// Bail if always false
Boolean theEval = (Boolean) Matching.getEvaluator().eval(oper);
if (theEval == null || !(theEval).booleanValue())
return new List[0];
// Always true, so just forget this residual
tmpResidual.remove(i);
}
}
return ans;
} | java | private List[] reduceResidual(List[] equatedIds) {
List[] ans = null;
for (int i = 0; i < tmpResidual.size(); ) {
Operator oper = substitute((Operator) tmpResidual.get(i), equatedIds);
if (oper.getNumIds() > 0 && !Matching.isSimple(oper))
// Even after substitution, must remain as a residual
tmpResidual.set(i++, oper);
else if (oper.getNumIds() == 1) {
// Eligible as a simple test. DNF transform the test first to exploit new type
// information that may have been introduced by the substitution.
Selector trans = Matching.getTransformer().DNF(oper);
if (trans instanceof Operator && ((Operator) trans).getOp() == Selector.OR)
// DNF transformation of the result has revealed a new OR connector. This can
// happen iff the process of substitution changed a <> operator of type
// UNKNOWN into type NUMERIC, which in turn became a disjunction of
// inequalities. If this happens we choose to punt since otherwise we would
// have to redo the entire division of the selector into Conjunctions. We
// don't have logic for the case where the transformation reveals a new AND
// because there is no substitution into a DNF-normalized conjunct that can
// produce a naked AND.
tmpResidual.set(i++, oper);
else {
// Otherwise, remove the residual and make a new SimpleTest and enter it. If
// the new SimpleTest is non-conflicting, proceed, otherwise abandon the
// Conjunction.
SimpleTest newTest = new SimpleTestImpl(trans);
if (!and(newTest))
return new List[0];
tmpResidual.remove(i);
// See if the new test is capable of further reducing the residual
if (newTest.getKind() == SimpleTest.NULL) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(newTest.getIdentifier().getName());
ans[1].add(null);
}
else {
Object newTestValue = newTest.getValue();
if (newTestValue != null) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(newTest.getIdentifier().getName());
ans[1].add(newTestValue);
}
}
}
}
else { // oper.numIds == 0
// Bail if always false
Boolean theEval = (Boolean) Matching.getEvaluator().eval(oper);
if (theEval == null || !(theEval).booleanValue())
return new List[0];
// Always true, so just forget this residual
tmpResidual.remove(i);
}
}
return ans;
} | [
"private",
"List",
"[",
"]",
"reduceResidual",
"(",
"List",
"[",
"]",
"equatedIds",
")",
"{",
"List",
"[",
"]",
"ans",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tmpResidual",
".",
"size",
"(",
")",
";",
")",
"{",
"Operator",
"oper",
"=",
"substitute",
"(",
"(",
"Operator",
")",
"tmpResidual",
".",
"get",
"(",
"i",
")",
",",
"equatedIds",
")",
";",
"if",
"(",
"oper",
".",
"getNumIds",
"(",
")",
">",
"0",
"&&",
"!",
"Matching",
".",
"isSimple",
"(",
"oper",
")",
")",
"// Even after substitution, must remain as a residual",
"tmpResidual",
".",
"set",
"(",
"i",
"++",
",",
"oper",
")",
";",
"else",
"if",
"(",
"oper",
".",
"getNumIds",
"(",
")",
"==",
"1",
")",
"{",
"// Eligible as a simple test. DNF transform the test first to exploit new type",
"// information that may have been introduced by the substitution.",
"Selector",
"trans",
"=",
"Matching",
".",
"getTransformer",
"(",
")",
".",
"DNF",
"(",
"oper",
")",
";",
"if",
"(",
"trans",
"instanceof",
"Operator",
"&&",
"(",
"(",
"Operator",
")",
"trans",
")",
".",
"getOp",
"(",
")",
"==",
"Selector",
".",
"OR",
")",
"// DNF transformation of the result has revealed a new OR connector. This can",
"// happen iff the process of substitution changed a <> operator of type",
"// UNKNOWN into type NUMERIC, which in turn became a disjunction of",
"// inequalities. If this happens we choose to punt since otherwise we would",
"// have to redo the entire division of the selector into Conjunctions. We",
"// don't have logic for the case where the transformation reveals a new AND",
"// because there is no substitution into a DNF-normalized conjunct that can",
"// produce a naked AND.",
"tmpResidual",
".",
"set",
"(",
"i",
"++",
",",
"oper",
")",
";",
"else",
"{",
"// Otherwise, remove the residual and make a new SimpleTest and enter it. If",
"// the new SimpleTest is non-conflicting, proceed, otherwise abandon the",
"// Conjunction.",
"SimpleTest",
"newTest",
"=",
"new",
"SimpleTestImpl",
"(",
"trans",
")",
";",
"if",
"(",
"!",
"and",
"(",
"newTest",
")",
")",
"return",
"new",
"List",
"[",
"0",
"]",
";",
"tmpResidual",
".",
"remove",
"(",
"i",
")",
";",
"// See if the new test is capable of further reducing the residual",
"if",
"(",
"newTest",
".",
"getKind",
"(",
")",
"==",
"SimpleTest",
".",
"NULL",
")",
"{",
"if",
"(",
"ans",
"==",
"null",
")",
"ans",
"=",
"new",
"List",
"[",
"]",
"{",
"new",
"ArrayList",
"(",
")",
",",
"new",
"ArrayList",
"(",
")",
"}",
";",
"ans",
"[",
"0",
"]",
".",
"add",
"(",
"newTest",
".",
"getIdentifier",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"ans",
"[",
"1",
"]",
".",
"add",
"(",
"null",
")",
";",
"}",
"else",
"{",
"Object",
"newTestValue",
"=",
"newTest",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"newTestValue",
"!=",
"null",
")",
"{",
"if",
"(",
"ans",
"==",
"null",
")",
"ans",
"=",
"new",
"List",
"[",
"]",
"{",
"new",
"ArrayList",
"(",
")",
",",
"new",
"ArrayList",
"(",
")",
"}",
";",
"ans",
"[",
"0",
"]",
".",
"add",
"(",
"newTest",
".",
"getIdentifier",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"ans",
"[",
"1",
"]",
".",
"add",
"(",
"newTestValue",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"// oper.numIds == 0",
"// Bail if always false",
"Boolean",
"theEval",
"=",
"(",
"Boolean",
")",
"Matching",
".",
"getEvaluator",
"(",
")",
".",
"eval",
"(",
"oper",
")",
";",
"if",
"(",
"theEval",
"==",
"null",
"||",
"!",
"(",
"theEval",
")",
".",
"booleanValue",
"(",
")",
")",
"return",
"new",
"List",
"[",
"0",
"]",
";",
"// Always true, so just forget this residual",
"tmpResidual",
".",
"remove",
"(",
"i",
")",
";",
"}",
"}",
"return",
"ans",
";",
"}"
] | therefore should be abandoned. | [
"therefore",
"should",
"be",
"abandoned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java#L239-L296 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java | ConjunctionImpl.substitute | private static Operator substitute(Operator oper, List[] equatedIds) {
Selector op1 = oper.getOperands()[0];
Selector op2 = (oper.getOperands().length == 1) ? null : oper.getOperands()[1];
if (op1 instanceof Identifier)
op1 = substitute((Identifier) op1, equatedIds);
else if (op1 instanceof Operator)
op1 = substitute((Operator) op1, equatedIds);
if (op1 == null)
return null;
if (op2 != null) {
if (op2 instanceof Identifier)
op2 = substitute((Identifier) op2, equatedIds);
else if (op2 instanceof Operator)
op2 = substitute((Operator) op2, equatedIds);
if (op2 == null)
return null;
}
if (op1 == oper.getOperands()[0] && (op2 == null || op2 == oper.getOperands()[1]))
return oper;
else if (oper instanceof LikeOperator) {
LikeOperatorImpl loper = (LikeOperatorImpl) oper;
return new LikeOperatorImpl(loper.getOp(), op1, loper.getInternalPattern(), loper.getPattern(), loper.isEscaped(), loper.getEscape());
}
else
return (op2 == null) ? new OperatorImpl(oper.getOp(), op1) : new OperatorImpl(oper.getOp(), op1, op2);
} | java | private static Operator substitute(Operator oper, List[] equatedIds) {
Selector op1 = oper.getOperands()[0];
Selector op2 = (oper.getOperands().length == 1) ? null : oper.getOperands()[1];
if (op1 instanceof Identifier)
op1 = substitute((Identifier) op1, equatedIds);
else if (op1 instanceof Operator)
op1 = substitute((Operator) op1, equatedIds);
if (op1 == null)
return null;
if (op2 != null) {
if (op2 instanceof Identifier)
op2 = substitute((Identifier) op2, equatedIds);
else if (op2 instanceof Operator)
op2 = substitute((Operator) op2, equatedIds);
if (op2 == null)
return null;
}
if (op1 == oper.getOperands()[0] && (op2 == null || op2 == oper.getOperands()[1]))
return oper;
else if (oper instanceof LikeOperator) {
LikeOperatorImpl loper = (LikeOperatorImpl) oper;
return new LikeOperatorImpl(loper.getOp(), op1, loper.getInternalPattern(), loper.getPattern(), loper.isEscaped(), loper.getEscape());
}
else
return (op2 == null) ? new OperatorImpl(oper.getOp(), op1) : new OperatorImpl(oper.getOp(), op1, op2);
} | [
"private",
"static",
"Operator",
"substitute",
"(",
"Operator",
"oper",
",",
"List",
"[",
"]",
"equatedIds",
")",
"{",
"Selector",
"op1",
"=",
"oper",
".",
"getOperands",
"(",
")",
"[",
"0",
"]",
";",
"Selector",
"op2",
"=",
"(",
"oper",
".",
"getOperands",
"(",
")",
".",
"length",
"==",
"1",
")",
"?",
"null",
":",
"oper",
".",
"getOperands",
"(",
")",
"[",
"1",
"]",
";",
"if",
"(",
"op1",
"instanceof",
"Identifier",
")",
"op1",
"=",
"substitute",
"(",
"(",
"Identifier",
")",
"op1",
",",
"equatedIds",
")",
";",
"else",
"if",
"(",
"op1",
"instanceof",
"Operator",
")",
"op1",
"=",
"substitute",
"(",
"(",
"Operator",
")",
"op1",
",",
"equatedIds",
")",
";",
"if",
"(",
"op1",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"op2",
"!=",
"null",
")",
"{",
"if",
"(",
"op2",
"instanceof",
"Identifier",
")",
"op2",
"=",
"substitute",
"(",
"(",
"Identifier",
")",
"op2",
",",
"equatedIds",
")",
";",
"else",
"if",
"(",
"op2",
"instanceof",
"Operator",
")",
"op2",
"=",
"substitute",
"(",
"(",
"Operator",
")",
"op2",
",",
"equatedIds",
")",
";",
"if",
"(",
"op2",
"==",
"null",
")",
"return",
"null",
";",
"}",
"if",
"(",
"op1",
"==",
"oper",
".",
"getOperands",
"(",
")",
"[",
"0",
"]",
"&&",
"(",
"op2",
"==",
"null",
"||",
"op2",
"==",
"oper",
".",
"getOperands",
"(",
")",
"[",
"1",
"]",
")",
")",
"return",
"oper",
";",
"else",
"if",
"(",
"oper",
"instanceof",
"LikeOperator",
")",
"{",
"LikeOperatorImpl",
"loper",
"=",
"(",
"LikeOperatorImpl",
")",
"oper",
";",
"return",
"new",
"LikeOperatorImpl",
"(",
"loper",
".",
"getOp",
"(",
")",
",",
"op1",
",",
"loper",
".",
"getInternalPattern",
"(",
")",
",",
"loper",
".",
"getPattern",
"(",
")",
",",
"loper",
".",
"isEscaped",
"(",
")",
",",
"loper",
".",
"getEscape",
"(",
")",
")",
";",
"}",
"else",
"return",
"(",
"op2",
"==",
"null",
")",
"?",
"new",
"OperatorImpl",
"(",
"oper",
".",
"getOp",
"(",
")",
",",
"op1",
")",
":",
"new",
"OperatorImpl",
"(",
"oper",
".",
"getOp",
"(",
")",
",",
"op1",
",",
"op2",
")",
";",
"}"
] | mutations are made directly to any tree nodes. | [
"mutations",
"are",
"made",
"directly",
"to",
"any",
"tree",
"nodes",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java#L307-L332 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java | ConjunctionImpl.substitute | private static Selector substitute(Identifier id, List[] equatedIds) {
for (int i = 0; i < equatedIds[0].size(); i++)
if (id.getName().equals(equatedIds[0].get(i)))
return new LiteralImpl(equatedIds[1].get(i));
return id;
} | java | private static Selector substitute(Identifier id, List[] equatedIds) {
for (int i = 0; i < equatedIds[0].size(); i++)
if (id.getName().equals(equatedIds[0].get(i)))
return new LiteralImpl(equatedIds[1].get(i));
return id;
} | [
"private",
"static",
"Selector",
"substitute",
"(",
"Identifier",
"id",
",",
"List",
"[",
"]",
"equatedIds",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"equatedIds",
"[",
"0",
"]",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"if",
"(",
"id",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"equatedIds",
"[",
"0",
"]",
".",
"get",
"(",
"i",
")",
")",
")",
"return",
"new",
"LiteralImpl",
"(",
"equatedIds",
"[",
"1",
"]",
".",
"get",
"(",
"i",
")",
")",
";",
"return",
"id",
";",
"}"
] | if not matched. | [
"if",
"not",
"matched",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/ConjunctionImpl.java#L338-L343 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java | ServletWrapper.setUnavailableUntil | private void setUnavailableUntil(long time, boolean isInit) //PM01373
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "setUnavailableUntil", "setUnavailableUntil() : " + time);
if(isInit){
state = UNINITIALIZED_STATE; //PM01373
}
else {
state = UNAVAILABLE_STATE;
}
unavailableUntil = time;
evtSource.onServletUnavailableForService(getServletEvent());
} | java | private void setUnavailableUntil(long time, boolean isInit) //PM01373
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "setUnavailableUntil", "setUnavailableUntil() : " + time);
if(isInit){
state = UNINITIALIZED_STATE; //PM01373
}
else {
state = UNAVAILABLE_STATE;
}
unavailableUntil = time;
evtSource.onServletUnavailableForService(getServletEvent());
} | [
"private",
"void",
"setUnavailableUntil",
"(",
"long",
"time",
",",
"boolean",
"isInit",
")",
"//PM01373",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"setUnavailableUntil\"",
",",
"\"setUnavailableUntil() : \"",
"+",
"time",
")",
";",
"if",
"(",
"isInit",
")",
"{",
"state",
"=",
"UNINITIALIZED_STATE",
";",
"//PM01373",
"}",
"else",
"{",
"state",
"=",
"UNAVAILABLE_STATE",
";",
"}",
"unavailableUntil",
"=",
"time",
";",
"evtSource",
".",
"onServletUnavailableForService",
"(",
"getServletEvent",
"(",
")",
")",
";",
"}"
] | Method setUnavailableUntil.
@param time
@param isInit | [
"Method",
"setUnavailableUntil",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java#L1730-L1742 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java | ServletWrapper.setUninitialize | protected void setUninitialize()
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setUninitialized ","" + this.toString());
state = UNINITIALIZED_STATE;
} | java | protected void setUninitialize()
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"setUninitialized ","" + this.toString());
state = UNINITIALIZED_STATE;
} | [
"protected",
"void",
"setUninitialize",
"(",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"setUninitialized \"",
",",
"\"\"",
"+",
"this",
".",
"toString",
"(",
")",
")",
";",
"state",
"=",
"UNINITIALIZED_STATE",
";",
"}"
] | Puts a servlet into uninitialize state. | [
"Puts",
"a",
"servlet",
"into",
"uninitialize",
"state",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java#L1749-L1755 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java | ServletWrapper.invalidateCacheWrappers | protected synchronized void invalidateCacheWrappers() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) // 306998.15
logger.entering(CLASS_NAME, "invalidateCacheWrappers"); // 569469
if (cacheWrappers != null) {
// invalidate all the cache wrappers that wrap this target.
Iterator i = cacheWrappers.iterator();
while (i.hasNext()) {
ServletReferenceListener w = (ServletReferenceListener) i.next();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) // 306998.15
logger.logp(Level.FINE, CLASS_NAME, "invalidateCacheWrappers", "servlet reference listener -->[" + w + "]");
w.invalidate();
}
cacheWrappers = null;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) // 306998.15
logger.exiting(CLASS_NAME, "invalidateCacheWrappers"); // 569469
} | java | protected synchronized void invalidateCacheWrappers() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) // 306998.15
logger.entering(CLASS_NAME, "invalidateCacheWrappers"); // 569469
if (cacheWrappers != null) {
// invalidate all the cache wrappers that wrap this target.
Iterator i = cacheWrappers.iterator();
while (i.hasNext()) {
ServletReferenceListener w = (ServletReferenceListener) i.next();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) // 306998.15
logger.logp(Level.FINE, CLASS_NAME, "invalidateCacheWrappers", "servlet reference listener -->[" + w + "]");
w.invalidate();
}
cacheWrappers = null;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) // 306998.15
logger.exiting(CLASS_NAME, "invalidateCacheWrappers"); // 569469
} | [
"protected",
"synchronized",
"void",
"invalidateCacheWrappers",
"(",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"// 306998.15",
"logger",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"invalidateCacheWrappers\"",
")",
";",
"// 569469",
"if",
"(",
"cacheWrappers",
"!=",
"null",
")",
"{",
"// invalidate all the cache wrappers that wrap this target.",
"Iterator",
"i",
"=",
"cacheWrappers",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"ServletReferenceListener",
"w",
"=",
"(",
"ServletReferenceListener",
")",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"// 306998.15",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"invalidateCacheWrappers\"",
",",
"\"servlet reference listener -->[\"",
"+",
"w",
"+",
"\"]\"",
")",
";",
"w",
".",
"invalidate",
"(",
")",
";",
"}",
"cacheWrappers",
"=",
"null",
";",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"// 306998.15",
"logger",
".",
"exiting",
"(",
"CLASS_NAME",
",",
"\"invalidateCacheWrappers\"",
")",
";",
"// 569469",
"}"
] | which makes a call to invalidateCacheWrappers | [
"which",
"makes",
"a",
"call",
"to",
"invalidateCacheWrappers"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java#L1784-L1803 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java | ServletWrapper.checkForDefaultImplementation | private boolean checkForDefaultImplementation(Class checkClass, String checkMethod, Class[] methodParams){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.exiting(CLASS_NAME,"checkForDefaultImplementation","Method : " + checkMethod + ", Class : " + checkClass.getName());
boolean defaultMethodInUse=true;
while (defaultMethodInUse && checkClass!=null && !checkClass.getName().equals("javax.servlet.http.HttpServlet")) {
try {
checkClass.getDeclaredMethod(checkMethod, methodParams);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation","Class implementing " + checkMethod + " is " + checkClass.getName());
defaultMethodInUse=false;
break;
} catch (java.lang.NoSuchMethodException exc) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation",checkMethod + " is not implemented by class " + checkClass.getName());
} catch (java.lang.SecurityException exc) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation","Cannot determine if " + checkMethod + " is implemented by class " + checkClass.getName());
}
checkClass = checkClass.getSuperclass();
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.exiting(CLASS_NAME,"checkForDefaultImplementation","Result : " + defaultMethodInUse);
return defaultMethodInUse;
} | java | private boolean checkForDefaultImplementation(Class checkClass, String checkMethod, Class[] methodParams){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.exiting(CLASS_NAME,"checkForDefaultImplementation","Method : " + checkMethod + ", Class : " + checkClass.getName());
boolean defaultMethodInUse=true;
while (defaultMethodInUse && checkClass!=null && !checkClass.getName().equals("javax.servlet.http.HttpServlet")) {
try {
checkClass.getDeclaredMethod(checkMethod, methodParams);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation","Class implementing " + checkMethod + " is " + checkClass.getName());
defaultMethodInUse=false;
break;
} catch (java.lang.NoSuchMethodException exc) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation",checkMethod + " is not implemented by class " + checkClass.getName());
} catch (java.lang.SecurityException exc) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation","Cannot determine if " + checkMethod + " is implemented by class " + checkClass.getName());
}
checkClass = checkClass.getSuperclass();
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE)) //306998.14
logger.exiting(CLASS_NAME,"checkForDefaultImplementation","Result : " + defaultMethodInUse);
return defaultMethodInUse;
} | [
"private",
"boolean",
"checkForDefaultImplementation",
"(",
"Class",
"checkClass",
",",
"String",
"checkMethod",
",",
"Class",
"[",
"]",
"methodParams",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"//306998.14",
"logger",
".",
"exiting",
"(",
"CLASS_NAME",
",",
"\"checkForDefaultImplementation\"",
",",
"\"Method : \"",
"+",
"checkMethod",
"+",
"\", Class : \"",
"+",
"checkClass",
".",
"getName",
"(",
")",
")",
";",
"boolean",
"defaultMethodInUse",
"=",
"true",
";",
"while",
"(",
"defaultMethodInUse",
"&&",
"checkClass",
"!=",
"null",
"&&",
"!",
"checkClass",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"javax.servlet.http.HttpServlet\"",
")",
")",
"{",
"try",
"{",
"checkClass",
".",
"getDeclaredMethod",
"(",
"checkMethod",
",",
"methodParams",
")",
";",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"//306998.14",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"checkForDefaultImplementation\"",
",",
"\"Class implementing \"",
"+",
"checkMethod",
"+",
"\" is \"",
"+",
"checkClass",
".",
"getName",
"(",
")",
")",
";",
"defaultMethodInUse",
"=",
"false",
";",
"break",
";",
"}",
"catch",
"(",
"java",
".",
"lang",
".",
"NoSuchMethodException",
"exc",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"//306998.14",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"checkForDefaultImplementation\"",
",",
"checkMethod",
"+",
"\" is not implemented by class \"",
"+",
"checkClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"java",
".",
"lang",
".",
"SecurityException",
"exc",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"//306998.14",
"logger",
".",
"logp",
"(",
"Level",
".",
"FINE",
",",
"CLASS_NAME",
",",
"\"checkForDefaultImplementation\"",
",",
"\"Cannot determine if \"",
"+",
"checkMethod",
"+",
"\" is implemented by class \"",
"+",
"checkClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"checkClass",
"=",
"checkClass",
".",
"getSuperclass",
"(",
")",
";",
"}",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"//306998.14",
"logger",
".",
"exiting",
"(",
"CLASS_NAME",
",",
"\"checkForDefaultImplementation\"",
",",
"\"Result : \"",
"+",
"defaultMethodInUse",
")",
";",
"return",
"defaultMethodInUse",
";",
"}"
] | PK83258 Add method checkDefaultImplementation | [
"PK83258",
"Add",
"method",
"checkDefaultImplementation"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/servlet/ServletWrapper.java#L2155-L2188 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java | BucketImpl.findIndexByKey | private int findIndexByKey(Object key)
{
// Traverse the vector from the back. Given proper locking done at
// a higher level, this will ensure that the cache gets to the same
// element in the presence of duplicates.
// Traversing the vector from the first element causes a problem since
// elements are inserted at the end of the vector (for efficiency).
// Consequently after inserting duplicate element 1.2, if another
// operation is performed on the same key 1, we will get to 1.1 instead
// of 1.2
for (int i = (size() - 1); i >= 0; --i) {
Element element = (Element) get(i);
if (element.key.equals(key)) {
return i;
}
}
return -1;
} | java | private int findIndexByKey(Object key)
{
// Traverse the vector from the back. Given proper locking done at
// a higher level, this will ensure that the cache gets to the same
// element in the presence of duplicates.
// Traversing the vector from the first element causes a problem since
// elements are inserted at the end of the vector (for efficiency).
// Consequently after inserting duplicate element 1.2, if another
// operation is performed on the same key 1, we will get to 1.1 instead
// of 1.2
for (int i = (size() - 1); i >= 0; --i) {
Element element = (Element) get(i);
if (element.key.equals(key)) {
return i;
}
}
return -1;
} | [
"private",
"int",
"findIndexByKey",
"(",
"Object",
"key",
")",
"{",
"// Traverse the vector from the back. Given proper locking done at",
"// a higher level, this will ensure that the cache gets to the same",
"// element in the presence of duplicates.",
"// Traversing the vector from the first element causes a problem since",
"// elements are inserted at the end of the vector (for efficiency).",
"// Consequently after inserting duplicate element 1.2, if another",
"// operation is performed on the same key 1, we will get to 1.1 instead",
"// of 1.2",
"for",
"(",
"int",
"i",
"=",
"(",
"size",
"(",
")",
"-",
"1",
")",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"Element",
"element",
"=",
"(",
"Element",
")",
"get",
"(",
"i",
")",
";",
"if",
"(",
"element",
".",
"key",
".",
"equals",
"(",
"key",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] | Return the index of the element with the specified key | [
"Return",
"the",
"index",
"of",
"the",
"element",
"with",
"the",
"specified",
"key"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java#L187-L205 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java | BucketImpl.toArray | public void toArray(Element[] dest)
{
if (ivElements != null)
{
System.arraycopy(ivElements, ivHeadIndex, dest, 0, size());
}
} | java | public void toArray(Element[] dest)
{
if (ivElements != null)
{
System.arraycopy(ivElements, ivHeadIndex, dest, 0, size());
}
} | [
"public",
"void",
"toArray",
"(",
"Element",
"[",
"]",
"dest",
")",
"{",
"if",
"(",
"ivElements",
"!=",
"null",
")",
"{",
"System",
".",
"arraycopy",
"(",
"ivElements",
",",
"ivHeadIndex",
",",
"dest",
",",
"0",
",",
"size",
"(",
")",
")",
";",
"}",
"}"
] | Copies elements from the bucket into the destination array starting at
index 0. The destination array must be at least large enough to hold all
the elements in the bucket; otherwise, the behavior is undefined.
@param dest the destination array | [
"Copies",
"elements",
"from",
"the",
"bucket",
"into",
"the",
"destination",
"array",
"starting",
"at",
"index",
"0",
".",
"The",
"destination",
"array",
"must",
"be",
"at",
"least",
"large",
"enough",
"to",
"hold",
"all",
"the",
"elements",
"in",
"the",
"bucket",
";",
"otherwise",
"the",
"behavior",
"is",
"undefined",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java#L234-L240 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java | BucketImpl.add | private void add(Element element)
{
if (ivElements == null)
{
ivElements = new Element[DEFAULT_CAPACITY];
}
else if (ivTailIndex == ivElements.length)
{
// No more room at the tail of the array. If we're completely out of
// space (ivBaseIndex == 0), then we need a bigger array. Otherwise,
// determine if we can reset ivBaseIndex to 0 without needing to copy
// more than half the elements. If not, we allocate a new array.
//
// We choose to limit to half the array to avoid repeatedly copying
// the array. For example, if the array is full and ivBaseIndex == 0,
// and we have a sequence of remove(0)/add(x), we do not want:
// - remove(0): ivBaseIndex++
// - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x
// - remove(0): ivBaseIndex++
// - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x
// - ...etc.
int size = size();
int halfCapacity = ivElements.length >> 1;
if (ivHeadIndex > halfCapacity)
{
// Less than half of the array is full. Rather than creating a new
// array, just copy all the elements to the front.
System.arraycopy(ivElements, ivHeadIndex, ivElements, 0, size);
Arrays.fill(ivElements, ivHeadIndex, ivElements.length, null);
}
else
{
// Either we're completely out of space (ivBaseIndex == 0), or it
// would be wasteful to continuously copy over half the elements.
// Grow the array by half its current size.
Element[] newElements = new Element[ivElements.length + halfCapacity];
System.arraycopy(ivElements, ivHeadIndex, newElements, 0, size);
ivElements = newElements;
}
ivHeadIndex = 0;
ivTailIndex = size;
}
ivElements[ivTailIndex++] = element;
} | java | private void add(Element element)
{
if (ivElements == null)
{
ivElements = new Element[DEFAULT_CAPACITY];
}
else if (ivTailIndex == ivElements.length)
{
// No more room at the tail of the array. If we're completely out of
// space (ivBaseIndex == 0), then we need a bigger array. Otherwise,
// determine if we can reset ivBaseIndex to 0 without needing to copy
// more than half the elements. If not, we allocate a new array.
//
// We choose to limit to half the array to avoid repeatedly copying
// the array. For example, if the array is full and ivBaseIndex == 0,
// and we have a sequence of remove(0)/add(x), we do not want:
// - remove(0): ivBaseIndex++
// - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x
// - remove(0): ivBaseIndex++
// - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x
// - ...etc.
int size = size();
int halfCapacity = ivElements.length >> 1;
if (ivHeadIndex > halfCapacity)
{
// Less than half of the array is full. Rather than creating a new
// array, just copy all the elements to the front.
System.arraycopy(ivElements, ivHeadIndex, ivElements, 0, size);
Arrays.fill(ivElements, ivHeadIndex, ivElements.length, null);
}
else
{
// Either we're completely out of space (ivBaseIndex == 0), or it
// would be wasteful to continuously copy over half the elements.
// Grow the array by half its current size.
Element[] newElements = new Element[ivElements.length + halfCapacity];
System.arraycopy(ivElements, ivHeadIndex, newElements, 0, size);
ivElements = newElements;
}
ivHeadIndex = 0;
ivTailIndex = size;
}
ivElements[ivTailIndex++] = element;
} | [
"private",
"void",
"add",
"(",
"Element",
"element",
")",
"{",
"if",
"(",
"ivElements",
"==",
"null",
")",
"{",
"ivElements",
"=",
"new",
"Element",
"[",
"DEFAULT_CAPACITY",
"]",
";",
"}",
"else",
"if",
"(",
"ivTailIndex",
"==",
"ivElements",
".",
"length",
")",
"{",
"// No more room at the tail of the array. If we're completely out of",
"// space (ivBaseIndex == 0), then we need a bigger array. Otherwise,",
"// determine if we can reset ivBaseIndex to 0 without needing to copy",
"// more than half the elements. If not, we allocate a new array.",
"//",
"// We choose to limit to half the array to avoid repeatedly copying",
"// the array. For example, if the array is full and ivBaseIndex == 0,",
"// and we have a sequence of remove(0)/add(x), we do not want:",
"// - remove(0): ivBaseIndex++",
"// - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x",
"// - remove(0): ivBaseIndex++",
"// - add(x): copy 1..N to 0..N-1, ivBaseIndex=0, array[N] = x",
"// - ...etc.",
"int",
"size",
"=",
"size",
"(",
")",
";",
"int",
"halfCapacity",
"=",
"ivElements",
".",
"length",
">>",
"1",
";",
"if",
"(",
"ivHeadIndex",
">",
"halfCapacity",
")",
"{",
"// Less than half of the array is full. Rather than creating a new",
"// array, just copy all the elements to the front.",
"System",
".",
"arraycopy",
"(",
"ivElements",
",",
"ivHeadIndex",
",",
"ivElements",
",",
"0",
",",
"size",
")",
";",
"Arrays",
".",
"fill",
"(",
"ivElements",
",",
"ivHeadIndex",
",",
"ivElements",
".",
"length",
",",
"null",
")",
";",
"}",
"else",
"{",
"// Either we're completely out of space (ivBaseIndex == 0), or it",
"// would be wasteful to continuously copy over half the elements.",
"// Grow the array by half its current size.",
"Element",
"[",
"]",
"newElements",
"=",
"new",
"Element",
"[",
"ivElements",
".",
"length",
"+",
"halfCapacity",
"]",
";",
"System",
".",
"arraycopy",
"(",
"ivElements",
",",
"ivHeadIndex",
",",
"newElements",
",",
"0",
",",
"size",
")",
";",
"ivElements",
"=",
"newElements",
";",
"}",
"ivHeadIndex",
"=",
"0",
";",
"ivTailIndex",
"=",
"size",
";",
"}",
"ivElements",
"[",
"ivTailIndex",
"++",
"]",
"=",
"element",
";",
"}"
] | Adds an element to the end of the bucket.
@param element the element to add | [
"Adds",
"an",
"element",
"to",
"the",
"end",
"of",
"the",
"bucket",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java#L259-L305 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java | BucketImpl.remove | private void remove(int listIndex)
{
if (listIndex == 0)
{
// Trivially remove from head.
ivElements[ivHeadIndex++] = null;
}
else if (listIndex == ivTailIndex - 1)
{
// Trivially remove from tail.
ivElements[--ivTailIndex] = null;
}
else
{
// Determine whether shifting the head or the tail requires the lower
// number of element copies.
int size = size();
int halfSize = size >> 1;
if (listIndex < halfSize)
{
// The index is less than half. Shift the elements at the head of
// the array up one index to cover the removed element.
System.arraycopy(ivElements, ivHeadIndex, ivElements, ivHeadIndex + 1, listIndex);
ivElements[ivHeadIndex++] = null;
}
else
{
// The index is more than half. Shift the elements at the tail of
// the array down one index to cover the removed element.
int arrayIndex = ivHeadIndex + listIndex;
System.arraycopy(ivElements, arrayIndex + 1, ivElements, arrayIndex, size - listIndex - 1);
ivElements[--ivTailIndex] = null;
}
}
if (isEmpty())
{
// Reset ivHeadIndex to 0 to avoid element copies in add().
ivHeadIndex = 0;
ivTailIndex = 0;
}
} | java | private void remove(int listIndex)
{
if (listIndex == 0)
{
// Trivially remove from head.
ivElements[ivHeadIndex++] = null;
}
else if (listIndex == ivTailIndex - 1)
{
// Trivially remove from tail.
ivElements[--ivTailIndex] = null;
}
else
{
// Determine whether shifting the head or the tail requires the lower
// number of element copies.
int size = size();
int halfSize = size >> 1;
if (listIndex < halfSize)
{
// The index is less than half. Shift the elements at the head of
// the array up one index to cover the removed element.
System.arraycopy(ivElements, ivHeadIndex, ivElements, ivHeadIndex + 1, listIndex);
ivElements[ivHeadIndex++] = null;
}
else
{
// The index is more than half. Shift the elements at the tail of
// the array down one index to cover the removed element.
int arrayIndex = ivHeadIndex + listIndex;
System.arraycopy(ivElements, arrayIndex + 1, ivElements, arrayIndex, size - listIndex - 1);
ivElements[--ivTailIndex] = null;
}
}
if (isEmpty())
{
// Reset ivHeadIndex to 0 to avoid element copies in add().
ivHeadIndex = 0;
ivTailIndex = 0;
}
} | [
"private",
"void",
"remove",
"(",
"int",
"listIndex",
")",
"{",
"if",
"(",
"listIndex",
"==",
"0",
")",
"{",
"// Trivially remove from head.",
"ivElements",
"[",
"ivHeadIndex",
"++",
"]",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"listIndex",
"==",
"ivTailIndex",
"-",
"1",
")",
"{",
"// Trivially remove from tail.",
"ivElements",
"[",
"--",
"ivTailIndex",
"]",
"=",
"null",
";",
"}",
"else",
"{",
"// Determine whether shifting the head or the tail requires the lower",
"// number of element copies.",
"int",
"size",
"=",
"size",
"(",
")",
";",
"int",
"halfSize",
"=",
"size",
">>",
"1",
";",
"if",
"(",
"listIndex",
"<",
"halfSize",
")",
"{",
"// The index is less than half. Shift the elements at the head of",
"// the array up one index to cover the removed element.",
"System",
".",
"arraycopy",
"(",
"ivElements",
",",
"ivHeadIndex",
",",
"ivElements",
",",
"ivHeadIndex",
"+",
"1",
",",
"listIndex",
")",
";",
"ivElements",
"[",
"ivHeadIndex",
"++",
"]",
"=",
"null",
";",
"}",
"else",
"{",
"// The index is more than half. Shift the elements at the tail of",
"// the array down one index to cover the removed element.",
"int",
"arrayIndex",
"=",
"ivHeadIndex",
"+",
"listIndex",
";",
"System",
".",
"arraycopy",
"(",
"ivElements",
",",
"arrayIndex",
"+",
"1",
",",
"ivElements",
",",
"arrayIndex",
",",
"size",
"-",
"listIndex",
"-",
"1",
")",
";",
"ivElements",
"[",
"--",
"ivTailIndex",
"]",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"// Reset ivHeadIndex to 0 to avoid element copies in add().",
"ivHeadIndex",
"=",
"0",
";",
"ivTailIndex",
"=",
"0",
";",
"}",
"}"
] | Removes the element at the specified index. The index must be greater or
equal to 0 and less than the size; otherwise, the behavior is undefined.
@param listIndex the index of the element to remove | [
"Removes",
"the",
"element",
"at",
"the",
"specified",
"index",
".",
"The",
"index",
"must",
"be",
"greater",
"or",
"equal",
"to",
"0",
"and",
"less",
"than",
"the",
"size",
";",
"otherwise",
"the",
"behavior",
"is",
"undefined",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java#L313-L355 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/destination/AbstractRemoteSupport.java | AbstractRemoteSupport.setToBeDeleted | public void setToBeDeleted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setToBeDeleted");
synchronized (_anycastInputHandlers)
{
_toBeDeleted = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setToBeDeleted");
} | java | public void setToBeDeleted()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "setToBeDeleted");
synchronized (_anycastInputHandlers)
{
_toBeDeleted = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "setToBeDeleted");
} | [
"public",
"void",
"setToBeDeleted",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"setToBeDeleted\"",
")",
";",
"synchronized",
"(",
"_anycastInputHandlers",
")",
"{",
"_toBeDeleted",
"=",
"true",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"setToBeDeleted\"",
")",
";",
"}"
] | Method to indicate that the destination has been deleted | [
"Method",
"to",
"indicate",
"that",
"the",
"destination",
"has",
"been",
"deleted"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/destination/AbstractRemoteSupport.java#L1129-L1141 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java | EJBSecurityCollaboratorImpl.isInternalUnprotectedMethod | private boolean isInternalUnprotectedMethod(EJBMethodMetaData methodMetaData) {
EJBMethodInterface interfaceType = methodMetaData.getEJBMethodInterface();
/***
* For TIMED_OBJECT, the code references EJB 2.1 spec section 22.2.2 and matches a
* method signature, which is necessary but not sufficient. As of EJB 3.0, the
* TimedObject interface is not necessary and arbitrary methods can be designated
* as timeout callback methods using the @Timeout annotation. Further, the EJB
* 3.1 spec adds the ability to specify timeout methods without a Timer argument,
* and it also adds new timeout callback methods via the @Schedule annotation. In
* all of these cases, the MethodInterface will be TIMED_OBJECT.
*
* For LIFECYCLE_INTERCEPTOR, this type is used only for lifecycle interceptors of
* EJB 3.1 singleton session beans. This type should have been added to the EJB 3.1
* spec, but it was overlooked by the EG. However, EJB container needs to classify
* methods in this way, so an internal type was added.
*
* For background on why returning true from internalUnprotected is correct for
* LIFECYCLE_INTERCEPTOR, a singleton method invocation has two steps, and the
* container invokes the security collaborator for each.
*
* 1. Obtain the bean instance if it does not already exist.
* If the bean does not exist, the container calls the security collaborator
* with LifecycleInterceptor to establish a RunAs security context. However,
* authorization checks are not needed because the bean is performing
* initialization, not business logic. Further, attempting to pass the
* internal-only LifecycleInterceptor type to JACC causes an
* IllegalArgumentException.
*
* If a singleton session bean is annotated @Startup, then the container
* performs this step as part of application start rather than when a method
* is first invoked on the bean. This is the scenario for this defect.
*
* 2. Invoke the business method.
* The container calls the security collaborator "as normal" with Local,
* Remote, or ServiceEndpoint to both authorize the caller security context
* and to establish a RunAs security context as needed.
*
* Per EJB spec section 22.2.2:
*
* Since the ejbTimeout method is an internal method of the bean class,
* it has no client security context. When getCallerPrincipal is called
* from within the ejbTimeout method, it returns the container
* representation of the unauthenticated identity.
* Since the ejbTimeout method is an internal method of the bean class,
* it has no client security context. The Bean Provider should use the
* run-as deployment descriptor element to specify a security identity to
* be used for the invocation of methods from within the ejbTimeout method.
*
* Because of the above spec requirements, we still need to establish the
* runasSpecified identity when this method is called.
**/
if (EJBMethodInterface.LIFECYCLE_INTERCEPTOR.value() == (interfaceType.value()) ||
EJBMethodInterface.TIMER.value() == (interfaceType.value())) {
return true;
//TODO: should this logic go into ejb container?
}
return false;
} | java | private boolean isInternalUnprotectedMethod(EJBMethodMetaData methodMetaData) {
EJBMethodInterface interfaceType = methodMetaData.getEJBMethodInterface();
/***
* For TIMED_OBJECT, the code references EJB 2.1 spec section 22.2.2 and matches a
* method signature, which is necessary but not sufficient. As of EJB 3.0, the
* TimedObject interface is not necessary and arbitrary methods can be designated
* as timeout callback methods using the @Timeout annotation. Further, the EJB
* 3.1 spec adds the ability to specify timeout methods without a Timer argument,
* and it also adds new timeout callback methods via the @Schedule annotation. In
* all of these cases, the MethodInterface will be TIMED_OBJECT.
*
* For LIFECYCLE_INTERCEPTOR, this type is used only for lifecycle interceptors of
* EJB 3.1 singleton session beans. This type should have been added to the EJB 3.1
* spec, but it was overlooked by the EG. However, EJB container needs to classify
* methods in this way, so an internal type was added.
*
* For background on why returning true from internalUnprotected is correct for
* LIFECYCLE_INTERCEPTOR, a singleton method invocation has two steps, and the
* container invokes the security collaborator for each.
*
* 1. Obtain the bean instance if it does not already exist.
* If the bean does not exist, the container calls the security collaborator
* with LifecycleInterceptor to establish a RunAs security context. However,
* authorization checks are not needed because the bean is performing
* initialization, not business logic. Further, attempting to pass the
* internal-only LifecycleInterceptor type to JACC causes an
* IllegalArgumentException.
*
* If a singleton session bean is annotated @Startup, then the container
* performs this step as part of application start rather than when a method
* is first invoked on the bean. This is the scenario for this defect.
*
* 2. Invoke the business method.
* The container calls the security collaborator "as normal" with Local,
* Remote, or ServiceEndpoint to both authorize the caller security context
* and to establish a RunAs security context as needed.
*
* Per EJB spec section 22.2.2:
*
* Since the ejbTimeout method is an internal method of the bean class,
* it has no client security context. When getCallerPrincipal is called
* from within the ejbTimeout method, it returns the container
* representation of the unauthenticated identity.
* Since the ejbTimeout method is an internal method of the bean class,
* it has no client security context. The Bean Provider should use the
* run-as deployment descriptor element to specify a security identity to
* be used for the invocation of methods from within the ejbTimeout method.
*
* Because of the above spec requirements, we still need to establish the
* runasSpecified identity when this method is called.
**/
if (EJBMethodInterface.LIFECYCLE_INTERCEPTOR.value() == (interfaceType.value()) ||
EJBMethodInterface.TIMER.value() == (interfaceType.value())) {
return true;
//TODO: should this logic go into ejb container?
}
return false;
} | [
"private",
"boolean",
"isInternalUnprotectedMethod",
"(",
"EJBMethodMetaData",
"methodMetaData",
")",
"{",
"EJBMethodInterface",
"interfaceType",
"=",
"methodMetaData",
".",
"getEJBMethodInterface",
"(",
")",
";",
"/***\n * For TIMED_OBJECT, the code references EJB 2.1 spec section 22.2.2 and matches a\n * method signature, which is necessary but not sufficient. As of EJB 3.0, the\n * TimedObject interface is not necessary and arbitrary methods can be designated\n * as timeout callback methods using the @Timeout annotation. Further, the EJB\n * 3.1 spec adds the ability to specify timeout methods without a Timer argument,\n * and it also adds new timeout callback methods via the @Schedule annotation. In\n * all of these cases, the MethodInterface will be TIMED_OBJECT.\n *\n * For LIFECYCLE_INTERCEPTOR, this type is used only for lifecycle interceptors of\n * EJB 3.1 singleton session beans. This type should have been added to the EJB 3.1\n * spec, but it was overlooked by the EG. However, EJB container needs to classify\n * methods in this way, so an internal type was added.\n *\n * For background on why returning true from internalUnprotected is correct for\n * LIFECYCLE_INTERCEPTOR, a singleton method invocation has two steps, and the\n * container invokes the security collaborator for each.\n *\n * 1. Obtain the bean instance if it does not already exist.\n * If the bean does not exist, the container calls the security collaborator\n * with LifecycleInterceptor to establish a RunAs security context. However,\n * authorization checks are not needed because the bean is performing\n * initialization, not business logic. Further, attempting to pass the\n * internal-only LifecycleInterceptor type to JACC causes an\n * IllegalArgumentException.\n *\n * If a singleton session bean is annotated @Startup, then the container\n * performs this step as part of application start rather than when a method\n * is first invoked on the bean. This is the scenario for this defect.\n *\n * 2. Invoke the business method.\n * The container calls the security collaborator \"as normal\" with Local,\n * Remote, or ServiceEndpoint to both authorize the caller security context\n * and to establish a RunAs security context as needed.\n *\n * Per EJB spec section 22.2.2:\n *\n * Since the ejbTimeout method is an internal method of the bean class,\n * it has no client security context. When getCallerPrincipal is called\n * from within the ejbTimeout method, it returns the container\n * representation of the unauthenticated identity.\n * Since the ejbTimeout method is an internal method of the bean class,\n * it has no client security context. The Bean Provider should use the\n * run-as deployment descriptor element to specify a security identity to\n * be used for the invocation of methods from within the ejbTimeout method.\n *\n * Because of the above spec requirements, we still need to establish the\n * runasSpecified identity when this method is called.\n **/",
"if",
"(",
"EJBMethodInterface",
".",
"LIFECYCLE_INTERCEPTOR",
".",
"value",
"(",
")",
"==",
"(",
"interfaceType",
".",
"value",
"(",
")",
")",
"||",
"EJBMethodInterface",
".",
"TIMER",
".",
"value",
"(",
")",
"==",
"(",
"interfaceType",
".",
"value",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"//TODO: should this logic go into ejb container?",
"}",
"return",
"false",
";",
"}"
] | Check if the methodMetaData interface is internal and supposed to be unprotected as per
spec.
@param methodMetaData methodMetaData to get the interface type
@return true if it should be unprotected, otherwise false | [
"Check",
"if",
"the",
"methodMetaData",
"interface",
"is",
"internal",
"and",
"supposed",
"to",
"be",
"unprotected",
"as",
"per",
"spec",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java#L334-L391 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/common/OidcCommonClientRequest.java | OidcCommonClientRequest.errorCommon | public JWTTokenValidationFailedException errorCommon(boolean bTrError, TraceComponent tc, String[] msgCodes, Object[] objects) throws JWTTokenValidationFailedException {
int msgIndex = 0;
if (!TYPE_ID_TOKEN.equals(this.getTokenType())) {
msgIndex = 1;
}
return errorCommon(bTrError, tc, msgCodes[msgIndex], objects);
} | java | public JWTTokenValidationFailedException errorCommon(boolean bTrError, TraceComponent tc, String[] msgCodes, Object[] objects) throws JWTTokenValidationFailedException {
int msgIndex = 0;
if (!TYPE_ID_TOKEN.equals(this.getTokenType())) {
msgIndex = 1;
}
return errorCommon(bTrError, tc, msgCodes[msgIndex], objects);
} | [
"public",
"JWTTokenValidationFailedException",
"errorCommon",
"(",
"boolean",
"bTrError",
",",
"TraceComponent",
"tc",
",",
"String",
"[",
"]",
"msgCodes",
",",
"Object",
"[",
"]",
"objects",
")",
"throws",
"JWTTokenValidationFailedException",
"{",
"int",
"msgIndex",
"=",
"0",
";",
"if",
"(",
"!",
"TYPE_ID_TOKEN",
".",
"equals",
"(",
"this",
".",
"getTokenType",
"(",
")",
")",
")",
"{",
"msgIndex",
"=",
"1",
";",
"}",
"return",
"errorCommon",
"(",
"bTrError",
",",
"tc",
",",
"msgCodes",
"[",
"msgIndex",
"]",
",",
"objects",
")",
";",
"}"
] | do not override | [
"do",
"not",
"override"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/common/OidcCommonClientRequest.java#L66-L72 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSBoxedListImpl.java | JSBoxedListImpl.create | static JSBoxedListImpl create(JSVaryingList subList, int subAccessor) {
if (subList.getIndirection() > 0)
return new JSIndirectBoxedListImpl(subList, subAccessor);
else
return new JSBoxedListImpl(subList, subAccessor);
} | java | static JSBoxedListImpl create(JSVaryingList subList, int subAccessor) {
if (subList.getIndirection() > 0)
return new JSIndirectBoxedListImpl(subList, subAccessor);
else
return new JSBoxedListImpl(subList, subAccessor);
} | [
"static",
"JSBoxedListImpl",
"create",
"(",
"JSVaryingList",
"subList",
",",
"int",
"subAccessor",
")",
"{",
"if",
"(",
"subList",
".",
"getIndirection",
"(",
")",
">",
"0",
")",
"return",
"new",
"JSIndirectBoxedListImpl",
"(",
"subList",
",",
"subAccessor",
")",
";",
"else",
"return",
"new",
"JSBoxedListImpl",
"(",
"subList",
",",
"subAccessor",
")",
";",
"}"
] | kind of constructor. | [
"kind",
"of",
"constructor",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSBoxedListImpl.java#L83-L88 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSBoxedListImpl.java | JSBoxedListImpl.get | public Object get(int accessor) {
try {
return ((JMFNativePart)subList.getValue(accessor)).getValue(subAccessor);
} catch (JMFException ex) {
FFDCFilter.processException(ex, "get", "129", this);
return null;
}
} | java | public Object get(int accessor) {
try {
return ((JMFNativePart)subList.getValue(accessor)).getValue(subAccessor);
} catch (JMFException ex) {
FFDCFilter.processException(ex, "get", "129", this);
return null;
}
} | [
"public",
"Object",
"get",
"(",
"int",
"accessor",
")",
"{",
"try",
"{",
"return",
"(",
"(",
"JMFNativePart",
")",
"subList",
".",
"getValue",
"(",
"accessor",
")",
")",
".",
"getValue",
"(",
"subAccessor",
")",
";",
"}",
"catch",
"(",
"JMFException",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"\"get\"",
",",
"\"129\"",
",",
"this",
")",
";",
"return",
"null",
";",
"}",
"}"
] | thrown). | [
"thrown",
")",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSBoxedListImpl.java#L102-L109 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java | ServerCommonLoginModule.setCredentials | protected void setCredentials(Subject subject,
String securityName,
String urAuthenticatedId) throws Exception {
// Principal principal = new WSPrincipal(securityName, accessId, authMethod);
if (urAuthenticatedId != null && !urAuthenticatedId.equals(securityName)) {
Hashtable<String, String> subjectHash = new Hashtable<String, String>();
subjectHash.put(AuthenticationConstants.UR_AUTHENTICATED_USERID_KEY, urAuthenticatedId);
subject.getPrivateCredentials().add(subjectHash);
}
CredentialsService credentialsService = getCredentialsService();
credentialsService.setCredentials(subject);
} | java | protected void setCredentials(Subject subject,
String securityName,
String urAuthenticatedId) throws Exception {
// Principal principal = new WSPrincipal(securityName, accessId, authMethod);
if (urAuthenticatedId != null && !urAuthenticatedId.equals(securityName)) {
Hashtable<String, String> subjectHash = new Hashtable<String, String>();
subjectHash.put(AuthenticationConstants.UR_AUTHENTICATED_USERID_KEY, urAuthenticatedId);
subject.getPrivateCredentials().add(subjectHash);
}
CredentialsService credentialsService = getCredentialsService();
credentialsService.setCredentials(subject);
} | [
"protected",
"void",
"setCredentials",
"(",
"Subject",
"subject",
",",
"String",
"securityName",
",",
"String",
"urAuthenticatedId",
")",
"throws",
"Exception",
"{",
"// Principal principal = new WSPrincipal(securityName, accessId, authMethod);",
"if",
"(",
"urAuthenticatedId",
"!=",
"null",
"&&",
"!",
"urAuthenticatedId",
".",
"equals",
"(",
"securityName",
")",
")",
"{",
"Hashtable",
"<",
"String",
",",
"String",
">",
"subjectHash",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"subjectHash",
".",
"put",
"(",
"AuthenticationConstants",
".",
"UR_AUTHENTICATED_USERID_KEY",
",",
"urAuthenticatedId",
")",
";",
"subject",
".",
"getPrivateCredentials",
"(",
")",
".",
"add",
"(",
"subjectHash",
")",
";",
"}",
"CredentialsService",
"credentialsService",
"=",
"getCredentialsService",
"(",
")",
";",
"credentialsService",
".",
"setCredentials",
"(",
"subject",
")",
";",
"}"
] | Set the relevant Credentials for this login module into the Subject,
and set the credentials for the determined accessId.
@throws Exception | [
"Set",
"the",
"relevant",
"Credentials",
"for",
"this",
"login",
"module",
"into",
"the",
"Subject",
"and",
"set",
"the",
"credentials",
"for",
"the",
"determined",
"accessId",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java#L137-L149 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java | ServerCommonLoginModule.updateSubjectWithSharedStateContents | protected void updateSubjectWithSharedStateContents() {
subject.getPrincipals().add((WSPrincipal) sharedState.get(Constants.WSPRINCIPAL_KEY));
subject.getPublicCredentials().add(sharedState.get(Constants.WSCREDENTIAL_KEY));
if (sharedState.get(Constants.WSSSOTOKEN_KEY) != null)
subject.getPrivateCredentials().add(sharedState.get(Constants.WSSSOTOKEN_KEY));
} | java | protected void updateSubjectWithSharedStateContents() {
subject.getPrincipals().add((WSPrincipal) sharedState.get(Constants.WSPRINCIPAL_KEY));
subject.getPublicCredentials().add(sharedState.get(Constants.WSCREDENTIAL_KEY));
if (sharedState.get(Constants.WSSSOTOKEN_KEY) != null)
subject.getPrivateCredentials().add(sharedState.get(Constants.WSSSOTOKEN_KEY));
} | [
"protected",
"void",
"updateSubjectWithSharedStateContents",
"(",
")",
"{",
"subject",
".",
"getPrincipals",
"(",
")",
".",
"add",
"(",
"(",
"WSPrincipal",
")",
"sharedState",
".",
"get",
"(",
"Constants",
".",
"WSPRINCIPAL_KEY",
")",
")",
";",
"subject",
".",
"getPublicCredentials",
"(",
")",
".",
"add",
"(",
"sharedState",
".",
"get",
"(",
"Constants",
".",
"WSCREDENTIAL_KEY",
")",
")",
";",
"if",
"(",
"sharedState",
".",
"get",
"(",
"Constants",
".",
"WSSSOTOKEN_KEY",
")",
"!=",
"null",
")",
"subject",
".",
"getPrivateCredentials",
"(",
")",
".",
"add",
"(",
"sharedState",
".",
"get",
"(",
"Constants",
".",
"WSSSOTOKEN_KEY",
")",
")",
";",
"}"
] | Sets the original subject with the shared state contents. | [
"Sets",
"the",
"original",
"subject",
"with",
"the",
"shared",
"state",
"contents",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java#L242-L247 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java | ServerCommonLoginModule.setUpSubject | void setUpSubject(final String securityName, final String accessId,
final String authMethod) throws LoginException {
// Populate a temporary subject in response to a successful authentication.
// We use a temporary Subject because if something goes wrong in this flow,
// we are not updating the "live" Subject.
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
temporarySubject = new Subject();
setWSPrincipal(temporarySubject, securityName, accessId, authMethod);
setCredentials(temporarySubject, securityName, null);
setOtherPrincipals(temporarySubject, securityName, accessId, authMethod, null);
// Commit the newly created elements into the original Subject
subject.getPrincipals().addAll(temporarySubject.getPrincipals());
subject.getPublicCredentials().addAll(temporarySubject.getPublicCredentials());
subject.getPrivateCredentials().addAll(temporarySubject.getPrivateCredentials());
return null;
}
});
} catch (PrivilegedActionException e) {
throw new LoginException(e.getLocalizedMessage());
}
} | java | void setUpSubject(final String securityName, final String accessId,
final String authMethod) throws LoginException {
// Populate a temporary subject in response to a successful authentication.
// We use a temporary Subject because if something goes wrong in this flow,
// we are not updating the "live" Subject.
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
temporarySubject = new Subject();
setWSPrincipal(temporarySubject, securityName, accessId, authMethod);
setCredentials(temporarySubject, securityName, null);
setOtherPrincipals(temporarySubject, securityName, accessId, authMethod, null);
// Commit the newly created elements into the original Subject
subject.getPrincipals().addAll(temporarySubject.getPrincipals());
subject.getPublicCredentials().addAll(temporarySubject.getPublicCredentials());
subject.getPrivateCredentials().addAll(temporarySubject.getPrivateCredentials());
return null;
}
});
} catch (PrivilegedActionException e) {
throw new LoginException(e.getLocalizedMessage());
}
} | [
"void",
"setUpSubject",
"(",
"final",
"String",
"securityName",
",",
"final",
"String",
"accessId",
",",
"final",
"String",
"authMethod",
")",
"throws",
"LoginException",
"{",
"// Populate a temporary subject in response to a successful authentication.",
"// We use a temporary Subject because if something goes wrong in this flow,",
"// we are not updating the \"live\" Subject.",
"try",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"<",
"Object",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"run",
"(",
")",
"throws",
"Exception",
"{",
"temporarySubject",
"=",
"new",
"Subject",
"(",
")",
";",
"setWSPrincipal",
"(",
"temporarySubject",
",",
"securityName",
",",
"accessId",
",",
"authMethod",
")",
";",
"setCredentials",
"(",
"temporarySubject",
",",
"securityName",
",",
"null",
")",
";",
"setOtherPrincipals",
"(",
"temporarySubject",
",",
"securityName",
",",
"accessId",
",",
"authMethod",
",",
"null",
")",
";",
"// Commit the newly created elements into the original Subject",
"subject",
".",
"getPrincipals",
"(",
")",
".",
"addAll",
"(",
"temporarySubject",
".",
"getPrincipals",
"(",
")",
")",
";",
"subject",
".",
"getPublicCredentials",
"(",
")",
".",
"addAll",
"(",
"temporarySubject",
".",
"getPublicCredentials",
"(",
")",
")",
";",
"subject",
".",
"getPrivateCredentials",
"(",
")",
".",
"addAll",
"(",
"temporarySubject",
".",
"getPrivateCredentials",
"(",
")",
")",
";",
"return",
"null",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"e",
")",
"{",
"throw",
"new",
"LoginException",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"}",
"}"
] | Common Subject set up. Guarantees an atomic commit to the subject
passed in via initialization.
@throws LoginException | [
"Common",
"Subject",
"set",
"up",
".",
"Guarantees",
"an",
"atomic",
"commit",
"to",
"the",
"subject",
"passed",
"in",
"via",
"initialization",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java#L295-L320 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java | MultiScopeRecoveryLog.payloadWritten | protected void payloadWritten(int payloadSize)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "payloadWritten", new Object[] { this, payloadSize });
_unwrittenDataSize.addAndGet(-payloadSize);
if (tc.isDebugEnabled())
Tr.debug(tc, "unwrittenDataSize = " + _unwrittenDataSize.get() + " totalDataSize = " + _totalDataSize);
if (tc.isEntryEnabled())
Tr.exit(tc, "payloadWritten");
} | java | protected void payloadWritten(int payloadSize)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "payloadWritten", new Object[] { this, payloadSize });
_unwrittenDataSize.addAndGet(-payloadSize);
if (tc.isDebugEnabled())
Tr.debug(tc, "unwrittenDataSize = " + _unwrittenDataSize.get() + " totalDataSize = " + _totalDataSize);
if (tc.isEntryEnabled())
Tr.exit(tc, "payloadWritten");
} | [
"protected",
"void",
"payloadWritten",
"(",
"int",
"payloadSize",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"payloadWritten\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"payloadSize",
"}",
")",
";",
"_unwrittenDataSize",
".",
"addAndGet",
"(",
"-",
"payloadSize",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"unwrittenDataSize = \"",
"+",
"_unwrittenDataSize",
".",
"get",
"(",
")",
"+",
"\" totalDataSize = \"",
"+",
"_totalDataSize",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"payloadWritten\"",
")",
";",
"}"
] | Informs the recovery log that previously unwritten data has been written to disk
by one of its recoverable units and no longer needs to be tracked in the unwritten
data field. The recovery log must use the supplied information to track the amount
of unwritten active data it holds.
This call is driven from the recoverable unit from which data has been written
and accounts for both the data and header fields necessary to write the data
completly.
Writing data in this manner will not change the total amount of active data contained
by the recovery log so only the unwritten data size will be effected.
The following example can be used to illustrate this. Consider that data items of sizes
D1, D2 and D3 have been added to an initially empty recovery log (see payloadAdded).
If H represents the size of all the header information that the underlying recoverable
units, sections and data items will need to form a persistent record of the data, then
the unwritten and total data size fields will be made up as follows:
unwritten total
D3 D3
D2 D2
D1 D1
H H
Suppose that the data item corrisponding to D2 has been written to disk. D2 + h2
(where h2 is any component of H that will no longer be required to form a
persistent record of the unwritten data) will be removed from the unwritten total so we
have:-
unwritten total
D3
D3 D2
D1 D1
H-h2 H
If the remaining data items are also written it should be clear that D3+h3 + D1+h1
bytes will also be removed from the unwritten total leaving it at zero. Also that
h1 + h2 + h3 = H.
@param payloadSize The number of bytes that no longer need to be written in order
to form a persistent record of the remaining unwritten data items
when a writeSections or forceSections operation is driven by the
client service. | [
"Informs",
"the",
"recovery",
"log",
"that",
"previously",
"unwritten",
"data",
"has",
"been",
"written",
"to",
"disk",
"by",
"one",
"of",
"its",
"recoverable",
"units",
"and",
"no",
"longer",
"needs",
"to",
"be",
"tracked",
"in",
"the",
"unwritten",
"data",
"field",
".",
"The",
"recovery",
"log",
"must",
"use",
"the",
"supplied",
"information",
"to",
"track",
"the",
"amount",
"of",
"unwritten",
"active",
"data",
"it",
"holds",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java#L2116-L2127 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java | MultiScopeRecoveryLog.payloadDeleted | protected void payloadDeleted(int totalPayloadSize, int unwrittenPayloadSize)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "payloadDeleted", new Object[] { this, totalPayloadSize, unwrittenPayloadSize });
_unwrittenDataSize.addAndGet(-unwrittenPayloadSize);
synchronized (this)
{
_totalDataSize -= totalPayloadSize;
}
if (tc.isDebugEnabled())
Tr.debug(tc, "unwrittenDataSize = " + _unwrittenDataSize.get() + " totalDataSize = " + _totalDataSize);
if (tc.isEntryEnabled())
Tr.exit(tc, "payloadDeleted");
} | java | protected void payloadDeleted(int totalPayloadSize, int unwrittenPayloadSize)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "payloadDeleted", new Object[] { this, totalPayloadSize, unwrittenPayloadSize });
_unwrittenDataSize.addAndGet(-unwrittenPayloadSize);
synchronized (this)
{
_totalDataSize -= totalPayloadSize;
}
if (tc.isDebugEnabled())
Tr.debug(tc, "unwrittenDataSize = " + _unwrittenDataSize.get() + " totalDataSize = " + _totalDataSize);
if (tc.isEntryEnabled())
Tr.exit(tc, "payloadDeleted");
} | [
"protected",
"void",
"payloadDeleted",
"(",
"int",
"totalPayloadSize",
",",
"int",
"unwrittenPayloadSize",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"payloadDeleted\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"totalPayloadSize",
",",
"unwrittenPayloadSize",
"}",
")",
";",
"_unwrittenDataSize",
".",
"addAndGet",
"(",
"-",
"unwrittenPayloadSize",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"_totalDataSize",
"-=",
"totalPayloadSize",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"unwrittenDataSize = \"",
"+",
"_unwrittenDataSize",
".",
"get",
"(",
")",
"+",
"\" totalDataSize = \"",
"+",
"_totalDataSize",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"payloadDeleted\"",
")",
";",
"}"
] | Informs the recovery log that data has been removed from one of its recoverable
units. Right now, this means that a recoverable unit and all its content has
been removed, but in the future this will also be driven when a single recoverable
unit section within a recoverable unit has been removed. The recovery log must use
the supplied information to track the amount of active data it holds. This information
will be required each time a keypoint occurs, in order to determine if there is
sufficient space in the current file to perform the keypoint sucessfully.
This call is driven by the recoverable unit that has been removed and accounts for
both the data and header fields that would have been necessary to form a persistnet
record of the the recoverable unit and its content.
This data may or may not have been written to persistent storage and must therefour be
tracked in both total and unwritten data size fields. It is important to
understand why two parameters are required on this call rather than a single
value that could be reflected in both fields. The following example can be used
to illustrate the reason for this. Consider that data items of sizes D1, D2
and D3 have been added to an initially empty recovery log. If H represents the
size of all the header information that the underlying recoverable units, sections
and data items will need to form a persistent record of the data, then the
unwritten and total data size fields will be made up as follows:
unwritten total
D3 D3
D2 D2
D1 D1
H H
If this information has been written to disk, D1+D2+d3+H will be deducted
from the unwritten total (see payloadWritten) whilst the total data size remains
unchanged.
unwritten total
D3
D2
D1
- H
If D1,D2 and D3 are subsequently deleted, the total will need to be reduced but
the unwritten field will remian unchanged. Since it is the callers responsibility
to determine the amount that needs to be removed from each, two arguments are
required.
@param unwrittenPayloadSize The number of bytes that will no longer be required
to form a persistent record of the recovery log when a
writeSections or forceSections operation is driven
by the client service.
@param totalPayloadSize The number of bytes that will no longer be required
to form a persistent record of the recovery log the
next time a keypoint operation occurs. | [
"Informs",
"the",
"recovery",
"log",
"that",
"data",
"has",
"been",
"removed",
"from",
"one",
"of",
"its",
"recoverable",
"units",
".",
"Right",
"now",
"this",
"means",
"that",
"a",
"recoverable",
"unit",
"and",
"all",
"its",
"content",
"has",
"been",
"removed",
"but",
"in",
"the",
"future",
"this",
"will",
"also",
"be",
"driven",
"when",
"a",
"single",
"recoverable",
"unit",
"section",
"within",
"a",
"recoverable",
"unit",
"has",
"been",
"removed",
".",
"The",
"recovery",
"log",
"must",
"use",
"the",
"supplied",
"information",
"to",
"track",
"the",
"amount",
"of",
"active",
"data",
"it",
"holds",
".",
"This",
"information",
"will",
"be",
"required",
"each",
"time",
"a",
"keypoint",
"occurs",
"in",
"order",
"to",
"determine",
"if",
"there",
"is",
"sufficient",
"space",
"in",
"the",
"current",
"file",
"to",
"perform",
"the",
"keypoint",
"sucessfully",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java#L2184-L2199 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java | MultiScopeRecoveryLog.addRecoverableUnit | protected void addRecoverableUnit(RecoverableUnit recoverableUnit, boolean recovered)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "addRecoverableUnit", new Object[] { recoverableUnit, recovered, this });
final long identity = recoverableUnit.identity();
_recoverableUnits.put(identity, recoverableUnit);
if (recovered)
{
_recUnitIdTable.reserveId(identity, recoverableUnit);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "addRecoverableUnit");
} | java | protected void addRecoverableUnit(RecoverableUnit recoverableUnit, boolean recovered)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "addRecoverableUnit", new Object[] { recoverableUnit, recovered, this });
final long identity = recoverableUnit.identity();
_recoverableUnits.put(identity, recoverableUnit);
if (recovered)
{
_recUnitIdTable.reserveId(identity, recoverableUnit);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "addRecoverableUnit");
} | [
"protected",
"void",
"addRecoverableUnit",
"(",
"RecoverableUnit",
"recoverableUnit",
",",
"boolean",
"recovered",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"addRecoverableUnit\"",
",",
"new",
"Object",
"[",
"]",
"{",
"recoverableUnit",
",",
"recovered",
",",
"this",
"}",
")",
";",
"final",
"long",
"identity",
"=",
"recoverableUnit",
".",
"identity",
"(",
")",
";",
"_recoverableUnits",
".",
"put",
"(",
"identity",
",",
"recoverableUnit",
")",
";",
"if",
"(",
"recovered",
")",
"{",
"_recUnitIdTable",
".",
"reserveId",
"(",
"identity",
",",
"recoverableUnit",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"addRecoverableUnit\"",
")",
";",
"}"
] | Adds a new RecoverableUnitImpl object, keyed from its identity to this
classes collection of such objects.
@param recoverableUnit The RecoverableUnit to be added
@param recovered Flag to indicate if this instances have been created during
recovery (true) or normal running (false). If its been created
during recovery we need to reserve the associated id so that
it can't be allocated to an independent RecoverableUnit. | [
"Adds",
"a",
"new",
"RecoverableUnitImpl",
"object",
"keyed",
"from",
"its",
"identity",
"to",
"this",
"classes",
"collection",
"of",
"such",
"objects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java#L2378-L2394 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java | MultiScopeRecoveryLog.removeRecoverableUnitMapEntries | protected RecoverableUnitImpl removeRecoverableUnitMapEntries(long identity)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "removeRecoverableUnitMapEntries", new Object[] { identity, this });
final RecoverableUnitImpl recoverableUnit = (RecoverableUnitImpl) _recoverableUnits.remove(identity);
if (recoverableUnit != null)
{
_recUnitIdTable.removeId(identity);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "removeRecoverableUnitMapEntries", recoverableUnit);
return recoverableUnit;
} | java | protected RecoverableUnitImpl removeRecoverableUnitMapEntries(long identity)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "removeRecoverableUnitMapEntries", new Object[] { identity, this });
final RecoverableUnitImpl recoverableUnit = (RecoverableUnitImpl) _recoverableUnits.remove(identity);
if (recoverableUnit != null)
{
_recUnitIdTable.removeId(identity);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "removeRecoverableUnitMapEntries", recoverableUnit);
return recoverableUnit;
} | [
"protected",
"RecoverableUnitImpl",
"removeRecoverableUnitMapEntries",
"(",
"long",
"identity",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"removeRecoverableUnitMapEntries\"",
",",
"new",
"Object",
"[",
"]",
"{",
"identity",
",",
"this",
"}",
")",
";",
"final",
"RecoverableUnitImpl",
"recoverableUnit",
"=",
"(",
"RecoverableUnitImpl",
")",
"_recoverableUnits",
".",
"remove",
"(",
"identity",
")",
";",
"if",
"(",
"recoverableUnit",
"!=",
"null",
")",
"{",
"_recUnitIdTable",
".",
"removeId",
"(",
"identity",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"removeRecoverableUnitMapEntries\"",
",",
"recoverableUnit",
")",
";",
"return",
"recoverableUnit",
";",
"}"
] | Removes a RecoverableUnitImpl object, keyed from its identity from this
classes collection of such objects.
@param identity The identity of the RecoverableUnitImpl to be removed
@return RecoverableUnitImpl The RecoverableUnitImpl thats no longer associated
with the MultiScopeRecoveryLog. | [
"Removes",
"a",
"RecoverableUnitImpl",
"object",
"keyed",
"from",
"its",
"identity",
"from",
"this",
"classes",
"collection",
"of",
"such",
"objects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java#L2408-L2423 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java | MultiScopeRecoveryLog.getRecoverableUnit | protected RecoverableUnitImpl getRecoverableUnit(long identity)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "getRecoverableUnit", new Object[] { identity, this });
RecoverableUnitImpl recoverableUnit = null;
// Only attempt to resolve the recoverable unit if the log is compatible and valid.
if (!incompatible() && !failed())
{
recoverableUnit = (RecoverableUnitImpl) _recoverableUnits.get(identity);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getRecoverableUnit", recoverableUnit);
return recoverableUnit;
} | java | protected RecoverableUnitImpl getRecoverableUnit(long identity)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "getRecoverableUnit", new Object[] { identity, this });
RecoverableUnitImpl recoverableUnit = null;
// Only attempt to resolve the recoverable unit if the log is compatible and valid.
if (!incompatible() && !failed())
{
recoverableUnit = (RecoverableUnitImpl) _recoverableUnits.get(identity);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getRecoverableUnit", recoverableUnit);
return recoverableUnit;
} | [
"protected",
"RecoverableUnitImpl",
"getRecoverableUnit",
"(",
"long",
"identity",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getRecoverableUnit\"",
",",
"new",
"Object",
"[",
"]",
"{",
"identity",
",",
"this",
"}",
")",
";",
"RecoverableUnitImpl",
"recoverableUnit",
"=",
"null",
";",
"// Only attempt to resolve the recoverable unit if the log is compatible and valid.",
"if",
"(",
"!",
"incompatible",
"(",
")",
"&&",
"!",
"failed",
"(",
")",
")",
"{",
"recoverableUnit",
"=",
"(",
"RecoverableUnitImpl",
")",
"_recoverableUnits",
".",
"get",
"(",
"identity",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getRecoverableUnit\"",
",",
"recoverableUnit",
")",
";",
"return",
"recoverableUnit",
";",
"}"
] | Retrieves a RecoverableUnitImpl object, keyed from its identity from this
classes collection of such objects.
@param identity The identity of the RecoverableUnitImpl to be retrieved
@return RecoverableUnitImpl The required RecoverableUnitImpl | [
"Retrieves",
"a",
"RecoverableUnitImpl",
"object",
"keyed",
"from",
"its",
"identity",
"from",
"this",
"classes",
"collection",
"of",
"such",
"objects",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java#L2436-L2452 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java | MultiScopeRecoveryLog.associateLog | @Override
public void associateLog(DistributedRecoveryLog otherLog, boolean failAssociatedLog)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "associateLog", new Object[] { otherLog, failAssociatedLog, this });
if (otherLog instanceof MultiScopeLog)
{
_associatedLog = (MultiScopeLog) otherLog;
_failAssociatedLog = failAssociatedLog;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "associateLog");
} | java | @Override
public void associateLog(DistributedRecoveryLog otherLog, boolean failAssociatedLog)
{
if (tc.isEntryEnabled())
Tr.entry(tc, "associateLog", new Object[] { otherLog, failAssociatedLog, this });
if (otherLog instanceof MultiScopeLog)
{
_associatedLog = (MultiScopeLog) otherLog;
_failAssociatedLog = failAssociatedLog;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "associateLog");
} | [
"@",
"Override",
"public",
"void",
"associateLog",
"(",
"DistributedRecoveryLog",
"otherLog",
",",
"boolean",
"failAssociatedLog",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"associateLog\"",
",",
"new",
"Object",
"[",
"]",
"{",
"otherLog",
",",
"failAssociatedLog",
",",
"this",
"}",
")",
";",
"if",
"(",
"otherLog",
"instanceof",
"MultiScopeLog",
")",
"{",
"_associatedLog",
"=",
"(",
"MultiScopeLog",
")",
"otherLog",
";",
"_failAssociatedLog",
"=",
"failAssociatedLog",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"associateLog\"",
")",
";",
"}"
] | Associates another log with this one. PI45254.
The code is protects against infinite recursion since associated logs are only marked as failed if
the log isn't already mark as failed.
The code does NOT protect against deadlock due to synchronization for logA->logB and logB->logA
- this is not an issue since failAssociated is only set to true for tranLog and not partnerLog
- this could be fixed for general use by delegating to an 'AssociatedLogGroup' object shared between associated logs. | [
"Associates",
"another",
"log",
"with",
"this",
"one",
".",
"PI45254",
".",
"The",
"code",
"is",
"protects",
"against",
"infinite",
"recursion",
"since",
"associated",
"logs",
"are",
"only",
"marked",
"as",
"failed",
"if",
"the",
"log",
"isn",
"t",
"already",
"mark",
"as",
"failed",
".",
"The",
"code",
"does",
"NOT",
"protect",
"against",
"deadlock",
"due",
"to",
"synchronization",
"for",
"logA",
"-",
">",
"logB",
"and",
"logB",
"-",
">",
"logA",
"-",
"this",
"is",
"not",
"an",
"issue",
"since",
"failAssociated",
"is",
"only",
"set",
"to",
"true",
"for",
"tranLog",
"and",
"not",
"partnerLog",
"-",
"this",
"could",
"be",
"fixed",
"for",
"general",
"use",
"by",
"delegating",
"to",
"an",
"AssociatedLogGroup",
"object",
"shared",
"between",
"associated",
"logs",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/MultiScopeRecoveryLog.java#L2564-L2577 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapDiscriminator.java | JFapDiscriminator.getDiscriminatoryDataType | public Class getDiscriminatoryDataType() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getDiscriminatorDataType");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getDiscriminatorDataType");
return com.ibm.wsspi.bytebuffer.WsByteBuffer.class; // F188491
} | java | public Class getDiscriminatoryDataType() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getDiscriminatorDataType");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getDiscriminatorDataType");
return com.ibm.wsspi.bytebuffer.WsByteBuffer.class; // F188491
} | [
"public",
"Class",
"getDiscriminatoryDataType",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getDiscriminatorDataType\"",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getDiscriminatorDataType\"",
")",
";",
"return",
"com",
".",
"ibm",
".",
"wsspi",
".",
"bytebuffer",
".",
"WsByteBuffer",
".",
"class",
";",
"// F188491",
"}"
] | Returns the data type this discriminator is able to discriminate for.
This is always WsByteBuffer. | [
"Returns",
"the",
"data",
"type",
"this",
"discriminator",
"is",
"able",
"to",
"discriminate",
"for",
".",
"This",
"is",
"always",
"WsByteBuffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapDiscriminator.java#L176-L182 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapDiscriminator.java | JFapDiscriminator.getChannel | public Channel getChannel() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getChannel");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getChannel", channel);
return channel;
} | java | public Channel getChannel() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getChannel");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getChannel", channel);
return channel;
} | [
"public",
"Channel",
"getChannel",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getChannel\"",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getChannel\"",
",",
"channel",
")",
";",
"return",
"channel",
";",
"}"
] | Returns the channel this discriminator discriminates on behalf of. | [
"Returns",
"the",
"channel",
"this",
"discriminator",
"discriminates",
"on",
"behalf",
"of",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapDiscriminator.java#L187-L193 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapDiscriminator.java | JFapDiscriminator.getWeight | public int getWeight() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getWeight");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getWeight");
// TODO: this probably isn't a good value.
return 0;
} | java | public int getWeight() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "getWeight");
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "getWeight");
// TODO: this probably isn't a good value.
return 0;
} | [
"public",
"int",
"getWeight",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getWeight\"",
")",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getWeight\"",
")",
";",
"// TODO: this probably isn't a good value.",
"return",
"0",
";",
"}"
] | Get the weighting to use for this discriminator | [
"Get",
"the",
"weighting",
"to",
"use",
"for",
"this",
"discriminator"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/jfapchannel/server/impl/JFapDiscriminator.java#L209-L216 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/BaseSIXAResourceProxy.java | BaseSIXAResourceProxy.join | protected synchronized void join(SIXAResource resource)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "join", resource);
resourcesJoinedToThisResource.add(resource);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "join");
} | java | protected synchronized void join(SIXAResource resource)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "join", resource);
resourcesJoinedToThisResource.add(resource);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "join");
} | [
"protected",
"synchronized",
"void",
"join",
"(",
"SIXAResource",
"resource",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"join\"",
",",
"resource",
")",
";",
"resourcesJoinedToThisResource",
".",
"add",
"(",
"resource",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"join\"",
")",
";",
"}"
] | Called when another XAResource is joining to us.
@param resource | [
"Called",
"when",
"another",
"XAResource",
"is",
"joining",
"to",
"us",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/BaseSIXAResourceProxy.java#L88-L93 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/BaseSIXAResourceProxy.java | BaseSIXAResourceProxy.unjoin | protected synchronized void unjoin(SIXAResource resource)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unjoin", resource);
resourcesJoinedToThisResource.remove(resource);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unjoin");
} | java | protected synchronized void unjoin(SIXAResource resource)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unjoin", resource);
resourcesJoinedToThisResource.remove(resource);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unjoin");
} | [
"protected",
"synchronized",
"void",
"unjoin",
"(",
"SIXAResource",
"resource",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"unjoin\"",
",",
"resource",
")",
";",
"resourcesJoinedToThisResource",
".",
"remove",
"(",
"resource",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"unjoin\"",
")",
";",
"}"
] | Called when another instance is un-joining from us.
@param resource | [
"Called",
"when",
"another",
"instance",
"is",
"un",
"-",
"joining",
"from",
"us",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/BaseSIXAResourceProxy.java#L99-L104 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java | SSLChannelProvider.updatedSslSupport | protected void updatedSslSupport(SSLSupport service, Map<String, Object> props) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "updatedSslSupport", props);
}
sslSupport = service;
// If the default pid has changed.. we need to go hunting for who was using the default.
String id = (String) props.get(SSL_CFG_REF);
if (!defaultId.equals(id)) {
for (SSLChannelOptions options : sslOptions.values()) {
options.updateRefId(id);
options.updateRegistration(bContext, sslConfigs);
}
defaultId = id;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "updatedSslSupport", "defaultConfigId=" + defaultId);
}
} | java | protected void updatedSslSupport(SSLSupport service, Map<String, Object> props) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "updatedSslSupport", props);
}
sslSupport = service;
// If the default pid has changed.. we need to go hunting for who was using the default.
String id = (String) props.get(SSL_CFG_REF);
if (!defaultId.equals(id)) {
for (SSLChannelOptions options : sslOptions.values()) {
options.updateRefId(id);
options.updateRegistration(bContext, sslConfigs);
}
defaultId = id;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "updatedSslSupport", "defaultConfigId=" + defaultId);
}
} | [
"protected",
"void",
"updatedSslSupport",
"(",
"SSLSupport",
"service",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"updatedSslSupport\"",
",",
"props",
")",
";",
"}",
"sslSupport",
"=",
"service",
";",
"// If the default pid has changed.. we need to go hunting for who was using the default.",
"String",
"id",
"=",
"(",
"String",
")",
"props",
".",
"get",
"(",
"SSL_CFG_REF",
")",
";",
"if",
"(",
"!",
"defaultId",
".",
"equals",
"(",
"id",
")",
")",
"{",
"for",
"(",
"SSLChannelOptions",
"options",
":",
"sslOptions",
".",
"values",
"(",
")",
")",
"{",
"options",
".",
"updateRefId",
"(",
"id",
")",
";",
"options",
".",
"updateRegistration",
"(",
"bContext",
",",
"sslConfigs",
")",
";",
"}",
"defaultId",
"=",
"id",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"updatedSslSupport\"",
",",
"\"defaultConfigId=\"",
"+",
"defaultId",
")",
";",
"}",
"}"
] | This is called if the service is updated.
@param ref reference to the service | [
"This",
"is",
"called",
"if",
"the",
"service",
"is",
"updated",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java#L216-L235 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java | SSLChannelProvider.getJSSEProvider | public static JSSEProvider getJSSEProvider() {
SSLChannelProvider p = instance.get();
if (p != null)
return p.sslSupport.getJSSEProvider();
throw new IllegalStateException("Requested service is null: no active component instance");
} | java | public static JSSEProvider getJSSEProvider() {
SSLChannelProvider p = instance.get();
if (p != null)
return p.sslSupport.getJSSEProvider();
throw new IllegalStateException("Requested service is null: no active component instance");
} | [
"public",
"static",
"JSSEProvider",
"getJSSEProvider",
"(",
")",
"{",
"SSLChannelProvider",
"p",
"=",
"instance",
".",
"get",
"(",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"return",
"p",
".",
"sslSupport",
".",
"getJSSEProvider",
"(",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"\"Requested service is null: no active component instance\"",
")",
";",
"}"
] | Access the JSSE provider factory service.
@return JSSEProviderService - null if not set | [
"Access",
"the",
"JSSE",
"provider",
"factory",
"service",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java#L358-L364 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java | SSLChannelProvider.getJSSEHelper | public static JSSEHelper getJSSEHelper() {
SSLChannelProvider p = instance.get();
if (p != null)
return p.sslSupport.getJSSEHelper();
throw new IllegalStateException("Requested service is null: no active component instance");
} | java | public static JSSEHelper getJSSEHelper() {
SSLChannelProvider p = instance.get();
if (p != null)
return p.sslSupport.getJSSEHelper();
throw new IllegalStateException("Requested service is null: no active component instance");
} | [
"public",
"static",
"JSSEHelper",
"getJSSEHelper",
"(",
")",
"{",
"SSLChannelProvider",
"p",
"=",
"instance",
".",
"get",
"(",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"return",
"p",
".",
"sslSupport",
".",
"getJSSEHelper",
"(",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"\"Requested service is null: no active component instance\"",
")",
";",
"}"
] | Access the JSSEHelper service.
@return JSSEHelperService - null if not set | [
"Access",
"the",
"JSSEHelper",
"service",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java#L371-L377 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java | FormatSet.getBasicDateFormatter | public static DateFormat getBasicDateFormatter() { // PK42263 - made static
// Retrieve a standard Java DateFormat object with desired format, using default locale
return customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM), false);
} | java | public static DateFormat getBasicDateFormatter() { // PK42263 - made static
// Retrieve a standard Java DateFormat object with desired format, using default locale
return customizeDateFormat(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM), false);
} | [
"public",
"static",
"DateFormat",
"getBasicDateFormatter",
"(",
")",
"{",
"// PK42263 - made static",
"// Retrieve a standard Java DateFormat object with desired format, using default locale",
"return",
"customizeDateFormat",
"(",
"DateFormat",
".",
"getDateTimeInstance",
"(",
"DateFormat",
".",
"SHORT",
",",
"DateFormat",
".",
"MEDIUM",
")",
",",
"false",
")",
";",
"}"
] | Return a DateFormat object that can be used to format timestamps in the
System.out, System.err and TraceOutput logs. It will use the default date
format. | [
"Return",
"a",
"DateFormat",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"timestamps",
"in",
"the",
"System",
".",
"out",
"System",
".",
"err",
"and",
"TraceOutput",
"logs",
".",
"It",
"will",
"use",
"the",
"default",
"date",
"format",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java#L112-L115 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java | FormatSet.customizeDateFormat | public static DateFormat customizeDateFormat(DateFormat formatter, boolean isoDateFormat) {
String pattern;
int patternLength;
int endOfSecsIndex;
if (!!!isoDateFormat) {
if (formatter instanceof SimpleDateFormat) {
// Retrieve the pattern from the formatter, since we will need to modify it.
SimpleDateFormat sdFormatter = (SimpleDateFormat) formatter;
pattern = sdFormatter.toPattern();
// Append milliseconds and timezone after seconds
patternLength = pattern.length();
endOfSecsIndex = pattern.lastIndexOf('s') + 1;
String newPattern = pattern.substring(0, endOfSecsIndex) + ":SSS z";
if (endOfSecsIndex < patternLength)
newPattern += pattern.substring(endOfSecsIndex, patternLength);
// 0-23 hour clock (get rid of any other clock formats and am/pm)
newPattern = newPattern.replace('h', 'H');
newPattern = newPattern.replace('K', 'H');
newPattern = newPattern.replace('k', 'H');
newPattern = newPattern.replace('a', ' ');
newPattern = newPattern.trim();
sdFormatter.applyPattern(newPattern);
formatter = sdFormatter;
} else {
formatter = new SimpleDateFormat("yy.MM.dd HH:mm:ss:SSS z");
}
} else {
formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
}
// PK13288 Start -
if (sysTimeZone != null) {
formatter.setTimeZone(sysTimeZone);
}
// PK13288 End
return formatter;
} | java | public static DateFormat customizeDateFormat(DateFormat formatter, boolean isoDateFormat) {
String pattern;
int patternLength;
int endOfSecsIndex;
if (!!!isoDateFormat) {
if (formatter instanceof SimpleDateFormat) {
// Retrieve the pattern from the formatter, since we will need to modify it.
SimpleDateFormat sdFormatter = (SimpleDateFormat) formatter;
pattern = sdFormatter.toPattern();
// Append milliseconds and timezone after seconds
patternLength = pattern.length();
endOfSecsIndex = pattern.lastIndexOf('s') + 1;
String newPattern = pattern.substring(0, endOfSecsIndex) + ":SSS z";
if (endOfSecsIndex < patternLength)
newPattern += pattern.substring(endOfSecsIndex, patternLength);
// 0-23 hour clock (get rid of any other clock formats and am/pm)
newPattern = newPattern.replace('h', 'H');
newPattern = newPattern.replace('K', 'H');
newPattern = newPattern.replace('k', 'H');
newPattern = newPattern.replace('a', ' ');
newPattern = newPattern.trim();
sdFormatter.applyPattern(newPattern);
formatter = sdFormatter;
} else {
formatter = new SimpleDateFormat("yy.MM.dd HH:mm:ss:SSS z");
}
} else {
formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
}
// PK13288 Start -
if (sysTimeZone != null) {
formatter.setTimeZone(sysTimeZone);
}
// PK13288 End
return formatter;
} | [
"public",
"static",
"DateFormat",
"customizeDateFormat",
"(",
"DateFormat",
"formatter",
",",
"boolean",
"isoDateFormat",
")",
"{",
"String",
"pattern",
";",
"int",
"patternLength",
";",
"int",
"endOfSecsIndex",
";",
"if",
"(",
"!",
"!",
"!",
"isoDateFormat",
")",
"{",
"if",
"(",
"formatter",
"instanceof",
"SimpleDateFormat",
")",
"{",
"// Retrieve the pattern from the formatter, since we will need to modify it.",
"SimpleDateFormat",
"sdFormatter",
"=",
"(",
"SimpleDateFormat",
")",
"formatter",
";",
"pattern",
"=",
"sdFormatter",
".",
"toPattern",
"(",
")",
";",
"// Append milliseconds and timezone after seconds",
"patternLength",
"=",
"pattern",
".",
"length",
"(",
")",
";",
"endOfSecsIndex",
"=",
"pattern",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
";",
"String",
"newPattern",
"=",
"pattern",
".",
"substring",
"(",
"0",
",",
"endOfSecsIndex",
")",
"+",
"\":SSS z\"",
";",
"if",
"(",
"endOfSecsIndex",
"<",
"patternLength",
")",
"newPattern",
"+=",
"pattern",
".",
"substring",
"(",
"endOfSecsIndex",
",",
"patternLength",
")",
";",
"// 0-23 hour clock (get rid of any other clock formats and am/pm)",
"newPattern",
"=",
"newPattern",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"newPattern",
"=",
"newPattern",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"newPattern",
"=",
"newPattern",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"newPattern",
"=",
"newPattern",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"newPattern",
"=",
"newPattern",
".",
"trim",
"(",
")",
";",
"sdFormatter",
".",
"applyPattern",
"(",
"newPattern",
")",
";",
"formatter",
"=",
"sdFormatter",
";",
"}",
"else",
"{",
"formatter",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yy.MM.dd HH:mm:ss:SSS z\"",
")",
";",
"}",
"}",
"else",
"{",
"formatter",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\"",
")",
";",
"}",
"// PK13288 Start -",
"if",
"(",
"sysTimeZone",
"!=",
"null",
")",
"{",
"formatter",
".",
"setTimeZone",
"(",
"sysTimeZone",
")",
";",
"}",
"// PK13288 End",
"return",
"formatter",
";",
"}"
] | Modifies an existing DateFormat object so that it can be used to format timestamps in the
System.out, System.err and TraceOutput logs using either default date and time format or
ISO-8601 date and time format
@param formatter DateFormat object to be modified
@param flag to use ISO-8601 date format for output.
@return DateFormat object with adjusted pattern | [
"Modifies",
"an",
"existing",
"DateFormat",
"object",
"so",
"that",
"it",
"can",
"be",
"used",
"to",
"format",
"timestamps",
"in",
"the",
"System",
".",
"out",
"System",
".",
"err",
"and",
"TraceOutput",
"logs",
"using",
"either",
"default",
"date",
"and",
"time",
"format",
"or",
"ISO",
"-",
"8601",
"date",
"and",
"time",
"format"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java#L127-L164 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityConfiguration.java | SecurityConfiguration.setAndValidateProperties | private void setAndValidateProperties(String cfgAuthentication,
String cfgAuthorization,
String cfgUserRegistry) {
if ((cfgAuthentication == null) || cfgAuthentication.isEmpty()) {
throwIllegalArgumentExceptionMissingAttribute(CFG_KEY_AUTHENTICATION_REF);
}
this.cfgAuthenticationRef = cfgAuthentication;
if ((cfgAuthorization == null) || cfgAuthorization.isEmpty()) {
throwIllegalArgumentExceptionMissingAttribute(CFG_KEY_AUTHORIZATION_REF);
}
this.cfgAuthorizationRef = cfgAuthorization;
if ((cfgUserRegistry == null) || cfgUserRegistry.isEmpty()) {
throwIllegalArgumentExceptionMissingAttribute(CFG_KEY_USERREGISTRY_REF);
}
this.cfgUserRegistryRef = cfgUserRegistry;
} | java | private void setAndValidateProperties(String cfgAuthentication,
String cfgAuthorization,
String cfgUserRegistry) {
if ((cfgAuthentication == null) || cfgAuthentication.isEmpty()) {
throwIllegalArgumentExceptionMissingAttribute(CFG_KEY_AUTHENTICATION_REF);
}
this.cfgAuthenticationRef = cfgAuthentication;
if ((cfgAuthorization == null) || cfgAuthorization.isEmpty()) {
throwIllegalArgumentExceptionMissingAttribute(CFG_KEY_AUTHORIZATION_REF);
}
this.cfgAuthorizationRef = cfgAuthorization;
if ((cfgUserRegistry == null) || cfgUserRegistry.isEmpty()) {
throwIllegalArgumentExceptionMissingAttribute(CFG_KEY_USERREGISTRY_REF);
}
this.cfgUserRegistryRef = cfgUserRegistry;
} | [
"private",
"void",
"setAndValidateProperties",
"(",
"String",
"cfgAuthentication",
",",
"String",
"cfgAuthorization",
",",
"String",
"cfgUserRegistry",
")",
"{",
"if",
"(",
"(",
"cfgAuthentication",
"==",
"null",
")",
"||",
"cfgAuthentication",
".",
"isEmpty",
"(",
")",
")",
"{",
"throwIllegalArgumentExceptionMissingAttribute",
"(",
"CFG_KEY_AUTHENTICATION_REF",
")",
";",
"}",
"this",
".",
"cfgAuthenticationRef",
"=",
"cfgAuthentication",
";",
"if",
"(",
"(",
"cfgAuthorization",
"==",
"null",
")",
"||",
"cfgAuthorization",
".",
"isEmpty",
"(",
")",
")",
"{",
"throwIllegalArgumentExceptionMissingAttribute",
"(",
"CFG_KEY_AUTHORIZATION_REF",
")",
";",
"}",
"this",
".",
"cfgAuthorizationRef",
"=",
"cfgAuthorization",
";",
"if",
"(",
"(",
"cfgUserRegistry",
"==",
"null",
")",
"||",
"cfgUserRegistry",
".",
"isEmpty",
"(",
")",
")",
"{",
"throwIllegalArgumentExceptionMissingAttribute",
"(",
"CFG_KEY_USERREGISTRY_REF",
")",
";",
"}",
"this",
".",
"cfgUserRegistryRef",
"=",
"cfgUserRegistry",
";",
"}"
] | Sets and validates the configuration properties. If any of the
configuration properties are not set, an IllegalArgumentException
is thrown.
@param cfgAuthentication
@param cfgAuthorization
@param cfgUserRegistry
@throws IllegalArgumentException if any of the configuration elements
are not set | [
"Sets",
"and",
"validates",
"the",
"configuration",
"properties",
".",
"If",
"any",
"of",
"the",
"configuration",
"properties",
"are",
"not",
"set",
"an",
"IllegalArgumentException",
"is",
"thrown",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityConfiguration.java#L71-L88 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/service/ManagementEJBService.java | ManagementEJBService.setServerStarted | @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL)
protected synchronized void setServerStarted(ServerStarted serverStarted) {
isServerStarted = true;
// Start SystemModule if everything else is ready
startManagementEJB();
} | java | @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL)
protected synchronized void setServerStarted(ServerStarted serverStarted) {
isServerStarted = true;
// Start SystemModule if everything else is ready
startManagementEJB();
} | [
"@",
"Reference",
"(",
"policy",
"=",
"ReferencePolicy",
".",
"DYNAMIC",
",",
"cardinality",
"=",
"ReferenceCardinality",
".",
"OPTIONAL",
")",
"protected",
"synchronized",
"void",
"setServerStarted",
"(",
"ServerStarted",
"serverStarted",
")",
"{",
"isServerStarted",
"=",
"true",
";",
"// Start SystemModule if everything else is ready",
"startManagementEJB",
"(",
")",
";",
"}"
] | Declarative services method that is invoked once the ServerStarted service
is available. Only after this method is invoked is the Management EJB system
module started.
@param serverStarted The server started instance | [
"Declarative",
"services",
"method",
"that",
"is",
"invoked",
"once",
"the",
"ServerStarted",
"service",
"is",
"available",
".",
"Only",
"after",
"this",
"method",
"is",
"invoked",
"is",
"the",
"Management",
"EJB",
"system",
"module",
"started",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/service/ManagementEJBService.java#L93-L99 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/async/ThreadContextManager.java | ThreadContextManager.saveContextData | public HashMap<String,Object> saveContextData(){
HashMap<String,Object> contextData = new HashMap<String, Object>();
//Save off the data from the other components we have hooks into
ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
ComponentMetaData cmd = cmdai.getComponentMetaData();
if (cmd != null) {
contextData.put(ComponentMetaData, cmd);
}
//Each producer service of the Transfer service is accessed in order to get the thread context data
//The context data is then stored off
Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
if (TransferIterator != null) {
while(TransferIterator.hasNext()){
ITransferContextService tcs = TransferIterator.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling storeState on: " + tcs);
}
tcs.storeState(contextData);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No implmenting services found");
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Saving the context data : " + contextData);
}
return contextData;
} | java | public HashMap<String,Object> saveContextData(){
HashMap<String,Object> contextData = new HashMap<String, Object>();
//Save off the data from the other components we have hooks into
ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
ComponentMetaData cmd = cmdai.getComponentMetaData();
if (cmd != null) {
contextData.put(ComponentMetaData, cmd);
}
//Each producer service of the Transfer service is accessed in order to get the thread context data
//The context data is then stored off
Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
if (TransferIterator != null) {
while(TransferIterator.hasNext()){
ITransferContextService tcs = TransferIterator.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling storeState on: " + tcs);
}
tcs.storeState(contextData);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No implmenting services found");
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Saving the context data : " + contextData);
}
return contextData;
} | [
"public",
"HashMap",
"<",
"String",
",",
"Object",
">",
"saveContextData",
"(",
")",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"contextData",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"//Save off the data from the other components we have hooks into",
"ComponentMetaDataAccessorImpl",
"cmdai",
"=",
"ComponentMetaDataAccessorImpl",
".",
"getComponentMetaDataAccessor",
"(",
")",
";",
"ComponentMetaData",
"cmd",
"=",
"cmdai",
".",
"getComponentMetaData",
"(",
")",
";",
"if",
"(",
"cmd",
"!=",
"null",
")",
"{",
"contextData",
".",
"put",
"(",
"ComponentMetaData",
",",
"cmd",
")",
";",
"}",
"//Each producer service of the Transfer service is accessed in order to get the thread context data",
"//The context data is then stored off",
"Iterator",
"<",
"ITransferContextService",
">",
"TransferIterator",
"=",
"com",
".",
"ibm",
".",
"ws",
".",
"webcontainer",
".",
"osgi",
".",
"WebContainer",
".",
"getITransferContextServices",
"(",
")",
";",
"if",
"(",
"TransferIterator",
"!=",
"null",
")",
"{",
"while",
"(",
"TransferIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"ITransferContextService",
"tcs",
"=",
"TransferIterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Calling storeState on: \"",
"+",
"tcs",
")",
";",
"}",
"tcs",
".",
"storeState",
"(",
"contextData",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"No implmenting services found\"",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Saving the context data : \"",
"+",
"contextData",
")",
";",
"}",
"return",
"contextData",
";",
"}"
] | Save off the context data for the current thread | [
"Save",
"off",
"the",
"context",
"data",
"for",
"the",
"current",
"thread"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/async/ThreadContextManager.java#L59-L89 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/DefaultSecurityHelper.java | DefaultSecurityHelper.finalizeSubject | @Override
public Subject finalizeSubject(Subject subject,
ConnectionRequestInfo reqInfo,
CMConfigData cmConfigData) throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "finalizeSubject");
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "finalizeSubject");
}
return subject; // Pass back unchanged Subject
} | java | @Override
public Subject finalizeSubject(Subject subject,
ConnectionRequestInfo reqInfo,
CMConfigData cmConfigData) throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "finalizeSubject");
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "finalizeSubject");
}
return subject; // Pass back unchanged Subject
} | [
"@",
"Override",
"public",
"Subject",
"finalizeSubject",
"(",
"Subject",
"subject",
",",
"ConnectionRequestInfo",
"reqInfo",
",",
"CMConfigData",
"cmConfigData",
")",
"throws",
"ResourceException",
"{",
"final",
"boolean",
"isTracingEnabled",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTracingEnabled",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"finalizeSubject\"",
")",
";",
"}",
"if",
"(",
"isTracingEnabled",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"finalizeSubject\"",
")",
";",
"}",
"return",
"subject",
";",
"// Pass back unchanged Subject",
"}"
] | The finalizeSubject method is used to set what the final Subject
will be for processing.
The primary intent of this method is to allow the Subject to be
defaulted.
@param Subject subject
@param ConnectionRequestInfo reqInfo
@param cmConfigData
@return Subject
@exception ResourceException | [
"The",
"finalizeSubject",
"method",
"is",
"used",
"to",
"set",
"what",
"the",
"final",
"Subject",
"will",
"be",
"for",
"processing",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/DefaultSecurityHelper.java#L52-L69 | train |
Subsets and Splits