repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPBaseRequestContext.java | TCPBaseRequestContext.updateIOCounts | public boolean updateIOCounts(long byteCount, int type) {
setLastIOAmt(byteCount);
setIODoneAmount(getIODoneAmount() + byteCount);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
String dbString = null;
if (type == 0) {
dbString = "Read ";
} else {
dbString = "Wrote ";
}
SocketIOChannel channel = getTCPConnLink().getSocketIOChannel();
Tr.event(tc, dbString + byteCount + "(" + +getIODoneAmount() + ")" + " bytes, " + getIOAmount() + " requested on local: " + channel.getSocket().getLocalSocketAddress()
+ " remote: " + channel.getSocket().getRemoteSocketAddress());
}
boolean rc;
if (getIODoneAmount() >= getIOAmount()) {
// read is complete on current thread
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (type == 0) {
Tr.debug(tc, "read complete, at least minimum amount of data read");
} else {
Tr.debug(tc, "write complete, at least minimum amount of data written");
}
}
rc = true;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (type == 0) {
Tr.debug(tc, "read not complete, more data needed");
} else {
Tr.debug(tc, "write not complete, more data needs to be written");
}
}
rc = false;
}
return rc;
} | java | public boolean updateIOCounts(long byteCount, int type) {
setLastIOAmt(byteCount);
setIODoneAmount(getIODoneAmount() + byteCount);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
String dbString = null;
if (type == 0) {
dbString = "Read ";
} else {
dbString = "Wrote ";
}
SocketIOChannel channel = getTCPConnLink().getSocketIOChannel();
Tr.event(tc, dbString + byteCount + "(" + +getIODoneAmount() + ")" + " bytes, " + getIOAmount() + " requested on local: " + channel.getSocket().getLocalSocketAddress()
+ " remote: " + channel.getSocket().getRemoteSocketAddress());
}
boolean rc;
if (getIODoneAmount() >= getIOAmount()) {
// read is complete on current thread
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (type == 0) {
Tr.debug(tc, "read complete, at least minimum amount of data read");
} else {
Tr.debug(tc, "write complete, at least minimum amount of data written");
}
}
rc = true;
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (type == 0) {
Tr.debug(tc, "read not complete, more data needed");
} else {
Tr.debug(tc, "write not complete, more data needs to be written");
}
}
rc = false;
}
return rc;
} | [
"public",
"boolean",
"updateIOCounts",
"(",
"long",
"byteCount",
",",
"int",
"type",
")",
"{",
"setLastIOAmt",
"(",
"byteCount",
")",
";",
"setIODoneAmount",
"(",
"getIODoneAmount",
"(",
")",
"+",
"byteCount",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"String",
"dbString",
"=",
"null",
";",
"if",
"(",
"type",
"==",
"0",
")",
"{",
"dbString",
"=",
"\"Read \"",
";",
"}",
"else",
"{",
"dbString",
"=",
"\"Wrote \"",
";",
"}",
"SocketIOChannel",
"channel",
"=",
"getTCPConnLink",
"(",
")",
".",
"getSocketIOChannel",
"(",
")",
";",
"Tr",
".",
"event",
"(",
"tc",
",",
"dbString",
"+",
"byteCount",
"+",
"\"(\"",
"+",
"+",
"getIODoneAmount",
"(",
")",
"+",
"\")\"",
"+",
"\" bytes, \"",
"+",
"getIOAmount",
"(",
")",
"+",
"\" requested on local: \"",
"+",
"channel",
".",
"getSocket",
"(",
")",
".",
"getLocalSocketAddress",
"(",
")",
"+",
"\" remote: \"",
"+",
"channel",
".",
"getSocket",
"(",
")",
".",
"getRemoteSocketAddress",
"(",
")",
")",
";",
"}",
"boolean",
"rc",
";",
"if",
"(",
"getIODoneAmount",
"(",
")",
">=",
"getIOAmount",
"(",
")",
")",
"{",
"// read is complete on current thread",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"type",
"==",
"0",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"read complete, at least minimum amount of data read\"",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"write complete, at least minimum amount of data written\"",
")",
";",
"}",
"}",
"rc",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"type",
"==",
"0",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"read not complete, more data needed\"",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"write not complete, more data needs to be written\"",
")",
";",
"}",
"}",
"rc",
"=",
"false",
";",
"}",
"return",
"rc",
";",
"}"
] | rather than in extension classes | [
"rather",
"than",
"in",
"extension",
"classes"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPBaseRequestContext.java#L524-L563 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java | ServerTransportAcceptListener.acceptConnection | public ConversationReceiveListener acceptConnection(Conversation cfConversation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "acceptConnection", cfConversation);
// Add this conversation to our active conversations list
synchronized (activeConversations) {
Object connectionReference = cfConversation.getConnectionReference();
ArrayList list = (ArrayList) activeConversations.get(connectionReference);
if (list == null) {
list = new ArrayList();
activeConversations.put(connectionReference, list);
} else {
// This is mank - but if TRM does a redirect it is possible that we may get a
// connection but then they close the Conversation directly without sending us any
// kind of close flow. As such, every time we connect we should have a check on all
// the conversations to ensure they are not closed, and if they are remove them from
// the list.
ArrayList removeList = new ArrayList();
for (int x = 0; x < list.size(); x++) {
Conversation conv = (Conversation) list.get(x);
if (conv.isClosed()) {
removeList.add(conv);
}
}
// Actually do the remove...
for (int x = 0; x < removeList.size(); x++) {
list.remove(removeList.get(x));
}
}
list.add(cfConversation);
// At this point we have a look to see if the connection closed listener has been set.
// If it has not been set then this is a new connection (or one with no active
// Conversations on it. We must set ourselves as the listener in the event that the
// socket terminates before any SI connections are established and so any cleanup
// required.
// Note that once a connection to the ME is established, this listener is overwritten
// with one in ServerSideConnection. This also performs the same cleanup but also does
// MFP cleanup as well (which is not appropriate if the connection goes down at this
// stage).
if (cfConversation.getConnectionClosedListener(ConversationUsageType.JFAP) == null) {
cfConversation.addConnectionClosedListener(this, ConversationUsageType.JFAP);
}
}
if (cfConversation.getAttachment() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Creating conversation state");
cfConversation.setAttachment(new ConversationState());
}
if (cfConversation.getLinkLevelAttachment() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Creating link level state");
cfConversation.setLinkLevelAttachment(new ServerLinkLevelState());
}
// Set a hint that this conversation is being used for ME to client communications.
cfConversation.setConversationType(Conversation.CLIENT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "acceptConnection", serverTransportReceiveListener);
return serverTransportReceiveListener;
} | java | public ConversationReceiveListener acceptConnection(Conversation cfConversation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "acceptConnection", cfConversation);
// Add this conversation to our active conversations list
synchronized (activeConversations) {
Object connectionReference = cfConversation.getConnectionReference();
ArrayList list = (ArrayList) activeConversations.get(connectionReference);
if (list == null) {
list = new ArrayList();
activeConversations.put(connectionReference, list);
} else {
// This is mank - but if TRM does a redirect it is possible that we may get a
// connection but then they close the Conversation directly without sending us any
// kind of close flow. As such, every time we connect we should have a check on all
// the conversations to ensure they are not closed, and if they are remove them from
// the list.
ArrayList removeList = new ArrayList();
for (int x = 0; x < list.size(); x++) {
Conversation conv = (Conversation) list.get(x);
if (conv.isClosed()) {
removeList.add(conv);
}
}
// Actually do the remove...
for (int x = 0; x < removeList.size(); x++) {
list.remove(removeList.get(x));
}
}
list.add(cfConversation);
// At this point we have a look to see if the connection closed listener has been set.
// If it has not been set then this is a new connection (or one with no active
// Conversations on it. We must set ourselves as the listener in the event that the
// socket terminates before any SI connections are established and so any cleanup
// required.
// Note that once a connection to the ME is established, this listener is overwritten
// with one in ServerSideConnection. This also performs the same cleanup but also does
// MFP cleanup as well (which is not appropriate if the connection goes down at this
// stage).
if (cfConversation.getConnectionClosedListener(ConversationUsageType.JFAP) == null) {
cfConversation.addConnectionClosedListener(this, ConversationUsageType.JFAP);
}
}
if (cfConversation.getAttachment() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Creating conversation state");
cfConversation.setAttachment(new ConversationState());
}
if (cfConversation.getLinkLevelAttachment() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Creating link level state");
cfConversation.setLinkLevelAttachment(new ServerLinkLevelState());
}
// Set a hint that this conversation is being used for ME to client communications.
cfConversation.setConversationType(Conversation.CLIENT);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "acceptConnection", serverTransportReceiveListener);
return serverTransportReceiveListener;
} | [
"public",
"ConversationReceiveListener",
"acceptConnection",
"(",
"Conversation",
"cfConversation",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"acceptConnection\"",
",",
"cfConversation",
")",
";",
"// Add this conversation to our active conversations list",
"synchronized",
"(",
"activeConversations",
")",
"{",
"Object",
"connectionReference",
"=",
"cfConversation",
".",
"getConnectionReference",
"(",
")",
";",
"ArrayList",
"list",
"=",
"(",
"ArrayList",
")",
"activeConversations",
".",
"get",
"(",
"connectionReference",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"ArrayList",
"(",
")",
";",
"activeConversations",
".",
"put",
"(",
"connectionReference",
",",
"list",
")",
";",
"}",
"else",
"{",
"// This is mank - but if TRM does a redirect it is possible that we may get a",
"// connection but then they close the Conversation directly without sending us any",
"// kind of close flow. As such, every time we connect we should have a check on all",
"// the conversations to ensure they are not closed, and if they are remove them from",
"// the list.",
"ArrayList",
"removeList",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"list",
".",
"size",
"(",
")",
";",
"x",
"++",
")",
"{",
"Conversation",
"conv",
"=",
"(",
"Conversation",
")",
"list",
".",
"get",
"(",
"x",
")",
";",
"if",
"(",
"conv",
".",
"isClosed",
"(",
")",
")",
"{",
"removeList",
".",
"add",
"(",
"conv",
")",
";",
"}",
"}",
"// Actually do the remove...",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"removeList",
".",
"size",
"(",
")",
";",
"x",
"++",
")",
"{",
"list",
".",
"remove",
"(",
"removeList",
".",
"get",
"(",
"x",
")",
")",
";",
"}",
"}",
"list",
".",
"add",
"(",
"cfConversation",
")",
";",
"// At this point we have a look to see if the connection closed listener has been set.",
"// If it has not been set then this is a new connection (or one with no active",
"// Conversations on it. We must set ourselves as the listener in the event that the",
"// socket terminates before any SI connections are established and so any cleanup",
"// required.",
"// Note that once a connection to the ME is established, this listener is overwritten",
"// with one in ServerSideConnection. This also performs the same cleanup but also does",
"// MFP cleanup as well (which is not appropriate if the connection goes down at this",
"// stage).",
"if",
"(",
"cfConversation",
".",
"getConnectionClosedListener",
"(",
"ConversationUsageType",
".",
"JFAP",
")",
"==",
"null",
")",
"{",
"cfConversation",
".",
"addConnectionClosedListener",
"(",
"this",
",",
"ConversationUsageType",
".",
"JFAP",
")",
";",
"}",
"}",
"if",
"(",
"cfConversation",
".",
"getAttachment",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Creating conversation state\"",
")",
";",
"cfConversation",
".",
"setAttachment",
"(",
"new",
"ConversationState",
"(",
")",
")",
";",
"}",
"if",
"(",
"cfConversation",
".",
"getLinkLevelAttachment",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Creating link level state\"",
")",
";",
"cfConversation",
".",
"setLinkLevelAttachment",
"(",
"new",
"ServerLinkLevelState",
"(",
")",
")",
";",
"}",
"// Set a hint that this conversation is being used for ME to client communications.",
"cfConversation",
".",
"setConversationType",
"(",
"Conversation",
".",
"CLIENT",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"acceptConnection\"",
",",
"serverTransportReceiveListener",
")",
";",
"return",
"serverTransportReceiveListener",
";",
"}"
] | Called when we are about to accept a connection from a peer.
@param cfConversation | [
"Called",
"when",
"we",
"are",
"about",
"to",
"accept",
"a",
"connection",
"from",
"a",
"peer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java#L93-L157 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java | ServerTransportAcceptListener.removeConversation | public void removeConversation(Conversation conv) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeConversation", conv);
synchronized (activeConversations) {
Object connectionReference = conv.getConnectionReference();
ArrayList list = (ArrayList) activeConversations.get(connectionReference);
if (list != null) {
list.remove(conv);
if (list.size() == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "List is now empty, removing connection object");
activeConversations.remove(connectionReference);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeConversation");
} | java | public void removeConversation(Conversation conv) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeConversation", conv);
synchronized (activeConversations) {
Object connectionReference = conv.getConnectionReference();
ArrayList list = (ArrayList) activeConversations.get(connectionReference);
if (list != null) {
list.remove(conv);
if (list.size() == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "List is now empty, removing connection object");
activeConversations.remove(connectionReference);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeConversation");
} | [
"public",
"void",
"removeConversation",
"(",
"Conversation",
"conv",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"removeConversation\"",
",",
"conv",
")",
";",
"synchronized",
"(",
"activeConversations",
")",
"{",
"Object",
"connectionReference",
"=",
"conv",
".",
"getConnectionReference",
"(",
")",
";",
"ArrayList",
"list",
"=",
"(",
"ArrayList",
")",
"activeConversations",
".",
"get",
"(",
"connectionReference",
")",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"list",
".",
"remove",
"(",
"conv",
")",
";",
"if",
"(",
"list",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"List is now empty, removing connection object\"",
")",
";",
"activeConversations",
".",
"remove",
"(",
"connectionReference",
")",
";",
"}",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"removeConversation\"",
")",
";",
"}"
] | This method removes a conversation from the list of active conversations. This would be called
if the connection is closed or if a failure is deteceted.
@param conv | [
"This",
"method",
"removes",
"a",
"conversation",
"from",
"the",
"list",
"of",
"active",
"conversations",
".",
"This",
"would",
"be",
"called",
"if",
"the",
"connection",
"is",
"closed",
"or",
"if",
"a",
"failure",
"is",
"deteceted",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java#L165-L185 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java | ServerTransportAcceptListener.connectionClosed | public void connectionClosed(Object connectionReference) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "connectionClosed", connectionReference);
removeAllConversations(connectionReference);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "connectionClosed");
} | java | public void connectionClosed(Object connectionReference) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "connectionClosed", connectionReference);
removeAllConversations(connectionReference);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "connectionClosed");
} | [
"public",
"void",
"connectionClosed",
"(",
"Object",
"connectionReference",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"connectionClosed\"",
",",
"connectionReference",
")",
";",
"removeAllConversations",
"(",
"connectionReference",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"connectionClosed\"",
")",
";",
"}"
] | Driven in the event that the underlying connection closes. This will only be driven if the
socket dies before a connection to the ME has had chance to be established.
@see com.ibm.ws.sib.jfapchannel.ConnectionClosedListener#connectionClosed(java.lang.Object) | [
"Driven",
"in",
"the",
"event",
"that",
"the",
"underlying",
"connection",
"closes",
".",
"This",
"will",
"only",
"be",
"driven",
"if",
"the",
"socket",
"dies",
"before",
"a",
"connection",
"to",
"the",
"ME",
"has",
"had",
"chance",
"to",
"be",
"established",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java#L193-L201 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java | ServerTransportAcceptListener.removeAllConversations | public void removeAllConversations(Object connectionReference) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeAllConversations", connectionReference);
final ArrayList list;
synchronized (activeConversations) {
list = (ArrayList) activeConversations.remove(connectionReference);
}
// Remove the connection reference from the list
if (list != null) {
try {
for (int x = 0; x < list.size(); x++) {
Conversation conv = (Conversation) list.get(x);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Found a Conversation in the table: ", conv);
// Now call the server transport receive listener to clean up the resources
serverTransportReceiveListener.cleanupConnection(conv);
}
} catch (Throwable t) {
FFDCFilter.processException(t, CLASS_NAME + ".removeAllConversations",
CommsConstants.SERVERTRANSPORTACCEPTLISTENER_REMOVEALL_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Caught an exception cleaning up a connection", t);
}
// Now clear the list
list.clear();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeAllConversations");
} | java | public void removeAllConversations(Object connectionReference) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeAllConversations", connectionReference);
final ArrayList list;
synchronized (activeConversations) {
list = (ArrayList) activeConversations.remove(connectionReference);
}
// Remove the connection reference from the list
if (list != null) {
try {
for (int x = 0; x < list.size(); x++) {
Conversation conv = (Conversation) list.get(x);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Found a Conversation in the table: ", conv);
// Now call the server transport receive listener to clean up the resources
serverTransportReceiveListener.cleanupConnection(conv);
}
} catch (Throwable t) {
FFDCFilter.processException(t, CLASS_NAME + ".removeAllConversations",
CommsConstants.SERVERTRANSPORTACCEPTLISTENER_REMOVEALL_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Caught an exception cleaning up a connection", t);
}
// Now clear the list
list.clear();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeAllConversations");
} | [
"public",
"void",
"removeAllConversations",
"(",
"Object",
"connectionReference",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"removeAllConversations\"",
",",
"connectionReference",
")",
";",
"final",
"ArrayList",
"list",
";",
"synchronized",
"(",
"activeConversations",
")",
"{",
"list",
"=",
"(",
"ArrayList",
")",
"activeConversations",
".",
"remove",
"(",
"connectionReference",
")",
";",
"}",
"// Remove the connection reference from the list",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"try",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"list",
".",
"size",
"(",
")",
";",
"x",
"++",
")",
"{",
"Conversation",
"conv",
"=",
"(",
"Conversation",
")",
"list",
".",
"get",
"(",
"x",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Found a Conversation in the table: \"",
",",
"conv",
")",
";",
"// Now call the server transport receive listener to clean up the resources",
"serverTransportReceiveListener",
".",
"cleanupConnection",
"(",
"conv",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"t",
",",
"CLASS_NAME",
"+",
"\".removeAllConversations\"",
",",
"CommsConstants",
".",
"SERVERTRANSPORTACCEPTLISTENER_REMOVEALL_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Caught an exception cleaning up a connection\"",
",",
"t",
")",
";",
"}",
"// Now clear the list",
"list",
".",
"clear",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"removeAllConversations\"",
")",
";",
"}"
] | This method is used to clean up any resources that
@param connectionReference | [
"This",
"method",
"is",
"used",
"to",
"clean",
"up",
"any",
"resources",
"that"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportAcceptListener.java#L225-L259 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java | InjectionProcessor.getObjectFactoryInfo | protected final ObjectFactoryInfo getObjectFactoryInfo(Class<?> klass, String className) // F743-32443
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getObjectFactory: " + klass + ", " + className);
if (ivObjectFactoryMap == null)
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getObjectFactory: no factories");
return null;
}
if (klass != null && klass != Object.class) // d700708
{
ObjectFactoryInfo result = ivObjectFactoryMap.get(klass);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getObjectFactory: " + result);
return result;
}
if (ivObjectFactoryByNameMap == null)
{
ivObjectFactoryByNameMap = new HashMap<String, ObjectFactoryInfo>();
for (Map.Entry<Class<?>, ObjectFactoryInfo> entry : ivObjectFactoryMap.entrySet())
{
ivObjectFactoryByNameMap.put(entry.getKey().getName(), entry.getValue());
}
}
ObjectFactoryInfo result = ivObjectFactoryByNameMap.get(className);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getObjectFactory (by-name): " + result);
return result;
} | java | protected final ObjectFactoryInfo getObjectFactoryInfo(Class<?> klass, String className) // F743-32443
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getObjectFactory: " + klass + ", " + className);
if (ivObjectFactoryMap == null)
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getObjectFactory: no factories");
return null;
}
if (klass != null && klass != Object.class) // d700708
{
ObjectFactoryInfo result = ivObjectFactoryMap.get(klass);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getObjectFactory: " + result);
return result;
}
if (ivObjectFactoryByNameMap == null)
{
ivObjectFactoryByNameMap = new HashMap<String, ObjectFactoryInfo>();
for (Map.Entry<Class<?>, ObjectFactoryInfo> entry : ivObjectFactoryMap.entrySet())
{
ivObjectFactoryByNameMap.put(entry.getKey().getName(), entry.getValue());
}
}
ObjectFactoryInfo result = ivObjectFactoryByNameMap.get(className);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getObjectFactory (by-name): " + result);
return result;
} | [
"protected",
"final",
"ObjectFactoryInfo",
"getObjectFactoryInfo",
"(",
"Class",
"<",
"?",
">",
"klass",
",",
"String",
"className",
")",
"// F743-32443",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getObjectFactory: \"",
"+",
"klass",
"+",
"\", \"",
"+",
"className",
")",
";",
"if",
"(",
"ivObjectFactoryMap",
"==",
"null",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getObjectFactory: no factories\"",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"klass",
"!=",
"null",
"&&",
"klass",
"!=",
"Object",
".",
"class",
")",
"// d700708",
"{",
"ObjectFactoryInfo",
"result",
"=",
"ivObjectFactoryMap",
".",
"get",
"(",
"klass",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getObjectFactory: \"",
"+",
"result",
")",
";",
"return",
"result",
";",
"}",
"if",
"(",
"ivObjectFactoryByNameMap",
"==",
"null",
")",
"{",
"ivObjectFactoryByNameMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"ObjectFactoryInfo",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Class",
"<",
"?",
">",
",",
"ObjectFactoryInfo",
">",
"entry",
":",
"ivObjectFactoryMap",
".",
"entrySet",
"(",
")",
")",
"{",
"ivObjectFactoryByNameMap",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
".",
"getName",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"ObjectFactoryInfo",
"result",
"=",
"ivObjectFactoryByNameMap",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getObjectFactory (by-name): \"",
"+",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Gets an object factory for the specified class or class name. This
method must be used to support configurations without a class loader.
@param klass the class or <tt>null</tt> if unavailable
@param className the class name or <tt>null</tt> if klass was specified
@return the ObjectFactory | [
"Gets",
"an",
"object",
"factory",
"for",
"the",
"specified",
"class",
"or",
"class",
"name",
".",
"This",
"method",
"must",
"be",
"used",
"to",
"support",
"configurations",
"without",
"a",
"class",
"loader",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java#L268-L304 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java | InjectionProcessor.updateInjectionBinding | private void updateInjectionBinding(String jndiName, InjectionBinding<A> injectionBinding) // d675172
{
// If the annotation didn't have a name or the binding implementation
// constructor did not set it, then the binding needs to be updated
// with the default name or name (if not set by constructor). // d682415
if (!jndiName.equals(injectionBinding.getJndiName())) // d675172.1
{
injectionBinding.setJndiName(jndiName);
}
} | java | private void updateInjectionBinding(String jndiName, InjectionBinding<A> injectionBinding) // d675172
{
// If the annotation didn't have a name or the binding implementation
// constructor did not set it, then the binding needs to be updated
// with the default name or name (if not set by constructor). // d682415
if (!jndiName.equals(injectionBinding.getJndiName())) // d675172.1
{
injectionBinding.setJndiName(jndiName);
}
} | [
"private",
"void",
"updateInjectionBinding",
"(",
"String",
"jndiName",
",",
"InjectionBinding",
"<",
"A",
">",
"injectionBinding",
")",
"// d675172",
"{",
"// If the annotation didn't have a name or the binding implementation",
"// constructor did not set it, then the binding needs to be updated",
"// with the default name or name (if not set by constructor). // d682415",
"if",
"(",
"!",
"jndiName",
".",
"equals",
"(",
"injectionBinding",
".",
"getJndiName",
"(",
")",
")",
")",
"// d675172.1",
"{",
"injectionBinding",
".",
"setJndiName",
"(",
"jndiName",
")",
";",
"}",
"}"
] | Updates an InjectionBinding created for an annotation. | [
"Updates",
"an",
"InjectionBinding",
"created",
"for",
"an",
"annotation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java#L356-L365 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java | InjectionProcessor.addOrMergeOverrideInjectionBinding | private <P extends Annotation> InjectionBinding<?> addOrMergeOverrideInjectionBinding(Class<?> instanceClass,
Member member,
A annotation,
String jndiName) // d675843.2
throws InjectionException
{
@SuppressWarnings("unchecked")
InjectionProcessor<P, ?> processor = (InjectionProcessor<P, ?>) ivOverrideProcessor;
if (processor != null)
{
// This logic is the same as addOrMergeInjectionBinding, except it
// uses OverrideInjectionProcessor methods to create and merge
// injection bindings rather than InjectionProcessor and
// InjectionBinding methods.
InjectionBinding<P> injectionBinding = processor.getInjectionBindingForAnnotation(jndiName);
@SuppressWarnings("unchecked")
OverrideInjectionProcessor<P, A> overrideProcessor = (OverrideInjectionProcessor<P, A>) processor;
if (injectionBinding == null)
{
injectionBinding = overrideProcessor.createOverrideInjectionBinding(instanceClass, member, annotation, jndiName);
if (injectionBinding != null)
{
processor.updateInjectionBinding(jndiName, injectionBinding);
processor.addInjectionBinding(injectionBinding);
return injectionBinding;
}
}
else
{
overrideProcessor.mergeOverrideInjectionBinding(instanceClass, member, annotation, injectionBinding);
return injectionBinding;
}
}
return null;
} | java | private <P extends Annotation> InjectionBinding<?> addOrMergeOverrideInjectionBinding(Class<?> instanceClass,
Member member,
A annotation,
String jndiName) // d675843.2
throws InjectionException
{
@SuppressWarnings("unchecked")
InjectionProcessor<P, ?> processor = (InjectionProcessor<P, ?>) ivOverrideProcessor;
if (processor != null)
{
// This logic is the same as addOrMergeInjectionBinding, except it
// uses OverrideInjectionProcessor methods to create and merge
// injection bindings rather than InjectionProcessor and
// InjectionBinding methods.
InjectionBinding<P> injectionBinding = processor.getInjectionBindingForAnnotation(jndiName);
@SuppressWarnings("unchecked")
OverrideInjectionProcessor<P, A> overrideProcessor = (OverrideInjectionProcessor<P, A>) processor;
if (injectionBinding == null)
{
injectionBinding = overrideProcessor.createOverrideInjectionBinding(instanceClass, member, annotation, jndiName);
if (injectionBinding != null)
{
processor.updateInjectionBinding(jndiName, injectionBinding);
processor.addInjectionBinding(injectionBinding);
return injectionBinding;
}
}
else
{
overrideProcessor.mergeOverrideInjectionBinding(instanceClass, member, annotation, injectionBinding);
return injectionBinding;
}
}
return null;
} | [
"private",
"<",
"P",
"extends",
"Annotation",
">",
"InjectionBinding",
"<",
"?",
">",
"addOrMergeOverrideInjectionBinding",
"(",
"Class",
"<",
"?",
">",
"instanceClass",
",",
"Member",
"member",
",",
"A",
"annotation",
",",
"String",
"jndiName",
")",
"// d675843.2",
"throws",
"InjectionException",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"InjectionProcessor",
"<",
"P",
",",
"?",
">",
"processor",
"=",
"(",
"InjectionProcessor",
"<",
"P",
",",
"?",
">",
")",
"ivOverrideProcessor",
";",
"if",
"(",
"processor",
"!=",
"null",
")",
"{",
"// This logic is the same as addOrMergeInjectionBinding, except it",
"// uses OverrideInjectionProcessor methods to create and merge",
"// injection bindings rather than InjectionProcessor and",
"// InjectionBinding methods.",
"InjectionBinding",
"<",
"P",
">",
"injectionBinding",
"=",
"processor",
".",
"getInjectionBindingForAnnotation",
"(",
"jndiName",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"OverrideInjectionProcessor",
"<",
"P",
",",
"A",
">",
"overrideProcessor",
"=",
"(",
"OverrideInjectionProcessor",
"<",
"P",
",",
"A",
">",
")",
"processor",
";",
"if",
"(",
"injectionBinding",
"==",
"null",
")",
"{",
"injectionBinding",
"=",
"overrideProcessor",
".",
"createOverrideInjectionBinding",
"(",
"instanceClass",
",",
"member",
",",
"annotation",
",",
"jndiName",
")",
";",
"if",
"(",
"injectionBinding",
"!=",
"null",
")",
"{",
"processor",
".",
"updateInjectionBinding",
"(",
"jndiName",
",",
"injectionBinding",
")",
";",
"processor",
".",
"addInjectionBinding",
"(",
"injectionBinding",
")",
";",
"return",
"injectionBinding",
";",
"}",
"}",
"else",
"{",
"overrideProcessor",
".",
"mergeOverrideInjectionBinding",
"(",
"instanceClass",
",",
"member",
",",
"annotation",
",",
"injectionBinding",
")",
";",
"return",
"injectionBinding",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Creates and adds a new override injection binding, or merges the data in
an annotation with an existing override injection binding.
@param <P> the primary annotation class; from the perspective of this
method, the A type variable is the overridden annotation type
@param instanceClass the class that contained the annotation
@param member the member in class that contained the annotation, or
<tt>null</tt> if the annotation was found at the class level
@param annotation the override annotation data
@return true if the override injection binding was created or merged, or
false if the annotation was not overridden
@throws InjectionException | [
"Creates",
"and",
"adds",
"a",
"new",
"override",
"injection",
"binding",
"or",
"merges",
"the",
"data",
"in",
"an",
"annotation",
"with",
"an",
"existing",
"override",
"injection",
"binding",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java#L413-L452 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java | InjectionProcessor.performJavaNameSpaceBinding | void performJavaNameSpaceBinding() throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "performJavaNameSpaceBinding: " + this);
for (InjectionBinding<A> injectionBinding : ivAllAnnotationsCollection.values())
{
// F743-31682 - Only bind to java:global/:app/:module if needed.
if (injectionBinding.getInjectionScope() == InjectionScope.COMP ||
ivContext.ivBindNonCompInjectionBindings)
{
if (injectionBinding.getBindingObject() == null)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "skipping empty " + injectionBinding);
}
else
{
injectionBinding.bindInjectedObject();
}
}
else
{
if (isTraceOn && tc.isEntryEnabled())
Tr.debug(tc, "skipping non-java:comp " + injectionBinding.toSimpleString());
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "performJavaNameSpaceBinding");
} | java | void performJavaNameSpaceBinding() throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "performJavaNameSpaceBinding: " + this);
for (InjectionBinding<A> injectionBinding : ivAllAnnotationsCollection.values())
{
// F743-31682 - Only bind to java:global/:app/:module if needed.
if (injectionBinding.getInjectionScope() == InjectionScope.COMP ||
ivContext.ivBindNonCompInjectionBindings)
{
if (injectionBinding.getBindingObject() == null)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "skipping empty " + injectionBinding);
}
else
{
injectionBinding.bindInjectedObject();
}
}
else
{
if (isTraceOn && tc.isEntryEnabled())
Tr.debug(tc, "skipping non-java:comp " + injectionBinding.toSimpleString());
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "performJavaNameSpaceBinding");
} | [
"void",
"performJavaNameSpaceBinding",
"(",
")",
"throws",
"InjectionException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"performJavaNameSpaceBinding: \"",
"+",
"this",
")",
";",
"for",
"(",
"InjectionBinding",
"<",
"A",
">",
"injectionBinding",
":",
"ivAllAnnotationsCollection",
".",
"values",
"(",
")",
")",
"{",
"// F743-31682 - Only bind to java:global/:app/:module if needed.",
"if",
"(",
"injectionBinding",
".",
"getInjectionScope",
"(",
")",
"==",
"InjectionScope",
".",
"COMP",
"||",
"ivContext",
".",
"ivBindNonCompInjectionBindings",
")",
"{",
"if",
"(",
"injectionBinding",
".",
"getBindingObject",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"skipping empty \"",
"+",
"injectionBinding",
")",
";",
"}",
"else",
"{",
"injectionBinding",
".",
"bindInjectedObject",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"skipping non-java:comp \"",
"+",
"injectionBinding",
".",
"toSimpleString",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"performJavaNameSpaceBinding\"",
")",
";",
"}"
] | Bind all the jndi annotation entries found. | [
"Bind",
"all",
"the",
"jndi",
"annotation",
"entries",
"found",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java#L708-L739 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java | InjectionProcessor.addInjectionBinding | public final void addInjectionBinding(InjectionBinding<A> injectionBinding)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "addInjectionBinding: " + injectionBinding);
// jndi name not found in collection, simple add
ivAllAnnotationsCollection.put(injectionBinding.getJndiName(), injectionBinding);
} | java | public final void addInjectionBinding(InjectionBinding<A> injectionBinding)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "addInjectionBinding: " + injectionBinding);
// jndi name not found in collection, simple add
ivAllAnnotationsCollection.put(injectionBinding.getJndiName(), injectionBinding);
} | [
"public",
"final",
"void",
"addInjectionBinding",
"(",
"InjectionBinding",
"<",
"A",
">",
"injectionBinding",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"addInjectionBinding: \"",
"+",
"injectionBinding",
")",
";",
"// jndi name not found in collection, simple add",
"ivAllAnnotationsCollection",
".",
"put",
"(",
"injectionBinding",
".",
"getJndiName",
"(",
")",
",",
"injectionBinding",
")",
";",
"}"
] | Add the InjectionBinding to the annotationCollection. The collection will be used
later when binding and resolving injection targets.
@param injectionBinding | [
"Add",
"the",
"InjectionBinding",
"to",
"the",
"annotationCollection",
".",
"The",
"collection",
"will",
"be",
"used",
"later",
"when",
"binding",
"and",
"resolving",
"injection",
"targets",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java#L747-L755 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java | InjectionProcessor.getJavaBeansPropertyName | protected final String getJavaBeansPropertyName(Member fieldOrMethod)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getJavaBeansPropertyName : " + fieldOrMethod);
String propertyName;
if (fieldOrMethod instanceof Field)
{
Field field = (Field) fieldOrMethod;
propertyName = field.getName();
}
else
{
Method method = (Method) fieldOrMethod;
String name = method.getName();
if (name.startsWith("set") &&
name.length() > 3 &&
Character.isUpperCase(name.charAt(3)))
{
propertyName = Character.toLowerCase(name.charAt(3)) +
(name.length() > 4 ? name.substring(4) : "");
}
else
{
propertyName = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getJavaBeansPropertyName : " + propertyName);
return propertyName;
} | java | protected final String getJavaBeansPropertyName(Member fieldOrMethod)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getJavaBeansPropertyName : " + fieldOrMethod);
String propertyName;
if (fieldOrMethod instanceof Field)
{
Field field = (Field) fieldOrMethod;
propertyName = field.getName();
}
else
{
Method method = (Method) fieldOrMethod;
String name = method.getName();
if (name.startsWith("set") &&
name.length() > 3 &&
Character.isUpperCase(name.charAt(3)))
{
propertyName = Character.toLowerCase(name.charAt(3)) +
(name.length() > 4 ? name.substring(4) : "");
}
else
{
propertyName = null;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getJavaBeansPropertyName : " + propertyName);
return propertyName;
} | [
"protected",
"final",
"String",
"getJavaBeansPropertyName",
"(",
"Member",
"fieldOrMethod",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getJavaBeansPropertyName : \"",
"+",
"fieldOrMethod",
")",
";",
"String",
"propertyName",
";",
"if",
"(",
"fieldOrMethod",
"instanceof",
"Field",
")",
"{",
"Field",
"field",
"=",
"(",
"Field",
")",
"fieldOrMethod",
";",
"propertyName",
"=",
"field",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",
"Method",
"method",
"=",
"(",
"Method",
")",
"fieldOrMethod",
";",
"String",
"name",
"=",
"method",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"set\"",
")",
"&&",
"name",
".",
"length",
"(",
")",
">",
"3",
"&&",
"Character",
".",
"isUpperCase",
"(",
"name",
".",
"charAt",
"(",
"3",
")",
")",
")",
"{",
"propertyName",
"=",
"Character",
".",
"toLowerCase",
"(",
"name",
".",
"charAt",
"(",
"3",
")",
")",
"+",
"(",
"name",
".",
"length",
"(",
")",
">",
"4",
"?",
"name",
".",
"substring",
"(",
"4",
")",
":",
"\"\"",
")",
";",
"}",
"else",
"{",
"propertyName",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getJavaBeansPropertyName : \"",
"+",
"propertyName",
")",
";",
"return",
"propertyName",
";",
"}"
] | F50309.5 | [
"F50309",
".",
"5"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java#L767-L800 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/EmbeddedServerImpl.java | EmbeddedServerImpl.getServerFeatures | public Set<String> getServerFeatures() {
ServerTask serverTask = runningServer.get();
try {
if (serverTask != null)
return serverTask.getServerFeatures();
} catch (InterruptedException e) {
// nothing to do here, we couldn't get the results from the server
}
return Collections.emptySet();
} | java | public Set<String> getServerFeatures() {
ServerTask serverTask = runningServer.get();
try {
if (serverTask != null)
return serverTask.getServerFeatures();
} catch (InterruptedException e) {
// nothing to do here, we couldn't get the results from the server
}
return Collections.emptySet();
} | [
"public",
"Set",
"<",
"String",
">",
"getServerFeatures",
"(",
")",
"{",
"ServerTask",
"serverTask",
"=",
"runningServer",
".",
"get",
"(",
")",
";",
"try",
"{",
"if",
"(",
"serverTask",
"!=",
"null",
")",
"return",
"serverTask",
".",
"getServerFeatures",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// nothing to do here, we couldn't get the results from the server",
"}",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}"
] | The feature gather operation needs to launch the server far enough for it to read
config and figure out all of the features that would be loaded. It doesn't actually
start any of those features, but it needs to get far enough to evaluate the full
feature set, including features and auto-features that are part of Liberty or are
provided by product extensions.
@return Set of strings describing the required features for the server. Will not return null. | [
"The",
"feature",
"gather",
"operation",
"needs",
"to",
"launch",
"the",
"server",
"far",
"enough",
"for",
"it",
"to",
"read",
"config",
"and",
"figure",
"out",
"all",
"of",
"the",
"features",
"that",
"would",
"be",
"loaded",
".",
"It",
"doesn",
"t",
"actually",
"start",
"any",
"of",
"those",
"features",
"but",
"it",
"needs",
"to",
"get",
"far",
"enough",
"to",
"evaluate",
"the",
"full",
"feature",
"set",
"including",
"features",
"and",
"auto",
"-",
"features",
"that",
"are",
"part",
"of",
"Liberty",
"or",
"are",
"provided",
"by",
"product",
"extensions",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/EmbeddedServerImpl.java#L273-L283 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java | Node.findNode | protected Node findNode(int nodeStreamID) {
// mainline debug in this recursive method is way to verbose, so only debug when we find what we are looking for
if (nodeStreamID == this.streamID) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNode exit: bottom of recursion, found node: " + this);
}
return this;
} else {
Iterator<Node> iter = dependents.iterator();
Node found = null;
while (iter.hasNext()) {
found = iter.next().findNode(nodeStreamID);
if (found != null) {
return found;
}
}
return null;
}
} | java | protected Node findNode(int nodeStreamID) {
// mainline debug in this recursive method is way to verbose, so only debug when we find what we are looking for
if (nodeStreamID == this.streamID) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNode exit: bottom of recursion, found node: " + this);
}
return this;
} else {
Iterator<Node> iter = dependents.iterator();
Node found = null;
while (iter.hasNext()) {
found = iter.next().findNode(nodeStreamID);
if (found != null) {
return found;
}
}
return null;
}
} | [
"protected",
"Node",
"findNode",
"(",
"int",
"nodeStreamID",
")",
"{",
"// mainline debug in this recursive method is way to verbose, so only debug when we find what we are looking for",
"if",
"(",
"nodeStreamID",
"==",
"this",
".",
"streamID",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"findNode exit: bottom of recursion, found node: \"",
"+",
"this",
")",
";",
"}",
"return",
"this",
";",
"}",
"else",
"{",
"Iterator",
"<",
"Node",
">",
"iter",
"=",
"dependents",
".",
"iterator",
"(",
")",
";",
"Node",
"found",
"=",
"null",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"found",
"=",
"iter",
".",
"next",
"(",
")",
".",
"findNode",
"(",
"nodeStreamID",
")",
";",
"if",
"(",
"found",
"!=",
"null",
")",
"{",
"return",
"found",
";",
"}",
"}",
"return",
"null",
";",
"}",
"}"
] | Starting with this node, find the node matching the input stream ID, look at this node and all dependents recursively.
To search the whole tree start by calling findNode on the root node.
@param nodeStreamID
@return | [
"Starting",
"with",
"this",
"node",
"find",
"the",
"node",
"matching",
"the",
"input",
"stream",
"ID",
"look",
"at",
"this",
"node",
"and",
"all",
"dependents",
"recursively",
".",
"To",
"search",
"the",
"whole",
"tree",
"start",
"by",
"calling",
"findNode",
"on",
"the",
"root",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java#L77-L98 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java | Node.addDependent | protected void addDependent(Node nodeToAdd) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "addDependent entry: node to add: " + nodeToAdd);
}
dependents.add(nodeToAdd);
} | java | protected void addDependent(Node nodeToAdd) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "addDependent entry: node to add: " + nodeToAdd);
}
dependents.add(nodeToAdd);
} | [
"protected",
"void",
"addDependent",
"(",
"Node",
"nodeToAdd",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"addDependent entry: node to add: \"",
"+",
"nodeToAdd",
")",
";",
"}",
"dependents",
".",
"add",
"(",
"nodeToAdd",
")",
";",
"}"
] | Add a new dependent to this node.
@param toAdd | [
"Add",
"a",
"new",
"dependent",
"to",
"this",
"node",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java#L105-L110 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java | Node.removeDependent | protected void removeDependent(Node nodeToRemove) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeDependent entry: node to remove: " + nodeToRemove);
}
dependents.remove(nodeToRemove);
} | java | protected void removeDependent(Node nodeToRemove) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeDependent entry: node to remove: " + nodeToRemove);
}
dependents.remove(nodeToRemove);
} | [
"protected",
"void",
"removeDependent",
"(",
"Node",
"nodeToRemove",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"removeDependent entry: node to remove: \"",
"+",
"nodeToRemove",
")",
";",
"}",
"dependents",
".",
"remove",
"(",
"nodeToRemove",
")",
";",
"}"
] | Remove a dependent from the dependent list this node is keeping
@param toRemove | [
"Remove",
"a",
"dependent",
"from",
"the",
"dependent",
"list",
"this",
"node",
"is",
"keeping"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java#L117-L122 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java | Node.clearDependentsWriteCount | protected void clearDependentsWriteCount() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "clearDependentsWriteCount entry: for this node: " + this);
}
dependentWriteCount = 0;
if ((dependents == null) || (dependents.size() == 0)) {
return;
}
for (int i = 0; i < dependents.size(); i++) {
dependents.get(i).setWriteCount(0);
}
} | java | protected void clearDependentsWriteCount() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "clearDependentsWriteCount entry: for this node: " + this);
}
dependentWriteCount = 0;
if ((dependents == null) || (dependents.size() == 0)) {
return;
}
for (int i = 0; i < dependents.size(); i++) {
dependents.get(i).setWriteCount(0);
}
} | [
"protected",
"void",
"clearDependentsWriteCount",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"clearDependentsWriteCount entry: for this node: \"",
"+",
"this",
")",
";",
"}",
"dependentWriteCount",
"=",
"0",
";",
"if",
"(",
"(",
"dependents",
"==",
"null",
")",
"||",
"(",
"dependents",
".",
"size",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dependents",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"dependents",
".",
"get",
"(",
"i",
")",
".",
"setWriteCount",
"(",
"0",
")",
";",
"}",
"}"
] | clear counts for all direct dependents of this node.
also clear the dependent write counter | [
"clear",
"counts",
"for",
"all",
"direct",
"dependents",
"of",
"this",
"node",
".",
"also",
"clear",
"the",
"dependent",
"write",
"counter"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java#L132-L148 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java | Node.findNextWrite | protected Node findNextWrite() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite entry: on node " + this + "With status: " + status + "and positive ratio of: " + getPriorityRatioPositive());
}
if (status == NODE_STATUS.REQUESTING_WRITE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite exit: node to write next is: " + this.toStringDetails());
}
return this;
} else {
// go through all dependents in order
for (int i = 0; i < dependents.size(); i++) {
Node n = dependents.get(i);
Node nextWrite = n.findNextWrite();
if (nextWrite != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite exit: next write node found. stream-id: " + nextWrite.getStreamID() + " node hc: " + nextWrite.hashCode());
}
return nextWrite;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite exit: null");
}
return null;
}
} | java | protected Node findNextWrite() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite entry: on node " + this + "With status: " + status + "and positive ratio of: " + getPriorityRatioPositive());
}
if (status == NODE_STATUS.REQUESTING_WRITE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite exit: node to write next is: " + this.toStringDetails());
}
return this;
} else {
// go through all dependents in order
for (int i = 0; i < dependents.size(); i++) {
Node n = dependents.get(i);
Node nextWrite = n.findNextWrite();
if (nextWrite != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite exit: next write node found. stream-id: " + nextWrite.getStreamID() + " node hc: " + nextWrite.hashCode());
}
return nextWrite;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "findNextWrite exit: null");
}
return null;
}
} | [
"protected",
"Node",
"findNextWrite",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"findNextWrite entry: on node \"",
"+",
"this",
"+",
"\"With status: \"",
"+",
"status",
"+",
"\"and positive ratio of: \"",
"+",
"getPriorityRatioPositive",
"(",
")",
")",
";",
"}",
"if",
"(",
"status",
"==",
"NODE_STATUS",
".",
"REQUESTING_WRITE",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"findNextWrite exit: node to write next is: \"",
"+",
"this",
".",
"toStringDetails",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}",
"else",
"{",
"// go through all dependents in order",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dependents",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Node",
"n",
"=",
"dependents",
".",
"get",
"(",
"i",
")",
";",
"Node",
"nextWrite",
"=",
"n",
".",
"findNextWrite",
"(",
")",
";",
"if",
"(",
"nextWrite",
"!=",
"null",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"findNextWrite exit: next write node found. stream-id: \"",
"+",
"nextWrite",
".",
"getStreamID",
"(",
")",
"+",
"\" node hc: \"",
"+",
"nextWrite",
".",
"hashCode",
"(",
")",
")",
";",
"}",
"return",
"nextWrite",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"findNextWrite exit: null\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"}"
] | recursively go through the tree finding the highest priority node that is requesting to write.
Assume nodes are arranged according to which dependents should write next from low index to high index at all levels.
Recursively find the next node ready to write, where first option is the highest rank node at a given level, then all
the nodes in its tree, before moving to the next highest rank node at the same level, recursively.
@return | [
"recursively",
"go",
"through",
"the",
"tree",
"finding",
"the",
"highest",
"priority",
"node",
"that",
"is",
"requesting",
"to",
"write",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java#L282-L312 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java | Node.incrementDependentWriteCount | protected int incrementDependentWriteCount() {
dependentWriteCount++;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "incrementDependentWriteCount entry: new dependentWriteCount of: " + dependentWriteCount + " for node: " + this);
}
return dependentWriteCount;
} | java | protected int incrementDependentWriteCount() {
dependentWriteCount++;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "incrementDependentWriteCount entry: new dependentWriteCount of: " + dependentWriteCount + " for node: " + this);
}
return dependentWriteCount;
} | [
"protected",
"int",
"incrementDependentWriteCount",
"(",
")",
"{",
"dependentWriteCount",
"++",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"incrementDependentWriteCount entry: new dependentWriteCount of: \"",
"+",
"dependentWriteCount",
"+",
"\" for node: \"",
"+",
"this",
")",
";",
"}",
"return",
"dependentWriteCount",
";",
"}"
] | increment the count since of the number of writes the direct dependents have done since that last reset. | [
"increment",
"the",
"count",
"since",
"of",
"the",
"number",
"of",
"writes",
"the",
"direct",
"dependents",
"have",
"done",
"since",
"that",
"last",
"reset",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java#L317-L323 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java | Node.setParent | protected void setParent(Node newParent, boolean removeDep) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setParent entry: new parent will be: " + newParent + " for node: " + this);
}
Node oldParent = parent;
parent = newParent;
if (newParent != null) {
parent.addDependent(this);
}
// removing dependents can cause ConcurrentModificationException if calling is iterating over a list of dependent nodes
// therefore removeDep should be false if setParent is being called while iterating or looping over a list of
// dependent nodes.
if (removeDep) {
// remove this node from the old parents list of dependents.
if (oldParent != null) {
if (newParent == null) {
oldParent.removeDependent(this);
} else if (oldParent.getStreamID() != parent.getStreamID()) {
oldParent.removeDependent(this);
}
}
}
} | java | protected void setParent(Node newParent, boolean removeDep) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setParent entry: new parent will be: " + newParent + " for node: " + this);
}
Node oldParent = parent;
parent = newParent;
if (newParent != null) {
parent.addDependent(this);
}
// removing dependents can cause ConcurrentModificationException if calling is iterating over a list of dependent nodes
// therefore removeDep should be false if setParent is being called while iterating or looping over a list of
// dependent nodes.
if (removeDep) {
// remove this node from the old parents list of dependents.
if (oldParent != null) {
if (newParent == null) {
oldParent.removeDependent(this);
} else if (oldParent.getStreamID() != parent.getStreamID()) {
oldParent.removeDependent(this);
}
}
}
} | [
"protected",
"void",
"setParent",
"(",
"Node",
"newParent",
",",
"boolean",
"removeDep",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setParent entry: new parent will be: \"",
"+",
"newParent",
"+",
"\" for node: \"",
"+",
"this",
")",
";",
"}",
"Node",
"oldParent",
"=",
"parent",
";",
"parent",
"=",
"newParent",
";",
"if",
"(",
"newParent",
"!=",
"null",
")",
"{",
"parent",
".",
"addDependent",
"(",
"this",
")",
";",
"}",
"// removing dependents can cause ConcurrentModificationException if calling is iterating over a list of dependent nodes",
"// therefore removeDep should be false if setParent is being called while iterating or looping over a list of",
"// dependent nodes.",
"if",
"(",
"removeDep",
")",
"{",
"// remove this node from the old parents list of dependents.",
"if",
"(",
"oldParent",
"!=",
"null",
")",
"{",
"if",
"(",
"newParent",
"==",
"null",
")",
"{",
"oldParent",
".",
"removeDependent",
"(",
"this",
")",
";",
"}",
"else",
"if",
"(",
"oldParent",
".",
"getStreamID",
"(",
")",
"!=",
"parent",
".",
"getStreamID",
"(",
")",
")",
"{",
"oldParent",
".",
"removeDependent",
"(",
"this",
")",
";",
"}",
"}",
"}",
"}"
] | Give this node a new parent.
Remove this node as a dependent of the old parent
Add this node as a dependent of the new parent.
@param newParent The new parent for this node. Null is allowed is is basically removing this node from the tree. | [
"Give",
"this",
"node",
"a",
"new",
"parent",
".",
"Remove",
"this",
"node",
"as",
"a",
"dependent",
"of",
"the",
"old",
"parent",
"Add",
"this",
"node",
"as",
"a",
"dependent",
"of",
"the",
"new",
"parent",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/priority/Node.java#L332-L358 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java | Subcursor._next | private final AbstractItemLink _next(long lockID) throws SevereMessageStoreException
{
// first look for an available link that we can lock. We scan the tree
// removing each element as we find it. If we are able to lock the link
// we use it.
AbstractItemLink lockedMatchingLink = null;
if (_jumpbackEnabled)
{
while (null == lockedMatchingLink)
{
AbstractItemLink link;
// Get and remove the first AIL in the list of AILs behind the current position
synchronized(this)
{
link = _behindList.getFirst(true);
}
if (link == null)
{
break;
}
else if (link.lockItemIfAvailable(lockID))
{
lockedMatchingLink = link;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "using available: " + lockedMatchingLink);
}
}
}
if (null == lockedMatchingLink)
{
// we didn't find and lock an available link, so we must now resume
// the traverse of the linked list
AbstractItemLink lookAtLink;
synchronized(this)
{
lookAtLink = (AbstractItemLink)advance();
}
while (null != lookAtLink && null == lockedMatchingLink)
{
// update our position for each link we examine in the chain
long pos = lookAtLink.getPosition();
synchronized(this)
{
if (pos > _highestPosition)
{
_highestPosition = pos;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "examine " + lookAtLink + "(seq = " + _highestPosition + ")");
}
}
// try to lock the link
//
// PAY ATTENTION
//
// This can read from the persistence layer so we MUST not be synchronized
// on this subcursor for the sake of concurrency (although it will not deadlock).
// Defect 298364 (sev 1) was raised to reflect a delay of several minutes due to this
if (lookAtLink.lockIfMatches(_filter, lockID))
{
// we matched and locked the link
lockedMatchingLink = lookAtLink;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "found: " + lockedMatchingLink);
}
else
{
// we didn't get the link - it didn't match or didn't lock. Advance
synchronized(this)
{
lookAtLink = (AbstractItemLink)advance();
}
}
}
}
return lockedMatchingLink;
} | java | private final AbstractItemLink _next(long lockID) throws SevereMessageStoreException
{
// first look for an available link that we can lock. We scan the tree
// removing each element as we find it. If we are able to lock the link
// we use it.
AbstractItemLink lockedMatchingLink = null;
if (_jumpbackEnabled)
{
while (null == lockedMatchingLink)
{
AbstractItemLink link;
// Get and remove the first AIL in the list of AILs behind the current position
synchronized(this)
{
link = _behindList.getFirst(true);
}
if (link == null)
{
break;
}
else if (link.lockItemIfAvailable(lockID))
{
lockedMatchingLink = link;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "using available: " + lockedMatchingLink);
}
}
}
if (null == lockedMatchingLink)
{
// we didn't find and lock an available link, so we must now resume
// the traverse of the linked list
AbstractItemLink lookAtLink;
synchronized(this)
{
lookAtLink = (AbstractItemLink)advance();
}
while (null != lookAtLink && null == lockedMatchingLink)
{
// update our position for each link we examine in the chain
long pos = lookAtLink.getPosition();
synchronized(this)
{
if (pos > _highestPosition)
{
_highestPosition = pos;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "examine " + lookAtLink + "(seq = " + _highestPosition + ")");
}
}
// try to lock the link
//
// PAY ATTENTION
//
// This can read from the persistence layer so we MUST not be synchronized
// on this subcursor for the sake of concurrency (although it will not deadlock).
// Defect 298364 (sev 1) was raised to reflect a delay of several minutes due to this
if (lookAtLink.lockIfMatches(_filter, lockID))
{
// we matched and locked the link
lockedMatchingLink = lookAtLink;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "found: " + lockedMatchingLink);
}
else
{
// we didn't get the link - it didn't match or didn't lock. Advance
synchronized(this)
{
lookAtLink = (AbstractItemLink)advance();
}
}
}
}
return lockedMatchingLink;
} | [
"private",
"final",
"AbstractItemLink",
"_next",
"(",
"long",
"lockID",
")",
"throws",
"SevereMessageStoreException",
"{",
"// first look for an available link that we can lock. We scan the tree",
"// removing each element as we find it. If we are able to lock the link",
"// we use it.",
"AbstractItemLink",
"lockedMatchingLink",
"=",
"null",
";",
"if",
"(",
"_jumpbackEnabled",
")",
"{",
"while",
"(",
"null",
"==",
"lockedMatchingLink",
")",
"{",
"AbstractItemLink",
"link",
";",
"// Get and remove the first AIL in the list of AILs behind the current position",
"synchronized",
"(",
"this",
")",
"{",
"link",
"=",
"_behindList",
".",
"getFirst",
"(",
"true",
")",
";",
"}",
"if",
"(",
"link",
"==",
"null",
")",
"{",
"break",
";",
"}",
"else",
"if",
"(",
"link",
".",
"lockItemIfAvailable",
"(",
"lockID",
")",
")",
"{",
"lockedMatchingLink",
"=",
"link",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"using available: \"",
"+",
"lockedMatchingLink",
")",
";",
"}",
"}",
"}",
"if",
"(",
"null",
"==",
"lockedMatchingLink",
")",
"{",
"// we didn't find and lock an available link, so we must now resume",
"// the traverse of the linked list",
"AbstractItemLink",
"lookAtLink",
";",
"synchronized",
"(",
"this",
")",
"{",
"lookAtLink",
"=",
"(",
"AbstractItemLink",
")",
"advance",
"(",
")",
";",
"}",
"while",
"(",
"null",
"!=",
"lookAtLink",
"&&",
"null",
"==",
"lockedMatchingLink",
")",
"{",
"// update our position for each link we examine in the chain",
"long",
"pos",
"=",
"lookAtLink",
".",
"getPosition",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"pos",
">",
"_highestPosition",
")",
"{",
"_highestPosition",
"=",
"pos",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"examine \"",
"+",
"lookAtLink",
"+",
"\"(seq = \"",
"+",
"_highestPosition",
"+",
"\")\"",
")",
";",
"}",
"}",
"// try to lock the link",
"//",
"// PAY ATTENTION",
"//",
"// This can read from the persistence layer so we MUST not be synchronized",
"// on this subcursor for the sake of concurrency (although it will not deadlock).",
"// Defect 298364 (sev 1) was raised to reflect a delay of several minutes due to this",
"if",
"(",
"lookAtLink",
".",
"lockIfMatches",
"(",
"_filter",
",",
"lockID",
")",
")",
"{",
"// we matched and locked the link",
"lockedMatchingLink",
"=",
"lookAtLink",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"found: \"",
"+",
"lockedMatchingLink",
")",
";",
"}",
"else",
"{",
"// we didn't get the link - it didn't match or didn't lock. Advance",
"synchronized",
"(",
"this",
")",
"{",
"lookAtLink",
"=",
"(",
"AbstractItemLink",
")",
"advance",
"(",
")",
";",
"}",
"}",
"}",
"}",
"return",
"lockedMatchingLink",
";",
"}"
] | Finds and locks the next matching item.
<p>This method MUST NOT be synchronized. It can cause reading from the
persistence layer. For this reason, and because it contains a loop to
find a suitable item, the execution time of this method can be long
and synchronization would prevent concurrent addition of entries to the
behind list.
@param lockID
@return
@throws SevereMessageStoreException | [
"Finds",
"and",
"locks",
"the",
"next",
"matching",
"item",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java#L82-L163 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java | Subcursor.available | public final void available(AbstractItemLink link) throws SevereMessageStoreException
{
if (_jumpbackEnabled)
{
final long newPos = link.getPosition();
// we need to synchronize the read of the position
// or we can miss out items when reading an empty queue fast.
// More importantly, the removal of the next from the cursor cannot
// happen while we are adding the available
synchronized(this)
{
if (newPos <= _highestPosition)
{
// Only store matching links, 'coz its quicker
if (null != link.matches(_filter))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink adding: " + link);
_behindList.insert(link);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink does not match: " + link);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink seq(" + newPos + ") too large (" + _highestPosition + ")");
}
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "available link - jumpbackDisabled: " + link);
}
} | java | public final void available(AbstractItemLink link) throws SevereMessageStoreException
{
if (_jumpbackEnabled)
{
final long newPos = link.getPosition();
// we need to synchronize the read of the position
// or we can miss out items when reading an empty queue fast.
// More importantly, the removal of the next from the cursor cannot
// happen while we are adding the available
synchronized(this)
{
if (newPos <= _highestPosition)
{
// Only store matching links, 'coz its quicker
if (null != link.matches(_filter))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink adding: " + link);
_behindList.insert(link);
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink does not match: " + link);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "availableLink seq(" + newPos + ") too large (" + _highestPosition + ")");
}
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "available link - jumpbackDisabled: " + link);
}
} | [
"public",
"final",
"void",
"available",
"(",
"AbstractItemLink",
"link",
")",
"throws",
"SevereMessageStoreException",
"{",
"if",
"(",
"_jumpbackEnabled",
")",
"{",
"final",
"long",
"newPos",
"=",
"link",
".",
"getPosition",
"(",
")",
";",
"// we need to synchronize the read of the position",
"// or we can miss out items when reading an empty queue fast.",
"// More importantly, the removal of the next from the cursor cannot",
"// happen while we are adding the available",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"newPos",
"<=",
"_highestPosition",
")",
"{",
"// Only store matching links, 'coz its quicker",
"if",
"(",
"null",
"!=",
"link",
".",
"matches",
"(",
"_filter",
")",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"availableLink adding: \"",
"+",
"link",
")",
";",
"_behindList",
".",
"insert",
"(",
"link",
")",
";",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"availableLink does not match: \"",
"+",
"link",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"availableLink seq(\"",
"+",
"newPos",
"+",
"\") too large (\"",
"+",
"_highestPosition",
"+",
"\")\"",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"available link - jumpbackDisabled: \"",
"+",
"link",
")",
";",
"}",
"}"
] | The cursor is being told that a link has become available. Add it to the list to revisit, but
only if it is older than the current cursor position.
@param link
@throws SevereMessageStoreException | [
"The",
"cursor",
"is",
"being",
"told",
"that",
"a",
"link",
"has",
"become",
"available",
".",
"Add",
"it",
"to",
"the",
"list",
"to",
"revisit",
"but",
"only",
"if",
"it",
"is",
"older",
"than",
"the",
"current",
"cursor",
"position",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java#L172-L208 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java | Subcursor.next | public final AbstractItem next(long lockID) throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "next", Long.valueOf(lockID));
final AbstractItemLink lockedMatchingLink = _next(lockID);
// retrieve the item from the link
AbstractItem lockedMatchingItem = null;
if (null != lockedMatchingLink)
{
lockedMatchingItem = lockedMatchingLink.getItem();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "next", lockedMatchingItem);
return lockedMatchingItem;
} | java | public final AbstractItem next(long lockID) throws SevereMessageStoreException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "next", Long.valueOf(lockID));
final AbstractItemLink lockedMatchingLink = _next(lockID);
// retrieve the item from the link
AbstractItem lockedMatchingItem = null;
if (null != lockedMatchingLink)
{
lockedMatchingItem = lockedMatchingLink.getItem();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "next", lockedMatchingItem);
return lockedMatchingItem;
} | [
"public",
"final",
"AbstractItem",
"next",
"(",
"long",
"lockID",
")",
"throws",
"SevereMessageStoreException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"next\"",
",",
"Long",
".",
"valueOf",
"(",
"lockID",
")",
")",
";",
"final",
"AbstractItemLink",
"lockedMatchingLink",
"=",
"_next",
"(",
"lockID",
")",
";",
"// retrieve the item from the link",
"AbstractItem",
"lockedMatchingItem",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"lockedMatchingLink",
")",
"{",
"lockedMatchingItem",
"=",
"lockedMatchingLink",
".",
"getItem",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"next\"",
",",
"lockedMatchingItem",
")",
";",
"return",
"lockedMatchingItem",
";",
"}"
] | Return the next item that is deemed a match by the filter specified when the cursor
was created. Items returned by this method are locked.
@throws SevereMessageStoreException | [
"Return",
"the",
"next",
"item",
"that",
"is",
"deemed",
"a",
"match",
"by",
"the",
"filter",
"specified",
"when",
"the",
"cursor",
"was",
"created",
".",
"Items",
"returned",
"by",
"this",
"method",
"are",
"locked",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java#L258-L273 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java | Subcursor.finished | public final void finished()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "finished");
if (null != _lastLink)
{
_lastLink.cursorRemoved();
_lastLink = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "finished");
} | java | public final void finished()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "finished");
if (null != _lastLink)
{
_lastLink.cursorRemoved();
_lastLink = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "finished");
} | [
"public",
"final",
"void",
"finished",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"finished\"",
")",
";",
"if",
"(",
"null",
"!=",
"_lastLink",
")",
"{",
"_lastLink",
".",
"cursorRemoved",
"(",
")",
";",
"_lastLink",
"=",
"null",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"finished\"",
")",
";",
"}"
] | Signals that use of the cursor has finished. The cursor is removed from the AIL that it currently
rests on. | [
"Signals",
"that",
"use",
"of",
"the",
"cursor",
"has",
"finished",
".",
"The",
"cursor",
"is",
"removed",
"from",
"the",
"AIL",
"that",
"it",
"currently",
"rests",
"on",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/list/Subcursor.java#L279-L290 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SingletonBeanO.java | SingletonBeanO.callTransactionalLifecycleInterceptors | private void callTransactionalLifecycleInterceptors(InterceptorProxy[] proxies, int methodId) throws RemoteException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
LifecycleInterceptorWrapper wrapper = new LifecycleInterceptorWrapper(container, this);
EJSDeployedSupport s = new EJSDeployedSupport();
// F743761.CodRv - Exceptions from lifecycle callback interceptors do not
// throw application exceptions.
s.ivIgnoreApplicationExceptions = true;
try {
container.preInvokeForLifecycleInterceptors(wrapper, methodId, s, this);
// F743-1751CodRev - Inline callLifecycleInterceptors. We need to
// manage HandleList separately.
if (isTraceOn) // d527372
{
if (TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceEJBCallEntry(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]);
if (tc.isDebugEnabled())
Tr.debug(tc, "callLifecycleInterceptors");
}
InvocationContextImpl<?> inv = getInvocationContext();
BeanMetaData bmd = home.beanMetaData;
inv.doLifeCycle(proxies, bmd._moduleMetaData); // F743-14982
} catch (Throwable t) {
s.setUncheckedLocalException(t);
} finally {
if (isTraceOn && TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallExit(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]);
}
container.postInvokeForLifecycleInterceptors(wrapper, methodId, s);
}
} | java | private void callTransactionalLifecycleInterceptors(InterceptorProxy[] proxies, int methodId) throws RemoteException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
LifecycleInterceptorWrapper wrapper = new LifecycleInterceptorWrapper(container, this);
EJSDeployedSupport s = new EJSDeployedSupport();
// F743761.CodRv - Exceptions from lifecycle callback interceptors do not
// throw application exceptions.
s.ivIgnoreApplicationExceptions = true;
try {
container.preInvokeForLifecycleInterceptors(wrapper, methodId, s, this);
// F743-1751CodRev - Inline callLifecycleInterceptors. We need to
// manage HandleList separately.
if (isTraceOn) // d527372
{
if (TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceEJBCallEntry(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]);
if (tc.isDebugEnabled())
Tr.debug(tc, "callLifecycleInterceptors");
}
InvocationContextImpl<?> inv = getInvocationContext();
BeanMetaData bmd = home.beanMetaData;
inv.doLifeCycle(proxies, bmd._moduleMetaData); // F743-14982
} catch (Throwable t) {
s.setUncheckedLocalException(t);
} finally {
if (isTraceOn && TEBeanLifeCycleInfo.isTraceEnabled()) {
TEBeanLifeCycleInfo.traceEJBCallExit(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]);
}
container.postInvokeForLifecycleInterceptors(wrapper, methodId, s);
}
} | [
"private",
"void",
"callTransactionalLifecycleInterceptors",
"(",
"InterceptorProxy",
"[",
"]",
"proxies",
",",
"int",
"methodId",
")",
"throws",
"RemoteException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"LifecycleInterceptorWrapper",
"wrapper",
"=",
"new",
"LifecycleInterceptorWrapper",
"(",
"container",
",",
"this",
")",
";",
"EJSDeployedSupport",
"s",
"=",
"new",
"EJSDeployedSupport",
"(",
")",
";",
"// F743761.CodRv - Exceptions from lifecycle callback interceptors do not",
"// throw application exceptions.",
"s",
".",
"ivIgnoreApplicationExceptions",
"=",
"true",
";",
"try",
"{",
"container",
".",
"preInvokeForLifecycleInterceptors",
"(",
"wrapper",
",",
"methodId",
",",
"s",
",",
"this",
")",
";",
"// F743-1751CodRev - Inline callLifecycleInterceptors. We need to",
"// manage HandleList separately.",
"if",
"(",
"isTraceOn",
")",
"// d527372",
"{",
"if",
"(",
"TEBeanLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
")",
"TEBeanLifeCycleInfo",
".",
"traceEJBCallEntry",
"(",
"LifecycleInterceptorWrapper",
".",
"TRACE_NAMES",
"[",
"methodId",
"]",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"callLifecycleInterceptors\"",
")",
";",
"}",
"InvocationContextImpl",
"<",
"?",
">",
"inv",
"=",
"getInvocationContext",
"(",
")",
";",
"BeanMetaData",
"bmd",
"=",
"home",
".",
"beanMetaData",
";",
"inv",
".",
"doLifeCycle",
"(",
"proxies",
",",
"bmd",
".",
"_moduleMetaData",
")",
";",
"// F743-14982",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"s",
".",
"setUncheckedLocalException",
"(",
"t",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"isTraceOn",
"&&",
"TEBeanLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"TEBeanLifeCycleInfo",
".",
"traceEJBCallExit",
"(",
"LifecycleInterceptorWrapper",
".",
"TRACE_NAMES",
"[",
"methodId",
"]",
")",
";",
"}",
"container",
".",
"postInvokeForLifecycleInterceptors",
"(",
"wrapper",
",",
"methodId",
",",
"s",
")",
";",
"}",
"}"
] | Invoke PostConstruct or PreDestroy interceptors associated with this bean
using the transaction and security context specified in the method info.
@param proxies the non-null reference to InterceptorProxy array that
contains the PostConstruct interceptor methods to invoke.
@param methodInfo the method info for transaction and security context | [
"Invoke",
"PostConstruct",
"or",
"PreDestroy",
"interceptors",
"associated",
"with",
"this",
"bean",
"using",
"the",
"transaction",
"and",
"security",
"context",
"specified",
"in",
"the",
"method",
"info",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SingletonBeanO.java#L194-L231 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SingletonBeanO.java | SingletonBeanO.postInvoke | @Override
public void postInvoke(int id, EJSDeployedSupport s) throws RemoteException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "postInvoke");
}
// Release lock acquired if container managed concurrency control.
if (ivContainerManagedConcurrency && s.ivLockAcquired) {
// Get the lock type to use for the method being invoked.
EJBMethodInfoImpl mInfo = s.methodInfo;
LockType lockType = mInfo.ivLockType;
if (lockType == LockType.READ) {
ivReadLock.unlock();
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "postInvoke released read lock: " + ivLock.toString());
}
} else {
ivWriteLock.unlock();
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "postInvoke released write lock: " + ivLock.toString());
}
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "postInvoke");
}
} | java | @Override
public void postInvoke(int id, EJSDeployedSupport s) throws RemoteException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "postInvoke");
}
// Release lock acquired if container managed concurrency control.
if (ivContainerManagedConcurrency && s.ivLockAcquired) {
// Get the lock type to use for the method being invoked.
EJBMethodInfoImpl mInfo = s.methodInfo;
LockType lockType = mInfo.ivLockType;
if (lockType == LockType.READ) {
ivReadLock.unlock();
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "postInvoke released read lock: " + ivLock.toString());
}
} else {
ivWriteLock.unlock();
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "postInvoke released write lock: " + ivLock.toString());
}
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "postInvoke");
}
} | [
"@",
"Override",
"public",
"void",
"postInvoke",
"(",
"int",
"id",
",",
"EJSDeployedSupport",
"s",
")",
"throws",
"RemoteException",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"postInvoke\"",
")",
";",
"}",
"// Release lock acquired if container managed concurrency control.",
"if",
"(",
"ivContainerManagedConcurrency",
"&&",
"s",
".",
"ivLockAcquired",
")",
"{",
"// Get the lock type to use for the method being invoked.",
"EJBMethodInfoImpl",
"mInfo",
"=",
"s",
".",
"methodInfo",
";",
"LockType",
"lockType",
"=",
"mInfo",
".",
"ivLockType",
";",
"if",
"(",
"lockType",
"==",
"LockType",
".",
"READ",
")",
"{",
"ivReadLock",
".",
"unlock",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"postInvoke released read lock: \"",
"+",
"ivLock",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"ivWriteLock",
".",
"unlock",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"postInvoke released write lock: \"",
"+",
"ivLock",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"postInvoke\"",
")",
";",
"}",
"}"
] | Release lock acquired by preInvoke.
@see com.ibm.ejs.container.BeanO#postInvoke(int, com.ibm.ejs.container.EJSDeployedSupport) | [
"Release",
"lock",
"acquired",
"by",
"preInvoke",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SingletonBeanO.java#L543-L574 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java | DeserializationObjectInputStream.resolveClassWithCL | private Class<?> resolveClassWithCL(String name) throws ClassNotFoundException {
SecurityManager security = System.getSecurityManager();
if (security != null) {
return Class.forName(name, false, getClassLoader(thisClass));
}
// The platform classloader is null if we failed to get it when using java 9, or if we are
// running with a java level below 9. In those cases, the bootstrap classloader
// is used to resolve the needed class.
// Note that this change is being made to account for the fact that in java 9, classes
// such as java.sql.* (java.sql module) are no longer discoverable through the bootstrap
// classloader. Those classes are now discoverable through the java 9 platform classloader.
// The platform classloader is between the bootstrap classloader and the app classloader.
return Class.forName(name, false, platformClassloader);
} | java | private Class<?> resolveClassWithCL(String name) throws ClassNotFoundException {
SecurityManager security = System.getSecurityManager();
if (security != null) {
return Class.forName(name, false, getClassLoader(thisClass));
}
// The platform classloader is null if we failed to get it when using java 9, or if we are
// running with a java level below 9. In those cases, the bootstrap classloader
// is used to resolve the needed class.
// Note that this change is being made to account for the fact that in java 9, classes
// such as java.sql.* (java.sql module) are no longer discoverable through the bootstrap
// classloader. Those classes are now discoverable through the java 9 platform classloader.
// The platform classloader is between the bootstrap classloader and the app classloader.
return Class.forName(name, false, platformClassloader);
} | [
"private",
"Class",
"<",
"?",
">",
"resolveClassWithCL",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"SecurityManager",
"security",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"security",
"!=",
"null",
")",
"{",
"return",
"Class",
".",
"forName",
"(",
"name",
",",
"false",
",",
"getClassLoader",
"(",
"thisClass",
")",
")",
";",
"}",
"// The platform classloader is null if we failed to get it when using java 9, or if we are",
"// running with a java level below 9. In those cases, the bootstrap classloader",
"// is used to resolve the needed class.",
"// Note that this change is being made to account for the fact that in java 9, classes",
"// such as java.sql.* (java.sql module) are no longer discoverable through the bootstrap",
"// classloader. Those classes are now discoverable through the java 9 platform classloader.",
"// The platform classloader is between the bootstrap classloader and the app classloader.",
"return",
"Class",
".",
"forName",
"(",
"name",
",",
"false",
",",
"platformClassloader",
")",
";",
"}"
] | Resolves a class using the appropriate classloader.
@param name The name of the class to resolve.
@return The resolved class.
@throws ClassNotFoundException | [
"Resolves",
"a",
"class",
"using",
"the",
"appropriate",
"classloader",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java#L128-L142 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java | DeserializationObjectInputStream.resolveProxyClass | @Override
protected Class<?> resolveProxyClass(String[] interfaceNames) throws ClassNotFoundException {
ClassLoader proxyClassLoader = classLoader;
Class<?>[] interfaces = new Class[interfaceNames.length];
Class<?> nonPublicInterface = null;
for (int i = 0; i < interfaceNames.length; i++) {
Class<?> intf = loadClass(interfaceNames[i]);
if (!Modifier.isPublic(intf.getModifiers())) {
ClassLoader classLoader = getClassLoader(intf);
if (nonPublicInterface != null) {
if (classLoader != proxyClassLoader) {
throw new IllegalAccessError(nonPublicInterface + " and " + intf + " both declared non-public in different class loaders");
}
} else {
nonPublicInterface = intf;
proxyClassLoader = classLoader;
}
}
interfaces[i] = intf;
}
try {
return Proxy.getProxyClass(proxyClassLoader, interfaces);
} catch (IllegalArgumentException ex) {
throw new ClassNotFoundException(null, ex);
}
} | java | @Override
protected Class<?> resolveProxyClass(String[] interfaceNames) throws ClassNotFoundException {
ClassLoader proxyClassLoader = classLoader;
Class<?>[] interfaces = new Class[interfaceNames.length];
Class<?> nonPublicInterface = null;
for (int i = 0; i < interfaceNames.length; i++) {
Class<?> intf = loadClass(interfaceNames[i]);
if (!Modifier.isPublic(intf.getModifiers())) {
ClassLoader classLoader = getClassLoader(intf);
if (nonPublicInterface != null) {
if (classLoader != proxyClassLoader) {
throw new IllegalAccessError(nonPublicInterface + " and " + intf + " both declared non-public in different class loaders");
}
} else {
nonPublicInterface = intf;
proxyClassLoader = classLoader;
}
}
interfaces[i] = intf;
}
try {
return Proxy.getProxyClass(proxyClassLoader, interfaces);
} catch (IllegalArgumentException ex) {
throw new ClassNotFoundException(null, ex);
}
} | [
"@",
"Override",
"protected",
"Class",
"<",
"?",
">",
"resolveProxyClass",
"(",
"String",
"[",
"]",
"interfaceNames",
")",
"throws",
"ClassNotFoundException",
"{",
"ClassLoader",
"proxyClassLoader",
"=",
"classLoader",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"new",
"Class",
"[",
"interfaceNames",
".",
"length",
"]",
";",
"Class",
"<",
"?",
">",
"nonPublicInterface",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"interfaceNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"Class",
"<",
"?",
">",
"intf",
"=",
"loadClass",
"(",
"interfaceNames",
"[",
"i",
"]",
")",
";",
"if",
"(",
"!",
"Modifier",
".",
"isPublic",
"(",
"intf",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"ClassLoader",
"classLoader",
"=",
"getClassLoader",
"(",
"intf",
")",
";",
"if",
"(",
"nonPublicInterface",
"!=",
"null",
")",
"{",
"if",
"(",
"classLoader",
"!=",
"proxyClassLoader",
")",
"{",
"throw",
"new",
"IllegalAccessError",
"(",
"nonPublicInterface",
"+",
"\" and \"",
"+",
"intf",
"+",
"\" both declared non-public in different class loaders\"",
")",
";",
"}",
"}",
"else",
"{",
"nonPublicInterface",
"=",
"intf",
";",
"proxyClassLoader",
"=",
"classLoader",
";",
"}",
"}",
"interfaces",
"[",
"i",
"]",
"=",
"intf",
";",
"}",
"try",
"{",
"return",
"Proxy",
".",
"getProxyClass",
"(",
"proxyClassLoader",
",",
"interfaces",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ex",
")",
"{",
"throw",
"new",
"ClassNotFoundException",
"(",
"null",
",",
"ex",
")",
";",
"}",
"}"
] | Delegates class loading to the specified class loader.
<p>{@inheritDoc} | [
"Delegates",
"class",
"loading",
"to",
"the",
"specified",
"class",
"loader",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java#L212-L241 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java | DeserializationObjectInputStream.getPlatformClassLoader | private static ClassLoader getPlatformClassLoader() {
if (JavaInfo.majorVersion() >= 9) {
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
ClassLoader pcl = null;
try {
Method getPlatformClassLoader = ClassLoader.class.getMethod("getPlatformClassLoader");
pcl = (ClassLoader) getPlatformClassLoader.invoke(null);
} catch (Throwable t) {
// Log an FFDC.
}
return pcl;
}
});
}
return null;
} | java | private static ClassLoader getPlatformClassLoader() {
if (JavaInfo.majorVersion() >= 9) {
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
ClassLoader pcl = null;
try {
Method getPlatformClassLoader = ClassLoader.class.getMethod("getPlatformClassLoader");
pcl = (ClassLoader) getPlatformClassLoader.invoke(null);
} catch (Throwable t) {
// Log an FFDC.
}
return pcl;
}
});
}
return null;
} | [
"private",
"static",
"ClassLoader",
"getPlatformClassLoader",
"(",
")",
"{",
"if",
"(",
"JavaInfo",
".",
"majorVersion",
"(",
")",
">=",
"9",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"ClassLoader",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ClassLoader",
"run",
"(",
")",
"{",
"ClassLoader",
"pcl",
"=",
"null",
";",
"try",
"{",
"Method",
"getPlatformClassLoader",
"=",
"ClassLoader",
".",
"class",
".",
"getMethod",
"(",
"\"getPlatformClassLoader\"",
")",
";",
"pcl",
"=",
"(",
"ClassLoader",
")",
"getPlatformClassLoader",
".",
"invoke",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"// Log an FFDC.",
"}",
"return",
"pcl",
";",
"}",
"}",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the PlatformClassloader when running with java 9 and above; otherwise returns null. | [
"Returns",
"the",
"PlatformClassloader",
"when",
"running",
"with",
"java",
"9",
"and",
"above",
";",
"otherwise",
"returns",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/DeserializationObjectInputStream.java#L255-L272 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java | CATAsynchConsumer.setAsynchConsumerCallback | @Override
public void setAsynchConsumerCallback(int requestNumber,
int maxActiveMessages,
long messageLockExpiry,
int batchsize,
OrderingContext orderContext,
boolean stoppable,
int maxSequentialFailures,
long hiddenMessageDelay) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setAsynchConsumerCallback",
new Object[]
{
requestNumber,
maxActiveMessages,
messageLockExpiry,
batchsize,
orderContext,
stoppable,
maxSequentialFailures,
hiddenMessageDelay
});
try {
// Here we need to examine the config parameter that will denote whether we are telling
// MP to inline our async callbacks or not. We will default to false, but this can
// be overrideen.
boolean inlineCallbacks =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.INLINE_ASYNC_CBACKS_KEY,
CommsConstants.INLINE_ASYNC_CBACKS);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Inline async callbacks: " + inlineCallbacks);
MPConsumerSession session = (MPConsumerSession) getConsumerSession();
if (stoppable) {
session.registerStoppableAsynchConsumerCallback(this,
maxActiveMessages,
messageLockExpiry,
batchsize,
getUnrecoverableReliability(),
inlineCallbacks,
orderContext,
maxSequentialFailures,
hiddenMessageDelay);
} else {
session.registerAsynchConsumerCallback(this,
maxActiveMessages,
messageLockExpiry,
batchsize,
getUnrecoverableReliability(),
inlineCallbacks,
orderContext);
}
try {
getConversation().send(poolManager.allocate(),
JFapChannelConstants.SEG_REGISTER_ASYNC_CONSUMER_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".setAsynchConsumerCallback",
CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
// End d175222
} catch (SIException e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".setAsynchConsumerCallback",
CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setAsynchConsumerCallback");
} | java | @Override
public void setAsynchConsumerCallback(int requestNumber,
int maxActiveMessages,
long messageLockExpiry,
int batchsize,
OrderingContext orderContext,
boolean stoppable,
int maxSequentialFailures,
long hiddenMessageDelay) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setAsynchConsumerCallback",
new Object[]
{
requestNumber,
maxActiveMessages,
messageLockExpiry,
batchsize,
orderContext,
stoppable,
maxSequentialFailures,
hiddenMessageDelay
});
try {
// Here we need to examine the config parameter that will denote whether we are telling
// MP to inline our async callbacks or not. We will default to false, but this can
// be overrideen.
boolean inlineCallbacks =
CommsUtils.getRuntimeBooleanProperty(CommsConstants.INLINE_ASYNC_CBACKS_KEY,
CommsConstants.INLINE_ASYNC_CBACKS);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Inline async callbacks: " + inlineCallbacks);
MPConsumerSession session = (MPConsumerSession) getConsumerSession();
if (stoppable) {
session.registerStoppableAsynchConsumerCallback(this,
maxActiveMessages,
messageLockExpiry,
batchsize,
getUnrecoverableReliability(),
inlineCallbacks,
orderContext,
maxSequentialFailures,
hiddenMessageDelay);
} else {
session.registerAsynchConsumerCallback(this,
maxActiveMessages,
messageLockExpiry,
batchsize,
getUnrecoverableReliability(),
inlineCallbacks,
orderContext);
}
try {
getConversation().send(poolManager.allocate(),
JFapChannelConstants.SEG_REGISTER_ASYNC_CONSUMER_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".setAsynchConsumerCallback",
CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
// End d175222
} catch (SIException e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".setAsynchConsumerCallback",
CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setAsynchConsumerCallback");
} | [
"@",
"Override",
"public",
"void",
"setAsynchConsumerCallback",
"(",
"int",
"requestNumber",
",",
"int",
"maxActiveMessages",
",",
"long",
"messageLockExpiry",
",",
"int",
"batchsize",
",",
"OrderingContext",
"orderContext",
",",
"boolean",
"stoppable",
",",
"int",
"maxSequentialFailures",
",",
"long",
"hiddenMessageDelay",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"setAsynchConsumerCallback\"",
",",
"new",
"Object",
"[",
"]",
"{",
"requestNumber",
",",
"maxActiveMessages",
",",
"messageLockExpiry",
",",
"batchsize",
",",
"orderContext",
",",
"stoppable",
",",
"maxSequentialFailures",
",",
"hiddenMessageDelay",
"}",
")",
";",
"try",
"{",
"// Here we need to examine the config parameter that will denote whether we are telling",
"// MP to inline our async callbacks or not. We will default to false, but this can",
"// be overrideen.",
"boolean",
"inlineCallbacks",
"=",
"CommsUtils",
".",
"getRuntimeBooleanProperty",
"(",
"CommsConstants",
".",
"INLINE_ASYNC_CBACKS_KEY",
",",
"CommsConstants",
".",
"INLINE_ASYNC_CBACKS",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"\"Inline async callbacks: \"",
"+",
"inlineCallbacks",
")",
";",
"MPConsumerSession",
"session",
"=",
"(",
"MPConsumerSession",
")",
"getConsumerSession",
"(",
")",
";",
"if",
"(",
"stoppable",
")",
"{",
"session",
".",
"registerStoppableAsynchConsumerCallback",
"(",
"this",
",",
"maxActiveMessages",
",",
"messageLockExpiry",
",",
"batchsize",
",",
"getUnrecoverableReliability",
"(",
")",
",",
"inlineCallbacks",
",",
"orderContext",
",",
"maxSequentialFailures",
",",
"hiddenMessageDelay",
")",
";",
"}",
"else",
"{",
"session",
".",
"registerAsynchConsumerCallback",
"(",
"this",
",",
"maxActiveMessages",
",",
"messageLockExpiry",
",",
"batchsize",
",",
"getUnrecoverableReliability",
"(",
")",
",",
"inlineCallbacks",
",",
"orderContext",
")",
";",
"}",
"try",
"{",
"getConversation",
"(",
")",
".",
"send",
"(",
"poolManager",
".",
"allocate",
"(",
")",
",",
"JFapChannelConstants",
".",
"SEG_REGISTER_ASYNC_CONSUMER_R",
",",
"requestNumber",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".setAsynchConsumerCallback\"",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_SETCALLBACK_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2017\"",
",",
"e",
")",
";",
"}",
"// End d175222",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"//No FFDC code needed",
"//Only FFDC if we haven't received a meTerminated event.",
"if",
"(",
"!",
"(",
"(",
"ConversationState",
")",
"getConversation",
"(",
")",
".",
"getAttachment",
"(",
")",
")",
".",
"hasMETerminated",
"(",
")",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".setAsynchConsumerCallback\"",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_SETCALLBACK_02",
",",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"StaticCATHelper",
".",
"sendExceptionToClient",
"(",
"e",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_SETCALLBACK_02",
",",
"getConversation",
"(",
")",
",",
"requestNumber",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"setAsynchConsumerCallback\"",
")",
";",
"}"
] | Creates a normal or stoppable async consumer for this session. This is called in response to
the request from a client. This differs from readahead or synchronous sessions where an async
callback is registered without the client knowing.
@param requestNumber
@param maxActiveMessages
@param messageLockExpiry
@param batchsize
@param orderContext
@param stoppable
@param maxSequentialFailures
@param hiddenMessageDelay | [
"Creates",
"a",
"normal",
"or",
"stoppable",
"async",
"consumer",
"for",
"this",
"session",
".",
"This",
"is",
"called",
"in",
"response",
"to",
"the",
"request",
"from",
"a",
"client",
".",
"This",
"differs",
"from",
"readahead",
"or",
"synchronous",
"sessions",
"where",
"an",
"async",
"callback",
"is",
"registered",
"without",
"the",
"client",
"knowing",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java#L173-L268 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java | CATAsynchConsumer.flush | @Override
public void flush(int requestNumber) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "flush", "" + requestNumber);
try {
// Make sure it is stopped before we activate it
if (mainConsumer.isStarted())
getConsumerSession().stop();
getConsumerSession().activateAsynchConsumer(true);
if (mainConsumer.isStarted())
getConsumerSession().start(false);
short jfapPriority = JFapChannelConstants.getJFAPPriority(Integer.valueOf(mainConsumer.getLowestPriority())); // d172528
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); // d172528
try {
getConversation().send(poolManager.allocate(),
JFapChannelConstants.SEG_FLUSH_SESS_R,
requestNumber,
jfapPriority,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".flush",
CommsConstants.CATASYNCHCONSUMER_FLUSH_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
} catch (SIException e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".flush",
CommsConstants.CATASYNCHCONSUMER_FLUSH_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATASYNCHCONSUMER_FLUSH_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "flush");
} | java | @Override
public void flush(int requestNumber) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "flush", "" + requestNumber);
try {
// Make sure it is stopped before we activate it
if (mainConsumer.isStarted())
getConsumerSession().stop();
getConsumerSession().activateAsynchConsumer(true);
if (mainConsumer.isStarted())
getConsumerSession().start(false);
short jfapPriority = JFapChannelConstants.getJFAPPriority(Integer.valueOf(mainConsumer.getLowestPriority())); // d172528
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); // d172528
try {
getConversation().send(poolManager.allocate(),
JFapChannelConstants.SEG_FLUSH_SESS_R,
requestNumber,
jfapPriority,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".flush",
CommsConstants.CATASYNCHCONSUMER_FLUSH_01,
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
} catch (SIException e) {
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) {
FFDCFilter.processException(e,
CLASS_NAME + ".flush",
CommsConstants.CATASYNCHCONSUMER_FLUSH_02,
this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.CATASYNCHCONSUMER_FLUSH_02,
getConversation(), requestNumber);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "flush");
} | [
"@",
"Override",
"public",
"void",
"flush",
"(",
"int",
"requestNumber",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"flush\"",
",",
"\"\"",
"+",
"requestNumber",
")",
";",
"try",
"{",
"// Make sure it is stopped before we activate it",
"if",
"(",
"mainConsumer",
".",
"isStarted",
"(",
")",
")",
"getConsumerSession",
"(",
")",
".",
"stop",
"(",
")",
";",
"getConsumerSession",
"(",
")",
".",
"activateAsynchConsumer",
"(",
"true",
")",
";",
"if",
"(",
"mainConsumer",
".",
"isStarted",
"(",
")",
")",
"getConsumerSession",
"(",
")",
".",
"start",
"(",
"false",
")",
";",
"short",
"jfapPriority",
"=",
"JFapChannelConstants",
".",
"getJFAPPriority",
"(",
"Integer",
".",
"valueOf",
"(",
"mainConsumer",
".",
"getLowestPriority",
"(",
")",
")",
")",
";",
"// d172528",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Sending with JFAP priority of \"",
"+",
"jfapPriority",
")",
";",
"// d172528",
"try",
"{",
"getConversation",
"(",
")",
".",
"send",
"(",
"poolManager",
".",
"allocate",
"(",
")",
",",
"JFapChannelConstants",
".",
"SEG_FLUSH_SESS_R",
",",
"requestNumber",
",",
"jfapPriority",
",",
"true",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".flush\"",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_FLUSH_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2017\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"//No FFDC code needed",
"//Only FFDC if we haven't received a meTerminated event.",
"if",
"(",
"!",
"(",
"(",
"ConversationState",
")",
"getConversation",
"(",
")",
".",
"getAttachment",
"(",
")",
")",
".",
"hasMETerminated",
"(",
")",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".flush\"",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_FLUSH_02",
",",
"this",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"StaticCATHelper",
".",
"sendExceptionToClient",
"(",
"e",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_FLUSH_02",
",",
"getConversation",
"(",
")",
",",
"requestNumber",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"flush\"",
")",
";",
"}"
] | This method will flush the consumer to ensure it is completely
out of messages.
@param requestNumber | [
"This",
"method",
"will",
"flush",
"the",
"consumer",
"to",
"ensure",
"it",
"is",
"completely",
"out",
"of",
"messages",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java#L619-L675 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java | CATAsynchConsumer.sendMessage | private boolean sendMessage(SIBusMessage sibMessage, boolean lastMsg, Integer priority)
throws MessageEncodeFailedException,
IncorrectMessageTypeException,
MessageCopyFailedException,
UnsupportedEncodingException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "sendMessage",
new Object[] { sibMessage, lastMsg, priority });
boolean ok = false;
// If we are at FAP9 or above we can do a 'chunked' send of the message in seperate
// slices to make life easier on the Java memory manager
final HandshakeProperties props = getConversation().getHandshakeProperties();
if (props.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9) {
ok = sendChunkedMessage(sibMessage, lastMsg, priority);
} else {
ok = sendEntireMessage(sibMessage, null, lastMsg, priority);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "sendMessage", ok);
return ok;
} | java | private boolean sendMessage(SIBusMessage sibMessage, boolean lastMsg, Integer priority)
throws MessageEncodeFailedException,
IncorrectMessageTypeException,
MessageCopyFailedException,
UnsupportedEncodingException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "sendMessage",
new Object[] { sibMessage, lastMsg, priority });
boolean ok = false;
// If we are at FAP9 or above we can do a 'chunked' send of the message in seperate
// slices to make life easier on the Java memory manager
final HandshakeProperties props = getConversation().getHandshakeProperties();
if (props.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9) {
ok = sendChunkedMessage(sibMessage, lastMsg, priority);
} else {
ok = sendEntireMessage(sibMessage, null, lastMsg, priority);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "sendMessage", ok);
return ok;
} | [
"private",
"boolean",
"sendMessage",
"(",
"SIBusMessage",
"sibMessage",
",",
"boolean",
"lastMsg",
",",
"Integer",
"priority",
")",
"throws",
"MessageEncodeFailedException",
",",
"IncorrectMessageTypeException",
",",
"MessageCopyFailedException",
",",
"UnsupportedEncodingException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"sendMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"sibMessage",
",",
"lastMsg",
",",
"priority",
"}",
")",
";",
"boolean",
"ok",
"=",
"false",
";",
"// If we are at FAP9 or above we can do a 'chunked' send of the message in seperate",
"// slices to make life easier on the Java memory manager",
"final",
"HandshakeProperties",
"props",
"=",
"getConversation",
"(",
")",
".",
"getHandshakeProperties",
"(",
")",
";",
"if",
"(",
"props",
".",
"getFapLevel",
"(",
")",
">=",
"JFapChannelConstants",
".",
"FAP_VERSION_9",
")",
"{",
"ok",
"=",
"sendChunkedMessage",
"(",
"sibMessage",
",",
"lastMsg",
",",
"priority",
")",
";",
"}",
"else",
"{",
"ok",
"=",
"sendEntireMessage",
"(",
"sibMessage",
",",
"null",
",",
"lastMsg",
",",
"priority",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"sendMessage\"",
",",
"ok",
")",
";",
"return",
"ok",
";",
"}"
] | Method to perform a single send of a message to the client.
@param sibMessage The message to send.
@param lastMsg true if this is the last message in the batch.
@param priority The priority to sent the message
@return Returns false if a communications error prevented the message
from being sent.
@throws MessageEncodeFailedException if the message encoded. | [
"Method",
"to",
"perform",
"a",
"single",
"send",
"of",
"a",
"message",
"to",
"the",
"client",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java#L689-L712 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java | CATAsynchConsumer.sendEntireMessage | private boolean sendEntireMessage(SIBusMessage sibMessage, List<DataSlice> messageSlices,
boolean lastMsg, Integer priority)
throws MessageEncodeFailedException,
IncorrectMessageTypeException,
MessageCopyFailedException,
UnsupportedEncodingException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "sendEntireMessage",
new Object[] { sibMessage, messageSlices, lastMsg, priority });
if (lastMsg) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Sending last in batch");
}
ConversationState convState = (ConversationState) getConversation().getAttachment();
// Flag to indicate a Comms error so that we stop sending messages
boolean ok = true;
try {
CommsServerByteBuffer byteBuffer = poolManager.allocate();
int msgLen = 0;
short msgFlags = CommsConstants.ASYNC_START_OR_MID_BATCH;
if (lastMsg)
msgFlags |= CommsConstants.ASYNC_LAST_IN_BATCH;
byteBuffer.putShort(convState.getConnectionObjectId());
byteBuffer.putShort(mainConsumer.getClientSessionId());
byteBuffer.putShort(msgFlags);
byteBuffer.putShort(mainConsumer.getMessageBatchNumber()); // BIT16 Message Batch
// Put the entire message into the buffer in whatever way is suitable
if (messageSlices == null) {
msgLen = byteBuffer.putMessage((JsMessage) sibMessage,
convState.getCommsConnection(),
getConversation());
} else {
msgLen = byteBuffer.putMessgeWithoutEncode(messageSlices);
}
int jfapPriority = JFapChannelConstants.getJFAPPriority(priority);
getConversation().send(byteBuffer,
JFapChannelConstants.SEG_ASYNC_MESSAGE,
0, // No request number
jfapPriority,
false,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".sendEntireMessage",
CommsConstants.CATASYNCHCONSUMER_SENDENTIREMESS_01,
this);
ok = false;
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "sendEntireMessage", ok);
return ok;
} | java | private boolean sendEntireMessage(SIBusMessage sibMessage, List<DataSlice> messageSlices,
boolean lastMsg, Integer priority)
throws MessageEncodeFailedException,
IncorrectMessageTypeException,
MessageCopyFailedException,
UnsupportedEncodingException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "sendEntireMessage",
new Object[] { sibMessage, messageSlices, lastMsg, priority });
if (lastMsg) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Sending last in batch");
}
ConversationState convState = (ConversationState) getConversation().getAttachment();
// Flag to indicate a Comms error so that we stop sending messages
boolean ok = true;
try {
CommsServerByteBuffer byteBuffer = poolManager.allocate();
int msgLen = 0;
short msgFlags = CommsConstants.ASYNC_START_OR_MID_BATCH;
if (lastMsg)
msgFlags |= CommsConstants.ASYNC_LAST_IN_BATCH;
byteBuffer.putShort(convState.getConnectionObjectId());
byteBuffer.putShort(mainConsumer.getClientSessionId());
byteBuffer.putShort(msgFlags);
byteBuffer.putShort(mainConsumer.getMessageBatchNumber()); // BIT16 Message Batch
// Put the entire message into the buffer in whatever way is suitable
if (messageSlices == null) {
msgLen = byteBuffer.putMessage((JsMessage) sibMessage,
convState.getCommsConnection(),
getConversation());
} else {
msgLen = byteBuffer.putMessgeWithoutEncode(messageSlices);
}
int jfapPriority = JFapChannelConstants.getJFAPPriority(priority);
getConversation().send(byteBuffer,
JFapChannelConstants.SEG_ASYNC_MESSAGE,
0, // No request number
jfapPriority,
false,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e,
CLASS_NAME + ".sendEntireMessage",
CommsConstants.CATASYNCHCONSUMER_SENDENTIREMESS_01,
this);
ok = false;
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "sendEntireMessage", ok);
return ok;
} | [
"private",
"boolean",
"sendEntireMessage",
"(",
"SIBusMessage",
"sibMessage",
",",
"List",
"<",
"DataSlice",
">",
"messageSlices",
",",
"boolean",
"lastMsg",
",",
"Integer",
"priority",
")",
"throws",
"MessageEncodeFailedException",
",",
"IncorrectMessageTypeException",
",",
"MessageCopyFailedException",
",",
"UnsupportedEncodingException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"sendEntireMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"sibMessage",
",",
"messageSlices",
",",
"lastMsg",
",",
"priority",
"}",
")",
";",
"if",
"(",
"lastMsg",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Sending last in batch\"",
")",
";",
"}",
"ConversationState",
"convState",
"=",
"(",
"ConversationState",
")",
"getConversation",
"(",
")",
".",
"getAttachment",
"(",
")",
";",
"// Flag to indicate a Comms error so that we stop sending messages",
"boolean",
"ok",
"=",
"true",
";",
"try",
"{",
"CommsServerByteBuffer",
"byteBuffer",
"=",
"poolManager",
".",
"allocate",
"(",
")",
";",
"int",
"msgLen",
"=",
"0",
";",
"short",
"msgFlags",
"=",
"CommsConstants",
".",
"ASYNC_START_OR_MID_BATCH",
";",
"if",
"(",
"lastMsg",
")",
"msgFlags",
"|=",
"CommsConstants",
".",
"ASYNC_LAST_IN_BATCH",
";",
"byteBuffer",
".",
"putShort",
"(",
"convState",
".",
"getConnectionObjectId",
"(",
")",
")",
";",
"byteBuffer",
".",
"putShort",
"(",
"mainConsumer",
".",
"getClientSessionId",
"(",
")",
")",
";",
"byteBuffer",
".",
"putShort",
"(",
"msgFlags",
")",
";",
"byteBuffer",
".",
"putShort",
"(",
"mainConsumer",
".",
"getMessageBatchNumber",
"(",
")",
")",
";",
"// BIT16 Message Batch",
"// Put the entire message into the buffer in whatever way is suitable",
"if",
"(",
"messageSlices",
"==",
"null",
")",
"{",
"msgLen",
"=",
"byteBuffer",
".",
"putMessage",
"(",
"(",
"JsMessage",
")",
"sibMessage",
",",
"convState",
".",
"getCommsConnection",
"(",
")",
",",
"getConversation",
"(",
")",
")",
";",
"}",
"else",
"{",
"msgLen",
"=",
"byteBuffer",
".",
"putMessgeWithoutEncode",
"(",
"messageSlices",
")",
";",
"}",
"int",
"jfapPriority",
"=",
"JFapChannelConstants",
".",
"getJFAPPriority",
"(",
"priority",
")",
";",
"getConversation",
"(",
")",
".",
"send",
"(",
"byteBuffer",
",",
"JFapChannelConstants",
".",
"SEG_ASYNC_MESSAGE",
",",
"0",
",",
"// No request number",
"jfapPriority",
",",
"false",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".sendEntireMessage\"",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_SENDENTIREMESS_01",
",",
"this",
")",
";",
"ok",
"=",
"false",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2017\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"sendEntireMessage\"",
",",
"ok",
")",
";",
"return",
"ok",
";",
"}"
] | Sends the message in one big buffer. If the messageSlices parameter is not null then
the message has already been encoded and does not need to be done again. This may be in the
case where the message was destined to be sent in chunks but is so small that it does not
seem worth it.
@param sibMessage The entire message to send.
@param messageSlices The already encoded message slices.
@param lastMsg
@param priority
@return Returns true if the message was sent.
@throws MessageEncodeFailedException
@throws IncorrectMessageTypeException
@throws MessageCopyFailedException
@throws UnsupportedEncodingException | [
"Sends",
"the",
"message",
"in",
"one",
"big",
"buffer",
".",
"If",
"the",
"messageSlices",
"parameter",
"is",
"not",
"null",
"then",
"the",
"message",
"has",
"already",
"been",
"encoded",
"and",
"does",
"not",
"need",
"to",
"be",
"done",
"again",
".",
"This",
"may",
"be",
"in",
"the",
"case",
"where",
"the",
"message",
"was",
"destined",
"to",
"be",
"sent",
"in",
"chunks",
"but",
"is",
"so",
"small",
"that",
"it",
"does",
"not",
"seem",
"worth",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java#L845-L910 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java | CATAsynchConsumer.consumerSessionStopped | public void consumerSessionStopped() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "consumerSessionStopped");
// Inform the main consumer instance that message processor has stopped the session, this will prevent any more
// restart requests from the client starting the consumer session by mistake, instead we must wait for a start
// request from the application.
mainConsumer.stopStoppableSession(); //471642
ConversationState convState = (ConversationState) getConversation().getAttachment();
CommsServerByteBuffer buffer = poolManager.allocate();
// Put conversation id
buffer.putShort(convState.getConnectionObjectId());
// Put session id
buffer.putShort(getClientSessionId());
try {
getConversation().send(buffer, JFapChannelConstants.SEG_ASYNC_SESSION_STOPPED_NOREPLY, 0, JFapChannelConstants.PRIORITY_MEDIUM, false, ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e, CLASS_NAME + ".consumerSessionStopped", CommsConstants.CATASYNCHCONSUMER_SENSSION_STOPPED_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "consumerSessionStopped");
} | java | public void consumerSessionStopped() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "consumerSessionStopped");
// Inform the main consumer instance that message processor has stopped the session, this will prevent any more
// restart requests from the client starting the consumer session by mistake, instead we must wait for a start
// request from the application.
mainConsumer.stopStoppableSession(); //471642
ConversationState convState = (ConversationState) getConversation().getAttachment();
CommsServerByteBuffer buffer = poolManager.allocate();
// Put conversation id
buffer.putShort(convState.getConnectionObjectId());
// Put session id
buffer.putShort(getClientSessionId());
try {
getConversation().send(buffer, JFapChannelConstants.SEG_ASYNC_SESSION_STOPPED_NOREPLY, 0, JFapChannelConstants.PRIORITY_MEDIUM, false, ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e) {
FFDCFilter.processException(e, CLASS_NAME + ".consumerSessionStopped", CommsConstants.CATASYNCHCONSUMER_SENSSION_STOPPED_01, this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "consumerSessionStopped");
} | [
"public",
"void",
"consumerSessionStopped",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"consumerSessionStopped\"",
")",
";",
"// Inform the main consumer instance that message processor has stopped the session, this will prevent any more",
"// restart requests from the client starting the consumer session by mistake, instead we must wait for a start",
"// request from the application.",
"mainConsumer",
".",
"stopStoppableSession",
"(",
")",
";",
"//471642",
"ConversationState",
"convState",
"=",
"(",
"ConversationState",
")",
"getConversation",
"(",
")",
".",
"getAttachment",
"(",
")",
";",
"CommsServerByteBuffer",
"buffer",
"=",
"poolManager",
".",
"allocate",
"(",
")",
";",
"// Put conversation id",
"buffer",
".",
"putShort",
"(",
"convState",
".",
"getConnectionObjectId",
"(",
")",
")",
";",
"// Put session id",
"buffer",
".",
"putShort",
"(",
"getClientSessionId",
"(",
")",
")",
";",
"try",
"{",
"getConversation",
"(",
")",
".",
"send",
"(",
"buffer",
",",
"JFapChannelConstants",
".",
"SEG_ASYNC_SESSION_STOPPED_NOREPLY",
",",
"0",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"false",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SIException",
"e",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"CLASS_NAME",
"+",
"\".consumerSessionStopped\"",
",",
"CommsConstants",
".",
"CATASYNCHCONSUMER_SENSSION_STOPPED_01",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"COMMUNICATION_ERROR_SICO2017\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"consumerSessionStopped\"",
")",
";",
"}"
] | Method called when the asynchronous consumer has been stopped duee to the maxSequentialFailures threshold being reached
@param lme | [
"Method",
"called",
"when",
"the",
"asynchronous",
"consumer",
"has",
"been",
"stopped",
"duee",
"to",
"the",
"maxSequentialFailures",
"threshold",
"being",
"reached"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java#L1092-L1123 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceProcessor.java | ResourceProcessor.checkObjectFactoryAttributes | private void checkObjectFactoryAttributes(ResourceInjectionBinding resourceBinding,
ObjectFactoryInfo extensionFactory) // d675976
throws InjectionConfigurationException
{
Resource resourceAnnotation = resourceBinding.getAnnotation();
if (!extensionFactory.isAttributeAllowed("authenticationType"))
{
checkObjectFactoryAttribute(resourceBinding, "authenticationType",
resourceAnnotation.authenticationType(), AuthenticationType.CONTAINER);
}
if (!extensionFactory.isAttributeAllowed("shareable"))
{
checkObjectFactoryAttribute(resourceBinding, "shareable",
resourceAnnotation.shareable(), true);
}
} | java | private void checkObjectFactoryAttributes(ResourceInjectionBinding resourceBinding,
ObjectFactoryInfo extensionFactory) // d675976
throws InjectionConfigurationException
{
Resource resourceAnnotation = resourceBinding.getAnnotation();
if (!extensionFactory.isAttributeAllowed("authenticationType"))
{
checkObjectFactoryAttribute(resourceBinding, "authenticationType",
resourceAnnotation.authenticationType(), AuthenticationType.CONTAINER);
}
if (!extensionFactory.isAttributeAllowed("shareable"))
{
checkObjectFactoryAttribute(resourceBinding, "shareable",
resourceAnnotation.shareable(), true);
}
} | [
"private",
"void",
"checkObjectFactoryAttributes",
"(",
"ResourceInjectionBinding",
"resourceBinding",
",",
"ObjectFactoryInfo",
"extensionFactory",
")",
"// d675976",
"throws",
"InjectionConfigurationException",
"{",
"Resource",
"resourceAnnotation",
"=",
"resourceBinding",
".",
"getAnnotation",
"(",
")",
";",
"if",
"(",
"!",
"extensionFactory",
".",
"isAttributeAllowed",
"(",
"\"authenticationType\"",
")",
")",
"{",
"checkObjectFactoryAttribute",
"(",
"resourceBinding",
",",
"\"authenticationType\"",
",",
"resourceAnnotation",
".",
"authenticationType",
"(",
")",
",",
"AuthenticationType",
".",
"CONTAINER",
")",
";",
"}",
"if",
"(",
"!",
"extensionFactory",
".",
"isAttributeAllowed",
"(",
"\"shareable\"",
")",
")",
"{",
"checkObjectFactoryAttribute",
"(",
"resourceBinding",
",",
"\"shareable\"",
",",
"resourceAnnotation",
".",
"shareable",
"(",
")",
",",
"true",
")",
";",
"}",
"}"
] | Check attributes for registered ObjectFactory's.
@param resourceBinding
@param extensionFactory
@throws InjectionConfigurationException | [
"Check",
"attributes",
"for",
"registered",
"ObjectFactory",
"s",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceProcessor.java#L872-L889 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceProcessor.java | ResourceProcessor.createExtensionFactoryReference | private Reference createExtensionFactoryReference(ObjectFactoryInfo extensionFactory,
ResourceInjectionBinding resourceBinding) // F48603.9
{
String className = extensionFactory.getObjectFactoryClass().getName();
Reference ref = new Reference(resourceBinding.getInjectionClassTypeName(), className, null);
if (extensionFactory.isRefAddrNeeded()) // F48603
{
ref.add(new ResourceInfoRefAddr(createResourceInfo(resourceBinding)));
}
return ref;
} | java | private Reference createExtensionFactoryReference(ObjectFactoryInfo extensionFactory,
ResourceInjectionBinding resourceBinding) // F48603.9
{
String className = extensionFactory.getObjectFactoryClass().getName();
Reference ref = new Reference(resourceBinding.getInjectionClassTypeName(), className, null);
if (extensionFactory.isRefAddrNeeded()) // F48603
{
ref.add(new ResourceInfoRefAddr(createResourceInfo(resourceBinding)));
}
return ref;
} | [
"private",
"Reference",
"createExtensionFactoryReference",
"(",
"ObjectFactoryInfo",
"extensionFactory",
",",
"ResourceInjectionBinding",
"resourceBinding",
")",
"// F48603.9",
"{",
"String",
"className",
"=",
"extensionFactory",
".",
"getObjectFactoryClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"Reference",
"ref",
"=",
"new",
"Reference",
"(",
"resourceBinding",
".",
"getInjectionClassTypeName",
"(",
")",
",",
"className",
",",
"null",
")",
";",
"if",
"(",
"extensionFactory",
".",
"isRefAddrNeeded",
"(",
")",
")",
"// F48603",
"{",
"ref",
".",
"add",
"(",
"new",
"ResourceInfoRefAddr",
"(",
"createResourceInfo",
"(",
"resourceBinding",
")",
")",
")",
";",
"}",
"return",
"ref",
";",
"}"
] | Creates a Reference for a binding from a registered ObjectFactory.
@param extensionFactory the object factory info
@param resourceBinding the resource binding
@return the reference | [
"Creates",
"a",
"Reference",
"for",
"a",
"binding",
"from",
"a",
"registered",
"ObjectFactory",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceProcessor.java#L928-L940 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceProcessor.java | ResourceProcessor.createResourceInfo | private ResourceInfo createResourceInfo(ResourceInjectionBinding resourceBinding) // F48603.9
{
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
Resource resourceAnnotation = resourceBinding.getAnnotation();
return new ResourceInfo(j2eeName == null ? null : j2eeName.getApplication(),
j2eeName == null ? null : j2eeName.getModule(),
// TODO: This should be j2eeName.getComponent(), but at least
// SIP is known to improperly depend on this being the module
// name without ".war".
ivNameSpaceConfig.getDisplayName(),
resourceBinding.getJndiName(),
resourceBinding.getInjectionClassTypeName(),
resourceAnnotation.authenticationType(),
resourceAnnotation.shareable(),
resourceBinding.ivLink,
getResourceRefConfig(resourceBinding, resourceBinding.getJndiName(), null));
} | java | private ResourceInfo createResourceInfo(ResourceInjectionBinding resourceBinding) // F48603.9
{
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
Resource resourceAnnotation = resourceBinding.getAnnotation();
return new ResourceInfo(j2eeName == null ? null : j2eeName.getApplication(),
j2eeName == null ? null : j2eeName.getModule(),
// TODO: This should be j2eeName.getComponent(), but at least
// SIP is known to improperly depend on this being the module
// name without ".war".
ivNameSpaceConfig.getDisplayName(),
resourceBinding.getJndiName(),
resourceBinding.getInjectionClassTypeName(),
resourceAnnotation.authenticationType(),
resourceAnnotation.shareable(),
resourceBinding.ivLink,
getResourceRefConfig(resourceBinding, resourceBinding.getJndiName(), null));
} | [
"private",
"ResourceInfo",
"createResourceInfo",
"(",
"ResourceInjectionBinding",
"resourceBinding",
")",
"// F48603.9",
"{",
"J2EEName",
"j2eeName",
"=",
"ivNameSpaceConfig",
".",
"getJ2EEName",
"(",
")",
";",
"Resource",
"resourceAnnotation",
"=",
"resourceBinding",
".",
"getAnnotation",
"(",
")",
";",
"return",
"new",
"ResourceInfo",
"(",
"j2eeName",
"==",
"null",
"?",
"null",
":",
"j2eeName",
".",
"getApplication",
"(",
")",
",",
"j2eeName",
"==",
"null",
"?",
"null",
":",
"j2eeName",
".",
"getModule",
"(",
")",
",",
"// TODO: This should be j2eeName.getComponent(), but at least",
"// SIP is known to improperly depend on this being the module",
"// name without \".war\".",
"ivNameSpaceConfig",
".",
"getDisplayName",
"(",
")",
",",
"resourceBinding",
".",
"getJndiName",
"(",
")",
",",
"resourceBinding",
".",
"getInjectionClassTypeName",
"(",
")",
",",
"resourceAnnotation",
".",
"authenticationType",
"(",
")",
",",
"resourceAnnotation",
".",
"shareable",
"(",
")",
",",
"resourceBinding",
".",
"ivLink",
",",
"getResourceRefConfig",
"(",
"resourceBinding",
",",
"resourceBinding",
".",
"getJndiName",
"(",
")",
",",
"null",
")",
")",
";",
"}"
] | Creates a ResourceInfo for a binding.
@param resourceBinding the binding
@return the info | [
"Creates",
"a",
"ResourceInfo",
"for",
"a",
"binding",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceProcessor.java#L948-L965 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java | HttpsURLConnectionFactory.createConnection | public HttpURLConnection createConnection(TLSClientParameters tlsClientParameters,
Proxy proxy, URL url) throws IOException {
HttpURLConnection connection = (HttpURLConnection) (proxy != null ? url.openConnection(proxy) : url.openConnection());
if (HTTPS_URL_PROTOCOL_ID.equals(url.getProtocol())) {
if (tlsClientParameters == null) {
tlsClientParameters = new TLSClientParameters();
}
Exception ex = null;
try {
decorateWithTLS(tlsClientParameters, connection);
} catch (Exception e) {
ex = e;
} finally {
if (ex != null) {
if (ex instanceof IOException) {
throw (IOException) ex;
}
// use exception.initCause(ex) to be java 5 compatible
IOException ioException = new IOException("Error while initializing secure socket");
ioException.initCause(ex);
throw ioException;
}
}
}
return connection;
} | java | public HttpURLConnection createConnection(TLSClientParameters tlsClientParameters,
Proxy proxy, URL url) throws IOException {
HttpURLConnection connection = (HttpURLConnection) (proxy != null ? url.openConnection(proxy) : url.openConnection());
if (HTTPS_URL_PROTOCOL_ID.equals(url.getProtocol())) {
if (tlsClientParameters == null) {
tlsClientParameters = new TLSClientParameters();
}
Exception ex = null;
try {
decorateWithTLS(tlsClientParameters, connection);
} catch (Exception e) {
ex = e;
} finally {
if (ex != null) {
if (ex instanceof IOException) {
throw (IOException) ex;
}
// use exception.initCause(ex) to be java 5 compatible
IOException ioException = new IOException("Error while initializing secure socket");
ioException.initCause(ex);
throw ioException;
}
}
}
return connection;
} | [
"public",
"HttpURLConnection",
"createConnection",
"(",
"TLSClientParameters",
"tlsClientParameters",
",",
"Proxy",
"proxy",
",",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"connection",
"=",
"(",
"HttpURLConnection",
")",
"(",
"proxy",
"!=",
"null",
"?",
"url",
".",
"openConnection",
"(",
"proxy",
")",
":",
"url",
".",
"openConnection",
"(",
")",
")",
";",
"if",
"(",
"HTTPS_URL_PROTOCOL_ID",
".",
"equals",
"(",
"url",
".",
"getProtocol",
"(",
")",
")",
")",
"{",
"if",
"(",
"tlsClientParameters",
"==",
"null",
")",
"{",
"tlsClientParameters",
"=",
"new",
"TLSClientParameters",
"(",
")",
";",
"}",
"Exception",
"ex",
"=",
"null",
";",
"try",
"{",
"decorateWithTLS",
"(",
"tlsClientParameters",
",",
"connection",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"ex",
"=",
"e",
";",
"}",
"finally",
"{",
"if",
"(",
"ex",
"!=",
"null",
")",
"{",
"if",
"(",
"ex",
"instanceof",
"IOException",
")",
"{",
"throw",
"(",
"IOException",
")",
"ex",
";",
"}",
"// use exception.initCause(ex) to be java 5 compatible",
"IOException",
"ioException",
"=",
"new",
"IOException",
"(",
"\"Error while initializing secure socket\"",
")",
";",
"ioException",
".",
"initCause",
"(",
"ex",
")",
";",
"throw",
"ioException",
";",
"}",
"}",
"}",
"return",
"connection",
";",
"}"
] | Create a HttpURLConnection, proxified if necessary.
@param proxy This parameter is non-null if connection should be proxied.
@param url The target URL. This parameter must be an https url.
@return The HttpsURLConnection for the given URL.
@throws IOException This exception is thrown if
the "url" is not "https" or other IOException
is thrown. | [
"Create",
"a",
"HttpURLConnection",
"proxified",
"if",
"necessary",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java#L88-L117 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/util/ReaderUtils.java | ReaderUtils.collectConstructorParameters | public static List<Parameter> collectConstructorParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes) {
if (cls.isLocalClass() || (cls.isMemberClass() && !Modifier.isStatic(cls.getModifiers()))) {
return Collections.emptyList();
}
List<Parameter> selected = Collections.emptyList();
int maxParamsCount = 0;
for (Constructor<?> constructor : cls.getDeclaredConstructors()) {
if (!ReflectionUtils.isConstructorCompatible(constructor)
&& !ReflectionUtils.isInject(Arrays.asList(constructor.getDeclaredAnnotations()))) {
continue;
}
final Type[] genericParameterTypes = constructor.getGenericParameterTypes();
final Annotation[][] annotations = constructor.getParameterAnnotations();
int paramsCount = 0;
final List<Parameter> parameters = new ArrayList<Parameter>();
for (int i = 0; i < genericParameterTypes.length; i++) {
final List<Annotation> tmpAnnotations = Arrays.asList(annotations[i]);
if (isContext(tmpAnnotations)) {
paramsCount++;
} else {
final Type genericParameterType = genericParameterTypes[i];
final List<Parameter> tmpParameters = collectParameters(genericParameterType, tmpAnnotations, components, classConsumes);
if (tmpParameters.size() >= 1) {
for (Parameter tmpParameter : tmpParameters) {
if (ParameterProcessor.applyAnnotations(
tmpParameter,
genericParameterType,
tmpAnnotations,
components,
classConsumes == null ? new String[0] : classConsumes.value(),
null) != null) {
parameters.add(tmpParameter);
}
}
paramsCount++;
}
}
}
if (paramsCount >= maxParamsCount) {
maxParamsCount = paramsCount;
selected = parameters;
}
}
return selected;
} | java | public static List<Parameter> collectConstructorParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes) {
if (cls.isLocalClass() || (cls.isMemberClass() && !Modifier.isStatic(cls.getModifiers()))) {
return Collections.emptyList();
}
List<Parameter> selected = Collections.emptyList();
int maxParamsCount = 0;
for (Constructor<?> constructor : cls.getDeclaredConstructors()) {
if (!ReflectionUtils.isConstructorCompatible(constructor)
&& !ReflectionUtils.isInject(Arrays.asList(constructor.getDeclaredAnnotations()))) {
continue;
}
final Type[] genericParameterTypes = constructor.getGenericParameterTypes();
final Annotation[][] annotations = constructor.getParameterAnnotations();
int paramsCount = 0;
final List<Parameter> parameters = new ArrayList<Parameter>();
for (int i = 0; i < genericParameterTypes.length; i++) {
final List<Annotation> tmpAnnotations = Arrays.asList(annotations[i]);
if (isContext(tmpAnnotations)) {
paramsCount++;
} else {
final Type genericParameterType = genericParameterTypes[i];
final List<Parameter> tmpParameters = collectParameters(genericParameterType, tmpAnnotations, components, classConsumes);
if (tmpParameters.size() >= 1) {
for (Parameter tmpParameter : tmpParameters) {
if (ParameterProcessor.applyAnnotations(
tmpParameter,
genericParameterType,
tmpAnnotations,
components,
classConsumes == null ? new String[0] : classConsumes.value(),
null) != null) {
parameters.add(tmpParameter);
}
}
paramsCount++;
}
}
}
if (paramsCount >= maxParamsCount) {
maxParamsCount = paramsCount;
selected = parameters;
}
}
return selected;
} | [
"public",
"static",
"List",
"<",
"Parameter",
">",
"collectConstructorParameters",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Components",
"components",
",",
"javax",
".",
"ws",
".",
"rs",
".",
"Consumes",
"classConsumes",
")",
"{",
"if",
"(",
"cls",
".",
"isLocalClass",
"(",
")",
"||",
"(",
"cls",
".",
"isMemberClass",
"(",
")",
"&&",
"!",
"Modifier",
".",
"isStatic",
"(",
"cls",
".",
"getModifiers",
"(",
")",
")",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"Parameter",
">",
"selected",
"=",
"Collections",
".",
"emptyList",
"(",
")",
";",
"int",
"maxParamsCount",
"=",
"0",
";",
"for",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
":",
"cls",
".",
"getDeclaredConstructors",
"(",
")",
")",
"{",
"if",
"(",
"!",
"ReflectionUtils",
".",
"isConstructorCompatible",
"(",
"constructor",
")",
"&&",
"!",
"ReflectionUtils",
".",
"isInject",
"(",
"Arrays",
".",
"asList",
"(",
"constructor",
".",
"getDeclaredAnnotations",
"(",
")",
")",
")",
")",
"{",
"continue",
";",
"}",
"final",
"Type",
"[",
"]",
"genericParameterTypes",
"=",
"constructor",
".",
"getGenericParameterTypes",
"(",
")",
";",
"final",
"Annotation",
"[",
"]",
"[",
"]",
"annotations",
"=",
"constructor",
".",
"getParameterAnnotations",
"(",
")",
";",
"int",
"paramsCount",
"=",
"0",
";",
"final",
"List",
"<",
"Parameter",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"Parameter",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"genericParameterTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"List",
"<",
"Annotation",
">",
"tmpAnnotations",
"=",
"Arrays",
".",
"asList",
"(",
"annotations",
"[",
"i",
"]",
")",
";",
"if",
"(",
"isContext",
"(",
"tmpAnnotations",
")",
")",
"{",
"paramsCount",
"++",
";",
"}",
"else",
"{",
"final",
"Type",
"genericParameterType",
"=",
"genericParameterTypes",
"[",
"i",
"]",
";",
"final",
"List",
"<",
"Parameter",
">",
"tmpParameters",
"=",
"collectParameters",
"(",
"genericParameterType",
",",
"tmpAnnotations",
",",
"components",
",",
"classConsumes",
")",
";",
"if",
"(",
"tmpParameters",
".",
"size",
"(",
")",
">=",
"1",
")",
"{",
"for",
"(",
"Parameter",
"tmpParameter",
":",
"tmpParameters",
")",
"{",
"if",
"(",
"ParameterProcessor",
".",
"applyAnnotations",
"(",
"tmpParameter",
",",
"genericParameterType",
",",
"tmpAnnotations",
",",
"components",
",",
"classConsumes",
"==",
"null",
"?",
"new",
"String",
"[",
"0",
"]",
":",
"classConsumes",
".",
"value",
"(",
")",
",",
"null",
")",
"!=",
"null",
")",
"{",
"parameters",
".",
"add",
"(",
"tmpParameter",
")",
";",
"}",
"}",
"paramsCount",
"++",
";",
"}",
"}",
"}",
"if",
"(",
"paramsCount",
">=",
"maxParamsCount",
")",
"{",
"maxParamsCount",
"=",
"paramsCount",
";",
"selected",
"=",
"parameters",
";",
"}",
"}",
"return",
"selected",
";",
"}"
] | Collects constructor-level parameters from class.
@param cls is a class for collecting
@param components
@return the collection of supported parameters | [
"Collects",
"constructor",
"-",
"level",
"parameters",
"from",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/util/ReaderUtils.java#L49-L99 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/util/ReaderUtils.java | ReaderUtils.collectFieldParameters | public static List<Parameter> collectFieldParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes) {
final List<Parameter> parameters = new ArrayList<Parameter>();
for (Field field : ReflectionUtils.getDeclaredFields(cls)) {
final List<Annotation> annotations = Arrays.asList(field.getAnnotations());
final Type genericType = field.getGenericType();
parameters.addAll(collectParameters(genericType, annotations, components, classConsumes));
}
return parameters;
} | java | public static List<Parameter> collectFieldParameters(Class<?> cls, Components components, javax.ws.rs.Consumes classConsumes) {
final List<Parameter> parameters = new ArrayList<Parameter>();
for (Field field : ReflectionUtils.getDeclaredFields(cls)) {
final List<Annotation> annotations = Arrays.asList(field.getAnnotations());
final Type genericType = field.getGenericType();
parameters.addAll(collectParameters(genericType, annotations, components, classConsumes));
}
return parameters;
} | [
"public",
"static",
"List",
"<",
"Parameter",
">",
"collectFieldParameters",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Components",
"components",
",",
"javax",
".",
"ws",
".",
"rs",
".",
"Consumes",
"classConsumes",
")",
"{",
"final",
"List",
"<",
"Parameter",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"Parameter",
">",
"(",
")",
";",
"for",
"(",
"Field",
"field",
":",
"ReflectionUtils",
".",
"getDeclaredFields",
"(",
"cls",
")",
")",
"{",
"final",
"List",
"<",
"Annotation",
">",
"annotations",
"=",
"Arrays",
".",
"asList",
"(",
"field",
".",
"getAnnotations",
"(",
")",
")",
";",
"final",
"Type",
"genericType",
"=",
"field",
".",
"getGenericType",
"(",
")",
";",
"parameters",
".",
"addAll",
"(",
"collectParameters",
"(",
"genericType",
",",
"annotations",
",",
"components",
",",
"classConsumes",
")",
")",
";",
"}",
"return",
"parameters",
";",
"}"
] | Collects field-level parameters from class.
@param cls is a class for collecting
@param components
@return the collection of supported parameters | [
"Collects",
"field",
"-",
"level",
"parameters",
"from",
"class",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/util/ReaderUtils.java#L108-L116 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/util/ReaderUtils.java | ReaderUtils.splitContentValues | public static String[] splitContentValues(String[] strings) {
final Set<String> result = new LinkedHashSet<String>();
for (String string : strings) {
if (string.isEmpty())
continue;
String[] splitted = string.trim().split(",");
for (String string2 : splitted) {
result.add(string2);
}
}
return result.toArray(new String[result.size()]);
} | java | public static String[] splitContentValues(String[] strings) {
final Set<String> result = new LinkedHashSet<String>();
for (String string : strings) {
if (string.isEmpty())
continue;
String[] splitted = string.trim().split(",");
for (String string2 : splitted) {
result.add(string2);
}
}
return result.toArray(new String[result.size()]);
} | [
"public",
"static",
"String",
"[",
"]",
"splitContentValues",
"(",
"String",
"[",
"]",
"strings",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"LinkedHashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"string",
":",
"strings",
")",
"{",
"if",
"(",
"string",
".",
"isEmpty",
"(",
")",
")",
"continue",
";",
"String",
"[",
"]",
"splitted",
"=",
"string",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"String",
"string2",
":",
"splitted",
")",
"{",
"result",
".",
"add",
"(",
"string2",
")",
";",
"}",
"}",
"return",
"result",
".",
"toArray",
"(",
"new",
"String",
"[",
"result",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | Splits the provided array of strings into an array, using comma as the separator.
Also removes leading and trailing whitespace and omits empty strings from the results.
@param strings is the provided array of strings
@return the resulted array of strings | [
"Splits",
"the",
"provided",
"array",
"of",
"strings",
"into",
"an",
"array",
"using",
"comma",
"as",
"the",
"separator",
".",
"Also",
"removes",
"leading",
"and",
"trailing",
"whitespace",
"and",
"omits",
"empty",
"strings",
"from",
"the",
"results",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/jaxrs2/util/ReaderUtils.java#L140-L152 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaUtils.java | SibRaUtils.objectsNotEqual | public static boolean objectsNotEqual(final Object one, final Object two) {
return (one == null) ? (two != null) : (!one.equals(two));
} | java | public static boolean objectsNotEqual(final Object one, final Object two) {
return (one == null) ? (two != null) : (!one.equals(two));
} | [
"public",
"static",
"boolean",
"objectsNotEqual",
"(",
"final",
"Object",
"one",
",",
"final",
"Object",
"two",
")",
"{",
"return",
"(",
"one",
"==",
"null",
")",
"?",
"(",
"two",
"!=",
"null",
")",
":",
"(",
"!",
"one",
".",
"equals",
"(",
"two",
")",
")",
";",
"}"
] | Compares two objects for equality.
@param one
the first object
@param two
the second object
@return <code>true</code> if the two objects are <b>not </b> equal,
othewise <code>false</code> | [
"Compares",
"two",
"objects",
"for",
"equality",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaUtils.java#L82-L86 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaUtils.java | SibRaUtils.addFieldToString | public static void addFieldToString(final StringBuffer buffer,
final String name, final Object value) {
buffer.append(" <");
buffer.append(name);
buffer.append("=");
buffer.append(value);
buffer.append(">");
} | java | public static void addFieldToString(final StringBuffer buffer,
final String name, final Object value) {
buffer.append(" <");
buffer.append(name);
buffer.append("=");
buffer.append(value);
buffer.append(">");
} | [
"public",
"static",
"void",
"addFieldToString",
"(",
"final",
"StringBuffer",
"buffer",
",",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"buffer",
".",
"append",
"(",
"\" <\"",
")",
";",
"buffer",
".",
"append",
"(",
"name",
")",
";",
"buffer",
".",
"append",
"(",
"\"=\"",
")",
";",
"buffer",
".",
"append",
"(",
"value",
")",
";",
"buffer",
".",
"append",
"(",
"\">\"",
")",
";",
"}"
] | Adds a string representation of the given field to the buffer.
@param buffer
the buffer
@param name
the name of the field
@param value
the value of the field | [
"Adds",
"a",
"string",
"representation",
"of",
"the",
"given",
"field",
"to",
"the",
"buffer",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaUtils.java#L175-L184 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaUtils.java | SibRaUtils.addPasswordFieldToString | public static void addPasswordFieldToString(final StringBuffer buffer,
final String name, final Object value) {
addFieldToString(buffer, name, (value == null) ? null : "*****");
} | java | public static void addPasswordFieldToString(final StringBuffer buffer,
final String name, final Object value) {
addFieldToString(buffer, name, (value == null) ? null : "*****");
} | [
"public",
"static",
"void",
"addPasswordFieldToString",
"(",
"final",
"StringBuffer",
"buffer",
",",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"addFieldToString",
"(",
"buffer",
",",
"name",
",",
"(",
"value",
"==",
"null",
")",
"?",
"null",
":",
"\"*****\"",
")",
";",
"}"
] | Adds a string representation of the given password to the buffer. This
will contain a row of asterisks if the password is non-null.
@param buffer
the buffer
@param name
the name of the field
@param value
the value of the field | [
"Adds",
"a",
"string",
"representation",
"of",
"the",
"given",
"password",
"to",
"the",
"buffer",
".",
"This",
"will",
"contain",
"a",
"row",
"of",
"asterisks",
"if",
"the",
"password",
"is",
"non",
"-",
"null",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaUtils.java#L218-L223 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/runtime/HttpJspBase.java | HttpJspBase.service | public final void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
_jspService(request, response);
} | java | public final void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
_jspService(request, response);
} | [
"public",
"final",
"void",
"service",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"_jspService",
"(",
"request",
",",
"response",
")",
";",
"}"
] | Entry point into service. | [
"Entry",
"point",
"into",
"service",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/runtime/HttpJspBase.java#L98-L101 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java | LongObjectHashMap.put | public Object put(long key, Object value)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "put", new Object[]{new Long(key), value, this});
if (value == null)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "put", "IllegalArgumentException");
throw new IllegalArgumentException("Null is not a permitted value.");
}
// Find an empty bucket for the new value or
// a bucket the contains an entry with the
// same key.
int hash = getHashForNewEntry(key);
// Store the value previously held in the bucket
// mapping DELETED to null so that it
// can be returned to the caller.
Object previous = _values[hash] == DELETED ? null : _values[hash];
// Add the new value and key to the map.
_values[hash] = value;
_keys[hash] = key;
if (previous == null)
{
// This put resulted in a new entry being added to
// the map rather than an existing entry being
// updated. Increment the count of objects in the
// map and rehash if necessary.
_currentLoad++;
if (_currentLoad == _resizeThreshold)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "put", new Object[]{new Long(key), value, this});
// The current load of the map means that it
// has reached the desired loadFactor. Increase
// the size of the map and rehash all the entries.
// Take a copy of the map's contents so that we
// can add them back in once it's been resized.
long[] oldKeys = new long[_mapSize];
Object[] oldValues = new Object[_mapSize];
System.arraycopy(_keys, 0, oldKeys, 0, oldKeys.length);
System.arraycopy(_values, 0, oldValues, 0, oldValues.length);
// We know that the inital size of the map
// is a power of 2 so, by doubling it, we
// can increase the map's capacity and
// still be sure that it's size is a power
// of two.
_mapSize = (_mapSize * 2);
if (tc.isDebugEnabled()) Tr.debug(tc, "mapSize = " + _mapSize);
_resizeThreshold = (int)(((float)_mapSize) * ((float)_loadFactor) / 100f);
if (tc.isDebugEnabled()) Tr.debug(tc, "resizeThreshold = " + _resizeThreshold);
_values = new Object[_mapSize];
_keys = new long[_mapSize];
// Zero the count of objects in the map. This will
// be incremented to the correct value as the
// entries are added back into the resized map
// below.
_currentLoad = 0;
// Loop through the old values adding live
// entries back into the map.
for (int i = 0; i < oldValues.length; i++)
{
Object oldValue = oldValues[i];
if (oldValue != null && oldValue != DELETED)
{
put(oldKeys[i], oldValue);
}
}
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "put", previous);
return previous;
} | java | public Object put(long key, Object value)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "put", new Object[]{new Long(key), value, this});
if (value == null)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "put", "IllegalArgumentException");
throw new IllegalArgumentException("Null is not a permitted value.");
}
// Find an empty bucket for the new value or
// a bucket the contains an entry with the
// same key.
int hash = getHashForNewEntry(key);
// Store the value previously held in the bucket
// mapping DELETED to null so that it
// can be returned to the caller.
Object previous = _values[hash] == DELETED ? null : _values[hash];
// Add the new value and key to the map.
_values[hash] = value;
_keys[hash] = key;
if (previous == null)
{
// This put resulted in a new entry being added to
// the map rather than an existing entry being
// updated. Increment the count of objects in the
// map and rehash if necessary.
_currentLoad++;
if (_currentLoad == _resizeThreshold)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "put", new Object[]{new Long(key), value, this});
// The current load of the map means that it
// has reached the desired loadFactor. Increase
// the size of the map and rehash all the entries.
// Take a copy of the map's contents so that we
// can add them back in once it's been resized.
long[] oldKeys = new long[_mapSize];
Object[] oldValues = new Object[_mapSize];
System.arraycopy(_keys, 0, oldKeys, 0, oldKeys.length);
System.arraycopy(_values, 0, oldValues, 0, oldValues.length);
// We know that the inital size of the map
// is a power of 2 so, by doubling it, we
// can increase the map's capacity and
// still be sure that it's size is a power
// of two.
_mapSize = (_mapSize * 2);
if (tc.isDebugEnabled()) Tr.debug(tc, "mapSize = " + _mapSize);
_resizeThreshold = (int)(((float)_mapSize) * ((float)_loadFactor) / 100f);
if (tc.isDebugEnabled()) Tr.debug(tc, "resizeThreshold = " + _resizeThreshold);
_values = new Object[_mapSize];
_keys = new long[_mapSize];
// Zero the count of objects in the map. This will
// be incremented to the correct value as the
// entries are added back into the resized map
// below.
_currentLoad = 0;
// Loop through the old values adding live
// entries back into the map.
for (int i = 0; i < oldValues.length; i++)
{
Object oldValue = oldValues[i];
if (oldValue != null && oldValue != DELETED)
{
put(oldKeys[i], oldValue);
}
}
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "put", previous);
return previous;
} | [
"public",
"Object",
"put",
"(",
"long",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"put\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"key",
")",
",",
"value",
",",
"this",
"}",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"put\"",
",",
"\"IllegalArgumentException\"",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null is not a permitted value.\"",
")",
";",
"}",
"// Find an empty bucket for the new value or",
"// a bucket the contains an entry with the",
"// same key.",
"int",
"hash",
"=",
"getHashForNewEntry",
"(",
"key",
")",
";",
"// Store the value previously held in the bucket",
"// mapping DELETED to null so that it",
"// can be returned to the caller.",
"Object",
"previous",
"=",
"_values",
"[",
"hash",
"]",
"==",
"DELETED",
"?",
"null",
":",
"_values",
"[",
"hash",
"]",
";",
"// Add the new value and key to the map.",
"_values",
"[",
"hash",
"]",
"=",
"value",
";",
"_keys",
"[",
"hash",
"]",
"=",
"key",
";",
"if",
"(",
"previous",
"==",
"null",
")",
"{",
"// This put resulted in a new entry being added to",
"// the map rather than an existing entry being",
"// updated. Increment the count of objects in the",
"// map and rehash if necessary.",
"_currentLoad",
"++",
";",
"if",
"(",
"_currentLoad",
"==",
"_resizeThreshold",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"put\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"key",
")",
",",
"value",
",",
"this",
"}",
")",
";",
"// The current load of the map means that it",
"// has reached the desired loadFactor. Increase",
"// the size of the map and rehash all the entries.",
"// Take a copy of the map's contents so that we",
"// can add them back in once it's been resized.",
"long",
"[",
"]",
"oldKeys",
"=",
"new",
"long",
"[",
"_mapSize",
"]",
";",
"Object",
"[",
"]",
"oldValues",
"=",
"new",
"Object",
"[",
"_mapSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"_keys",
",",
"0",
",",
"oldKeys",
",",
"0",
",",
"oldKeys",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"_values",
",",
"0",
",",
"oldValues",
",",
"0",
",",
"oldValues",
".",
"length",
")",
";",
"// We know that the inital size of the map",
"// is a power of 2 so, by doubling it, we",
"// can increase the map's capacity and ",
"// still be sure that it's size is a power",
"// of two.",
"_mapSize",
"=",
"(",
"_mapSize",
"*",
"2",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"mapSize = \"",
"+",
"_mapSize",
")",
";",
"_resizeThreshold",
"=",
"(",
"int",
")",
"(",
"(",
"(",
"float",
")",
"_mapSize",
")",
"*",
"(",
"(",
"float",
")",
"_loadFactor",
")",
"/",
"100f",
")",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"resizeThreshold = \"",
"+",
"_resizeThreshold",
")",
";",
"_values",
"=",
"new",
"Object",
"[",
"_mapSize",
"]",
";",
"_keys",
"=",
"new",
"long",
"[",
"_mapSize",
"]",
";",
"// Zero the count of objects in the map. This will",
"// be incremented to the correct value as the",
"// entries are added back into the resized map",
"// below.",
"_currentLoad",
"=",
"0",
";",
"// Loop through the old values adding live",
"// entries back into the map.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"oldValues",
".",
"length",
";",
"i",
"++",
")",
"{",
"Object",
"oldValue",
"=",
"oldValues",
"[",
"i",
"]",
";",
"if",
"(",
"oldValue",
"!=",
"null",
"&&",
"oldValue",
"!=",
"DELETED",
")",
"{",
"put",
"(",
"oldKeys",
"[",
"i",
"]",
",",
"oldValue",
")",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"put\"",
",",
"previous",
")",
";",
"return",
"previous",
";",
"}"
] | Store the given value in the map, associating it with the given key. If the
map already contains an entry associated with the given key that entry will
be replaced.
@param key The key to associate with the entry
@param value The entry to be associated with the key
@return The entry replaced by this put operation, or null if no entry was replaced.
Null can also be returned if the given key was previously associated with a null value. | [
"Store",
"the",
"given",
"value",
"in",
"the",
"map",
"associating",
"it",
"with",
"the",
"given",
"key",
".",
"If",
"the",
"map",
"already",
"contains",
"an",
"entry",
"associated",
"with",
"the",
"given",
"key",
"that",
"entry",
"will",
"be",
"replaced",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java#L145-L230 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java | LongObjectHashMap.remove | public Object remove(long key)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "remove", new Object[]{new Long(key), this});
int hash = getHashForExistingEntry(key);
Object result = null;
if (hash >= 0)
{
result = _values[hash];
}
if (result != null)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Entry found in map - removing");
_values[hash] = DELETED;
_currentLoad--;
}
if (tc.isEntryEnabled()) Tr.exit(tc, "remove", result);
return result;
} | java | public Object remove(long key)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "remove", new Object[]{new Long(key), this});
int hash = getHashForExistingEntry(key);
Object result = null;
if (hash >= 0)
{
result = _values[hash];
}
if (result != null)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Entry found in map - removing");
_values[hash] = DELETED;
_currentLoad--;
}
if (tc.isEntryEnabled()) Tr.exit(tc, "remove", result);
return result;
} | [
"public",
"Object",
"remove",
"(",
"long",
"key",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"remove\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"key",
")",
",",
"this",
"}",
")",
";",
"int",
"hash",
"=",
"getHashForExistingEntry",
"(",
"key",
")",
";",
"Object",
"result",
"=",
"null",
";",
"if",
"(",
"hash",
">=",
"0",
")",
"{",
"result",
"=",
"_values",
"[",
"hash",
"]",
";",
"}",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"Entry found in map - removing\"",
")",
";",
"_values",
"[",
"hash",
"]",
"=",
"DELETED",
";",
"_currentLoad",
"--",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"remove\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Remove the entry from the map that is associated with
the given key.
@param key The key associated with the object that is to be removed
@return The object that has been removed from the map, or null if no object was removed.
Null can also be returned if the given key was previously associated with a null value. | [
"Remove",
"the",
"entry",
"from",
"the",
"map",
"that",
"is",
"associated",
"with",
"the",
"given",
"key",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java#L239-L261 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java | LongObjectHashMap.get | public Object get(long key)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "get", new Object[]{new Long(key), this});
int hash = getHashForExistingEntry(key);
Object value = null;
if (hash >= 0)
{
value = _values[hash];
}
if (tc.isEntryEnabled()) Tr.exit(tc, "get", value);
return value;
} | java | public Object get(long key)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "get", new Object[]{new Long(key), this});
int hash = getHashForExistingEntry(key);
Object value = null;
if (hash >= 0)
{
value = _values[hash];
}
if (tc.isEntryEnabled()) Tr.exit(tc, "get", value);
return value;
} | [
"public",
"Object",
"get",
"(",
"long",
"key",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"get\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"key",
")",
",",
"this",
"}",
")",
";",
"int",
"hash",
"=",
"getHashForExistingEntry",
"(",
"key",
")",
";",
"Object",
"value",
"=",
"null",
";",
"if",
"(",
"hash",
">=",
"0",
")",
"{",
"value",
"=",
"_values",
"[",
"hash",
"]",
";",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"get\"",
",",
"value",
")",
";",
"return",
"value",
";",
"}"
] | Return the entry from the map associated with the given key
@param key the key whose associated value is to be returned
@return the entry in the map associated with the given key. | [
"Return",
"the",
"entry",
"from",
"the",
"map",
"associated",
"with",
"the",
"given",
"key"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java#L268-L282 | train |
OpenLiberty/open-liberty | dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java | LongObjectHashMap.getHashForKey | private int getHashForKey(long key)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getHashForKey", new Object[]{new Long(key), this});
int hash = (int) (key % _mapSize);
if (hash < 0) hash = -hash;
if (tc.isEntryEnabled()) Tr.exit(tc, "getHashForKey", new Integer(hash));
return hash;
} | java | private int getHashForKey(long key)
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getHashForKey", new Object[]{new Long(key), this});
int hash = (int) (key % _mapSize);
if (hash < 0) hash = -hash;
if (tc.isEntryEnabled()) Tr.exit(tc, "getHashForKey", new Integer(hash));
return hash;
} | [
"private",
"int",
"getHashForKey",
"(",
"long",
"key",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"getHashForKey\"",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"key",
")",
",",
"this",
"}",
")",
";",
"int",
"hash",
"=",
"(",
"int",
")",
"(",
"key",
"%",
"_mapSize",
")",
";",
"if",
"(",
"hash",
"<",
"0",
")",
"hash",
"=",
"-",
"hash",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"getHashForKey\"",
",",
"new",
"Integer",
"(",
"hash",
")",
")",
";",
"return",
"hash",
";",
"}"
] | suitable int index into the map | [
"suitable",
"int",
"index",
"into",
"the",
"map"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.util/src/com/ibm/tx/util/LongObjectHashMap.java#L371-L380 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security.feature/src/com/ibm/ws/webcontainer/security/feature/internal/FeatureAuthorizationTable.java | FeatureAuthorizationTable.processConfigProps | private void processConfigProps(Map<String, Object> props) {
if (props == null || props.isEmpty())
return;
id = (String) props.get(CFG_KEY_ID);
if (id == null) {
Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL");
return;
}
rolePids = (String[]) props.get(CFG_KEY_ROLE);
// if (rolePids == null || rolePids.length < 1)
// return;
processRolePids();
} | java | private void processConfigProps(Map<String, Object> props) {
if (props == null || props.isEmpty())
return;
id = (String) props.get(CFG_KEY_ID);
if (id == null) {
Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL");
return;
}
rolePids = (String[]) props.get(CFG_KEY_ROLE);
// if (rolePids == null || rolePids.length < 1)
// return;
processRolePids();
} | [
"private",
"void",
"processConfigProps",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
")",
"{",
"if",
"(",
"props",
"==",
"null",
"||",
"props",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"id",
"=",
"(",
"String",
")",
"props",
".",
"get",
"(",
"CFG_KEY_ID",
")",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"AUTHZ_ROLE_ID_IS_NULL\"",
")",
";",
"return",
";",
"}",
"rolePids",
"=",
"(",
"String",
"[",
"]",
")",
"props",
".",
"get",
"(",
"CFG_KEY_ROLE",
")",
";",
"// if (rolePids == null || rolePids.length < 1)",
"// return;",
"processRolePids",
"(",
")",
";",
"}"
] | Process the sytemRole properties from the server.xml.
@param props | [
"Process",
"the",
"sytemRole",
"properties",
"from",
"the",
"server",
".",
"xml",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security.feature/src/com/ibm/ws/webcontainer/security/feature/internal/FeatureAuthorizationTable.java#L107-L119 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/ClassLoaderConfigHelper.java | ClassLoaderConfigHelper.retrieveConfig | private Configuration retrieveConfig(NestedConfigHelper configHelper, ConfigurationAdmin configAdmin) throws InitWithoutConfig {
if (configHelper == null)
throw new InitWithoutConfig("Configuration not found");
// We need configAdmin to list the configurations of nested classloader elements with this application as their parent
if (configAdmin == null)
throw new InitWithoutConfig("ConfigurationAdmin service not found");
String parentPid = (String) configHelper.get(Constants.SERVICE_PID);
String sourcePid = (String) configHelper.get("ibm.extends.source.pid");
if (sourcePid != null) {
parentPid = sourcePid;
}
try {
StringBuilder filter = new StringBuilder();
filter.append("(&");
filter.append(FilterUtils.createPropertyFilter("service.factoryPid", "com.ibm.ws.classloading.classloader"));
filter.append(FilterUtils.createPropertyFilter("config.parentPID", parentPid));
filter.append(")");
Configuration[] configs = configAdmin.listConfigurations(filter.toString());
if (configs == null || configs.length != 1) {
throw new InitWithoutConfig("No classloader element found");
}
Configuration config = configs[0];
if (config.getProperties() == null) {
if (tc.isErrorEnabled())
Tr.error(tc, "cls.classloader.missing", config.getPid());
config.delete();
throw new InitWithoutConfig("Classloader config not found");
}
return config;
} catch (IOException e) {
throw new InitWithoutConfig("Configuration for classloader not found, exception " + e);
} catch (InvalidSyntaxException e) {
throw new InitWithoutConfig("Configuration for classloader not found, exception " + e);
}
} | java | private Configuration retrieveConfig(NestedConfigHelper configHelper, ConfigurationAdmin configAdmin) throws InitWithoutConfig {
if (configHelper == null)
throw new InitWithoutConfig("Configuration not found");
// We need configAdmin to list the configurations of nested classloader elements with this application as their parent
if (configAdmin == null)
throw new InitWithoutConfig("ConfigurationAdmin service not found");
String parentPid = (String) configHelper.get(Constants.SERVICE_PID);
String sourcePid = (String) configHelper.get("ibm.extends.source.pid");
if (sourcePid != null) {
parentPid = sourcePid;
}
try {
StringBuilder filter = new StringBuilder();
filter.append("(&");
filter.append(FilterUtils.createPropertyFilter("service.factoryPid", "com.ibm.ws.classloading.classloader"));
filter.append(FilterUtils.createPropertyFilter("config.parentPID", parentPid));
filter.append(")");
Configuration[] configs = configAdmin.listConfigurations(filter.toString());
if (configs == null || configs.length != 1) {
throw new InitWithoutConfig("No classloader element found");
}
Configuration config = configs[0];
if (config.getProperties() == null) {
if (tc.isErrorEnabled())
Tr.error(tc, "cls.classloader.missing", config.getPid());
config.delete();
throw new InitWithoutConfig("Classloader config not found");
}
return config;
} catch (IOException e) {
throw new InitWithoutConfig("Configuration for classloader not found, exception " + e);
} catch (InvalidSyntaxException e) {
throw new InitWithoutConfig("Configuration for classloader not found, exception " + e);
}
} | [
"private",
"Configuration",
"retrieveConfig",
"(",
"NestedConfigHelper",
"configHelper",
",",
"ConfigurationAdmin",
"configAdmin",
")",
"throws",
"InitWithoutConfig",
"{",
"if",
"(",
"configHelper",
"==",
"null",
")",
"throw",
"new",
"InitWithoutConfig",
"(",
"\"Configuration not found\"",
")",
";",
"// We need configAdmin to list the configurations of nested classloader elements with this application as their parent",
"if",
"(",
"configAdmin",
"==",
"null",
")",
"throw",
"new",
"InitWithoutConfig",
"(",
"\"ConfigurationAdmin service not found\"",
")",
";",
"String",
"parentPid",
"=",
"(",
"String",
")",
"configHelper",
".",
"get",
"(",
"Constants",
".",
"SERVICE_PID",
")",
";",
"String",
"sourcePid",
"=",
"(",
"String",
")",
"configHelper",
".",
"get",
"(",
"\"ibm.extends.source.pid\"",
")",
";",
"if",
"(",
"sourcePid",
"!=",
"null",
")",
"{",
"parentPid",
"=",
"sourcePid",
";",
"}",
"try",
"{",
"StringBuilder",
"filter",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"filter",
".",
"append",
"(",
"\"(&\"",
")",
";",
"filter",
".",
"append",
"(",
"FilterUtils",
".",
"createPropertyFilter",
"(",
"\"service.factoryPid\"",
",",
"\"com.ibm.ws.classloading.classloader\"",
")",
")",
";",
"filter",
".",
"append",
"(",
"FilterUtils",
".",
"createPropertyFilter",
"(",
"\"config.parentPID\"",
",",
"parentPid",
")",
")",
";",
"filter",
".",
"append",
"(",
"\")\"",
")",
";",
"Configuration",
"[",
"]",
"configs",
"=",
"configAdmin",
".",
"listConfigurations",
"(",
"filter",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"configs",
"==",
"null",
"||",
"configs",
".",
"length",
"!=",
"1",
")",
"{",
"throw",
"new",
"InitWithoutConfig",
"(",
"\"No classloader element found\"",
")",
";",
"}",
"Configuration",
"config",
"=",
"configs",
"[",
"0",
"]",
";",
"if",
"(",
"config",
".",
"getProperties",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isErrorEnabled",
"(",
")",
")",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"cls.classloader.missing\"",
",",
"config",
".",
"getPid",
"(",
")",
")",
";",
"config",
".",
"delete",
"(",
")",
";",
"throw",
"new",
"InitWithoutConfig",
"(",
"\"Classloader config not found\"",
")",
";",
"}",
"return",
"config",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"InitWithoutConfig",
"(",
"\"Configuration for classloader not found, exception \"",
"+",
"e",
")",
";",
"}",
"catch",
"(",
"InvalidSyntaxException",
"e",
")",
"{",
"throw",
"new",
"InitWithoutConfig",
"(",
"\"Configuration for classloader not found, exception \"",
"+",
"e",
")",
";",
"}",
"}"
] | get the configuration object or die trying | [
"get",
"the",
"configuration",
"object",
"or",
"die",
"trying"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/ClassLoaderConfigHelper.java#L137-L172 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/ClassLoaderConfigHelper.java | ClassLoaderConfigHelper.getIds | private List<String> getIds(ConfigurationAdmin ca, String[] pids) {
final String methodName = "getIds(): ";
if (pids == null) {
return Collections.emptyList();
}
List<String> ids = new ArrayList<String>();
for (String pid : pids) {
try {
String filter = "(" + org.osgi.framework.Constants.SERVICE_PID + "=" + pid + ")";
Configuration[] config = ca.listConfigurations(filter);
if (config == null) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Configuration not found for pid " + pid);
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Found config for " + pid);
String id = (String) config[0].getProperties().get("id");
ids.add(id);
}
} catch (IOException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Configuration not found for " + pid, e);
} catch (InvalidSyntaxException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Configuration not found for " + pid, e);
}
}
return Collections.unmodifiableList(ids);
} | java | private List<String> getIds(ConfigurationAdmin ca, String[] pids) {
final String methodName = "getIds(): ";
if (pids == null) {
return Collections.emptyList();
}
List<String> ids = new ArrayList<String>();
for (String pid : pids) {
try {
String filter = "(" + org.osgi.framework.Constants.SERVICE_PID + "=" + pid + ")";
Configuration[] config = ca.listConfigurations(filter);
if (config == null) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Configuration not found for pid " + pid);
} else {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Found config for " + pid);
String id = (String) config[0].getProperties().get("id");
ids.add(id);
}
} catch (IOException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Configuration not found for " + pid, e);
} catch (InvalidSyntaxException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "Configuration not found for " + pid, e);
}
}
return Collections.unmodifiableList(ids);
} | [
"private",
"List",
"<",
"String",
">",
"getIds",
"(",
"ConfigurationAdmin",
"ca",
",",
"String",
"[",
"]",
"pids",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"getIds(): \"",
";",
"if",
"(",
"pids",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"String",
">",
"ids",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"pid",
":",
"pids",
")",
"{",
"try",
"{",
"String",
"filter",
"=",
"\"(\"",
"+",
"org",
".",
"osgi",
".",
"framework",
".",
"Constants",
".",
"SERVICE_PID",
"+",
"\"=\"",
"+",
"pid",
"+",
"\")\"",
";",
"Configuration",
"[",
"]",
"config",
"=",
"ca",
".",
"listConfigurations",
"(",
"filter",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\"Configuration not found for pid \"",
"+",
"pid",
")",
";",
"}",
"else",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\"Found config for \"",
"+",
"pid",
")",
";",
"String",
"id",
"=",
"(",
"String",
")",
"config",
"[",
"0",
"]",
".",
"getProperties",
"(",
")",
".",
"get",
"(",
"\"id\"",
")",
";",
"ids",
".",
"add",
"(",
"id",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\"Configuration not found for \"",
"+",
"pid",
",",
"e",
")",
";",
"}",
"catch",
"(",
"InvalidSyntaxException",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\"Configuration not found for \"",
"+",
"pid",
",",
"e",
")",
";",
"}",
"}",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"ids",
")",
";",
"}"
] | Find the PID in the configAdmin and get the id corresponding to it. | [
"Find",
"the",
"PID",
"in",
"the",
"configAdmin",
"and",
"get",
"the",
"id",
"corresponding",
"to",
"it",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/ClassLoaderConfigHelper.java#L175-L203 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/ClassLoaderConfigHelper.java | ClassLoaderConfigHelper.folderContainsFiles | private boolean folderContainsFiles(File folder) {
if (folder != null) {
File[] files = folder.listFiles();
for (File file : files)
if (file.isFile())
return true;
for (File file : files)
if (file.isDirectory())
if (folderContainsFiles(file))
return true;
}
return false;
} | java | private boolean folderContainsFiles(File folder) {
if (folder != null) {
File[] files = folder.listFiles();
for (File file : files)
if (file.isFile())
return true;
for (File file : files)
if (file.isDirectory())
if (folderContainsFiles(file))
return true;
}
return false;
} | [
"private",
"boolean",
"folderContainsFiles",
"(",
"File",
"folder",
")",
"{",
"if",
"(",
"folder",
"!=",
"null",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"folder",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"if",
"(",
"file",
".",
"isFile",
"(",
")",
")",
"return",
"true",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"if",
"(",
"folderContainsFiles",
"(",
"file",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Breadth-first traversal of folder and any subdirectories looking for if any files exist | [
"Breadth",
"-",
"first",
"traversal",
"of",
"folder",
"and",
"any",
"subdirectories",
"looking",
"for",
"if",
"any",
"files",
"exist"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/ClassLoaderConfigHelper.java#L221-L233 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/ASN1Sequence.java | ASN1Sequence.getInstance | public static ASN1Sequence getInstance(
Object obj)
{
if (obj == null || obj instanceof ASN1Sequence)
{
return (ASN1Sequence)obj;
}
throw new IllegalArgumentException("unknown object in getInstance");
} | java | public static ASN1Sequence getInstance(
Object obj)
{
if (obj == null || obj instanceof ASN1Sequence)
{
return (ASN1Sequence)obj;
}
throw new IllegalArgumentException("unknown object in getInstance");
} | [
"public",
"static",
"ASN1Sequence",
"getInstance",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
"||",
"obj",
"instanceof",
"ASN1Sequence",
")",
"{",
"return",
"(",
"ASN1Sequence",
")",
"obj",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"unknown object in getInstance\"",
")",
";",
"}"
] | return an ASN1Sequence from the given object.
@param obj the object we want converted.
@exception IllegalArgumentException if the object cannot be converted. | [
"return",
"an",
"ASN1Sequence",
"from",
"the",
"given",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/ASN1Sequence.java#L32-L41 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/webext/WebExtAdapter.java | WebExtAdapter.markError | private static boolean markError(OverlayContainer overlay, String errorTag) {
if ( overlay.getFromNonPersistentCache(errorTag, WebExtAdapter.class) == null ) {
overlay.addToNonPersistentCache(errorTag, WebExtAdapter.class, errorTag);
return true;
} else {
return false;
}
} | java | private static boolean markError(OverlayContainer overlay, String errorTag) {
if ( overlay.getFromNonPersistentCache(errorTag, WebExtAdapter.class) == null ) {
overlay.addToNonPersistentCache(errorTag, WebExtAdapter.class, errorTag);
return true;
} else {
return false;
}
} | [
"private",
"static",
"boolean",
"markError",
"(",
"OverlayContainer",
"overlay",
",",
"String",
"errorTag",
")",
"{",
"if",
"(",
"overlay",
".",
"getFromNonPersistentCache",
"(",
"errorTag",
",",
"WebExtAdapter",
".",
"class",
")",
"==",
"null",
")",
"{",
"overlay",
".",
"addToNonPersistentCache",
"(",
"errorTag",
",",
"WebExtAdapter",
".",
"class",
",",
"errorTag",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Mark an error condition to an overlay container.
The tag is used as both the overlay key and the overlay value.
Each mark is not placed relative to particular data. Each mark
may be placed at most once.
@param overlay The overlay in which to place the mark.
@param errorTag The tag used as the mark.
@return True or false telling if this is the first placement
of the tag to the overlay. | [
"Mark",
"an",
"error",
"condition",
"to",
"an",
"overlay",
"container",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/webext/WebExtAdapter.java#L69-L76 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/webext/WebExtAdapter.java | WebExtAdapter.adapt | @Override
@FFDCIgnore(ParseException.class)
public com.ibm.ws.javaee.dd.webext.WebExt adapt(
Container root,
OverlayContainer rootOverlay,
ArtifactContainer artifactContainer,
Container containerToAdapt) throws UnableToAdaptException {
// What web extension is stored depends on the web descriptor version:
// either "ibm-web-ext.xmi" or "ibm-web-ext.xml".
com.ibm.ws.javaee.dd.web.WebApp primary = containerToAdapt.adapt(com.ibm.ws.javaee.dd.web.WebApp.class);
String primaryVersion = ((primary == null) ? null : primary.getVersion());
boolean xmi = ( "2.2".equals(primaryVersion) || "2.3".equals(primaryVersion) || "2.4".equals(primaryVersion) );
String ddEntryName;
if ( xmi ) {
ddEntryName = com.ibm.ws.javaee.dd.webext.WebExt.XMI_EXT_NAME;
} else {
ddEntryName = com.ibm.ws.javaee.dd.webext.WebExt.XML_EXT_NAME;
}
Entry ddEntry = containerToAdapt.getEntry(ddEntryName);
com.ibm.ws.javaee.ddmodel.webext.WebExtComponentImpl fromConfig =
getConfigOverrides(rootOverlay, artifactContainer);
// Neither the web-extension nor the configuration override is available:
// Answer null.
if ( (ddEntry == null) && (fromConfig == null) ) {
return null;
}
if ( ddEntry != null ) {
com.ibm.ws.javaee.dd.webext.WebExt fromApp;
try {
fromApp = new com.ibm.ws.javaee.ddmodel.webext.WebExtDDParser(containerToAdapt, ddEntry, xmi).parse();
} catch ( ParseException e ) {
throw new UnableToAdaptException(e);
}
if ( fromConfig == null ) {
// Only the web extension is available.
return fromApp;
} else {
// Both are available: Answer the configuration override, with the
// web extension set as a delegate.
fromConfig.setDelegate(fromApp);
return fromConfig;
}
} else {
// Only the configuration override is available.
return fromConfig;
}
} | java | @Override
@FFDCIgnore(ParseException.class)
public com.ibm.ws.javaee.dd.webext.WebExt adapt(
Container root,
OverlayContainer rootOverlay,
ArtifactContainer artifactContainer,
Container containerToAdapt) throws UnableToAdaptException {
// What web extension is stored depends on the web descriptor version:
// either "ibm-web-ext.xmi" or "ibm-web-ext.xml".
com.ibm.ws.javaee.dd.web.WebApp primary = containerToAdapt.adapt(com.ibm.ws.javaee.dd.web.WebApp.class);
String primaryVersion = ((primary == null) ? null : primary.getVersion());
boolean xmi = ( "2.2".equals(primaryVersion) || "2.3".equals(primaryVersion) || "2.4".equals(primaryVersion) );
String ddEntryName;
if ( xmi ) {
ddEntryName = com.ibm.ws.javaee.dd.webext.WebExt.XMI_EXT_NAME;
} else {
ddEntryName = com.ibm.ws.javaee.dd.webext.WebExt.XML_EXT_NAME;
}
Entry ddEntry = containerToAdapt.getEntry(ddEntryName);
com.ibm.ws.javaee.ddmodel.webext.WebExtComponentImpl fromConfig =
getConfigOverrides(rootOverlay, artifactContainer);
// Neither the web-extension nor the configuration override is available:
// Answer null.
if ( (ddEntry == null) && (fromConfig == null) ) {
return null;
}
if ( ddEntry != null ) {
com.ibm.ws.javaee.dd.webext.WebExt fromApp;
try {
fromApp = new com.ibm.ws.javaee.ddmodel.webext.WebExtDDParser(containerToAdapt, ddEntry, xmi).parse();
} catch ( ParseException e ) {
throw new UnableToAdaptException(e);
}
if ( fromConfig == null ) {
// Only the web extension is available.
return fromApp;
} else {
// Both are available: Answer the configuration override, with the
// web extension set as a delegate.
fromConfig.setDelegate(fromApp);
return fromConfig;
}
} else {
// Only the configuration override is available.
return fromConfig;
}
} | [
"@",
"Override",
"@",
"FFDCIgnore",
"(",
"ParseException",
".",
"class",
")",
"public",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"webext",
".",
"WebExt",
"adapt",
"(",
"Container",
"root",
",",
"OverlayContainer",
"rootOverlay",
",",
"ArtifactContainer",
"artifactContainer",
",",
"Container",
"containerToAdapt",
")",
"throws",
"UnableToAdaptException",
"{",
"// What web extension is stored depends on the web descriptor version:",
"// either \"ibm-web-ext.xmi\" or \"ibm-web-ext.xml\".",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"web",
".",
"WebApp",
"primary",
"=",
"containerToAdapt",
".",
"adapt",
"(",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"web",
".",
"WebApp",
".",
"class",
")",
";",
"String",
"primaryVersion",
"=",
"(",
"(",
"primary",
"==",
"null",
")",
"?",
"null",
":",
"primary",
".",
"getVersion",
"(",
")",
")",
";",
"boolean",
"xmi",
"=",
"(",
"\"2.2\"",
".",
"equals",
"(",
"primaryVersion",
")",
"||",
"\"2.3\"",
".",
"equals",
"(",
"primaryVersion",
")",
"||",
"\"2.4\"",
".",
"equals",
"(",
"primaryVersion",
")",
")",
";",
"String",
"ddEntryName",
";",
"if",
"(",
"xmi",
")",
"{",
"ddEntryName",
"=",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"webext",
".",
"WebExt",
".",
"XMI_EXT_NAME",
";",
"}",
"else",
"{",
"ddEntryName",
"=",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"webext",
".",
"WebExt",
".",
"XML_EXT_NAME",
";",
"}",
"Entry",
"ddEntry",
"=",
"containerToAdapt",
".",
"getEntry",
"(",
"ddEntryName",
")",
";",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"ddmodel",
".",
"webext",
".",
"WebExtComponentImpl",
"fromConfig",
"=",
"getConfigOverrides",
"(",
"rootOverlay",
",",
"artifactContainer",
")",
";",
"// Neither the web-extension nor the configuration override is available:",
"// Answer null.",
"if",
"(",
"(",
"ddEntry",
"==",
"null",
")",
"&&",
"(",
"fromConfig",
"==",
"null",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"ddEntry",
"!=",
"null",
")",
"{",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"dd",
".",
"webext",
".",
"WebExt",
"fromApp",
";",
"try",
"{",
"fromApp",
"=",
"new",
"com",
".",
"ibm",
".",
"ws",
".",
"javaee",
".",
"ddmodel",
".",
"webext",
".",
"WebExtDDParser",
"(",
"containerToAdapt",
",",
"ddEntry",
",",
"xmi",
")",
".",
"parse",
"(",
")",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"throw",
"new",
"UnableToAdaptException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"fromConfig",
"==",
"null",
")",
"{",
"// Only the web extension is available.",
"return",
"fromApp",
";",
"}",
"else",
"{",
"// Both are available: Answer the configuration override, with the",
"// web extension set as a delegate.",
"fromConfig",
".",
"setDelegate",
"(",
"fromApp",
")",
";",
"return",
"fromConfig",
";",
"}",
"}",
"else",
"{",
"// Only the configuration override is available.",
"return",
"fromConfig",
";",
"}",
"}"
] | Obtain the web extension for a module container.
There are four possibilities:
(1) The container has neither a web extension nor a configuration override of its
web extension. In this case, answer null: No web extension is available.
(2) The container has a web extension and does not have a configuration override
(of the web extension). Answer the web extension.
(3) The container does not have a web extension, but does have a configuration
override. Answer the configuration override.
(4) The container has both a web extension and a configuration override. Answer
the configuration override with the web extension set as a delegate.
@param root The module container.
@param rootOverlay The root overlay container.
@param artifactContainer The raw module container.
@param containerToAdapt The module container.
@return The effective web extension of the module. Null if no extension is
available.
@throws UnableToAdaptException Thrown in case of an error obtaining the
effective web extension. This will usually be a parse error or a
naming error. | [
"Obtain",
"the",
"web",
"extension",
"for",
"a",
"module",
"container",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/webext/WebExtAdapter.java#L116-L170 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/webext/WebExtAdapter.java | WebExtAdapter.stripExtension | private String stripExtension(String moduleName) {
if ( moduleName.endsWith(".war") || moduleName.endsWith(".jar") ) {
return moduleName.substring(0, moduleName.length() - 4);
}
return moduleName;
} | java | private String stripExtension(String moduleName) {
if ( moduleName.endsWith(".war") || moduleName.endsWith(".jar") ) {
return moduleName.substring(0, moduleName.length() - 4);
}
return moduleName;
} | [
"private",
"String",
"stripExtension",
"(",
"String",
"moduleName",
")",
"{",
"if",
"(",
"moduleName",
".",
"endsWith",
"(",
"\".war\"",
")",
"||",
"moduleName",
".",
"endsWith",
"(",
"\".jar\"",
")",
")",
"{",
"return",
"moduleName",
".",
"substring",
"(",
"0",
",",
"moduleName",
".",
"length",
"(",
")",
"-",
"4",
")",
";",
"}",
"return",
"moduleName",
";",
"}"
] | Strip the extension from a module name.
Remove only ".war" or ".jar", and only if these are present in lower case.
The module name is as obtained from an application descriptor, or from a web
extension override, or from module information. Module names are usually,
but not always, simple file names. Module names can be relative paths.
@param moduleName The module name to strip.
@return The module name with its extension removed. | [
"Strip",
"the",
"extension",
"from",
"a",
"module",
"name",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmodel/src.gen/com/ibm/ws/javaee/ddmodel/webext/WebExtAdapter.java#L332-L337 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.isReconfigurable | public final boolean isReconfigurable(WSConnectionRequestInfoImpl cri, boolean reauth)
{
// The CRI is only reconfigurable if all fields which cannot be changed already match.
// Although sharding keys can sometimes be changed via connection.setShardingKey,
// the spec does not guarantee that this method will allow all sharding keys
// (even ones that are known to be valid) to be set on any connection. It leaves open
// the possibility that the JDBC driver implementation can decide not to allow switching
// between certain sharding keys. Given that we don't have any way of knowing in
// advance that a switching will be accepted (without preemptively trying to change it),
// we must consider sharding keys to be non-reconfigurable for the purposes of
// selecting a connection from the pool.
if (reauth)
{
return ivConfigID == cri.ivConfigID;
} else {
return match(ivUserName, cri.ivUserName) &&
match(ivPassword, cri.ivPassword) &&
match(ivShardingKey, cri.ivShardingKey) &&
match(ivSuperShardingKey, cri.ivSuperShardingKey) &&
ivConfigID == cri.ivConfigID;
}
} | java | public final boolean isReconfigurable(WSConnectionRequestInfoImpl cri, boolean reauth)
{
// The CRI is only reconfigurable if all fields which cannot be changed already match.
// Although sharding keys can sometimes be changed via connection.setShardingKey,
// the spec does not guarantee that this method will allow all sharding keys
// (even ones that are known to be valid) to be set on any connection. It leaves open
// the possibility that the JDBC driver implementation can decide not to allow switching
// between certain sharding keys. Given that we don't have any way of knowing in
// advance that a switching will be accepted (without preemptively trying to change it),
// we must consider sharding keys to be non-reconfigurable for the purposes of
// selecting a connection from the pool.
if (reauth)
{
return ivConfigID == cri.ivConfigID;
} else {
return match(ivUserName, cri.ivUserName) &&
match(ivPassword, cri.ivPassword) &&
match(ivShardingKey, cri.ivShardingKey) &&
match(ivSuperShardingKey, cri.ivSuperShardingKey) &&
ivConfigID == cri.ivConfigID;
}
} | [
"public",
"final",
"boolean",
"isReconfigurable",
"(",
"WSConnectionRequestInfoImpl",
"cri",
",",
"boolean",
"reauth",
")",
"{",
"// The CRI is only reconfigurable if all fields which cannot be changed already match.",
"// Although sharding keys can sometimes be changed via connection.setShardingKey,",
"// the spec does not guarantee that this method will allow all sharding keys",
"// (even ones that are known to be valid) to be set on any connection. It leaves open",
"// the possibility that the JDBC driver implementation can decide not to allow switching",
"// between certain sharding keys. Given that we don't have any way of knowing in",
"// advance that a switching will be accepted (without preemptively trying to change it),",
"// we must consider sharding keys to be non-reconfigurable for the purposes of",
"// selecting a connection from the pool.",
"if",
"(",
"reauth",
")",
"{",
"return",
"ivConfigID",
"==",
"cri",
".",
"ivConfigID",
";",
"}",
"else",
"{",
"return",
"match",
"(",
"ivUserName",
",",
"cri",
".",
"ivUserName",
")",
"&&",
"match",
"(",
"ivPassword",
",",
"cri",
".",
"ivPassword",
")",
"&&",
"match",
"(",
"ivShardingKey",
",",
"cri",
".",
"ivShardingKey",
")",
"&&",
"match",
"(",
"ivSuperShardingKey",
",",
"cri",
".",
"ivSuperShardingKey",
")",
"&&",
"ivConfigID",
"==",
"cri",
".",
"ivConfigID",
";",
"}",
"}"
] | Indicates whether a Connection with this CRI may be reconfigured to the specific CRI.
@param cri The CRI to test against.
@return true if a connection with the CRI represented by this class can be reconfigured
to the specified CRI. | [
"Indicates",
"whether",
"a",
"Connection",
"with",
"this",
"CRI",
"may",
"be",
"reconfigured",
"to",
"the",
"specific",
"CRI",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L419-L442 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchKerberosIdentities | private boolean matchKerberosIdentities(WSConnectionRequestInfoImpl cri) {
boolean flag = false;
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "matchKerberosIdentities", this, cri);
if (kerberosIdentityisSet && cri.kerberosIdentityisSet) {
flag = AdapterUtil.matchGSSName(cri.gssName, gssName);
} else if (kerberosIdentityisSet || cri.kerberosIdentityisSet) {
// one of them is true, so no match
flag = false;
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "only one has kerberos identity attributes set so no match");
} else
{// else: both are are false thus, match
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "both have kerberos identity attributes not set so match");
flag = true;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "matchKerberosIdentities", flag);
return flag;
} | java | private boolean matchKerberosIdentities(WSConnectionRequestInfoImpl cri) {
boolean flag = false;
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(this, tc, "matchKerberosIdentities", this, cri);
if (kerberosIdentityisSet && cri.kerberosIdentityisSet) {
flag = AdapterUtil.matchGSSName(cri.gssName, gssName);
} else if (kerberosIdentityisSet || cri.kerberosIdentityisSet) {
// one of them is true, so no match
flag = false;
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "only one has kerberos identity attributes set so no match");
} else
{// else: both are are false thus, match
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "both have kerberos identity attributes not set so match");
flag = true;
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(this, tc, "matchKerberosIdentities", flag);
return flag;
} | [
"private",
"boolean",
"matchKerberosIdentities",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"boolean",
"flag",
"=",
"false",
";",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"matchKerberosIdentities\"",
",",
"this",
",",
"cri",
")",
";",
"if",
"(",
"kerberosIdentityisSet",
"&&",
"cri",
".",
"kerberosIdentityisSet",
")",
"{",
"flag",
"=",
"AdapterUtil",
".",
"matchGSSName",
"(",
"cri",
".",
"gssName",
",",
"gssName",
")",
";",
"}",
"else",
"if",
"(",
"kerberosIdentityisSet",
"||",
"cri",
".",
"kerberosIdentityisSet",
")",
"{",
"// one of them is true, so no match",
"flag",
"=",
"false",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"only one has kerberos identity attributes set so no match\"",
")",
";",
"}",
"else",
"{",
"// else: both are are false thus, match",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"both have kerberos identity attributes not set so match\"",
")",
";",
"flag",
"=",
"true",
";",
"}",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"matchKerberosIdentities\"",
",",
"flag",
")",
";",
"return",
"flag",
";",
"}"
] | Per JAVA Docs,
method returns true if the two names contain at least one primitive element in common.
If either of the names represents an anonymous entity, the method will return false. | [
"Per",
"JAVA",
"Docs",
"method",
"returns",
"true",
"if",
"the",
"two",
"names",
"contain",
"at",
"least",
"one",
"primitive",
"element",
"in",
"common",
".",
"If",
"either",
"of",
"the",
"names",
"represents",
"an",
"anonymous",
"entity",
"the",
"method",
"will",
"return",
"false",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L524-L549 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.match | private static final boolean match(Object obj1, Object obj2) {
return obj1 == obj2 || (obj1 != null && obj1.equals(obj2));
} | java | private static final boolean match(Object obj1, Object obj2) {
return obj1 == obj2 || (obj1 != null && obj1.equals(obj2));
} | [
"private",
"static",
"final",
"boolean",
"match",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
")",
"{",
"return",
"obj1",
"==",
"obj2",
"||",
"(",
"obj1",
"!=",
"null",
"&&",
"obj1",
".",
"equals",
"(",
"obj2",
")",
")",
";",
"}"
] | Determine if two objects, either of which may be null, are equal.
@param obj1
one object.
@param obj2
another object.
@return true if the objects are equal or are both null, otherwise false. | [
"Determine",
"if",
"two",
"objects",
"either",
"of",
"which",
"may",
"be",
"null",
"are",
"equal",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L562-L564 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchCatalog | private final boolean matchCatalog(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
String defaultValue = defaultCatalog == null ? cri.defaultCatalog : defaultCatalog;
return match(ivCatalog, cri.ivCatalog)
|| ivCatalog == null && match(defaultValue, cri.ivCatalog)
|| cri.ivCatalog == null && match(ivCatalog, defaultValue);
} | java | private final boolean matchCatalog(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
String defaultValue = defaultCatalog == null ? cri.defaultCatalog : defaultCatalog;
return match(ivCatalog, cri.ivCatalog)
|| ivCatalog == null && match(defaultValue, cri.ivCatalog)
|| cri.ivCatalog == null && match(ivCatalog, defaultValue);
} | [
"private",
"final",
"boolean",
"matchCatalog",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"// At least one of the CRIs should know the default value.",
"String",
"defaultValue",
"=",
"defaultCatalog",
"==",
"null",
"?",
"cri",
".",
"defaultCatalog",
":",
"defaultCatalog",
";",
"return",
"match",
"(",
"ivCatalog",
",",
"cri",
".",
"ivCatalog",
")",
"||",
"ivCatalog",
"==",
"null",
"&&",
"match",
"(",
"defaultValue",
",",
"cri",
".",
"ivCatalog",
")",
"||",
"cri",
".",
"ivCatalog",
"==",
"null",
"&&",
"match",
"(",
"ivCatalog",
",",
"defaultValue",
")",
";",
"}"
] | Determine if the catalog property matches. It is considered to match if
- Both catalog values are unspecified.
- Both catalog values are the same value.
- One of the catalog values is unspecified and the other CRI requested the default value.
@return true if the catalogs match, otherwise false. | [
"Determine",
"if",
"the",
"catalog",
"property",
"matches",
".",
"It",
"is",
"considered",
"to",
"match",
"if",
"-",
"Both",
"catalog",
"values",
"are",
"unspecified",
".",
"-",
"Both",
"catalog",
"values",
"are",
"the",
"same",
"value",
".",
"-",
"One",
"of",
"the",
"catalog",
"values",
"is",
"unspecified",
"and",
"the",
"other",
"CRI",
"requested",
"the",
"default",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L574-L581 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchSchema | private final boolean matchSchema(WSConnectionRequestInfoImpl cri){
// At least one of the CRIs should know the default value.
String defaultValue = defaultSchema == null ? cri.defaultSchema : defaultSchema;
return match(ivSchema, cri.ivSchema)
|| ivSchema == null && match(defaultValue, cri.ivSchema)
|| cri.ivSchema == null && match(ivSchema, defaultValue);
} | java | private final boolean matchSchema(WSConnectionRequestInfoImpl cri){
// At least one of the CRIs should know the default value.
String defaultValue = defaultSchema == null ? cri.defaultSchema : defaultSchema;
return match(ivSchema, cri.ivSchema)
|| ivSchema == null && match(defaultValue, cri.ivSchema)
|| cri.ivSchema == null && match(ivSchema, defaultValue);
} | [
"private",
"final",
"boolean",
"matchSchema",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"// At least one of the CRIs should know the default value.",
"String",
"defaultValue",
"=",
"defaultSchema",
"==",
"null",
"?",
"cri",
".",
"defaultSchema",
":",
"defaultSchema",
";",
"return",
"match",
"(",
"ivSchema",
",",
"cri",
".",
"ivSchema",
")",
"||",
"ivSchema",
"==",
"null",
"&&",
"match",
"(",
"defaultValue",
",",
"cri",
".",
"ivSchema",
")",
"||",
"cri",
".",
"ivSchema",
"==",
"null",
"&&",
"match",
"(",
"ivSchema",
",",
"defaultValue",
")",
";",
"}"
] | Determine if the schema property matches. It is considered to match if
- Both schema values are unspecified.
- Both schema values are the same value.
- One of the schema values is unspecified and the other CRI requested the default value.
@return true if the schema match, otherwise false. | [
"Determine",
"if",
"the",
"schema",
"property",
"matches",
".",
"It",
"is",
"considered",
"to",
"match",
"if",
"-",
"Both",
"schema",
"values",
"are",
"unspecified",
".",
"-",
"Both",
"schema",
"values",
"are",
"the",
"same",
"value",
".",
"-",
"One",
"of",
"the",
"schema",
"values",
"is",
"unspecified",
"and",
"the",
"other",
"CRI",
"requested",
"the",
"default",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L591-L598 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchNetworkTimeout | private final boolean matchNetworkTimeout(WSConnectionRequestInfoImpl cri){
// At least one of the CRIs should know the default value.
int defaultValue = defaultNetworkTimeout == 0 ? cri.defaultNetworkTimeout : defaultNetworkTimeout;
return ivNetworkTimeout == cri.ivNetworkTimeout
|| ivNetworkTimeout == 0 && (defaultValue == cri.ivNetworkTimeout)
|| cri.ivNetworkTimeout == 0 && ivNetworkTimeout == defaultValue;
} | java | private final boolean matchNetworkTimeout(WSConnectionRequestInfoImpl cri){
// At least one of the CRIs should know the default value.
int defaultValue = defaultNetworkTimeout == 0 ? cri.defaultNetworkTimeout : defaultNetworkTimeout;
return ivNetworkTimeout == cri.ivNetworkTimeout
|| ivNetworkTimeout == 0 && (defaultValue == cri.ivNetworkTimeout)
|| cri.ivNetworkTimeout == 0 && ivNetworkTimeout == defaultValue;
} | [
"private",
"final",
"boolean",
"matchNetworkTimeout",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"// At least one of the CRIs should know the default value.",
"int",
"defaultValue",
"=",
"defaultNetworkTimeout",
"==",
"0",
"?",
"cri",
".",
"defaultNetworkTimeout",
":",
"defaultNetworkTimeout",
";",
"return",
"ivNetworkTimeout",
"==",
"cri",
".",
"ivNetworkTimeout",
"||",
"ivNetworkTimeout",
"==",
"0",
"&&",
"(",
"defaultValue",
"==",
"cri",
".",
"ivNetworkTimeout",
")",
"||",
"cri",
".",
"ivNetworkTimeout",
"==",
"0",
"&&",
"ivNetworkTimeout",
"==",
"defaultValue",
";",
"}"
] | Determine if the networkTimeout property matches. It is considered to match if
- Both networkTimeout values are unspecified.
- Both networkTimeout values are the same value.
- One of the networkTimeout values is unspecified and the other CRI requested the default value.
@return true if the networkTimeouts match, otherwise false. | [
"Determine",
"if",
"the",
"networkTimeout",
"property",
"matches",
".",
"It",
"is",
"considered",
"to",
"match",
"if",
"-",
"Both",
"networkTimeout",
"values",
"are",
"unspecified",
".",
"-",
"Both",
"networkTimeout",
"values",
"are",
"the",
"same",
"value",
".",
"-",
"One",
"of",
"the",
"networkTimeout",
"values",
"is",
"unspecified",
"and",
"the",
"other",
"CRI",
"requested",
"the",
"default",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L608-L615 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchHoldability | private final boolean matchHoldability(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
int defaultValue = defaultHoldability == 0 ? cri.defaultHoldability : defaultHoldability;
return ivHoldability == cri.ivHoldability
|| ivHoldability == 0 && match(defaultValue, cri.ivHoldability)
|| cri.ivHoldability == 0 && match(ivHoldability, defaultValue);
} | java | private final boolean matchHoldability(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
int defaultValue = defaultHoldability == 0 ? cri.defaultHoldability : defaultHoldability;
return ivHoldability == cri.ivHoldability
|| ivHoldability == 0 && match(defaultValue, cri.ivHoldability)
|| cri.ivHoldability == 0 && match(ivHoldability, defaultValue);
} | [
"private",
"final",
"boolean",
"matchHoldability",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"// At least one of the CRIs should know the default value.",
"int",
"defaultValue",
"=",
"defaultHoldability",
"==",
"0",
"?",
"cri",
".",
"defaultHoldability",
":",
"defaultHoldability",
";",
"return",
"ivHoldability",
"==",
"cri",
".",
"ivHoldability",
"||",
"ivHoldability",
"==",
"0",
"&&",
"match",
"(",
"defaultValue",
",",
"cri",
".",
"ivHoldability",
")",
"||",
"cri",
".",
"ivHoldability",
"==",
"0",
"&&",
"match",
"(",
"ivHoldability",
",",
"defaultValue",
")",
";",
"}"
] | Determine if the result set holdability property matches. It is considered to match if
- Both holdability values are unspecified.
- Both holdability values are the same value.
- One of the holdability values is unspecified and the other CRI requested the default value.
@return true if the result set holdabilities match, otherwise false. | [
"Determine",
"if",
"the",
"result",
"set",
"holdability",
"property",
"matches",
".",
"It",
"is",
"considered",
"to",
"match",
"if",
"-",
"Both",
"holdability",
"values",
"are",
"unspecified",
".",
"-",
"Both",
"holdability",
"values",
"are",
"the",
"same",
"value",
".",
"-",
"One",
"of",
"the",
"holdability",
"values",
"is",
"unspecified",
"and",
"the",
"other",
"CRI",
"requested",
"the",
"default",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L625-L632 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchReadOnly | private final boolean matchReadOnly(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
Boolean defaultValue = defaultReadOnly == null ? cri.defaultReadOnly : defaultReadOnly;
return match(ivReadOnly, cri.ivReadOnly)
|| ivReadOnly == null && match(defaultValue, cri.ivReadOnly)
|| cri.ivReadOnly == null && match(ivReadOnly, defaultValue);
} | java | private final boolean matchReadOnly(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
Boolean defaultValue = defaultReadOnly == null ? cri.defaultReadOnly : defaultReadOnly;
return match(ivReadOnly, cri.ivReadOnly)
|| ivReadOnly == null && match(defaultValue, cri.ivReadOnly)
|| cri.ivReadOnly == null && match(ivReadOnly, defaultValue);
} | [
"private",
"final",
"boolean",
"matchReadOnly",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"// At least one of the CRIs should know the default value.",
"Boolean",
"defaultValue",
"=",
"defaultReadOnly",
"==",
"null",
"?",
"cri",
".",
"defaultReadOnly",
":",
"defaultReadOnly",
";",
"return",
"match",
"(",
"ivReadOnly",
",",
"cri",
".",
"ivReadOnly",
")",
"||",
"ivReadOnly",
"==",
"null",
"&&",
"match",
"(",
"defaultValue",
",",
"cri",
".",
"ivReadOnly",
")",
"||",
"cri",
".",
"ivReadOnly",
"==",
"null",
"&&",
"match",
"(",
"ivReadOnly",
",",
"defaultValue",
")",
";",
"}"
] | Determine if the read-only property matches. It is considered to match if
- Both read-only values are unspecified.
- Both read-only values are the same value.
- One of the read-only values is unspecified and the other CRI requested the default value.
@return true if the read-only values match, otherwise false. | [
"Determine",
"if",
"the",
"read",
"-",
"only",
"property",
"matches",
".",
"It",
"is",
"considered",
"to",
"match",
"if",
"-",
"Both",
"read",
"-",
"only",
"values",
"are",
"unspecified",
".",
"-",
"Both",
"read",
"-",
"only",
"values",
"are",
"the",
"same",
"value",
".",
"-",
"One",
"of",
"the",
"read",
"-",
"only",
"values",
"is",
"unspecified",
"and",
"the",
"other",
"CRI",
"requested",
"the",
"default",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L642-L649 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchTypeMap | private final boolean matchTypeMap(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
Map<String, Class<?>> defaultValue = defaultTypeMap == null ? cri.defaultTypeMap : defaultTypeMap;
return matchTypeMap(ivTypeMap, cri.ivTypeMap)
|| ivTypeMap == null && matchTypeMap(defaultValue, cri.ivTypeMap)
|| cri.ivTypeMap == null && matchTypeMap(ivTypeMap, defaultValue);
} | java | private final boolean matchTypeMap(WSConnectionRequestInfoImpl cri) {
// At least one of the CRIs should know the default value.
Map<String, Class<?>> defaultValue = defaultTypeMap == null ? cri.defaultTypeMap : defaultTypeMap;
return matchTypeMap(ivTypeMap, cri.ivTypeMap)
|| ivTypeMap == null && matchTypeMap(defaultValue, cri.ivTypeMap)
|| cri.ivTypeMap == null && matchTypeMap(ivTypeMap, defaultValue);
} | [
"private",
"final",
"boolean",
"matchTypeMap",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"// At least one of the CRIs should know the default value.",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"defaultValue",
"=",
"defaultTypeMap",
"==",
"null",
"?",
"cri",
".",
"defaultTypeMap",
":",
"defaultTypeMap",
";",
"return",
"matchTypeMap",
"(",
"ivTypeMap",
",",
"cri",
".",
"ivTypeMap",
")",
"||",
"ivTypeMap",
"==",
"null",
"&&",
"matchTypeMap",
"(",
"defaultValue",
",",
"cri",
".",
"ivTypeMap",
")",
"||",
"cri",
".",
"ivTypeMap",
"==",
"null",
"&&",
"matchTypeMap",
"(",
"ivTypeMap",
",",
"defaultValue",
")",
";",
"}"
] | Determine if the type map property matches. It is considered to match if
- Both type map values are unspecified.
- Both type map values are the same value.
- One of the type map values is unspecified and the other CRI requested the default value.
@return true if the type map values match, otherwise false. | [
"Determine",
"if",
"the",
"type",
"map",
"property",
"matches",
".",
"It",
"is",
"considered",
"to",
"match",
"if",
"-",
"Both",
"type",
"map",
"values",
"are",
"unspecified",
".",
"-",
"Both",
"type",
"map",
"values",
"are",
"the",
"same",
"value",
".",
"-",
"One",
"of",
"the",
"type",
"map",
"values",
"is",
"unspecified",
"and",
"the",
"other",
"CRI",
"requested",
"the",
"default",
"value",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L659-L666 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchTypeMap | public static final boolean matchTypeMap(Map<String, Class<?>> m1, Map<String, Class<?>> m2) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "matchTypeMap", new Object[] { m1, m2 });
boolean match = false;
if (m1 == m2)
match = true;
else if (m1 != null && m1.equals(m2))
match = true;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "matchTypeMap", match);
return match;
} | java | public static final boolean matchTypeMap(Map<String, Class<?>> m1, Map<String, Class<?>> m2) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "matchTypeMap", new Object[] { m1, m2 });
boolean match = false;
if (m1 == m2)
match = true;
else if (m1 != null && m1.equals(m2))
match = true;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "matchTypeMap", match);
return match;
} | [
"public",
"static",
"final",
"boolean",
"matchTypeMap",
"(",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"m1",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"m2",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"matchTypeMap\"",
",",
"new",
"Object",
"[",
"]",
"{",
"m1",
",",
"m2",
"}",
")",
";",
"boolean",
"match",
"=",
"false",
";",
"if",
"(",
"m1",
"==",
"m2",
")",
"match",
"=",
"true",
";",
"else",
"if",
"(",
"m1",
"!=",
"null",
"&&",
"m1",
".",
"equals",
"(",
"m2",
")",
")",
"match",
"=",
"true",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"matchTypeMap\"",
",",
"match",
")",
";",
"return",
"match",
";",
"}"
] | determines if two typeMaps match. Note that this method takes under account
an Oracle 11g change with TypeMap
@param m1
@param m2
@return | [
"determines",
"if",
"two",
"typeMaps",
"match",
".",
"Note",
"that",
"this",
"method",
"takes",
"under",
"account",
"an",
"Oracle",
"11g",
"change",
"with",
"TypeMap"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L676-L691 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setDefaultValues | public void setDefaultValues(String catalog, int holdability, Boolean readOnly, Map<String, Class<?>> typeMap,
String schema, int networkTimeout) {
defaultCatalog = catalog;
defaultHoldability = holdability;
defaultReadOnly = readOnly;
defaultTypeMap = typeMap;
defaultSchema = schema;
defaultNetworkTimeout = networkTimeout;
} | java | public void setDefaultValues(String catalog, int holdability, Boolean readOnly, Map<String, Class<?>> typeMap,
String schema, int networkTimeout) {
defaultCatalog = catalog;
defaultHoldability = holdability;
defaultReadOnly = readOnly;
defaultTypeMap = typeMap;
defaultSchema = schema;
defaultNetworkTimeout = networkTimeout;
} | [
"public",
"void",
"setDefaultValues",
"(",
"String",
"catalog",
",",
"int",
"holdability",
",",
"Boolean",
"readOnly",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"typeMap",
",",
"String",
"schema",
",",
"int",
"networkTimeout",
")",
"{",
"defaultCatalog",
"=",
"catalog",
";",
"defaultHoldability",
"=",
"holdability",
";",
"defaultReadOnly",
"=",
"readOnly",
";",
"defaultTypeMap",
"=",
"typeMap",
";",
"defaultSchema",
"=",
"schema",
";",
"defaultNetworkTimeout",
"=",
"networkTimeout",
";",
"}"
] | Initialize default values that are used for unspecified properties.
This allows us to match unspecified values with specified values in another CRI.
@param catalog the default catalog value, or NULL if not supported.
@param holdability the default holdability value, or 0 if not supported.
@param readOnly the default read-only value, or NULL if not supported.
@param typeMap the default type map value, or NULL if not supported.
@param schema the default schema value, or NULL if not supported.
@param networkTimeout the default network timeout. | [
"Initialize",
"default",
"values",
"that",
"are",
"used",
"for",
"unspecified",
"properties",
".",
"This",
"allows",
"us",
"to",
"match",
"unspecified",
"values",
"with",
"specified",
"values",
"in",
"another",
"CRI",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L704-L712 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.isCRIChangable | public boolean isCRIChangable()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "isCRIChangable :", changable);
return changable;
} | java | public boolean isCRIChangable()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "isCRIChangable :", changable);
return changable;
} | [
"public",
"boolean",
"isCRIChangable",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"isCRIChangable :\"",
",",
"changable",
")",
";",
"return",
"changable",
";",
"}"
] | returns boolean indicating if cri is changable or not. | [
"returns",
"boolean",
"indicating",
"if",
"cri",
"is",
"changable",
"or",
"not",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L828-L834 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setCatalog | public void setCatalog(String catalog) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR", new Object[]
{ "ConnectionRequestInfo cannot be modified, doing so may result in corruption: catalog, cri", catalog, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting catalog on the CRI to: " + catalog);
ivCatalog = catalog;
} | java | public void setCatalog(String catalog) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR", new Object[]
{ "ConnectionRequestInfo cannot be modified, doing so may result in corruption: catalog, cri", catalog, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting catalog on the CRI to: " + catalog);
ivCatalog = catalog;
} | [
"public",
"void",
"setCatalog",
"(",
"String",
"catalog",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"changable",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"WS_INTERNAL_ERROR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"ConnectionRequestInfo cannot be modified, doing so may result in corruption: catalog, cri\"",
",",
"catalog",
",",
"this",
"}",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Setting catalog on the CRI to: \"",
"+",
"catalog",
")",
";",
"ivCatalog",
"=",
"catalog",
";",
"}"
] | Change the value of the catalog property in the connection request information.
@param catalog The new value.
@throws IllegalArgumentException if the key is incorrect.
@throws SQLException if the connection request information is not editable. | [
"Change",
"the",
"value",
"of",
"the",
"catalog",
"property",
"in",
"the",
"connection",
"request",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L844-L854 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setHoldability | public void setHoldability(int holdability) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR", new Object[]
{ "ConnectionRequestInfo cannot be modified, doing so may result in corruption: holdability, cri", holdability, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting holdability on the CRI to: " + holdability);
ivHoldability = holdability;
} | java | public void setHoldability(int holdability) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR", new Object[]
{ "ConnectionRequestInfo cannot be modified, doing so may result in corruption: holdability, cri", holdability, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting holdability on the CRI to: " + holdability);
ivHoldability = holdability;
} | [
"public",
"void",
"setHoldability",
"(",
"int",
"holdability",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"changable",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"WS_INTERNAL_ERROR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"ConnectionRequestInfo cannot be modified, doing so may result in corruption: holdability, cri\"",
",",
"holdability",
",",
"this",
"}",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Setting holdability on the CRI to: \"",
"+",
"holdability",
")",
";",
"ivHoldability",
"=",
"holdability",
";",
"}"
] | Change the value of the result set holdability property in the connection request information.
@param holdability The new value.
@throws IllegalArgumentException if the key is incorrect.
@throws SQLException if the connection request information is not editable. | [
"Change",
"the",
"value",
"of",
"the",
"result",
"set",
"holdability",
"property",
"in",
"the",
"connection",
"request",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L863-L873 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setTransactionIsolationLevel | public void setTransactionIsolationLevel(int iso) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: iso , cri", iso, this));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting isolation level on the CRI to:", iso);
ivIsoLevel = iso;
} | java | public void setTransactionIsolationLevel(int iso) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: iso , cri", iso, this));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting isolation level on the CRI to:", iso);
ivIsoLevel = iso;
} | [
"public",
"void",
"setTransactionIsolationLevel",
"(",
"int",
"iso",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"changable",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"WS_INTERNAL_ERROR\"",
",",
"\"ConnectionRequestInfo cannot be modified, doing so may result in corruption: iso , cri\"",
",",
"iso",
",",
"this",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Setting isolation level on the CRI to:\"",
",",
"iso",
")",
";",
"ivIsoLevel",
"=",
"iso",
";",
"}"
] | sets the isolation level for this CRI. The J2C team are aware of the change and they are
ok with setting the isolation level as the values are not part of the hashCode and hence any changes
there will not affect the bucket in which the mc will reside in the connection pool
We are in need for setting the cri in case the application sets the value on the connection. | [
"sets",
"the",
"isolation",
"level",
"for",
"this",
"CRI",
".",
"The",
"J2C",
"team",
"are",
"aware",
"of",
"the",
"change",
"and",
"they",
"are",
"ok",
"with",
"setting",
"the",
"isolation",
"level",
"as",
"the",
"values",
"are",
"not",
"part",
"of",
"the",
"hashCode",
"and",
"hence",
"any",
"changes",
"there",
"will",
"not",
"affect",
"the",
"bucket",
"in",
"which",
"the",
"mc",
"will",
"reside",
"in",
"the",
"connection",
"pool",
"We",
"are",
"in",
"need",
"for",
"setting",
"the",
"cri",
"in",
"case",
"the",
"application",
"sets",
"the",
"value",
"on",
"the",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L881-L891 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setReadOnly | public void setReadOnly(boolean readOnly) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
new Object[] {
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: readOnly , cri",
readOnly, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting read only on the CRI to:", readOnly);
ivReadOnly = readOnly;
} | java | public void setReadOnly(boolean readOnly) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
new Object[] {
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: readOnly , cri",
readOnly, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting read only on the CRI to:", readOnly);
ivReadOnly = readOnly;
} | [
"public",
"void",
"setReadOnly",
"(",
"boolean",
"readOnly",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"changable",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"WS_INTERNAL_ERROR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"ConnectionRequestInfo cannot be modified, doing so may result in corruption: readOnly , cri\"",
",",
"readOnly",
",",
"this",
"}",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Setting read only on the CRI to:\"",
",",
"readOnly",
")",
";",
"ivReadOnly",
"=",
"readOnly",
";",
"}"
] | sets the readonly for this CRI. The J2C team are aware of the change and they are
ok with setting the readonly as the values are not part of the hashCode and hence any changes
there will not affect the bucket in which the mc will reside in the connection pool.
We are in need for setting the cri in case the application sets the value on the connection. | [
"sets",
"the",
"readonly",
"for",
"this",
"CRI",
".",
"The",
"J2C",
"team",
"are",
"aware",
"of",
"the",
"change",
"and",
"they",
"are",
"ok",
"with",
"setting",
"the",
"readonly",
"as",
"the",
"values",
"are",
"not",
"part",
"of",
"the",
"hashCode",
"and",
"hence",
"any",
"changes",
"there",
"will",
"not",
"affect",
"the",
"bucket",
"in",
"which",
"the",
"mc",
"will",
"reside",
"in",
"the",
"connection",
"pool",
".",
"We",
"are",
"in",
"need",
"for",
"setting",
"the",
"cri",
"in",
"case",
"the",
"application",
"sets",
"the",
"value",
"on",
"the",
"connection",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L899-L912 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setShardingKey | public void setShardingKey(Object shardingKey) throws SQLException {
if (!changable)
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: shardingKey, cri", shardingKey, this));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting sharding key on the CRI to: " + shardingKey);
ivShardingKey = shardingKey;
} | java | public void setShardingKey(Object shardingKey) throws SQLException {
if (!changable)
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: shardingKey, cri", shardingKey, this));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting sharding key on the CRI to: " + shardingKey);
ivShardingKey = shardingKey;
} | [
"public",
"void",
"setShardingKey",
"(",
"Object",
"shardingKey",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"changable",
")",
"throw",
"new",
"SQLException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"WS_INTERNAL_ERROR\"",
",",
"\"ConnectionRequestInfo cannot be modified, doing so may result in corruption: shardingKey, cri\"",
",",
"shardingKey",
",",
"this",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Setting sharding key on the CRI to: \"",
"+",
"shardingKey",
")",
";",
"ivShardingKey",
"=",
"shardingKey",
";",
"}"
] | Change the value of the sharding key property in the connection request information.
@param shardingKey the new value.
@throws SQLException if the connection request information is not editable. | [
"Change",
"the",
"value",
"of",
"the",
"sharding",
"key",
"property",
"in",
"the",
"connection",
"request",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L920-L929 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setSuperShardingKey | public void setSuperShardingKey(Object superShardingKey) throws SQLException {
if (!changable)
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: superShardingKey, cri", superShardingKey, this));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting super sharding key on the CRI to: " + superShardingKey);
ivSuperShardingKey = superShardingKey;
} | java | public void setSuperShardingKey(Object superShardingKey) throws SQLException {
if (!changable)
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR",
"ConnectionRequestInfo cannot be modified, doing so may result in corruption: superShardingKey, cri", superShardingKey, this));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting super sharding key on the CRI to: " + superShardingKey);
ivSuperShardingKey = superShardingKey;
} | [
"public",
"void",
"setSuperShardingKey",
"(",
"Object",
"superShardingKey",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"changable",
")",
"throw",
"new",
"SQLException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"WS_INTERNAL_ERROR\"",
",",
"\"ConnectionRequestInfo cannot be modified, doing so may result in corruption: superShardingKey, cri\"",
",",
"superShardingKey",
",",
"this",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Setting super sharding key on the CRI to: \"",
"+",
"superShardingKey",
")",
";",
"ivSuperShardingKey",
"=",
"superShardingKey",
";",
"}"
] | Change the value of the super sharding key property in the connection request information.
@param superShardingKey the new value.
@throws SQLException if the connection request information is not editable. | [
"Change",
"the",
"value",
"of",
"the",
"super",
"sharding",
"key",
"property",
"in",
"the",
"connection",
"request",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L937-L946 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.setTypeMap | public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR", new Object[]
{ "ConnectionRequestInfo cannot be modified, doing so may result in corruption: type map, cri", map, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting the type map on the CRI to: " + map);
ivTypeMap = map;
} | java | public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
if (!changable) {
throw new SQLException(AdapterUtil.getNLSMessage("WS_INTERNAL_ERROR", new Object[]
{ "ConnectionRequestInfo cannot be modified, doing so may result in corruption: type map, cri", map, this }));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Setting the type map on the CRI to: " + map);
ivTypeMap = map;
} | [
"public",
"void",
"setTypeMap",
"(",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"map",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"changable",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"AdapterUtil",
".",
"getNLSMessage",
"(",
"\"WS_INTERNAL_ERROR\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"ConnectionRequestInfo cannot be modified, doing so may result in corruption: type map, cri\"",
",",
"map",
",",
"this",
"}",
")",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Setting the type map on the CRI to: \"",
"+",
"map",
")",
";",
"ivTypeMap",
"=",
"map",
";",
"}"
] | Change the value of the type map property in the connection request information.
@param map The new value.
@throws IllegalArgumentException if the key is incorrect.
@throws SQLException if the connection request information is not editable. | [
"Change",
"the",
"value",
"of",
"the",
"type",
"map",
"property",
"in",
"the",
"connection",
"request",
"information",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L955-L965 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.createChangableCRIFromNon | public static WSConnectionRequestInfoImpl createChangableCRIFromNon(WSConnectionRequestInfoImpl oldCRI) {
WSConnectionRequestInfoImpl connInfo = new WSConnectionRequestInfoImpl(
oldCRI.getUserName(),
oldCRI.getPassword(),
oldCRI.getIsolationLevel(),
oldCRI.getCatalog(),
oldCRI.isReadOnly(),
oldCRI.getShardingKey(),
oldCRI.getSuperShardingKey(),
oldCRI.getTypeMap(),
oldCRI.getHoldability(),
oldCRI.getSchema(),
oldCRI.getNetworkTimeout(),
oldCRI.getConfigID(),
oldCRI.getSupportIsolvlSwitchingValue());
connInfo.setDefaultValues(oldCRI.defaultCatalog, oldCRI.defaultHoldability,
oldCRI.defaultReadOnly, oldCRI.defaultTypeMap, oldCRI.defaultSchema,
oldCRI.defaultNetworkTimeout);
connInfo.markAsChangable();
return connInfo;
} | java | public static WSConnectionRequestInfoImpl createChangableCRIFromNon(WSConnectionRequestInfoImpl oldCRI) {
WSConnectionRequestInfoImpl connInfo = new WSConnectionRequestInfoImpl(
oldCRI.getUserName(),
oldCRI.getPassword(),
oldCRI.getIsolationLevel(),
oldCRI.getCatalog(),
oldCRI.isReadOnly(),
oldCRI.getShardingKey(),
oldCRI.getSuperShardingKey(),
oldCRI.getTypeMap(),
oldCRI.getHoldability(),
oldCRI.getSchema(),
oldCRI.getNetworkTimeout(),
oldCRI.getConfigID(),
oldCRI.getSupportIsolvlSwitchingValue());
connInfo.setDefaultValues(oldCRI.defaultCatalog, oldCRI.defaultHoldability,
oldCRI.defaultReadOnly, oldCRI.defaultTypeMap, oldCRI.defaultSchema,
oldCRI.defaultNetworkTimeout);
connInfo.markAsChangable();
return connInfo;
} | [
"public",
"static",
"WSConnectionRequestInfoImpl",
"createChangableCRIFromNon",
"(",
"WSConnectionRequestInfoImpl",
"oldCRI",
")",
"{",
"WSConnectionRequestInfoImpl",
"connInfo",
"=",
"new",
"WSConnectionRequestInfoImpl",
"(",
"oldCRI",
".",
"getUserName",
"(",
")",
",",
"oldCRI",
".",
"getPassword",
"(",
")",
",",
"oldCRI",
".",
"getIsolationLevel",
"(",
")",
",",
"oldCRI",
".",
"getCatalog",
"(",
")",
",",
"oldCRI",
".",
"isReadOnly",
"(",
")",
",",
"oldCRI",
".",
"getShardingKey",
"(",
")",
",",
"oldCRI",
".",
"getSuperShardingKey",
"(",
")",
",",
"oldCRI",
".",
"getTypeMap",
"(",
")",
",",
"oldCRI",
".",
"getHoldability",
"(",
")",
",",
"oldCRI",
".",
"getSchema",
"(",
")",
",",
"oldCRI",
".",
"getNetworkTimeout",
"(",
")",
",",
"oldCRI",
".",
"getConfigID",
"(",
")",
",",
"oldCRI",
".",
"getSupportIsolvlSwitchingValue",
"(",
")",
")",
";",
"connInfo",
".",
"setDefaultValues",
"(",
"oldCRI",
".",
"defaultCatalog",
",",
"oldCRI",
".",
"defaultHoldability",
",",
"oldCRI",
".",
"defaultReadOnly",
",",
"oldCRI",
".",
"defaultTypeMap",
",",
"oldCRI",
".",
"defaultSchema",
",",
"oldCRI",
".",
"defaultNetworkTimeout",
")",
";",
"connInfo",
".",
"markAsChangable",
"(",
")",
";",
"return",
"connInfo",
";",
"}"
] | utility to create changable CRI from non changable one.
@param oldCRI
@return | [
"utility",
"to",
"create",
"changable",
"CRI",
"from",
"non",
"changable",
"one",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L1001-L1023 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/spi/impl/ResourceAnnotationInjectionProvider.java | ResourceAnnotationInjectionProvider.processAnnotations | @Override
protected void processAnnotations(Object instance)
throws IllegalAccessException, InvocationTargetException, NamingException
{
if (context == null)
{
// No resource injection
return;
}
checkAnnotation(instance.getClass(), instance);
/*
* May be only check non private fields and methods
* for @Resource (JSR 250), if used all superclasses MUST be examined
* to discover all uses of this annotation.
*/
Class superclass = instance.getClass().getSuperclass();
while (superclass != null && (!superclass.equals(Object.class)))
{
checkAnnotation(superclass, instance);
superclass = superclass.getSuperclass();
}
} | java | @Override
protected void processAnnotations(Object instance)
throws IllegalAccessException, InvocationTargetException, NamingException
{
if (context == null)
{
// No resource injection
return;
}
checkAnnotation(instance.getClass(), instance);
/*
* May be only check non private fields and methods
* for @Resource (JSR 250), if used all superclasses MUST be examined
* to discover all uses of this annotation.
*/
Class superclass = instance.getClass().getSuperclass();
while (superclass != null && (!superclass.equals(Object.class)))
{
checkAnnotation(superclass, instance);
superclass = superclass.getSuperclass();
}
} | [
"@",
"Override",
"protected",
"void",
"processAnnotations",
"(",
"Object",
"instance",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"NamingException",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"// No resource injection",
"return",
";",
"}",
"checkAnnotation",
"(",
"instance",
".",
"getClass",
"(",
")",
",",
"instance",
")",
";",
"/* \n * May be only check non private fields and methods\n * for @Resource (JSR 250), if used all superclasses MUST be examined\n * to discover all uses of this annotation.\n */",
"Class",
"superclass",
"=",
"instance",
".",
"getClass",
"(",
")",
".",
"getSuperclass",
"(",
")",
";",
"while",
"(",
"superclass",
"!=",
"null",
"&&",
"(",
"!",
"superclass",
".",
"equals",
"(",
"Object",
".",
"class",
")",
")",
")",
"{",
"checkAnnotation",
"(",
"superclass",
",",
"instance",
")",
";",
"superclass",
"=",
"superclass",
".",
"getSuperclass",
"(",
")",
";",
"}",
"}"
] | Inject resources in specified instance. | [
"Inject",
"resources",
"in",
"specified",
"instance",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/spi/impl/ResourceAnnotationInjectionProvider.java#L89-L114 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/spi/impl/ResourceAnnotationInjectionProvider.java | ResourceAnnotationInjectionProvider.lookupMethodResource | protected static void lookupMethodResource(javax.naming.Context context,
Object instance, Method method, String name)
throws NamingException, IllegalAccessException, InvocationTargetException
{
if (!method.getName().startsWith("set")
|| method.getParameterTypes().length != 1
|| !method.getReturnType().getName().equals("void"))
{
throw new IllegalArgumentException("Invalid method resource injection annotation");
}
Object lookedupResource;
if ((name != null) && (name.length() > 0))
{
// TODO local or global JNDI
lookedupResource = context.lookup(JAVA_COMP_ENV + name);
}
else
{
// TODO local or global JNDI
lookedupResource =
context.lookup(JAVA_COMP_ENV + instance.getClass().getName() + "/" + getFieldName(method));
}
boolean accessibility = method.isAccessible();
method.setAccessible(true);
method.invoke(instance, lookedupResource);
method.setAccessible(accessibility);
} | java | protected static void lookupMethodResource(javax.naming.Context context,
Object instance, Method method, String name)
throws NamingException, IllegalAccessException, InvocationTargetException
{
if (!method.getName().startsWith("set")
|| method.getParameterTypes().length != 1
|| !method.getReturnType().getName().equals("void"))
{
throw new IllegalArgumentException("Invalid method resource injection annotation");
}
Object lookedupResource;
if ((name != null) && (name.length() > 0))
{
// TODO local or global JNDI
lookedupResource = context.lookup(JAVA_COMP_ENV + name);
}
else
{
// TODO local or global JNDI
lookedupResource =
context.lookup(JAVA_COMP_ENV + instance.getClass().getName() + "/" + getFieldName(method));
}
boolean accessibility = method.isAccessible();
method.setAccessible(true);
method.invoke(instance, lookedupResource);
method.setAccessible(accessibility);
} | [
"protected",
"static",
"void",
"lookupMethodResource",
"(",
"javax",
".",
"naming",
".",
"Context",
"context",
",",
"Object",
"instance",
",",
"Method",
"method",
",",
"String",
"name",
")",
"throws",
"NamingException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"if",
"(",
"!",
"method",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"set\"",
")",
"||",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"!=",
"1",
"||",
"!",
"method",
".",
"getReturnType",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"void\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid method resource injection annotation\"",
")",
";",
"}",
"Object",
"lookedupResource",
";",
"if",
"(",
"(",
"name",
"!=",
"null",
")",
"&&",
"(",
"name",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"// TODO local or global JNDI",
"lookedupResource",
"=",
"context",
".",
"lookup",
"(",
"JAVA_COMP_ENV",
"+",
"name",
")",
";",
"}",
"else",
"{",
"// TODO local or global JNDI",
"lookedupResource",
"=",
"context",
".",
"lookup",
"(",
"JAVA_COMP_ENV",
"+",
"instance",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"/\"",
"+",
"getFieldName",
"(",
"method",
")",
")",
";",
"}",
"boolean",
"accessibility",
"=",
"method",
".",
"isAccessible",
"(",
")",
";",
"method",
".",
"setAccessible",
"(",
"true",
")",
";",
"method",
".",
"invoke",
"(",
"instance",
",",
"lookedupResource",
")",
";",
"method",
".",
"setAccessible",
"(",
"accessibility",
")",
";",
"}"
] | Inject resources in specified method. | [
"Inject",
"resources",
"in",
"specified",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/spi/impl/ResourceAnnotationInjectionProvider.java#L202-L232 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java | ProducerSessionProxy._send | private void _send(SIBusMessage msg, SITransaction tran)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIErrorException,
SINotAuthorizedException,
SIIncorrectCallException,
SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "_send");
boolean sendSuccessful = false;
// Get the message priority
short jfapPriority = JFapChannelConstants.getJFAPPriority(msg.getPriority());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority);
updateLowestPriority(jfapPriority);
// *** Complex logic to determine if we can get away we need a reply to ***
// *** this send operation. ***
final boolean requireReply;
if (tran != null && !exchangeTransactedSends)
{
// If there is a transaction, and we haven't been explicitly told to exchange
// transacted sends - then a reply is NOT required.
requireReply = false;
}
else if (exchangeExpressSends)
{
// We have been prohibited from sending (rather than exchanging) low
// qualities of service - thus there is no way that we can avoid requiring
// a reply.
requireReply = true;
}
else
{
// We CAN perform the optimization where low qualities of service can be sent
// without requiring a reply. Check the message quality of service.
requireReply = (msg.getReliability() != Reliability.BEST_EFFORT_NONPERSISTENT) &&
(msg.getReliability() != Reliability.EXPRESS_NONPERSISTENT);
}
// *** end of "is a reply required" logic ***
// If we are at FAP9 or above we can do a 'chunked' send of the message in seperate
// slices to make life easier on the Java memory manager
final HandshakeProperties props = getConversation().getHandshakeProperties();
if (props.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9)
{
sendChunkedMessage(tran, msg, requireReply, jfapPriority);
}
else
{
sendEntireMessage(tran, msg, null, requireReply, jfapPriority);
}
sendSuccessful = true;
if (TraceComponent.isAnyTracingEnabled())
CommsLightTrace.traceMessageId(tc, "SendMsgTrace", msg);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "_send");
} | java | private void _send(SIBusMessage msg, SITransaction tran)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIErrorException,
SINotAuthorizedException,
SIIncorrectCallException,
SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "_send");
boolean sendSuccessful = false;
// Get the message priority
short jfapPriority = JFapChannelConstants.getJFAPPriority(msg.getPriority());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority);
updateLowestPriority(jfapPriority);
// *** Complex logic to determine if we can get away we need a reply to ***
// *** this send operation. ***
final boolean requireReply;
if (tran != null && !exchangeTransactedSends)
{
// If there is a transaction, and we haven't been explicitly told to exchange
// transacted sends - then a reply is NOT required.
requireReply = false;
}
else if (exchangeExpressSends)
{
// We have been prohibited from sending (rather than exchanging) low
// qualities of service - thus there is no way that we can avoid requiring
// a reply.
requireReply = true;
}
else
{
// We CAN perform the optimization where low qualities of service can be sent
// without requiring a reply. Check the message quality of service.
requireReply = (msg.getReliability() != Reliability.BEST_EFFORT_NONPERSISTENT) &&
(msg.getReliability() != Reliability.EXPRESS_NONPERSISTENT);
}
// *** end of "is a reply required" logic ***
// If we are at FAP9 or above we can do a 'chunked' send of the message in seperate
// slices to make life easier on the Java memory manager
final HandshakeProperties props = getConversation().getHandshakeProperties();
if (props.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9)
{
sendChunkedMessage(tran, msg, requireReply, jfapPriority);
}
else
{
sendEntireMessage(tran, msg, null, requireReply, jfapPriority);
}
sendSuccessful = true;
if (TraceComponent.isAnyTracingEnabled())
CommsLightTrace.traceMessageId(tc, "SendMsgTrace", msg);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "_send");
} | [
"private",
"void",
"_send",
"(",
"SIBusMessage",
"msg",
",",
"SITransaction",
"tran",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SIErrorException",
",",
"SINotAuthorizedException",
",",
"SIIncorrectCallException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"_send\"",
")",
";",
"boolean",
"sendSuccessful",
"=",
"false",
";",
"// Get the message priority",
"short",
"jfapPriority",
"=",
"JFapChannelConstants",
".",
"getJFAPPriority",
"(",
"msg",
".",
"getPriority",
"(",
")",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"SibTr",
".",
"debug",
"(",
"this",
",",
"tc",
",",
"\"Sending with JFAP priority of \"",
"+",
"jfapPriority",
")",
";",
"updateLowestPriority",
"(",
"jfapPriority",
")",
";",
"// *** Complex logic to determine if we can get away we need a reply to ***",
"// *** this send operation. ***",
"final",
"boolean",
"requireReply",
";",
"if",
"(",
"tran",
"!=",
"null",
"&&",
"!",
"exchangeTransactedSends",
")",
"{",
"// If there is a transaction, and we haven't been explicitly told to exchange",
"// transacted sends - then a reply is NOT required.",
"requireReply",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"exchangeExpressSends",
")",
"{",
"// We have been prohibited from sending (rather than exchanging) low",
"// qualities of service - thus there is no way that we can avoid requiring",
"// a reply.",
"requireReply",
"=",
"true",
";",
"}",
"else",
"{",
"// We CAN perform the optimization where low qualities of service can be sent",
"// without requiring a reply. Check the message quality of service.",
"requireReply",
"=",
"(",
"msg",
".",
"getReliability",
"(",
")",
"!=",
"Reliability",
".",
"BEST_EFFORT_NONPERSISTENT",
")",
"&&",
"(",
"msg",
".",
"getReliability",
"(",
")",
"!=",
"Reliability",
".",
"EXPRESS_NONPERSISTENT",
")",
";",
"}",
"// *** end of \"is a reply required\" logic ***",
"// If we are at FAP9 or above we can do a 'chunked' send of the message in seperate ",
"// slices to make life easier on the Java memory manager",
"final",
"HandshakeProperties",
"props",
"=",
"getConversation",
"(",
")",
".",
"getHandshakeProperties",
"(",
")",
";",
"if",
"(",
"props",
".",
"getFapLevel",
"(",
")",
">=",
"JFapChannelConstants",
".",
"FAP_VERSION_9",
")",
"{",
"sendChunkedMessage",
"(",
"tran",
",",
"msg",
",",
"requireReply",
",",
"jfapPriority",
")",
";",
"}",
"else",
"{",
"sendEntireMessage",
"(",
"tran",
",",
"msg",
",",
"null",
",",
"requireReply",
",",
"jfapPriority",
")",
";",
"}",
"sendSuccessful",
"=",
"true",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
")",
"CommsLightTrace",
".",
"traceMessageId",
"(",
"tc",
",",
"\"SendMsgTrace\"",
",",
"msg",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"_send\"",
")",
";",
"}"
] | This method performs the actual send, but does no parameter checking
and gets no locks needed to perform the send. This should be done
by a suitable 'super'-method.
@param msg
@param tran
@throws com.ibm.wsspi.sib.core.exception.SISessionUnavailableException
@throws com.ibm.wsspi.sib.core.exception.SISessionDroppedException
@throws com.ibm.wsspi.sib.core.exception.SIConnectionUnavailableException
@throws com.ibm.wsspi.sib.core.exception.SIConnectionDroppedException
@throws com.ibm.websphere.sib.exception.SIResourceException
@throws com.ibm.wsspi.sib.core.exception.SIConnectionLostException
@throws com.ibm.wsspi.sib.core.exception.SILimitExceededException
@throws com.ibm.websphere.sib.exception.SIErrorException
@throws com.ibm.wsspi.sib.core.exception.SINotAuthorizedException
@throws com.ibm.websphere.sib.exception.SIIncorrectCallException
@throws com.ibm.websphere.sib.exception.SINotPossibleInCurrentConfigurationException | [
"This",
"method",
"performs",
"the",
"actual",
"send",
"but",
"does",
"no",
"parameter",
"checking",
"and",
"gets",
"no",
"locks",
"needed",
"to",
"perform",
"the",
"send",
".",
"This",
"should",
"be",
"done",
"by",
"a",
"suitable",
"super",
"-",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java#L266-L328 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java | ProducerSessionProxy.sendEntireMessage | private void sendEntireMessage(SITransaction tran, SIBusMessage msg,
List<DataSlice> messageSlices, boolean requireReply,
short jfapPriority)
throws SIResourceException, SISessionUnavailableException,
SINotPossibleInCurrentConfigurationException, SIIncorrectCallException,
SIConnectionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage",
new Object[]{tran, msg, messageSlices, requireReply, jfapPriority});
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
request.putSITransaction(tran);
if (messageSlices == null)
{
request.putClientMessage(msg, getCommsConnection(), getConversation());
}
else
{
request.putMessgeWithoutEncode(messageSlices);
}
sendData(request,
jfapPriority,
requireReply,
tran,
JFapChannelConstants.SEG_SEND_SESS_MSG,
JFapChannelConstants.SEG_SEND_SESS_MSG_NOREPLY,
JFapChannelConstants.SEG_SEND_SESS_MSG_R);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage");
} | java | private void sendEntireMessage(SITransaction tran, SIBusMessage msg,
List<DataSlice> messageSlices, boolean requireReply,
short jfapPriority)
throws SIResourceException, SISessionUnavailableException,
SINotPossibleInCurrentConfigurationException, SIIncorrectCallException,
SIConnectionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage",
new Object[]{tran, msg, messageSlices, requireReply, jfapPriority});
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
request.putSITransaction(tran);
if (messageSlices == null)
{
request.putClientMessage(msg, getCommsConnection(), getConversation());
}
else
{
request.putMessgeWithoutEncode(messageSlices);
}
sendData(request,
jfapPriority,
requireReply,
tran,
JFapChannelConstants.SEG_SEND_SESS_MSG,
JFapChannelConstants.SEG_SEND_SESS_MSG_NOREPLY,
JFapChannelConstants.SEG_SEND_SESS_MSG_R);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage");
} | [
"private",
"void",
"sendEntireMessage",
"(",
"SITransaction",
"tran",
",",
"SIBusMessage",
"msg",
",",
"List",
"<",
"DataSlice",
">",
"messageSlices",
",",
"boolean",
"requireReply",
",",
"short",
"jfapPriority",
")",
"throws",
"SIResourceException",
",",
"SISessionUnavailableException",
",",
"SINotPossibleInCurrentConfigurationException",
",",
"SIIncorrectCallException",
",",
"SIConnectionUnavailableException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"sendEntireMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"tran",
",",
"msg",
",",
"messageSlices",
",",
"requireReply",
",",
"jfapPriority",
"}",
")",
";",
"CommsByteBuffer",
"request",
"=",
"getCommsByteBuffer",
"(",
")",
";",
"request",
".",
"putShort",
"(",
"getConnectionObjectID",
"(",
")",
")",
";",
"request",
".",
"putShort",
"(",
"getProxyID",
"(",
")",
")",
";",
"request",
".",
"putSITransaction",
"(",
"tran",
")",
";",
"if",
"(",
"messageSlices",
"==",
"null",
")",
"{",
"request",
".",
"putClientMessage",
"(",
"msg",
",",
"getCommsConnection",
"(",
")",
",",
"getConversation",
"(",
")",
")",
";",
"}",
"else",
"{",
"request",
".",
"putMessgeWithoutEncode",
"(",
"messageSlices",
")",
";",
"}",
"sendData",
"(",
"request",
",",
"jfapPriority",
",",
"requireReply",
",",
"tran",
",",
"JFapChannelConstants",
".",
"SEG_SEND_SESS_MSG",
",",
"JFapChannelConstants",
".",
"SEG_SEND_SESS_MSG_NOREPLY",
",",
"JFapChannelConstants",
".",
"SEG_SEND_SESS_MSG_R",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"sendEntireMessage\"",
")",
";",
"}"
] | Sends the entire message in one big JFap message. This requires the allocation of one big
area of storage for the whole message. If the messageSlices parameter is not null then the
message has already been encoded and can just be added into the buffer without encoding again.
@param tran
@param msg
@param messageSlices
@param requireReply
@param jfapPriority
@throws SIResourceException
@throws SISessionUnavailableException
@throws SINotPossibleInCurrentConfigurationException
@throws SIIncorrectCallException
@throws SIConnectionUnavailableException | [
"Sends",
"the",
"entire",
"message",
"in",
"one",
"big",
"JFap",
"message",
".",
"This",
"requires",
"the",
"allocation",
"of",
"one",
"big",
"area",
"of",
"storage",
"for",
"the",
"whole",
"message",
".",
"If",
"the",
"messageSlices",
"parameter",
"is",
"not",
"null",
"then",
"the",
"message",
"has",
"already",
"been",
"encoded",
"and",
"can",
"just",
"be",
"added",
"into",
"the",
"buffer",
"without",
"encoding",
"again",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java#L347-L380 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java | ProducerSessionProxy.sendData | private void sendData(CommsByteBuffer request, short jfapPriority, boolean requireReply,
SITransaction tran, int outboundSegmentType, int outboundNoReplySegmentType,
int replySegmentType)
throws SIResourceException, SISessionUnavailableException,
SINotPossibleInCurrentConfigurationException, SIIncorrectCallException,
SIConnectionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendData",
new Object[]
{
request,
jfapPriority,
requireReply,
tran,
outboundSegmentType,
outboundNoReplySegmentType,
replySegmentType
});
if (requireReply)
{
// Pass on call to server
CommsByteBuffer reply = jfapExchange(request,
outboundSegmentType,
jfapPriority,
false);
try
{
short err = reply.getCommandCompletionCode(replySegmentType);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SILimitExceededException(reply, err);
checkFor_SINotAuthorizedException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SINotPossibleInCurrentConfigurationException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
}
else
{
jfapSend(request,
outboundNoReplySegmentType,
jfapPriority,
false,
ThrottlingPolicy.BLOCK_THREAD);
// Update the lowest priority
if (tran != null)
{
((Transaction) tran).updateLowestMessagePriority(jfapPriority);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendData");
} | java | private void sendData(CommsByteBuffer request, short jfapPriority, boolean requireReply,
SITransaction tran, int outboundSegmentType, int outboundNoReplySegmentType,
int replySegmentType)
throws SIResourceException, SISessionUnavailableException,
SINotPossibleInCurrentConfigurationException, SIIncorrectCallException,
SIConnectionUnavailableException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendData",
new Object[]
{
request,
jfapPriority,
requireReply,
tran,
outboundSegmentType,
outboundNoReplySegmentType,
replySegmentType
});
if (requireReply)
{
// Pass on call to server
CommsByteBuffer reply = jfapExchange(request,
outboundSegmentType,
jfapPriority,
false);
try
{
short err = reply.getCommandCompletionCode(replySegmentType);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SILimitExceededException(reply, err);
checkFor_SINotAuthorizedException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SINotPossibleInCurrentConfigurationException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
}
else
{
jfapSend(request,
outboundNoReplySegmentType,
jfapPriority,
false,
ThrottlingPolicy.BLOCK_THREAD);
// Update the lowest priority
if (tran != null)
{
((Transaction) tran).updateLowestMessagePriority(jfapPriority);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendData");
} | [
"private",
"void",
"sendData",
"(",
"CommsByteBuffer",
"request",
",",
"short",
"jfapPriority",
",",
"boolean",
"requireReply",
",",
"SITransaction",
"tran",
",",
"int",
"outboundSegmentType",
",",
"int",
"outboundNoReplySegmentType",
",",
"int",
"replySegmentType",
")",
"throws",
"SIResourceException",
",",
"SISessionUnavailableException",
",",
"SINotPossibleInCurrentConfigurationException",
",",
"SIIncorrectCallException",
",",
"SIConnectionUnavailableException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"sendData\"",
",",
"new",
"Object",
"[",
"]",
"{",
"request",
",",
"jfapPriority",
",",
"requireReply",
",",
"tran",
",",
"outboundSegmentType",
",",
"outboundNoReplySegmentType",
",",
"replySegmentType",
"}",
")",
";",
"if",
"(",
"requireReply",
")",
"{",
"// Pass on call to server",
"CommsByteBuffer",
"reply",
"=",
"jfapExchange",
"(",
"request",
",",
"outboundSegmentType",
",",
"jfapPriority",
",",
"false",
")",
";",
"try",
"{",
"short",
"err",
"=",
"reply",
".",
"getCommandCompletionCode",
"(",
"replySegmentType",
")",
";",
"if",
"(",
"err",
"!=",
"CommsConstants",
".",
"SI_NO_EXCEPTION",
")",
"{",
"checkFor_SISessionUnavailableException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SISessionDroppedException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionUnavailableException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionDroppedException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIResourceException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionLostException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SILimitExceededException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SINotAuthorizedException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIIncorrectCallException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SINotPossibleInCurrentConfigurationException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIErrorException",
"(",
"reply",
",",
"err",
")",
";",
"defaultChecker",
"(",
"reply",
",",
"err",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"reply",
"!=",
"null",
")",
"reply",
".",
"release",
"(",
")",
";",
"}",
"}",
"else",
"{",
"jfapSend",
"(",
"request",
",",
"outboundNoReplySegmentType",
",",
"jfapPriority",
",",
"false",
",",
"ThrottlingPolicy",
".",
"BLOCK_THREAD",
")",
";",
"// Update the lowest priority",
"if",
"(",
"tran",
"!=",
"null",
")",
"{",
"(",
"(",
"Transaction",
")",
"tran",
")",
".",
"updateLowestMessagePriority",
"(",
"jfapPriority",
")",
";",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"sendData\"",
")",
";",
"}"
] | This helper method is used to send the final or only part of a message to our peer. It takes
care of whether we should be exchanging the message and deals with the exceptions returned.
@param request The request buffer
@param jfapPriority The JFap priority to send the message
@param requireReply Whether we require a reply (or fire-and-forget it)
@param tran The transaction being used to send the message (may be null)
@param outboundSegmentType The segment type to exchange with
@param outboundNoReplySegmentType The segment type to fire-and-forget with
@param replySegmentType The segment type to expect on replies
@throws SIResourceException
@throws SISessionUnavailableException
@throws SINotPossibleInCurrentConfigurationException
@throws SIIncorrectCallException
@throws SIConnectionUnavailableException | [
"This",
"helper",
"method",
"is",
"used",
"to",
"send",
"the",
"final",
"or",
"only",
"part",
"of",
"a",
"message",
"to",
"our",
"peer",
".",
"It",
"takes",
"care",
"of",
"whether",
"we",
"should",
"be",
"exchanging",
"the",
"message",
"and",
"deals",
"with",
"the",
"exceptions",
"returned",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java#L527-L594 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java | ProducerSessionProxy.close | public void close()
throws SIResourceException, SIConnectionLostException,
SIErrorException, SIConnectionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close");
// Have we already been closed?
if (!isClosed())
{
try
{
closeLock.writeLock().lockInterruptibly();
try
{
CommsByteBuffer request = getCommsByteBuffer();
// Build Message Header
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
// Pass on call to server
CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_CLOSE_PRODUCER_SESS,
lowestPriority,
true);
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_CLOSE_PRODUCER_SESS_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
setClosed();
if (oc != null) oc.decrementUseCount();
}
finally
{
closeLock.writeLock().unlock();
}
}
catch (InterruptedException e)
{
// No FFDC code needed
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
} | java | public void close()
throws SIResourceException, SIConnectionLostException,
SIErrorException, SIConnectionDroppedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "close");
// Have we already been closed?
if (!isClosed())
{
try
{
closeLock.writeLock().lockInterruptibly();
try
{
CommsByteBuffer request = getCommsByteBuffer();
// Build Message Header
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
// Pass on call to server
CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_CLOSE_PRODUCER_SESS,
lowestPriority,
true);
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_CLOSE_PRODUCER_SESS_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
setClosed();
if (oc != null) oc.decrementUseCount();
}
finally
{
closeLock.writeLock().unlock();
}
}
catch (InterruptedException e)
{
// No FFDC code needed
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "close");
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SIErrorException",
",",
"SIConnectionDroppedException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"close\"",
")",
";",
"// Have we already been closed?",
"if",
"(",
"!",
"isClosed",
"(",
")",
")",
"{",
"try",
"{",
"closeLock",
".",
"writeLock",
"(",
")",
".",
"lockInterruptibly",
"(",
")",
";",
"try",
"{",
"CommsByteBuffer",
"request",
"=",
"getCommsByteBuffer",
"(",
")",
";",
"// Build Message Header",
"request",
".",
"putShort",
"(",
"getConnectionObjectID",
"(",
")",
")",
";",
"request",
".",
"putShort",
"(",
"getProxyID",
"(",
")",
")",
";",
"// Pass on call to server",
"CommsByteBuffer",
"reply",
"=",
"jfapExchange",
"(",
"request",
",",
"JFapChannelConstants",
".",
"SEG_CLOSE_PRODUCER_SESS",
",",
"lowestPriority",
",",
"true",
")",
";",
"try",
"{",
"short",
"err",
"=",
"reply",
".",
"getCommandCompletionCode",
"(",
"JFapChannelConstants",
".",
"SEG_CLOSE_PRODUCER_SESS_R",
")",
";",
"if",
"(",
"err",
"!=",
"CommsConstants",
".",
"SI_NO_EXCEPTION",
")",
"{",
"checkFor_SIConnectionDroppedException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIResourceException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionLostException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIErrorException",
"(",
"reply",
",",
"err",
")",
";",
"defaultChecker",
"(",
"reply",
",",
"err",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"reply",
"!=",
"null",
")",
"reply",
".",
"release",
"(",
")",
";",
"}",
"setClosed",
"(",
")",
";",
"if",
"(",
"oc",
"!=",
"null",
")",
"oc",
".",
"decrementUseCount",
"(",
")",
";",
"}",
"finally",
"{",
"closeLock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// No FFDC code needed",
"}",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"close\"",
")",
";",
"}"
] | Closes the ProducerSession.
@throws com.ibm.websphere.sib.exception.SIResourceException
@throws com.ibm.wsspi.sib.core.exception.SIConnectionLostException
@throws com.ibm.websphere.sib.exception.SIErrorException
@throws com.ibm.wsspi.sib.core.exception.SIConnectionDroppedException | [
"Closes",
"the",
"ProducerSession",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProducerSessionProxy.java#L604-L663 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getFieldValue | private static Object getFieldValue(FieldClassValue fieldClassValue, Object obj) {
try {
return fieldClassValue.get(obj.getClass()).get(obj);
} catch (IllegalAccessException e) {
// FieldClassValueFactory returns ClassValue that make the Field
// accessible, so this should not happen.
throw new IllegalStateException(e);
}
} | java | private static Object getFieldValue(FieldClassValue fieldClassValue, Object obj) {
try {
return fieldClassValue.get(obj.getClass()).get(obj);
} catch (IllegalAccessException e) {
// FieldClassValueFactory returns ClassValue that make the Field
// accessible, so this should not happen.
throw new IllegalStateException(e);
}
} | [
"private",
"static",
"Object",
"getFieldValue",
"(",
"FieldClassValue",
"fieldClassValue",
",",
"Object",
"obj",
")",
"{",
"try",
"{",
"return",
"fieldClassValue",
".",
"get",
"(",
"obj",
".",
"getClass",
"(",
")",
")",
".",
"get",
"(",
"obj",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"// FieldClassValueFactory returns ClassValue that make the Field",
"// accessible, so this should not happen.",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}"
] | Get the value of a field from an object.
@param fieldClassValue the Field class value
@param obj the object
@return the field value | [
"Get",
"the",
"value",
"of",
"a",
"field",
"from",
"an",
"object",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L468-L476 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getLocalBeanWrapperProxyState | public static WrapperProxyState getLocalBeanWrapperProxyState(LocalBeanWrapperProxy obj) { // F58064
BusinessLocalWrapperProxy proxyStateHolder = (BusinessLocalWrapperProxy) getFieldValue(svLocalBeanWrapperProxyStateFieldClassValue, obj);
return proxyStateHolder.ivState;
} | java | public static WrapperProxyState getLocalBeanWrapperProxyState(LocalBeanWrapperProxy obj) { // F58064
BusinessLocalWrapperProxy proxyStateHolder = (BusinessLocalWrapperProxy) getFieldValue(svLocalBeanWrapperProxyStateFieldClassValue, obj);
return proxyStateHolder.ivState;
} | [
"public",
"static",
"WrapperProxyState",
"getLocalBeanWrapperProxyState",
"(",
"LocalBeanWrapperProxy",
"obj",
")",
"{",
"// F58064",
"BusinessLocalWrapperProxy",
"proxyStateHolder",
"=",
"(",
"BusinessLocalWrapperProxy",
")",
"getFieldValue",
"(",
"svLocalBeanWrapperProxyStateFieldClassValue",
",",
"obj",
")",
";",
"return",
"proxyStateHolder",
".",
"ivState",
";",
"}"
] | Returns the wrapper proxy object for an object that implements
LocalBeanWrapperProxy. This operation should never fail, but if it
does, exceptions will be thrown as EJBException.
@param obj the LocalBeanWrapperProxy
@return the wrapper proxy for the local bean wrapper proxy | [
"Returns",
"the",
"wrapper",
"proxy",
"object",
"for",
"an",
"object",
"that",
"implements",
"LocalBeanWrapperProxy",
".",
"This",
"operation",
"should",
"never",
"fail",
"but",
"if",
"it",
"does",
"exceptions",
"will",
"be",
"thrown",
"as",
"EJBException",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L502-L505 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.registerServant | protected void registerServant()
{
if (ivRemoteObjectWrapper != null)
{
// synchronized on the remote Wrapper to set the isRemoteRegistered flag
synchronized (ivRemoteObjectWrapper)
{
if (!isRemoteRegistered)
{
try
{
if (!isZOS) // LIDB2775-23.9
{
// Servant registration must be performed with the application classloader
// in force. This is especially needed for JITDeploy since
// the JIT pluggin will be on the application classloader.
// Without the JIT pluggin the classloader will not trigger
// JITDeploy to create the stub. //d521388
Object originalLoader = ThreadContextAccessor.UNCHANGED;
try
{
if (ivBMD != null) // EJBFactories have no BMD d529446
{
originalLoader = EJBThreadData.svThreadContextAccessor.pushContextClassLoaderForUnprivileged(ivBMD.classLoader); //PK83186
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
if (originalLoader != ThreadContextAccessor.UNCHANGED)
{
Tr.debug(tc, "registerServant : old ClassLoader = " + originalLoader);
Tr.debug(tc, "registerServant : new ClassLoader = " + ivBMD.classLoader);
}
else
{
Tr.debug(tc, "registerServant : current ClassLoader = " + ivBMD.classLoader);
}
}
}
ivRemoteObjectWrapper.container.getEJBRuntime().registerServant(ivRemoteObjectWrapper.beanId.getByteArray(), ivRemoteObjectWrapper);
} finally
{
EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(originalLoader);
} // finally
} // if( !isZOS )
isRemoteRegistered = true;
} catch (Exception ex)
{
FFDCFilter.processException(ex, CLASS_NAME +
".registerServant",
"184", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to register wrapper instance",
new Object[] { ivRemoteObjectWrapper, ex });
}
}
} // if ( !isRemoteRegistered )
} // synchronized( ivRemoteObject )
} // if ( ivRemoteObject != null )
} | java | protected void registerServant()
{
if (ivRemoteObjectWrapper != null)
{
// synchronized on the remote Wrapper to set the isRemoteRegistered flag
synchronized (ivRemoteObjectWrapper)
{
if (!isRemoteRegistered)
{
try
{
if (!isZOS) // LIDB2775-23.9
{
// Servant registration must be performed with the application classloader
// in force. This is especially needed for JITDeploy since
// the JIT pluggin will be on the application classloader.
// Without the JIT pluggin the classloader will not trigger
// JITDeploy to create the stub. //d521388
Object originalLoader = ThreadContextAccessor.UNCHANGED;
try
{
if (ivBMD != null) // EJBFactories have no BMD d529446
{
originalLoader = EJBThreadData.svThreadContextAccessor.pushContextClassLoaderForUnprivileged(ivBMD.classLoader); //PK83186
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
if (originalLoader != ThreadContextAccessor.UNCHANGED)
{
Tr.debug(tc, "registerServant : old ClassLoader = " + originalLoader);
Tr.debug(tc, "registerServant : new ClassLoader = " + ivBMD.classLoader);
}
else
{
Tr.debug(tc, "registerServant : current ClassLoader = " + ivBMD.classLoader);
}
}
}
ivRemoteObjectWrapper.container.getEJBRuntime().registerServant(ivRemoteObjectWrapper.beanId.getByteArray(), ivRemoteObjectWrapper);
} finally
{
EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(originalLoader);
} // finally
} // if( !isZOS )
isRemoteRegistered = true;
} catch (Exception ex)
{
FFDCFilter.processException(ex, CLASS_NAME +
".registerServant",
"184", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to register wrapper instance",
new Object[] { ivRemoteObjectWrapper, ex });
}
}
} // if ( !isRemoteRegistered )
} // synchronized( ivRemoteObject )
} // if ( ivRemoteObject != null )
} | [
"protected",
"void",
"registerServant",
"(",
")",
"{",
"if",
"(",
"ivRemoteObjectWrapper",
"!=",
"null",
")",
"{",
"// synchronized on the remote Wrapper to set the isRemoteRegistered flag",
"synchronized",
"(",
"ivRemoteObjectWrapper",
")",
"{",
"if",
"(",
"!",
"isRemoteRegistered",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isZOS",
")",
"// LIDB2775-23.9",
"{",
"// Servant registration must be performed with the application classloader",
"// in force. This is especially needed for JITDeploy since",
"// the JIT pluggin will be on the application classloader.",
"// Without the JIT pluggin the classloader will not trigger",
"// JITDeploy to create the stub. //d521388",
"Object",
"originalLoader",
"=",
"ThreadContextAccessor",
".",
"UNCHANGED",
";",
"try",
"{",
"if",
"(",
"ivBMD",
"!=",
"null",
")",
"// EJBFactories have no BMD d529446",
"{",
"originalLoader",
"=",
"EJBThreadData",
".",
"svThreadContextAccessor",
".",
"pushContextClassLoaderForUnprivileged",
"(",
"ivBMD",
".",
"classLoader",
")",
";",
"//PK83186",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"originalLoader",
"!=",
"ThreadContextAccessor",
".",
"UNCHANGED",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"registerServant : old ClassLoader = \"",
"+",
"originalLoader",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"registerServant : new ClassLoader = \"",
"+",
"ivBMD",
".",
"classLoader",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"registerServant : current ClassLoader = \"",
"+",
"ivBMD",
".",
"classLoader",
")",
";",
"}",
"}",
"}",
"ivRemoteObjectWrapper",
".",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"registerServant",
"(",
"ivRemoteObjectWrapper",
".",
"beanId",
".",
"getByteArray",
"(",
")",
",",
"ivRemoteObjectWrapper",
")",
";",
"}",
"finally",
"{",
"EJBThreadData",
".",
"svThreadContextAccessor",
".",
"popContextClassLoaderForUnprivileged",
"(",
"originalLoader",
")",
";",
"}",
"// finally",
"}",
"// if( !isZOS )",
"isRemoteRegistered",
"=",
"true",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".registerServant\"",
",",
"\"184\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Failed to register wrapper instance\"",
",",
"new",
"Object",
"[",
"]",
"{",
"ivRemoteObjectWrapper",
",",
"ex",
"}",
")",
";",
"}",
"}",
"}",
"// if ( !isRemoteRegistered )",
"}",
"// synchronized( ivRemoteObject )",
"}",
"// if ( ivRemoteObject != null )",
"}"
] | Register the remote wrapper servant to ORB. | [
"Register",
"the",
"remote",
"wrapper",
"servant",
"to",
"ORB",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L593-L660 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.registerServant | private void registerServant(BusinessRemoteWrapper wrapper, int i)
{
// synchronized on the remote Wrapper to set the isRemoteRegistered flag
synchronized (wrapper)
{
if (!ivBusinessRemoteRegistered[i])
{
try
{
if (!isZOS)
{
// Since there may be multiple remote interfaces per bean
// type, a unique WrapperId must be formed by combining the
// BeanId with specific remote interface information. d419704
WrapperId wrapperId = new WrapperId
(wrapper.beanId.getByteArrayBytes(),
wrapper.bmd.ivBusinessRemoteInterfaceClasses[i].getName(),
i);
// Servant registration must be performed with the application classloader
// in force. This is especially needed for JITDeploy since
// the JIT pluggin will be on the application classloader.
// Without the JIT pluggin the classloader will not trigger
// JITDeploy to create the stub. //d521388
Object originalLoader = ThreadContextAccessor.UNCHANGED;
try
{
if (ivBMD != null) // EJBFactories have no BMD. d529446
{
originalLoader = EJBThreadData.svThreadContextAccessor.pushContextClassLoaderForUnprivileged(ivBMD.classLoader); //PK83186
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
if (originalLoader != ThreadContextAccessor.UNCHANGED)
{
Tr.debug(tc, "registerServant : old ClassLoader = " + originalLoader);
Tr.debug(tc, "registerServant : new ClassLoader = " + ivBMD.classLoader);
}
else
{
Tr.debug(tc, "registerServant : current ClassLoader = " + ivBMD.classLoader);
}
}
}
wrapper.container.getEJBRuntime().registerServant(wrapperId, wrapper);
} finally
{
EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(originalLoader);
} // finally
} // if( !isZOS )
ivBusinessRemoteRegistered[i] = true;
} catch (Throwable ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".registerServant", "439", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to register wrapper instance", new Object[] { wrapper, ex });
}
}
} // if ( ! ivBusinessRemoteRegistered[i] )
} //synchronized( wrapper )
} | java | private void registerServant(BusinessRemoteWrapper wrapper, int i)
{
// synchronized on the remote Wrapper to set the isRemoteRegistered flag
synchronized (wrapper)
{
if (!ivBusinessRemoteRegistered[i])
{
try
{
if (!isZOS)
{
// Since there may be multiple remote interfaces per bean
// type, a unique WrapperId must be formed by combining the
// BeanId with specific remote interface information. d419704
WrapperId wrapperId = new WrapperId
(wrapper.beanId.getByteArrayBytes(),
wrapper.bmd.ivBusinessRemoteInterfaceClasses[i].getName(),
i);
// Servant registration must be performed with the application classloader
// in force. This is especially needed for JITDeploy since
// the JIT pluggin will be on the application classloader.
// Without the JIT pluggin the classloader will not trigger
// JITDeploy to create the stub. //d521388
Object originalLoader = ThreadContextAccessor.UNCHANGED;
try
{
if (ivBMD != null) // EJBFactories have no BMD. d529446
{
originalLoader = EJBThreadData.svThreadContextAccessor.pushContextClassLoaderForUnprivileged(ivBMD.classLoader); //PK83186
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
if (originalLoader != ThreadContextAccessor.UNCHANGED)
{
Tr.debug(tc, "registerServant : old ClassLoader = " + originalLoader);
Tr.debug(tc, "registerServant : new ClassLoader = " + ivBMD.classLoader);
}
else
{
Tr.debug(tc, "registerServant : current ClassLoader = " + ivBMD.classLoader);
}
}
}
wrapper.container.getEJBRuntime().registerServant(wrapperId, wrapper);
} finally
{
EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(originalLoader);
} // finally
} // if( !isZOS )
ivBusinessRemoteRegistered[i] = true;
} catch (Throwable ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".registerServant", "439", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to register wrapper instance", new Object[] { wrapper, ex });
}
}
} // if ( ! ivBusinessRemoteRegistered[i] )
} //synchronized( wrapper )
} | [
"private",
"void",
"registerServant",
"(",
"BusinessRemoteWrapper",
"wrapper",
",",
"int",
"i",
")",
"{",
"// synchronized on the remote Wrapper to set the isRemoteRegistered flag",
"synchronized",
"(",
"wrapper",
")",
"{",
"if",
"(",
"!",
"ivBusinessRemoteRegistered",
"[",
"i",
"]",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isZOS",
")",
"{",
"// Since there may be multiple remote interfaces per bean",
"// type, a unique WrapperId must be formed by combining the",
"// BeanId with specific remote interface information. d419704",
"WrapperId",
"wrapperId",
"=",
"new",
"WrapperId",
"(",
"wrapper",
".",
"beanId",
".",
"getByteArrayBytes",
"(",
")",
",",
"wrapper",
".",
"bmd",
".",
"ivBusinessRemoteInterfaceClasses",
"[",
"i",
"]",
".",
"getName",
"(",
")",
",",
"i",
")",
";",
"// Servant registration must be performed with the application classloader",
"// in force. This is especially needed for JITDeploy since",
"// the JIT pluggin will be on the application classloader.",
"// Without the JIT pluggin the classloader will not trigger",
"// JITDeploy to create the stub. //d521388",
"Object",
"originalLoader",
"=",
"ThreadContextAccessor",
".",
"UNCHANGED",
";",
"try",
"{",
"if",
"(",
"ivBMD",
"!=",
"null",
")",
"// EJBFactories have no BMD. d529446",
"{",
"originalLoader",
"=",
"EJBThreadData",
".",
"svThreadContextAccessor",
".",
"pushContextClassLoaderForUnprivileged",
"(",
"ivBMD",
".",
"classLoader",
")",
";",
"//PK83186",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"originalLoader",
"!=",
"ThreadContextAccessor",
".",
"UNCHANGED",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"registerServant : old ClassLoader = \"",
"+",
"originalLoader",
")",
";",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"registerServant : new ClassLoader = \"",
"+",
"ivBMD",
".",
"classLoader",
")",
";",
"}",
"else",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"registerServant : current ClassLoader = \"",
"+",
"ivBMD",
".",
"classLoader",
")",
";",
"}",
"}",
"}",
"wrapper",
".",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"registerServant",
"(",
"wrapperId",
",",
"wrapper",
")",
";",
"}",
"finally",
"{",
"EJBThreadData",
".",
"svThreadContextAccessor",
".",
"popContextClassLoaderForUnprivileged",
"(",
"originalLoader",
")",
";",
"}",
"// finally",
"}",
"// if( !isZOS )",
"ivBusinessRemoteRegistered",
"[",
"i",
"]",
"=",
"true",
";",
"}",
"catch",
"(",
"Throwable",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".registerServant\"",
",",
"\"439\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Failed to register wrapper instance\"",
",",
"new",
"Object",
"[",
"]",
"{",
"wrapper",
",",
"ex",
"}",
")",
";",
"}",
"}",
"}",
"// if ( ! ivBusinessRemoteRegistered[i] )",
"}",
"//synchronized( wrapper )",
"}"
] | d416391 added entire method. | [
"d416391",
"added",
"entire",
"method",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L666-L732 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.disconnect | protected void disconnect()
{
if (localWrapperProxyState != null) // F58064
{
localWrapperProxyState.disconnect();
}
if (ivBusinessLocalWrapperProxyStates != null) // F58064
{
for (WrapperProxyState state : ivBusinessLocalWrapperProxyStates)
{
state.disconnect();
}
}
if (ivRemoteObjectWrapper != null)
{ // synchronized on the remote Wrapper to set the isRemoteRegistered flag
synchronized (ivRemoteObjectWrapper)
{
if (isRemoteRegistered)
{
try
{
// @PQ98903A
// On zOS even though we don't call the object
// adapter to register the servant, we need
// to call it to unregister it if the wrapper
// is connected to the ORB (i.e. it has a Tie).
if ((!isZOS) || (ivRemoteObjectWrapper.intie != null)) // @PQ98903C
{
ivRemoteObjectWrapper.container.getEJBRuntime().unregisterServant(ivRemoteObjectWrapper);
}
isRemoteRegistered = false;
} catch (Exception ex)
{
FFDCFilter.processException(ex, CLASS_NAME +
".unregisterServant",
"207", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to unregister wrapper instance",
new Object[] { ivRemoteObjectWrapper, ex });
}
}
}
}
}
// d416391 start
// Unregister any BusinessRemoteWrapper objects that are registered with ORB.
if (ivBusinessRemote != null) // d416391 d424839
{
int numWrappers = ivBusinessRemote.length;
for (int i = 0; i < numWrappers; ++i)
{
BusinessRemoteWrapper wrapper = ivBusinessRemote[i];
synchronized (wrapper)
{
if (ivBusinessRemoteRegistered[i])
{
try
{
// On zOS even though we don't call the object adapter to register
// the servant, we need to call it to unregister it if the wrapper
// is connected to the ORB (i.e. it has a Tie).
if ((!isZOS) || (wrapper.intie != null))
{
wrapper.container.getEJBRuntime().unregisterServant(wrapper);
}
ivBusinessRemoteRegistered[i] = false;
} catch (Throwable ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".unregisterServant",
"516", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to unregister wrapper instance",
new Object[] { wrapper, ex });
}
}
}
} // end synchronized
} // end for
} // d416391 end
} | java | protected void disconnect()
{
if (localWrapperProxyState != null) // F58064
{
localWrapperProxyState.disconnect();
}
if (ivBusinessLocalWrapperProxyStates != null) // F58064
{
for (WrapperProxyState state : ivBusinessLocalWrapperProxyStates)
{
state.disconnect();
}
}
if (ivRemoteObjectWrapper != null)
{ // synchronized on the remote Wrapper to set the isRemoteRegistered flag
synchronized (ivRemoteObjectWrapper)
{
if (isRemoteRegistered)
{
try
{
// @PQ98903A
// On zOS even though we don't call the object
// adapter to register the servant, we need
// to call it to unregister it if the wrapper
// is connected to the ORB (i.e. it has a Tie).
if ((!isZOS) || (ivRemoteObjectWrapper.intie != null)) // @PQ98903C
{
ivRemoteObjectWrapper.container.getEJBRuntime().unregisterServant(ivRemoteObjectWrapper);
}
isRemoteRegistered = false;
} catch (Exception ex)
{
FFDCFilter.processException(ex, CLASS_NAME +
".unregisterServant",
"207", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to unregister wrapper instance",
new Object[] { ivRemoteObjectWrapper, ex });
}
}
}
}
}
// d416391 start
// Unregister any BusinessRemoteWrapper objects that are registered with ORB.
if (ivBusinessRemote != null) // d416391 d424839
{
int numWrappers = ivBusinessRemote.length;
for (int i = 0; i < numWrappers; ++i)
{
BusinessRemoteWrapper wrapper = ivBusinessRemote[i];
synchronized (wrapper)
{
if (ivBusinessRemoteRegistered[i])
{
try
{
// On zOS even though we don't call the object adapter to register
// the servant, we need to call it to unregister it if the wrapper
// is connected to the ORB (i.e. it has a Tie).
if ((!isZOS) || (wrapper.intie != null))
{
wrapper.container.getEJBRuntime().unregisterServant(wrapper);
}
ivBusinessRemoteRegistered[i] = false;
} catch (Throwable ex)
{
FFDCFilter.processException(ex, CLASS_NAME + ".unregisterServant",
"516", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
Tr.event(tc, "Failed to unregister wrapper instance",
new Object[] { wrapper, ex });
}
}
}
} // end synchronized
} // end for
} // d416391 end
} | [
"protected",
"void",
"disconnect",
"(",
")",
"{",
"if",
"(",
"localWrapperProxyState",
"!=",
"null",
")",
"// F58064",
"{",
"localWrapperProxyState",
".",
"disconnect",
"(",
")",
";",
"}",
"if",
"(",
"ivBusinessLocalWrapperProxyStates",
"!=",
"null",
")",
"// F58064",
"{",
"for",
"(",
"WrapperProxyState",
"state",
":",
"ivBusinessLocalWrapperProxyStates",
")",
"{",
"state",
".",
"disconnect",
"(",
")",
";",
"}",
"}",
"if",
"(",
"ivRemoteObjectWrapper",
"!=",
"null",
")",
"{",
"// synchronized on the remote Wrapper to set the isRemoteRegistered flag",
"synchronized",
"(",
"ivRemoteObjectWrapper",
")",
"{",
"if",
"(",
"isRemoteRegistered",
")",
"{",
"try",
"{",
"// @PQ98903A",
"// On zOS even though we don't call the object",
"// adapter to register the servant, we need",
"// to call it to unregister it if the wrapper",
"// is connected to the ORB (i.e. it has a Tie).",
"if",
"(",
"(",
"!",
"isZOS",
")",
"||",
"(",
"ivRemoteObjectWrapper",
".",
"intie",
"!=",
"null",
")",
")",
"// @PQ98903C",
"{",
"ivRemoteObjectWrapper",
".",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"unregisterServant",
"(",
"ivRemoteObjectWrapper",
")",
";",
"}",
"isRemoteRegistered",
"=",
"false",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".unregisterServant\"",
",",
"\"207\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Failed to unregister wrapper instance\"",
",",
"new",
"Object",
"[",
"]",
"{",
"ivRemoteObjectWrapper",
",",
"ex",
"}",
")",
";",
"}",
"}",
"}",
"}",
"}",
"// d416391 start",
"// Unregister any BusinessRemoteWrapper objects that are registered with ORB.",
"if",
"(",
"ivBusinessRemote",
"!=",
"null",
")",
"// d416391 d424839",
"{",
"int",
"numWrappers",
"=",
"ivBusinessRemote",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numWrappers",
";",
"++",
"i",
")",
"{",
"BusinessRemoteWrapper",
"wrapper",
"=",
"ivBusinessRemote",
"[",
"i",
"]",
";",
"synchronized",
"(",
"wrapper",
")",
"{",
"if",
"(",
"ivBusinessRemoteRegistered",
"[",
"i",
"]",
")",
"{",
"try",
"{",
"// On zOS even though we don't call the object adapter to register",
"// the servant, we need to call it to unregister it if the wrapper",
"// is connected to the ORB (i.e. it has a Tie).",
"if",
"(",
"(",
"!",
"isZOS",
")",
"||",
"(",
"wrapper",
".",
"intie",
"!=",
"null",
")",
")",
"{",
"wrapper",
".",
"container",
".",
"getEJBRuntime",
"(",
")",
".",
"unregisterServant",
"(",
"wrapper",
")",
";",
"}",
"ivBusinessRemoteRegistered",
"[",
"i",
"]",
"=",
"false",
";",
"}",
"catch",
"(",
"Throwable",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".unregisterServant\"",
",",
"\"516\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Failed to unregister wrapper instance\"",
",",
"new",
"Object",
"[",
"]",
"{",
"wrapper",
",",
"ex",
"}",
")",
";",
"}",
"}",
"}",
"}",
"// end synchronized",
"}",
"// end for",
"}",
"// d416391 end",
"}"
] | Disconnect all wrappers. Unregisters the remote wrapper servant from
ORB, and disconnects local wrapper proxy states. | [
"Disconnect",
"all",
"wrappers",
".",
"Unregisters",
"the",
"remote",
"wrapper",
"servant",
"from",
"ORB",
"and",
"disconnects",
"local",
"wrapper",
"proxy",
"states",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L738-L822 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getLocalObject | public EJBLocalObject getLocalObject()
{
if (localObject != null)
{
if (localWrapperProxyState != null &&
localWrapperProxyState.ivWrapper == null)
{
localWrapperProxyState.connect(ivBeanId, localWrapper);
}
return localObject;
}
throw new IllegalStateException("Local interface not defined");
} | java | public EJBLocalObject getLocalObject()
{
if (localObject != null)
{
if (localWrapperProxyState != null &&
localWrapperProxyState.ivWrapper == null)
{
localWrapperProxyState.connect(ivBeanId, localWrapper);
}
return localObject;
}
throw new IllegalStateException("Local interface not defined");
} | [
"public",
"EJBLocalObject",
"getLocalObject",
"(",
")",
"{",
"if",
"(",
"localObject",
"!=",
"null",
")",
"{",
"if",
"(",
"localWrapperProxyState",
"!=",
"null",
"&&",
"localWrapperProxyState",
".",
"ivWrapper",
"==",
"null",
")",
"{",
"localWrapperProxyState",
".",
"connect",
"(",
"ivBeanId",
",",
"localWrapper",
")",
";",
"}",
"return",
"localObject",
";",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"\"Local interface not defined\"",
")",
";",
"}"
] | Returns a client proxy object for the local component view. | [
"Returns",
"a",
"client",
"proxy",
"object",
"for",
"the",
"local",
"component",
"view",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L829-L842 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getBusinessObject | public Object getBusinessObject(String interfaceName) throws RemoteException {
int interfaceIndex = ivBMD.getLocalBusinessInterfaceIndex(interfaceName);
if (interfaceIndex != -1) {
return getLocalBusinessObject(interfaceIndex);
}
interfaceIndex = ivBMD.getRemoteBusinessInterfaceIndex(interfaceName);
if (interfaceIndex != -1) {
return getRemoteBusinessObject(interfaceIndex);
}
throw new IllegalStateException("Requested business interface not found : " + interfaceName);
} | java | public Object getBusinessObject(String interfaceName) throws RemoteException {
int interfaceIndex = ivBMD.getLocalBusinessInterfaceIndex(interfaceName);
if (interfaceIndex != -1) {
return getLocalBusinessObject(interfaceIndex);
}
interfaceIndex = ivBMD.getRemoteBusinessInterfaceIndex(interfaceName);
if (interfaceIndex != -1) {
return getRemoteBusinessObject(interfaceIndex);
}
throw new IllegalStateException("Requested business interface not found : " + interfaceName);
} | [
"public",
"Object",
"getBusinessObject",
"(",
"String",
"interfaceName",
")",
"throws",
"RemoteException",
"{",
"int",
"interfaceIndex",
"=",
"ivBMD",
".",
"getLocalBusinessInterfaceIndex",
"(",
"interfaceName",
")",
";",
"if",
"(",
"interfaceIndex",
"!=",
"-",
"1",
")",
"{",
"return",
"getLocalBusinessObject",
"(",
"interfaceIndex",
")",
";",
"}",
"interfaceIndex",
"=",
"ivBMD",
".",
"getRemoteBusinessInterfaceIndex",
"(",
"interfaceName",
")",
";",
"if",
"(",
"interfaceIndex",
"!=",
"-",
"1",
")",
"{",
"return",
"getRemoteBusinessObject",
"(",
"interfaceIndex",
")",
";",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"\"Requested business interface not found : \"",
"+",
"interfaceName",
")",
";",
"}"
] | Method to get a business object given the name of the interface.
@param interfaceName the interface name
@return the business object
@throws IllegalStateException if the interface name is not valid
@throws RemoteException if an error occurs obtaining a remote object | [
"Method",
"to",
"get",
"a",
"business",
"object",
"given",
"the",
"name",
"of",
"the",
"interface",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L874-L886 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getLocalBusinessObject | public Object getLocalBusinessObject(int interfaceIndex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getLocalBusinessObject : " +
ivBusinessLocalProxies[interfaceIndex].getClass().getName());
if (ivBusinessLocalWrapperProxyStates != null &&
ivBusinessLocalWrapperProxyStates[interfaceIndex].ivWrapper == null)
{
ivBusinessLocalWrapperProxyStates[interfaceIndex].connect(ivBeanId,
ivBusinessLocal[interfaceIndex]);
}
return ivBusinessLocalProxies[interfaceIndex];
} | java | public Object getLocalBusinessObject(int interfaceIndex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getLocalBusinessObject : " +
ivBusinessLocalProxies[interfaceIndex].getClass().getName());
if (ivBusinessLocalWrapperProxyStates != null &&
ivBusinessLocalWrapperProxyStates[interfaceIndex].ivWrapper == null)
{
ivBusinessLocalWrapperProxyStates[interfaceIndex].connect(ivBeanId,
ivBusinessLocal[interfaceIndex]);
}
return ivBusinessLocalProxies[interfaceIndex];
} | [
"public",
"Object",
"getLocalBusinessObject",
"(",
"int",
"interfaceIndex",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getLocalBusinessObject : \"",
"+",
"ivBusinessLocalProxies",
"[",
"interfaceIndex",
"]",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"ivBusinessLocalWrapperProxyStates",
"!=",
"null",
"&&",
"ivBusinessLocalWrapperProxyStates",
"[",
"interfaceIndex",
"]",
".",
"ivWrapper",
"==",
"null",
")",
"{",
"ivBusinessLocalWrapperProxyStates",
"[",
"interfaceIndex",
"]",
".",
"connect",
"(",
"ivBeanId",
",",
"ivBusinessLocal",
"[",
"interfaceIndex",
"]",
")",
";",
"}",
"return",
"ivBusinessLocalProxies",
"[",
"interfaceIndex",
"]",
";",
"}"
] | Method to get the local business object, given the index of the
interface. The returned object will be a wrapper, a no-interface
wrapper, or a local wrapper proxy.
@param interfaceIndex index of the interface
@return the object at the passed in interface | [
"Method",
"to",
"get",
"the",
"local",
"business",
"object",
"given",
"the",
"index",
"of",
"the",
"interface",
".",
"The",
"returned",
"object",
"will",
"be",
"a",
"wrapper",
"a",
"no",
"-",
"interface",
"wrapper",
"or",
"a",
"local",
"wrapper",
"proxy",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L896-L910 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getLocalBusinessWrapperBase | public EJSWrapperBase getLocalBusinessWrapperBase(int interfaceIndex) {
if (interfaceIndex == 0 && ivBMD.ivLocalBean) {
return getLocalBeanWrapperBase((LocalBeanWrapper) ivBusinessLocal[0]);
}
return (EJSWrapperBase) ivBusinessLocal[0];
} | java | public EJSWrapperBase getLocalBusinessWrapperBase(int interfaceIndex) {
if (interfaceIndex == 0 && ivBMD.ivLocalBean) {
return getLocalBeanWrapperBase((LocalBeanWrapper) ivBusinessLocal[0]);
}
return (EJSWrapperBase) ivBusinessLocal[0];
} | [
"public",
"EJSWrapperBase",
"getLocalBusinessWrapperBase",
"(",
"int",
"interfaceIndex",
")",
"{",
"if",
"(",
"interfaceIndex",
"==",
"0",
"&&",
"ivBMD",
".",
"ivLocalBean",
")",
"{",
"return",
"getLocalBeanWrapperBase",
"(",
"(",
"LocalBeanWrapper",
")",
"ivBusinessLocal",
"[",
"0",
"]",
")",
";",
"}",
"return",
"(",
"EJSWrapperBase",
")",
"ivBusinessLocal",
"[",
"0",
"]",
";",
"}"
] | Method to get the local business wrapper base. | [
"Method",
"to",
"get",
"the",
"local",
"business",
"wrapper",
"base",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L915-L920 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getRemoteBusinessObject | public Object getRemoteBusinessObject(int interfaceIndex)
throws RemoteException
{
Class<?>[] bInterfaceClasses = ivBMD.ivBusinessRemoteInterfaceClasses;
BusinessRemoteWrapper wrapper = ivBusinessRemote[interfaceIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getRemoteBusinessObject : " +
wrapper.getClass().getName());
registerServant(wrapper, interfaceIndex);
ClassLoader moduleContextClassLoader = ivBMD.ivContextClassLoader;
Object result = getRemoteBusinessReference(wrapper, moduleContextClassLoader, bInterfaceClasses[interfaceIndex]);
return result;
} | java | public Object getRemoteBusinessObject(int interfaceIndex)
throws RemoteException
{
Class<?>[] bInterfaceClasses = ivBMD.ivBusinessRemoteInterfaceClasses;
BusinessRemoteWrapper wrapper = ivBusinessRemote[interfaceIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getRemoteBusinessObject : " +
wrapper.getClass().getName());
registerServant(wrapper, interfaceIndex);
ClassLoader moduleContextClassLoader = ivBMD.ivContextClassLoader;
Object result = getRemoteBusinessReference(wrapper, moduleContextClassLoader, bInterfaceClasses[interfaceIndex]);
return result;
} | [
"public",
"Object",
"getRemoteBusinessObject",
"(",
"int",
"interfaceIndex",
")",
"throws",
"RemoteException",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"bInterfaceClasses",
"=",
"ivBMD",
".",
"ivBusinessRemoteInterfaceClasses",
";",
"BusinessRemoteWrapper",
"wrapper",
"=",
"ivBusinessRemote",
"[",
"interfaceIndex",
"]",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getRemoteBusinessObject : \"",
"+",
"wrapper",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"registerServant",
"(",
"wrapper",
",",
"interfaceIndex",
")",
";",
"ClassLoader",
"moduleContextClassLoader",
"=",
"ivBMD",
".",
"ivContextClassLoader",
";",
"Object",
"result",
"=",
"getRemoteBusinessReference",
"(",
"wrapper",
",",
"moduleContextClassLoader",
",",
"bInterfaceClasses",
"[",
"interfaceIndex",
"]",
")",
";",
"return",
"result",
";",
"}"
] | Method to get the remote business object, given the index of the
interface.
@param interfaceIndex index of the interface
@return the object at the passed in interface
@throws RemoteException | [
"Method",
"to",
"get",
"the",
"remote",
"business",
"object",
"given",
"the",
"index",
"of",
"the",
"interface",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L930-L946 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java | EJSWrapperCommon.getRemoteBusinessWrapper | public BusinessRemoteWrapper getRemoteBusinessWrapper(WrapperId wrapperId)
{
int remoteIndex = wrapperId.ivInterfaceIndex;
BusinessRemoteWrapper wrapper = null;
String wrapperInterfaceName = "";
if (remoteIndex < ivBusinessRemote.length)
{
wrapper = ivBusinessRemote[remoteIndex];
wrapperInterfaceName = ivBMD.ivBusinessRemoteInterfaceClasses[remoteIndex].getName();
}
// Is the BusinessRemoteWrapper for the correct interface name?
String interfaceName = wrapperId.ivInterfaceClassName;
if ((wrapper == null) || (!wrapperInterfaceName.equals(interfaceName)))
{
// Nope, index must be invalid, so we need to search the entire
// array to find the one that matches the desired interface name.
// Fix up the WrapperId with index that matches this server.
wrapper = null;
for (int i = 0; i < ivBusinessRemote.length; ++i)
{
wrapperInterfaceName = ivBMD.ivBusinessRemoteInterfaceClasses[i].getName();
if (wrapperInterfaceName.equals(interfaceName))
{
// This is the correct wrapper.
remoteIndex = i;
wrapper = ivBusinessRemote[remoteIndex];
wrapperId.ivInterfaceIndex = remoteIndex;
break;
}
}
// d739542 Begin
if (wrapper == null) {
throw new IllegalStateException("Remote " + interfaceName + " interface not defined");
}
// d739542 End
}
registerServant(wrapper, remoteIndex);
return wrapper;
} | java | public BusinessRemoteWrapper getRemoteBusinessWrapper(WrapperId wrapperId)
{
int remoteIndex = wrapperId.ivInterfaceIndex;
BusinessRemoteWrapper wrapper = null;
String wrapperInterfaceName = "";
if (remoteIndex < ivBusinessRemote.length)
{
wrapper = ivBusinessRemote[remoteIndex];
wrapperInterfaceName = ivBMD.ivBusinessRemoteInterfaceClasses[remoteIndex].getName();
}
// Is the BusinessRemoteWrapper for the correct interface name?
String interfaceName = wrapperId.ivInterfaceClassName;
if ((wrapper == null) || (!wrapperInterfaceName.equals(interfaceName)))
{
// Nope, index must be invalid, so we need to search the entire
// array to find the one that matches the desired interface name.
// Fix up the WrapperId with index that matches this server.
wrapper = null;
for (int i = 0; i < ivBusinessRemote.length; ++i)
{
wrapperInterfaceName = ivBMD.ivBusinessRemoteInterfaceClasses[i].getName();
if (wrapperInterfaceName.equals(interfaceName))
{
// This is the correct wrapper.
remoteIndex = i;
wrapper = ivBusinessRemote[remoteIndex];
wrapperId.ivInterfaceIndex = remoteIndex;
break;
}
}
// d739542 Begin
if (wrapper == null) {
throw new IllegalStateException("Remote " + interfaceName + " interface not defined");
}
// d739542 End
}
registerServant(wrapper, remoteIndex);
return wrapper;
} | [
"public",
"BusinessRemoteWrapper",
"getRemoteBusinessWrapper",
"(",
"WrapperId",
"wrapperId",
")",
"{",
"int",
"remoteIndex",
"=",
"wrapperId",
".",
"ivInterfaceIndex",
";",
"BusinessRemoteWrapper",
"wrapper",
"=",
"null",
";",
"String",
"wrapperInterfaceName",
"=",
"\"\"",
";",
"if",
"(",
"remoteIndex",
"<",
"ivBusinessRemote",
".",
"length",
")",
"{",
"wrapper",
"=",
"ivBusinessRemote",
"[",
"remoteIndex",
"]",
";",
"wrapperInterfaceName",
"=",
"ivBMD",
".",
"ivBusinessRemoteInterfaceClasses",
"[",
"remoteIndex",
"]",
".",
"getName",
"(",
")",
";",
"}",
"// Is the BusinessRemoteWrapper for the correct interface name?",
"String",
"interfaceName",
"=",
"wrapperId",
".",
"ivInterfaceClassName",
";",
"if",
"(",
"(",
"wrapper",
"==",
"null",
")",
"||",
"(",
"!",
"wrapperInterfaceName",
".",
"equals",
"(",
"interfaceName",
")",
")",
")",
"{",
"// Nope, index must be invalid, so we need to search the entire",
"// array to find the one that matches the desired interface name.",
"// Fix up the WrapperId with index that matches this server.",
"wrapper",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ivBusinessRemote",
".",
"length",
";",
"++",
"i",
")",
"{",
"wrapperInterfaceName",
"=",
"ivBMD",
".",
"ivBusinessRemoteInterfaceClasses",
"[",
"i",
"]",
".",
"getName",
"(",
")",
";",
"if",
"(",
"wrapperInterfaceName",
".",
"equals",
"(",
"interfaceName",
")",
")",
"{",
"// This is the correct wrapper.",
"remoteIndex",
"=",
"i",
";",
"wrapper",
"=",
"ivBusinessRemote",
"[",
"remoteIndex",
"]",
";",
"wrapperId",
".",
"ivInterfaceIndex",
"=",
"remoteIndex",
";",
"break",
";",
"}",
"}",
"// d739542 Begin",
"if",
"(",
"wrapper",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Remote \"",
"+",
"interfaceName",
"+",
"\" interface not defined\"",
")",
";",
"}",
"// d739542 End",
"}",
"registerServant",
"(",
"wrapper",
",",
"remoteIndex",
")",
";",
"return",
"wrapper",
";",
"}"
] | d419704 - rewrote for new WrapperId fields and remove the todo. | [
"d419704",
"-",
"rewrote",
"for",
"new",
"WrapperId",
"fields",
"and",
"remove",
"the",
"todo",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L1067-L1108 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java | ThreadIdentitySecurityHelper.getAliasToFinalize | private String getAliasToFinalize(CMConfigData cmConfigData) {
String alias = null;
if (cmConfigData == null)
return alias; // Not expected, but being safe
// Check for DefaultPrincipalMapping alias from res-ref:
final String DEFAULT_PRINCIPAL_MAPPING = "DefaultPrincipalMapping";
final String MAPPING_ALIAS = "com.ibm.mapping.authDataAlias";
String loginConfigurationName = cmConfigData.getLoginConfigurationName();
if ((loginConfigurationName != null) && (!loginConfigurationName.equals(""))) {
if (loginConfigurationName.equals(DEFAULT_PRINCIPAL_MAPPING)) {
HashMap loginConfigProps = cmConfigData.getLoginConfigProperties();
if ((loginConfigProps != null) && (!loginConfigProps.isEmpty())) {
alias = (String) loginConfigProps.get(MAPPING_ALIAS);
}
}
}
if (alias == null) {
// Check for container-managed auth alias from CF/DS:
alias = cmConfigData.getContainerAlias();
}
return alias;
} | java | private String getAliasToFinalize(CMConfigData cmConfigData) {
String alias = null;
if (cmConfigData == null)
return alias; // Not expected, but being safe
// Check for DefaultPrincipalMapping alias from res-ref:
final String DEFAULT_PRINCIPAL_MAPPING = "DefaultPrincipalMapping";
final String MAPPING_ALIAS = "com.ibm.mapping.authDataAlias";
String loginConfigurationName = cmConfigData.getLoginConfigurationName();
if ((loginConfigurationName != null) && (!loginConfigurationName.equals(""))) {
if (loginConfigurationName.equals(DEFAULT_PRINCIPAL_MAPPING)) {
HashMap loginConfigProps = cmConfigData.getLoginConfigProperties();
if ((loginConfigProps != null) && (!loginConfigProps.isEmpty())) {
alias = (String) loginConfigProps.get(MAPPING_ALIAS);
}
}
}
if (alias == null) {
// Check for container-managed auth alias from CF/DS:
alias = cmConfigData.getContainerAlias();
}
return alias;
} | [
"private",
"String",
"getAliasToFinalize",
"(",
"CMConfigData",
"cmConfigData",
")",
"{",
"String",
"alias",
"=",
"null",
";",
"if",
"(",
"cmConfigData",
"==",
"null",
")",
"return",
"alias",
";",
"// Not expected, but being safe",
"// Check for DefaultPrincipalMapping alias from res-ref:",
"final",
"String",
"DEFAULT_PRINCIPAL_MAPPING",
"=",
"\"DefaultPrincipalMapping\"",
";",
"final",
"String",
"MAPPING_ALIAS",
"=",
"\"com.ibm.mapping.authDataAlias\"",
";",
"String",
"loginConfigurationName",
"=",
"cmConfigData",
".",
"getLoginConfigurationName",
"(",
")",
";",
"if",
"(",
"(",
"loginConfigurationName",
"!=",
"null",
")",
"&&",
"(",
"!",
"loginConfigurationName",
".",
"equals",
"(",
"\"\"",
")",
")",
")",
"{",
"if",
"(",
"loginConfigurationName",
".",
"equals",
"(",
"DEFAULT_PRINCIPAL_MAPPING",
")",
")",
"{",
"HashMap",
"loginConfigProps",
"=",
"cmConfigData",
".",
"getLoginConfigProperties",
"(",
")",
";",
"if",
"(",
"(",
"loginConfigProps",
"!=",
"null",
")",
"&&",
"(",
"!",
"loginConfigProps",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"alias",
"=",
"(",
"String",
")",
"loginConfigProps",
".",
"get",
"(",
"MAPPING_ALIAS",
")",
";",
"}",
"}",
"}",
"if",
"(",
"alias",
"==",
"null",
")",
"{",
"// Check for container-managed auth alias from CF/DS:",
"alias",
"=",
"cmConfigData",
".",
"getContainerAlias",
"(",
")",
";",
"}",
"return",
"alias",
";",
"}"
] | Get the jaas alias from the config. | [
"Get",
"the",
"jaas",
"alias",
"from",
"the",
"config",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java#L639-L666 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java | ThreadIdentitySecurityHelper.getPrivateGenericCredentials | private Set getPrivateGenericCredentials(final Subject subj) throws ResourceException {
Set privateGenericCredentials = null;
if (System.getSecurityManager() != null) {
try {
privateGenericCredentials = (Set) AccessController.doPrivileged(
new PrivilegedExceptionAction() {
@Override
public Object run() throws Exception {
return subj.getPrivateCredentials(GenericCredential.class);
}
});
} catch (PrivilegedActionException pae) {
FFDCFilter.processException(pae, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "18", this);
Tr.error(tc, "FAILED_DOPRIVILEGED_J2CA0060", pae);
Exception e = pae.getException();
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper failed attempting to access Subject's credentials");
re.initCause(e);
throw re;
}
} else {
privateGenericCredentials = subj.getPrivateCredentials(GenericCredential.class);
}
return privateGenericCredentials;
} | java | private Set getPrivateGenericCredentials(final Subject subj) throws ResourceException {
Set privateGenericCredentials = null;
if (System.getSecurityManager() != null) {
try {
privateGenericCredentials = (Set) AccessController.doPrivileged(
new PrivilegedExceptionAction() {
@Override
public Object run() throws Exception {
return subj.getPrivateCredentials(GenericCredential.class);
}
});
} catch (PrivilegedActionException pae) {
FFDCFilter.processException(pae, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "18", this);
Tr.error(tc, "FAILED_DOPRIVILEGED_J2CA0060", pae);
Exception e = pae.getException();
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper failed attempting to access Subject's credentials");
re.initCause(e);
throw re;
}
} else {
privateGenericCredentials = subj.getPrivateCredentials(GenericCredential.class);
}
return privateGenericCredentials;
} | [
"private",
"Set",
"getPrivateGenericCredentials",
"(",
"final",
"Subject",
"subj",
")",
"throws",
"ResourceException",
"{",
"Set",
"privateGenericCredentials",
"=",
"null",
";",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"privateGenericCredentials",
"=",
"(",
"Set",
")",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"run",
"(",
")",
"throws",
"Exception",
"{",
"return",
"subj",
".",
"getPrivateCredentials",
"(",
"GenericCredential",
".",
"class",
")",
";",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"PrivilegedActionException",
"pae",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"pae",
",",
"\"com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection\"",
",",
"\"18\"",
",",
"this",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"FAILED_DOPRIVILEGED_J2CA0060\"",
",",
"pae",
")",
";",
"Exception",
"e",
"=",
"pae",
".",
"getException",
"(",
")",
";",
"ResourceException",
"re",
"=",
"new",
"ResourceException",
"(",
"\"ThreadIdentitySecurityHelper failed attempting to access Subject's credentials\"",
")",
";",
"re",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"re",
";",
"}",
"}",
"else",
"{",
"privateGenericCredentials",
"=",
"subj",
".",
"getPrivateCredentials",
"(",
"GenericCredential",
".",
"class",
")",
";",
"}",
"return",
"privateGenericCredentials",
";",
"}"
] | Return the set of private credentials of type GenericCredential from the
given subject.
Basically this method is a wrapper around Subject.getPrivateCredentials
with Java 2 Security handling. | [
"Return",
"the",
"set",
"of",
"private",
"credentials",
"of",
"type",
"GenericCredential",
"from",
"the",
"given",
"subject",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java#L771-L798 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java | ThreadIdentitySecurityHelper.setJ2CThreadIdentity | private Object setJ2CThreadIdentity(final Subject subj) throws ResourceException {
Object retObject = null;
try {
if (System.getSecurityManager() != null) {
retObject = AccessController.doPrivileged(
new PrivilegedExceptionAction() {
@Override
public Object run() throws Exception {
return ThreadIdentityManager.setJ2CThreadIdentity(subj);
}
});
} else {
retObject = ThreadIdentityManager.setJ2CThreadIdentity(subj);
}
} catch (PrivilegedActionException pae) {
FFDCFilter.processException(pae, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "11", this);
Tr.error(tc, "FAILED_DOPRIVILEGED_J2CA0060", pae);
Exception e = pae.getException();
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread");
re.initCause(e);
throw re;
} catch (IllegalStateException ise) {
FFDCFilter.processException(ise, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "20", this);
Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", ise };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread");
re.initCause(ise);
throw re;
} catch (ThreadIdentityException tie) {
FFDCFilter.processException(tie, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "21", this);
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread");
re.initCause(tie);
throw re;
}
return retObject;
} | java | private Object setJ2CThreadIdentity(final Subject subj) throws ResourceException {
Object retObject = null;
try {
if (System.getSecurityManager() != null) {
retObject = AccessController.doPrivileged(
new PrivilegedExceptionAction() {
@Override
public Object run() throws Exception {
return ThreadIdentityManager.setJ2CThreadIdentity(subj);
}
});
} else {
retObject = ThreadIdentityManager.setJ2CThreadIdentity(subj);
}
} catch (PrivilegedActionException pae) {
FFDCFilter.processException(pae, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "11", this);
Tr.error(tc, "FAILED_DOPRIVILEGED_J2CA0060", pae);
Exception e = pae.getException();
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread");
re.initCause(e);
throw re;
} catch (IllegalStateException ise) {
FFDCFilter.processException(ise, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "20", this);
Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", ise };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread");
re.initCause(ise);
throw re;
} catch (ThreadIdentityException tie) {
FFDCFilter.processException(tie, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection", "21", this);
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread");
re.initCause(tie);
throw re;
}
return retObject;
} | [
"private",
"Object",
"setJ2CThreadIdentity",
"(",
"final",
"Subject",
"subj",
")",
"throws",
"ResourceException",
"{",
"Object",
"retObject",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"!=",
"null",
")",
"{",
"retObject",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"run",
"(",
")",
"throws",
"Exception",
"{",
"return",
"ThreadIdentityManager",
".",
"setJ2CThreadIdentity",
"(",
"subj",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"retObject",
"=",
"ThreadIdentityManager",
".",
"setJ2CThreadIdentity",
"(",
"subj",
")",
";",
"}",
"}",
"catch",
"(",
"PrivilegedActionException",
"pae",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"pae",
",",
"\"com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection\"",
",",
"\"11\"",
",",
"this",
")",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"FAILED_DOPRIVILEGED_J2CA0060\"",
",",
"pae",
")",
";",
"Exception",
"e",
"=",
"pae",
".",
"getException",
"(",
")",
";",
"ResourceException",
"re",
"=",
"new",
"ResourceException",
"(",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread\"",
")",
";",
"re",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"re",
";",
"}",
"catch",
"(",
"IllegalStateException",
"ise",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ise",
",",
"\"com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection\"",
",",
"\"20\"",
",",
"this",
")",
";",
"Object",
"[",
"]",
"parms",
"=",
"new",
"Object",
"[",
"]",
"{",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection()\"",
",",
"ise",
"}",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"ILLEGAL_STATE_EXCEPTION_J2CA0079\"",
",",
"parms",
")",
";",
"ResourceException",
"re",
"=",
"new",
"ResourceException",
"(",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread\"",
")",
";",
"re",
".",
"initCause",
"(",
"ise",
")",
";",
"throw",
"re",
";",
"}",
"catch",
"(",
"ThreadIdentityException",
"tie",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"tie",
",",
"\"com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.beforeGettingConnection\"",
",",
"\"21\"",
",",
"this",
")",
";",
"ResourceException",
"re",
"=",
"new",
"ResourceException",
"(",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection() failed attempting to push the current user identity to the OS Thread\"",
")",
";",
"re",
".",
"initCause",
"(",
"tie",
")",
";",
"throw",
"re",
";",
"}",
"return",
"retObject",
";",
"}"
] | Apply the given subject's identity to the thread.
@return The identity token that must be supplied on the subsequent call to reset
the thread identity. | [
"Apply",
"the",
"given",
"subject",
"s",
"identity",
"to",
"the",
"thread",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java#L806-L844 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java | ThreadIdentitySecurityHelper.checkForUTOKENNotFoundError | private void checkForUTOKENNotFoundError(Subject subj) throws ResourceException {
// A Subject without a UTOKEN genericCredential can
// legitimately occur in the case where the resource
// adapter has indicated Thread Identity Support
// is "ALLOWED, but a valid Container-managed alias
// was specified. On the other hand, at this ponit, if
// either of the following two cases exist when there is
// no UTOKEN genericCredential, then we have an
// unexpected error and need to throw an exception:
//
// 1. The resource adapter REQUIRES that Thread Identity
// be used.
//
// 2. The Subject has no private credentials at all
//
// Check if ThreadIdentitySupport is "REQUIRED"
if (m_ThreadIdentitySupport == AbstractConnectionFactoryService.THREAD_IDENTITY_REQUIRED) {
// ThreadIdentitySupport indicates that the use of thread
// identity is "REQUIRED" by the connector, but the
// Subject doesn't contain a UTOKEN GenericCredential.
// This should not ever occur because finalizeSubject()
// should have created a Subject with a UTOKEN
// GenericCredential when ThreadidentitySupport is
// "REQUIRED". Thus, throw an exception to terminate
// processing right here.
//
try {
IllegalStateException e = new IllegalStateException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject not setup for using thread identity, but the connector requires thread identity be used.");
Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
throw e;
} catch (IllegalStateException ise) {
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state");
re.initCause(ise);
throw re;
}
} // end if m_ThreadIdentitySupport.equals REQUIRED
// Check if Subject has at least one a private credential
Set privateCredentials = subj.getPrivateCredentials();
Iterator privateIterator = privateCredentials.iterator();
if (!privateIterator.hasNext()) { // if no private credentials
// There is not only no UTOKEN generic credential, but
// also, there are no private credentials at all. This
// should not happen. If there are no private credentials,
// the finalizeSubject() processing should have built
// a UTOKEN generic credential.
//
try {
IllegalStateException e = new IllegalStateException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with no credentials.");
Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
throw e;
} catch (IllegalStateException ise) {
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state");
re.initCause(ise);
throw re;
}
} // end if no private credentials
} | java | private void checkForUTOKENNotFoundError(Subject subj) throws ResourceException {
// A Subject without a UTOKEN genericCredential can
// legitimately occur in the case where the resource
// adapter has indicated Thread Identity Support
// is "ALLOWED, but a valid Container-managed alias
// was specified. On the other hand, at this ponit, if
// either of the following two cases exist when there is
// no UTOKEN genericCredential, then we have an
// unexpected error and need to throw an exception:
//
// 1. The resource adapter REQUIRES that Thread Identity
// be used.
//
// 2. The Subject has no private credentials at all
//
// Check if ThreadIdentitySupport is "REQUIRED"
if (m_ThreadIdentitySupport == AbstractConnectionFactoryService.THREAD_IDENTITY_REQUIRED) {
// ThreadIdentitySupport indicates that the use of thread
// identity is "REQUIRED" by the connector, but the
// Subject doesn't contain a UTOKEN GenericCredential.
// This should not ever occur because finalizeSubject()
// should have created a Subject with a UTOKEN
// GenericCredential when ThreadidentitySupport is
// "REQUIRED". Thus, throw an exception to terminate
// processing right here.
//
try {
IllegalStateException e = new IllegalStateException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject not setup for using thread identity, but the connector requires thread identity be used.");
Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
throw e;
} catch (IllegalStateException ise) {
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state");
re.initCause(ise);
throw re;
}
} // end if m_ThreadIdentitySupport.equals REQUIRED
// Check if Subject has at least one a private credential
Set privateCredentials = subj.getPrivateCredentials();
Iterator privateIterator = privateCredentials.iterator();
if (!privateIterator.hasNext()) { // if no private credentials
// There is not only no UTOKEN generic credential, but
// also, there are no private credentials at all. This
// should not happen. If there are no private credentials,
// the finalizeSubject() processing should have built
// a UTOKEN generic credential.
//
try {
IllegalStateException e = new IllegalStateException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with no credentials.");
Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
throw e;
} catch (IllegalStateException ise) {
ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state");
re.initCause(ise);
throw re;
}
} // end if no private credentials
} | [
"private",
"void",
"checkForUTOKENNotFoundError",
"(",
"Subject",
"subj",
")",
"throws",
"ResourceException",
"{",
"// A Subject without a UTOKEN genericCredential can",
"// legitimately occur in the case where the resource",
"// adapter has indicated Thread Identity Support",
"// is \"ALLOWED, but a valid Container-managed alias",
"// was specified. On the other hand, at this ponit, if",
"// either of the following two cases exist when there is",
"// no UTOKEN genericCredential, then we have an",
"// unexpected error and need to throw an exception:",
"//",
"// 1. The resource adapter REQUIRES that Thread Identity",
"// be used.",
"//",
"// 2. The Subject has no private credentials at all",
"//",
"// Check if ThreadIdentitySupport is \"REQUIRED\"",
"if",
"(",
"m_ThreadIdentitySupport",
"==",
"AbstractConnectionFactoryService",
".",
"THREAD_IDENTITY_REQUIRED",
")",
"{",
"// ThreadIdentitySupport indicates that the use of thread",
"// identity is \"REQUIRED\" by the connector, but the",
"// Subject doesn't contain a UTOKEN GenericCredential.",
"// This should not ever occur because finalizeSubject()",
"// should have created a Subject with a UTOKEN",
"// GenericCredential when ThreadidentitySupport is",
"// \"REQUIRED\". Thus, throw an exception to terminate",
"// processing right here.",
"//",
"try",
"{",
"IllegalStateException",
"e",
"=",
"new",
"IllegalStateException",
"(",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject not setup for using thread identity, but the connector requires thread identity be used.\"",
")",
";",
"Object",
"[",
"]",
"parms",
"=",
"new",
"Object",
"[",
"]",
"{",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection()\"",
",",
"e",
"}",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"ILLEGAL_STATE_EXCEPTION_J2CA0079\"",
",",
"parms",
")",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"IllegalStateException",
"ise",
")",
"{",
"ResourceException",
"re",
"=",
"new",
"ResourceException",
"(",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state\"",
")",
";",
"re",
".",
"initCause",
"(",
"ise",
")",
";",
"throw",
"re",
";",
"}",
"}",
"// end if m_ThreadIdentitySupport.equals REQUIRED",
"// Check if Subject has at least one a private credential",
"Set",
"privateCredentials",
"=",
"subj",
".",
"getPrivateCredentials",
"(",
")",
";",
"Iterator",
"privateIterator",
"=",
"privateCredentials",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"!",
"privateIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"// if no private credentials",
"// There is not only no UTOKEN generic credential, but",
"// also, there are no private credentials at all. This",
"// should not happen. If there are no private credentials,",
"// the finalizeSubject() processing should have built",
"// a UTOKEN generic credential.",
"//",
"try",
"{",
"IllegalStateException",
"e",
"=",
"new",
"IllegalStateException",
"(",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with no credentials.\"",
")",
";",
"Object",
"[",
"]",
"parms",
"=",
"new",
"Object",
"[",
"]",
"{",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection()\"",
",",
"e",
"}",
";",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"ILLEGAL_STATE_EXCEPTION_J2CA0079\"",
",",
"parms",
")",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"IllegalStateException",
"ise",
")",
"{",
"ResourceException",
"re",
"=",
"new",
"ResourceException",
"(",
"\"ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state\"",
")",
";",
"re",
".",
"initCause",
"(",
"ise",
")",
";",
"throw",
"re",
";",
"}",
"}",
"// end if no private credentials",
"}"
] | Check for an unexpected condition when a UTOKEN is not found in the Subject.
@throws ResourceException if the condition is unexpected. | [
"Check",
"for",
"an",
"unexpected",
"condition",
"when",
"a",
"UTOKEN",
"is",
"not",
"found",
"in",
"the",
"Subject",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ThreadIdentitySecurityHelper.java#L851-L921 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java | ParserBase.copyStreams | protected void copyStreams(InputStream is, OutputStream os) throws IOException {
byte[] buffer = new byte[1024];
try {
int read;
while ((read = is.read(buffer)) != -1) {
os.write(buffer, 0, read);
buffer = new byte[1024];
}
} finally {
if (null != os)
os.close();
if (null != is)
is.close();
}
} | java | protected void copyStreams(InputStream is, OutputStream os) throws IOException {
byte[] buffer = new byte[1024];
try {
int read;
while ((read = is.read(buffer)) != -1) {
os.write(buffer, 0, read);
buffer = new byte[1024];
}
} finally {
if (null != os)
os.close();
if (null != is)
is.close();
}
} | [
"protected",
"void",
"copyStreams",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"try",
"{",
"int",
"read",
";",
"while",
"(",
"(",
"read",
"=",
"is",
".",
"read",
"(",
"buffer",
")",
")",
"!=",
"-",
"1",
")",
"{",
"os",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"read",
")",
";",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"null",
"!=",
"os",
")",
"os",
".",
"close",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"is",
")",
"is",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Reads from the input stream and copies to the output stream
@param is
@param os
@throws IOException | [
"Reads",
"from",
"the",
"input",
"stream",
"and",
"copies",
"to",
"the",
"output",
"stream"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L167-L181 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java | ParserBase.extractFileFromArchive | protected ExtractedFileInformation extractFileFromArchive(String fileName,
String regex) throws RepositoryArchiveException, RepositoryArchiveEntryNotFoundException, RepositoryArchiveIOException {
JarFile jarFile = null;
ExtractedFileInformation result = null;
File outputFile = null;
File sourceArchive = new File(fileName);
try {
try {
jarFile = new JarFile(sourceArchive);
} catch (FileNotFoundException | NoSuchFileException fne) {
throw new RepositoryArchiveException("Unable to locate archive " + fileName, sourceArchive, fne);
} catch (IOException ioe) {
throw new RepositoryArchiveIOException("Error opening archive ", sourceArchive, ioe);
}
Enumeration<JarEntry> enumEntries = jarFile.entries();
// Iterate through the files in the jar file searching for one we
// are interested in
while (enumEntries.hasMoreElements()) {
JarEntry entry = enumEntries.nextElement();
String name = entry.getName();
if (Pattern.matches(regex, name)) {
// Don't want to use the entire path to the file so create a
// file
// and then recreate it using just the "name" part of the
// filename
outputFile = new File(name);
outputFile = new File(outputFile.getName());
outputFile.deleteOnExit();
try {
copyStreams(jarFile.getInputStream(entry),
new FileOutputStream(outputFile));
} catch (IOException ioe) {
throw new RepositoryArchiveIOException("Failed to extract file " + name + " inside "
+ fileName + " to "
+ outputFile.getAbsolutePath(), sourceArchive, ioe);
}
result = new ExtractedFileInformation(outputFile, sourceArchive, name);
break;
}
}
} finally {
try {
if (null != jarFile) {
jarFile.close();
}
} catch (IOException e) {
e.printStackTrace();
throw new RepositoryArchiveIOException("Error closing archive ", sourceArchive, e);
}
}
// Make sure we have found a file
if (null == outputFile) {
throw new RepositoryArchiveEntryNotFoundException("Failed to find file matching regular expression <" + regex
+ "> inside archive " + fileName, sourceArchive, regex);
}
return result;
} | java | protected ExtractedFileInformation extractFileFromArchive(String fileName,
String regex) throws RepositoryArchiveException, RepositoryArchiveEntryNotFoundException, RepositoryArchiveIOException {
JarFile jarFile = null;
ExtractedFileInformation result = null;
File outputFile = null;
File sourceArchive = new File(fileName);
try {
try {
jarFile = new JarFile(sourceArchive);
} catch (FileNotFoundException | NoSuchFileException fne) {
throw new RepositoryArchiveException("Unable to locate archive " + fileName, sourceArchive, fne);
} catch (IOException ioe) {
throw new RepositoryArchiveIOException("Error opening archive ", sourceArchive, ioe);
}
Enumeration<JarEntry> enumEntries = jarFile.entries();
// Iterate through the files in the jar file searching for one we
// are interested in
while (enumEntries.hasMoreElements()) {
JarEntry entry = enumEntries.nextElement();
String name = entry.getName();
if (Pattern.matches(regex, name)) {
// Don't want to use the entire path to the file so create a
// file
// and then recreate it using just the "name" part of the
// filename
outputFile = new File(name);
outputFile = new File(outputFile.getName());
outputFile.deleteOnExit();
try {
copyStreams(jarFile.getInputStream(entry),
new FileOutputStream(outputFile));
} catch (IOException ioe) {
throw new RepositoryArchiveIOException("Failed to extract file " + name + " inside "
+ fileName + " to "
+ outputFile.getAbsolutePath(), sourceArchive, ioe);
}
result = new ExtractedFileInformation(outputFile, sourceArchive, name);
break;
}
}
} finally {
try {
if (null != jarFile) {
jarFile.close();
}
} catch (IOException e) {
e.printStackTrace();
throw new RepositoryArchiveIOException("Error closing archive ", sourceArchive, e);
}
}
// Make sure we have found a file
if (null == outputFile) {
throw new RepositoryArchiveEntryNotFoundException("Failed to find file matching regular expression <" + regex
+ "> inside archive " + fileName, sourceArchive, regex);
}
return result;
} | [
"protected",
"ExtractedFileInformation",
"extractFileFromArchive",
"(",
"String",
"fileName",
",",
"String",
"regex",
")",
"throws",
"RepositoryArchiveException",
",",
"RepositoryArchiveEntryNotFoundException",
",",
"RepositoryArchiveIOException",
"{",
"JarFile",
"jarFile",
"=",
"null",
";",
"ExtractedFileInformation",
"result",
"=",
"null",
";",
"File",
"outputFile",
"=",
"null",
";",
"File",
"sourceArchive",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"try",
"{",
"try",
"{",
"jarFile",
"=",
"new",
"JarFile",
"(",
"sourceArchive",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"|",
"NoSuchFileException",
"fne",
")",
"{",
"throw",
"new",
"RepositoryArchiveException",
"(",
"\"Unable to locate archive \"",
"+",
"fileName",
",",
"sourceArchive",
",",
"fne",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"RepositoryArchiveIOException",
"(",
"\"Error opening archive \"",
",",
"sourceArchive",
",",
"ioe",
")",
";",
"}",
"Enumeration",
"<",
"JarEntry",
">",
"enumEntries",
"=",
"jarFile",
".",
"entries",
"(",
")",
";",
"// Iterate through the files in the jar file searching for one we",
"// are interested in",
"while",
"(",
"enumEntries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"JarEntry",
"entry",
"=",
"enumEntries",
".",
"nextElement",
"(",
")",
";",
"String",
"name",
"=",
"entry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"Pattern",
".",
"matches",
"(",
"regex",
",",
"name",
")",
")",
"{",
"// Don't want to use the entire path to the file so create a",
"// file",
"// and then recreate it using just the \"name\" part of the",
"// filename",
"outputFile",
"=",
"new",
"File",
"(",
"name",
")",
";",
"outputFile",
"=",
"new",
"File",
"(",
"outputFile",
".",
"getName",
"(",
")",
")",
";",
"outputFile",
".",
"deleteOnExit",
"(",
")",
";",
"try",
"{",
"copyStreams",
"(",
"jarFile",
".",
"getInputStream",
"(",
"entry",
")",
",",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"RepositoryArchiveIOException",
"(",
"\"Failed to extract file \"",
"+",
"name",
"+",
"\" inside \"",
"+",
"fileName",
"+",
"\" to \"",
"+",
"outputFile",
".",
"getAbsolutePath",
"(",
")",
",",
"sourceArchive",
",",
"ioe",
")",
";",
"}",
"result",
"=",
"new",
"ExtractedFileInformation",
"(",
"outputFile",
",",
"sourceArchive",
",",
"name",
")",
";",
"break",
";",
"}",
"}",
"}",
"finally",
"{",
"try",
"{",
"if",
"(",
"null",
"!=",
"jarFile",
")",
"{",
"jarFile",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"RepositoryArchiveIOException",
"(",
"\"Error closing archive \"",
",",
"sourceArchive",
",",
"e",
")",
";",
"}",
"}",
"// Make sure we have found a file",
"if",
"(",
"null",
"==",
"outputFile",
")",
"{",
"throw",
"new",
"RepositoryArchiveEntryNotFoundException",
"(",
"\"Failed to find file matching regular expression <\"",
"+",
"regex",
"+",
"\"> inside archive \"",
"+",
"fileName",
",",
"sourceArchive",
",",
"regex",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Extract a file from a jar file to a temporary location on disk that is
deleted when the jvm exits.
@param fileName
The name of the archive file to extract the file from
@param regex
A regular expression, that is used to match the file to be
extracted from the archive. If more than one file matches the
regular expression only the first file is extracted
@return A file object representing the temporary file where the file in
the jar was extracted to.
@throws MassiveArchiveException
if the archive could not be read or the file could not be
extracted to disk
@throws RepositoryArchiveException
@throws RepositoryArchiveIOException
@throws RepositoryArchiveEntryNotFoundException
If no file matching the supplied regular expression could be
found | [
"Extract",
"a",
"file",
"from",
"a",
"jar",
"file",
"to",
"a",
"temporary",
"location",
"on",
"disk",
"that",
"is",
"deleted",
"when",
"the",
"jvm",
"exits",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L231-L297 | train |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java | ParserBase.processLAandLI | protected void processLAandLI(File archive, RepositoryResourceWritable resource,
ProvisioningFeatureDefinition feature) throws IOException, RepositoryException {
String LAHeader = feature.getHeader(LA_HEADER_FEATURE);
String LIHeader = feature.getHeader(LI_HEADER_FEATURE);
processLAandLI(archive, resource, LAHeader, LIHeader);
} | java | protected void processLAandLI(File archive, RepositoryResourceWritable resource,
ProvisioningFeatureDefinition feature) throws IOException, RepositoryException {
String LAHeader = feature.getHeader(LA_HEADER_FEATURE);
String LIHeader = feature.getHeader(LI_HEADER_FEATURE);
processLAandLI(archive, resource, LAHeader, LIHeader);
} | [
"protected",
"void",
"processLAandLI",
"(",
"File",
"archive",
",",
"RepositoryResourceWritable",
"resource",
",",
"ProvisioningFeatureDefinition",
"feature",
")",
"throws",
"IOException",
",",
"RepositoryException",
"{",
"String",
"LAHeader",
"=",
"feature",
".",
"getHeader",
"(",
"LA_HEADER_FEATURE",
")",
";",
"String",
"LIHeader",
"=",
"feature",
".",
"getHeader",
"(",
"LI_HEADER_FEATURE",
")",
";",
"processLAandLI",
"(",
"archive",
",",
"resource",
",",
"LAHeader",
",",
"LIHeader",
")",
";",
"}"
] | Locate and process license agreement and information files within a
feature
@param esa
@param resource
@throws IOException | [
"Locate",
"and",
"process",
"license",
"agreement",
"and",
"information",
"files",
"within",
"a",
"feature"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L513-L518 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.